/* NeoLoss — попап «Подбор эндокринолога». Токены — styles.css */

.quiz { width: min(1100px, calc(100vw - 32px)); max-width: none; height: min(720px, calc(100dvh - 32px)); max-height: none; padding: 0; border: 0; border-radius: 32px; background: transparent; overflow: visible; color: var(--ink); }
.quiz::backdrop { background: rgb(15 26 42 / .35); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.quiz[open] { animation: quiz-in .5s var(--ease-out); }
.quiz[open]::backdrop { animation: quiz-fade .4s ease; }
.quiz.is-closing { animation: quiz-out .3s ease forwards; }
.quiz.is-closing::backdrop { animation: quiz-fade .3s ease reverse forwards; }
@keyframes quiz-in { from { opacity: 0; transform: translateY(18px) scale(.97); filter: blur(8px); } }
@keyframes quiz-out { to { opacity: 0; transform: translateY(10px) scale(.98); filter: blur(6px); } }
@keyframes quiz-fade { from { opacity: 0; } }
html.quiz-open { overflow: hidden; }

.quiz__win { display: grid; grid-template-columns: 300px minmax(0, 1fr); height: 100%; border-radius: inherit; overflow: hidden; background: #fff; box-shadow: 0 40px 100px -30px rgb(10 30 70 / .5); }

/* ---------- левая колонка ---------- */
.quiz__side { display: flex; flex-direction: column; padding: 30px 28px; }
.quiz__logo { align-self: flex-start; height: 30px; width: auto; object-fit: contain; }
.quiz__side-title { margin: 28px 0 22px; font-size: 22px; font-weight: 300; letter-spacing: -.02em; line-height: 1.2; }
.quiz__steps { display: grid; gap: 4px; counter-reset: qs; }
.quiz__steps li { position: relative; display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; font-size: 14.5px; color: var(--ink-3); counter-increment: qs; transition: background-color .3s ease, color .3s ease; }
.quiz__steps li::before { content: counter(qs); width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 50%; background: rgb(255 255 255 / .7); box-shadow: inset 0 0 0 1px #D6E1EE; font-size: 12.5px; font-weight: 600; color: var(--ink-3); transition: background-color .3s ease, box-shadow .3s ease, color .3s ease; }
.quiz__steps li.is-now { background: rgb(255 255 255 / .75); color: var(--ink); font-weight: 600; }
.quiz__steps li.is-now::before { background: var(--blue); box-shadow: none; color: #fff; }
.quiz__steps li.is-done { color: var(--ink-2); }
.quiz__steps li.is-done::before { content: ""; background: #22B07D url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4L18 8'/%3E%3C/svg%3E") center / 14px no-repeat; box-shadow: none; }
.quiz__chosen { display: flex; align-items: center; gap: 12px; margin-top: 18px; padding: 10px 12px 10px 10px; border-radius: 16px; background: rgb(255 255 255 / .85); box-shadow: 0 6px 18px -12px rgb(16 40 90 / .35); animation: chosen-in .5s var(--ease-out); }
.quiz__chosen img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.quiz__chosen p { display: grid; font-size: 14px; line-height: 1.25; }
.quiz__chosen small { font-size: 12px; color: var(--ink-3); }
.quiz__chosen-ok { margin-left: auto; width: 22px; height: 22px; flex: none; border-radius: 50%; background: #22B07D url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4L18 8'/%3E%3C/svg%3E") center / 12px no-repeat; }
@keyframes chosen-in { from { opacity: 0; transform: translateY(6px); } }
.quiz__side-foot { margin-top: auto; padding-top: 20px; }
.quiz__side-foot p { font-size: 12.5px; line-height: 1.45; color: var(--ink-3); }
.quiz__faces { display: flex; align-items: center; margin-bottom: 12px; }
.quiz__faces img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; border: 2.5px solid #fff; }
.quiz__faces img + img, .quiz__faces b { margin-left: -10px; }
.quiz__faces b { height: 38px; padding: 0 10px; display: grid; place-items: center; border-radius: var(--r-pill); border: 2.5px solid #fff; background: var(--blue); color: #fff; font-size: 12.5px; }

/* ---------- правая колонка ---------- */
.quiz__main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.quiz__head { position: relative; display: flex; align-items: center; gap: 12px; padding: 20px 24px 16px 28px; }
.quiz__back { display: inline-flex; align-items: center; gap: 4px; height: 38px; padding: 0 12px 0 6px; border: 0; border-radius: 11px; background: none; font-size: 14.5px; font-weight: 500; color: var(--ink-3); transition: background-color .2s ease, color .2s ease, opacity .2s ease; }
.quiz__back:hover { background: var(--blue-50); color: var(--blue-hover); }
.quiz__back[hidden] { display: inline-flex; visibility: hidden; opacity: 0; }
.quiz__back .icon { width: 18px; height: 18px; }
.quiz__count { margin-left: auto; font-size: 13.5px; font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.quiz__close { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 12px; background: var(--surface-2); color: var(--ink-2); transition: background-color .2s ease, transform .2s var(--ease-out); }
.quiz__close:hover { background: var(--blue-50); transform: rotate(90deg); }
.quiz__close .icon { width: 18px; height: 18px; }
.quiz__bar { position: absolute; left: 28px; right: 24px; bottom: 0; height: 3px; border-radius: 3px; background: #EEF2F7; overflow: hidden; }
.quiz__bar i { display: block; height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg, #5FB2F6, var(--blue)); transform-origin: left; transform: scaleX(var(--p, .125)); transition: transform .6s var(--ease-soft); }

.quiz__body { position: relative; flex: 1; display: grid; min-height: 0; overflow-y: auto; padding: 28px 44px 12px; }
.q-step { grid-area: 1 / 1; align-self: start; min-width: 0; opacity: 0; visibility: hidden; transform: translateX(24px); filter: blur(6px); transition: opacity .35s ease, transform .5s var(--ease-out), filter .35s ease, visibility 0s .5s; }
.q-step.is-on { opacity: 1; visibility: visible; transform: none; filter: none; transition: opacity .45s ease .06s, transform .55s var(--ease-out) .06s, filter .45s ease .06s; }
.q-step.is-left { transform: translateX(-24px); }
.q-title { font-size: clamp(1.625rem, 1.2rem + 1.2vw, 2.25rem); line-height: 1.12; font-weight: 300; letter-spacing: -.03em; max-width: 22ch; }
.q-sub { margin: 10px 0 26px; font-size: 15.5px; color: var(--ink-3); }

/* варианты ответа */
.q-opts { display: grid; gap: 10px; }
.q-opts--grid { grid-template-columns: 1fr 1fr; }
.q-opts--three { grid-template-columns: repeat(3, 1fr); }
.q-opt {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 18px 20px; min-height: 84px;
  border: 0; border-radius: 18px; background: #F2F6FB; box-shadow: none; text-align: left;
  transition: background-color .25s ease, box-shadow .25s ease, transform .2s var(--ease-out);
}
.q-opt:hover { background: #EAF1FA; transform: translateY(-1px); }
.q-opt:active { transform: scale(.985); }
.q-opt b { font-size: 16.5px; font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
.q-opt span { font-size: 13.5px; color: var(--ink-3); }
.q-opt::after { content: ""; position: absolute; top: 16px; right: 16px; width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px #C6D2E1; background: #fff; transition: background-color .2s ease, box-shadow .2s ease; }
.q-opt--check::after { border-radius: 7px; }
.q-opt.is-on { background: #F0F6FF; box-shadow: inset 0 0 0 1.5px var(--blue), 0 12px 26px -18px rgb(11 107 229 / .6); }
.q-opt.is-on::after { box-shadow: none; background: var(--blue) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4L18 8'/%3E%3C/svg%3E") center / 14px no-repeat; animation: tick .3s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes tick { from { transform: scale(.5); } }
.q-opt--row { min-height: 0; padding-right: 54px; }
.q-opt--small { min-height: 0; padding: 16px 20px; align-items: center; }
.q-opt--small::after { display: none; }
.q-opt--none { grid-column: 1 / -1; min-height: 0; }

.q-list { display: grid; gap: 8px; margin: 18px 0 24px; padding: 18px 20px; border-radius: 18px; background: #FFF8EE; }
.q-list li { position: relative; padding-left: 18px; font-size: 15px; color: var(--ink-2); }
.q-list li::before { content: ""; position: absolute; left: 0; top: .6em; width: 6px; height: 6px; border-radius: 50%; background: #E39A2D; }

.q-sex { display: flex; margin-bottom: 28px; max-width: 360px; }
.q-sex button { height: 46px; font-size: 15.5px; }
.q-field { margin-bottom: 26px; max-width: 520px; }
.q-field label { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; font-size: 15px; color: var(--ink-3); }
.q-field output { font-size: 24px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.q-bmi { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; max-width: 520px; padding: 16px 20px; border-radius: 16px; background: #F0F6FF; }
.q-bmi span { font-size: 14px; color: var(--ink-3); }
.q-bmi b { font-size: 28px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.q-bmi em { font-style: normal; font-size: 14px; font-weight: 600; color: var(--blue-hover); }

.q-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.q-hint { margin: -6px 0 16px; font-size: 13.5px; color: var(--ink-3); }
.q-hint a { color: var(--blue); }
.q-inp { display: grid; gap: 7px; }
.q-inp label { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.q-inp input { height: 54px; padding: 0 16px; border: 0; border-radius: 14px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); font: inherit; font-size: 16px; color: var(--ink); outline: none; transition: box-shadow .2s ease, background-color .2s ease; }
.q-inp input:focus { background: #fff; box-shadow: inset 0 0 0 1.5px var(--blue), 0 0 0 4px rgb(11 107 229 / .12); }
.q-inp input.is-bad { box-shadow: inset 0 0 0 1.5px #E2533F; }
.q-consent { font-size: 13.5px; line-height: 1.45; color: var(--ink-3); }
.q-consent a { color: var(--blue); text-decoration: underline; text-underline-offset: 2px; }
.q-err { margin-top: 12px; font-size: 13.5px; color: #C2321F; }
.q-err:empty { display: none; }

/* подбор */
.q-search { justify-self: center; align-self: center; text-align: center; display: grid; justify-items: center; }
.q-search .q-title { margin: 26px 0 20px; }
.q-search__ring { position: relative; width: 132px; height: 132px; }
.q-search__ring::before { content: ""; position: absolute; inset: -10px; border-radius: 50%; border: 3px solid transparent; border-top-color: var(--blue); border-right-color: rgb(95 178 246 / .5); animation: spin 1s linear infinite; }
.q-search__ring img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 5px #fff, 0 18px 36px -16px rgb(16 40 90 / .4); transition: opacity .15s ease; }
@keyframes spin { to { transform: rotate(360deg); } }
.q-search__list { display: grid; gap: 10px; text-align: left; }
.q-search__list li { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--ink-4); transition: color .3s ease; }
.q-search__list li::before { content: ""; width: 20px; height: 20px; flex: none; border-radius: 50%; box-shadow: inset 0 0 0 1.5px #C6D2E1; transition: background-color .3s ease, box-shadow .3s ease; }
.q-search__list li.is-done { color: var(--ink); }
.q-search__list li.is-done::before { box-shadow: none; background: #22B07D url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4L18 8'/%3E%3C/svg%3E") center / 12px no-repeat; }

/* результат */
.q-result__kicker { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 18px; padding: 7px 14px 7px 10px; border-radius: var(--r-pill); background: #DDF5EC; color: #0F7354; font-size: 14px; font-weight: 600; }
.q-result__kicker .icon { width: 17px; height: 17px; stroke-width: 2.6; }
.q-doc { display: flex; align-items: center; gap: 18px; padding: 18px; border-radius: 22px; background: #fff; box-shadow: inset 0 0 0 1px var(--line), 0 18px 40px -26px rgb(16 40 90 / .4); }
.q-doc__photo { width: 88px; height: 88px; flex: none; border-radius: 50%; object-fit: cover; }
.q-doc__info { min-width: 0; }
.q-doc__name { font-size: 21px; font-weight: 600; letter-spacing: -.015em; }
.q-doc__role { margin-top: 2px; font-size: 14px; color: var(--ink-3); }
.q-doc__why { display: inline-block; margin-top: 8px; padding: 4px 11px; border-radius: var(--r-pill); background: var(--blue-50); color: var(--blue-hover); font-size: 13px; font-weight: 600; }
.q-doc__match { margin-left: auto; display: grid; justify-items: center; padding: 10px 14px; border-radius: 16px; background: #F0F6FF; font-size: 12px; color: var(--ink-3); }
.q-doc__match b { font-size: 24px; font-weight: 700; color: var(--blue); letter-spacing: -.02em; }
.q-slot { display: grid; grid-template-columns: auto 1fr 1fr; align-items: center; gap: 16px; margin: 12px 0; padding: 16px 18px; border-radius: 18px; background: var(--surface-2); }
.q-slot__ico { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: var(--blue-100); color: var(--blue); }
.q-slot p { font-size: 13px; color: var(--ink-3); }
.q-slot b { font-size: 16px; font-weight: 600; }
.q-note { margin-bottom: 14px; padding: 12px 16px; border-radius: 14px; background: #FFF8EE; font-size: 14px; line-height: 1.45; color: #7A4B00; }
.q-times { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin: 0 0 14px; }
.q-time { display: grid; justify-items: center; gap: 1px; padding: 10px 4px; border: 0; border-radius: 14px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); transition: background-color .2s ease, box-shadow .2s ease, color .2s ease, transform .2s var(--ease-out); }
.q-time b { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.q-time span { font-size: 12px; color: var(--mint); }
.q-time:not(:disabled):hover { box-shadow: inset 0 0 0 1.5px var(--blue); }
.q-time:not(:disabled):active { transform: scale(.97); }
.q-time[aria-checked="true"] { background: var(--blue); box-shadow: none; color: #fff; }
.q-time[aria-checked="true"] span { color: rgb(255 255 255 / .85); }
.q-time:disabled { background: var(--surface-2); box-shadow: none; color: var(--ink-4); cursor: not-allowed; }
.q-time:disabled b { text-decoration: line-through; font-weight: 500; }
.q-time:disabled span { color: var(--ink-4); }
.q-err--center { margin-top: 8px; text-align: center; }
.q-err--center:empty { display: none; }
.q-result__alt { margin-top: 10px; text-align: center; font-size: 14px; color: var(--ink-3); }
.q-result .link-btn { border: 0; background: none; padding: 6px 8px; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--blue); transition: background-color .2s ease; }
.q-result .link-btn:hover { background: var(--blue-50); color: var(--blue-hover); }
.q-result.is-on .q-doc { animation: card-in .6s var(--ease-out) .1s both; }
@keyframes card-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }

/* готово */
.q-done { justify-self: center; align-self: center; text-align: center; display: grid; justify-items: center; }
.q-done .q-title { max-width: none; }
.q-done__ico { width: 76px; height: 76px; display: grid; place-items: center; margin-bottom: 22px; border-radius: 50%; background: #22B07D; color: #fff; box-shadow: 0 0 0 12px rgb(34 176 125 / .14); }
.q-done__ico .icon { width: 36px; height: 36px; stroke-width: 2.6; }
.q-done.is-on .q-done__ico { animation: tick .6s cubic-bezier(.34, 1.56, .64, 1); }

.quiz__foot { display: flex; justify-content: flex-end; padding: 16px 44px 28px; }
.quiz__foot[hidden] { display: none; }
.quiz__next { min-width: 200px; }
.quiz__next:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn.is-loading { pointer-events: none; color: transparent; }
.btn.is-loading::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid rgb(255 255 255 / .4); border-top-color: #fff; animation: spin .7s linear infinite; }

/* ---------- телефон: на весь экран ---------- */
@media (max-width: 860px) {
  .quiz { width: 100vw; height: 100dvh; border-radius: 0; }
  .quiz__win { grid-template-columns: minmax(0, 1fr); border-radius: 0; }
  .quiz__side { display: none; }
  .quiz__head { padding: 14px 16px 14px; }
  .quiz__bar { left: 16px; right: 16px; }
  .quiz__body { padding: 22px 16px 8px; }
  .quiz__foot { padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); }
  .quiz__next { width: 100%; }
  .q-opts--grid, .q-fields { grid-template-columns: minmax(0, 1fr); }
  .q-opt { min-height: 0; padding: 16px 52px 16px 18px; }
  .q-doc { flex-wrap: wrap; }
  .q-doc__match { margin-left: 0; grid-auto-flow: column; gap: 6px; align-items: baseline; }
  .q-slot { grid-template-columns: auto 1fr; }
  .q-slot > div:last-child { grid-column: 2; }
  .q-times { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .quiz[open], .quiz.is-closing, .quiz[open]::backdrop { animation: none; }
  .q-step, .q-step.is-on { transition: none; transform: none; filter: none; }
  .q-search__ring::before { animation: none; }
}
