/* ═══════════════════════════════════════════════════════════
   SULLAVI — Анкета
   Минималистичный премиум. Тишина, воздух, доверие.
   ═══════════════════════════════════════════════════════════ */

/* ── Tokens ───────────────────────────────────────────────── */
/* ── Палитра «Олива» ─────────────────────────────────────────
   Тёплая бумага, приглушённый зелёный акцент. Успокаивающе
   и природно. Меньше всего похоже на приложение знакомств,
   больше всего — на кабинет терапевта.                     */
:root {
    /* Поверхности */
    --bg:            #FBFBF7;
    --bg-soft:       #F5F6F0;
    --bg-sunken:     #EBEDE1;

    /* Текст */
    --ink:           #1C1F17;
    --ink-muted:     #5F6455;
    --ink-faint:     #9AA08C;

    /* Акценты */
    --accent:        #1C1F17;
    --accent-warm:   #5A6B45;
    --accent-tint:   #EBEDE1;

    /* Линии */
    --line:          #E5E6DD;
    --line-strong:   #D2D6C4;

    /* Мягкое свечение на первом и последнем экране */
    --glow:          #EBEDE1;

    /* Состояния */
    --error:         #A0533E;

    /* Геометрия */
    --r-sm:   6px;
    --r-md:   10px;
    --r-lg:   16px;
    --r-full: 999px;

    /* Ритм */
    --gap-xs: 8px;
    --gap-sm: 14px;
    --gap-md: 22px;
    --gap-lg: 36px;
    --gap-xl: 56px;

    /* Шрифты: интерфейс — без засечек, голос бренда — с засечками */
    --font-ui:    -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Helvetica Neue', Arial, sans-serif;
    --font-voice: 'Noto Serif Georgian', Georgia, 'Times New Roman', 'Sylfaen', serif;

    /* Движение */
    --ease:  cubic-bezier(.22, .61, .36, 1);
    --fast:  .18s;
    --slow:  .42s;

    /* Тени — почти незаметные, только глубина */
    --shadow-sm: 0 1px 2px rgba(28,31,23,.05);
    --shadow-md: 0 2px 8px rgba(28,31,23,.07);
    --shadow-lg: 0 12px 40px rgba(28,31,23,.12);
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    padding: 0;
    background: var(--bg-soft);
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 16px;
    line-height: 1.55;
    letter-spacing: -0.006em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button, input { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

::selection { background: var(--accent-tint); }

/* ═══════════════════════════════════════════════════════════
   ПЕРВЫЙ ЭКРАН
   Отвечает на вопрос «зачем я это заполняю» до первого поля.
   ═══════════════════════════════════════════════════════════ */
.intro {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    overflow-y: auto;
    transition: opacity var(--slow) var(--ease),
                visibility var(--slow) var(--ease);
}

.intro.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.intro::before,
.finish::before {
    content: '';
    position: absolute;
    top: -140px;
    right: -140px;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: var(--glow);
    opacity: .5;
    pointer-events: none;
}

.intro-inner {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 520px;
    animation: introIn .7s var(--ease);
}

@keyframes introIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.intro-lang {
    justify-content: center;
    margin-bottom: var(--gap-xl);
}

.intro-quote {
    font-family: var(--font-voice);

    margin: 0 0 var(--gap-md);
    font-size: 27px;
    line-height: 1.42;
    font-weight: 500;
    letter-spacing: -0.024em;
    white-space: pre-line;
    text-wrap: balance;
}

.intro-author {
    margin-bottom: var(--gap-xl);
    padding-bottom: var(--gap-lg);
    border-bottom: 1px solid var(--line);
    font-size: 12.5px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--accent-warm);
}

.intro-lead {
    margin: 0 0 var(--gap-md);
    font-size: 16.5px;
    line-height: 1.65;
    color: var(--ink);
    white-space: pre-line;
    text-wrap: pretty;
}

.intro-note {
    margin: 0 0 var(--gap-xl);
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--ink-muted);
}

.intro-btn {
    width: 100%;
    max-width: 260px;
}

/* ── Ответы с прошлого раза ───────────────────────────────────
   Прежде черновик подставлялся молча — человек видел чужие
   на вид ответы и не понимал, откуда они. Теперь выбирает сам. */
.resume {
    margin-top: var(--gap-lg);
    padding: var(--gap-md);
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    text-align: left;
}

.resume-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.012em;
    margin-bottom: 5px;
}

.resume-text {
    margin: 0 0 var(--gap-md);
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--ink-muted);
}

.resume-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

@media (max-width: 480px) {
    .intro         { padding: 24px 20px; align-items: flex-start; padding-top: 48px; }
    .intro-quote   { font-size: 22px; }
    .intro-lead    { font-size: 15.5px; }
    .intro-lang    { margin-bottom: var(--gap-lg); }
    .intro-btn     { max-width: none; }
}

/* ── Каркас ───────────────────────────────────────────────── */
.app {
    max-width: 620px;
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    position: relative;
}

@media (min-width: 700px) {
    .app {
        border-left:  1px solid var(--line);
        border-right: 1px solid var(--line);
    }
}

/* ═══════════════════════════════════════════════════════════
   ПРОГРЕСС
   ═══════════════════════════════════════════════════════════ */
.progress-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(251,251,247,.97);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--line);
    padding: 20px 24px 14px;
}

/* ── Верхняя строка: языки + звук ─────────────────────────────── */
.header-top,
.intro-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.intro-top { margin-bottom: var(--gap-xl); }

.header-top .lang-switcher,
.intro-top .lang-switcher { margin-bottom: 0; }

/* ── Тихая музыка ─────────────────────────────────────────────
   Выключена по умолчанию. Анкету заполняют в метро, на работе,
   рядом со спящим человеком — внезапный звук закрывает вкладку. */
.sound-btn {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 7px;
    height: 30px;
    padding: 0 11px 0 9px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-full);
    background: transparent;
    transition: all var(--fast) var(--ease);
}

.sound-btn:hover {
    border-color: var(--ink-faint);
    background: var(--bg-sunken);
}

.sound-label {
    font-size: 11.5px;
    letter-spacing: .03em;
    color: var(--ink-muted);
    transition: color var(--fast) var(--ease);
}

/* Четыре полоски — эквалайзер. Сразу понятно, что это про звук. */
.sound-wave {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 13px;
}

.sound-wave i {
    display: block;
    width: 2px;
    border-radius: 1px;
    background: var(--ink-faint);
    transition: background var(--fast) var(--ease);
}

.sound-wave i:nth-child(1) { height: 5px; }
.sound-wave i:nth-child(2) { height: 11px; }
.sound-wave i:nth-child(3) { height: 7px; }
.sound-wave i:nth-child(4) { height: 13px; }

/* Включено — акцентный цвет и полоски танцуют */
.sound-btn[aria-pressed="true"] {
    border-color: var(--accent-warm);
    background: var(--accent-tint);
}

.sound-btn[aria-pressed="true"] .sound-label { color: var(--accent-warm); }
.sound-btn[aria-pressed="true"] .sound-wave i { background: var(--accent-warm); }

.sound-btn[aria-pressed="true"] .sound-wave i:nth-child(1) { animation: eq 1.1s ease-in-out -0.0s infinite; }
.sound-btn[aria-pressed="true"] .sound-wave i:nth-child(2) { animation: eq 1.4s ease-in-out -0.3s infinite; }
.sound-btn[aria-pressed="true"] .sound-wave i:nth-child(3) { animation: eq 1.2s ease-in-out -0.6s infinite; }
.sound-btn[aria-pressed="true"] .sound-wave i:nth-child(4) { animation: eq 1.6s ease-in-out -0.2s infinite; }

@keyframes eq {
    0%, 100% { height: 4px; }
    50%      { height: 13px; }
}

/* ── Переключатель языков ─────────────────────────────────────── */
.lang-switcher {
    display: flex;
    justify-content: flex-end;
    gap: 2px;
    margin-bottom: 14px;
}

.lang-btn {
    padding: 5px 9px;
    border-radius: var(--r-sm);
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: .06em;
    color: var(--ink-faint);
    background: transparent;
    transition: all var(--fast) var(--ease);
}

.lang-btn:hover {
    color: var(--ink);
    background: var(--bg-sunken);
}

.lang-btn.active {
    color: var(--ink);
    background: var(--accent-tint);
    font-weight: 600;
}

.progress-steps {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
}

.step span {
    font-size: 11px;
    letter-spacing: .04em;
    color: var(--ink-faint);
    white-space: nowrap;
    transition: color var(--fast) var(--ease);
}

.step-dot {
    width: 9px;
    height: 9px;
    border-radius: var(--r-full);
    background: var(--bg);
    border: 1.5px solid var(--line-strong);
    transition: all var(--fast) var(--ease);
}

.step.active .step-dot {
    background: var(--accent);
    border-color: var(--accent);
    transform: scale(1.25);
}

.step.active span {
    color: var(--ink);
    font-weight: 500;
}

.step.done .step-dot {
    background: var(--accent-warm);
    border-color: var(--accent-warm);
}

.step.done span { color: var(--ink-muted); }

.step-line {
    flex: 1 1 auto;
    height: 1px;
    background: var(--line);
    margin-bottom: 20px;
    transition: background var(--slow) var(--ease);
}

.step-line.done { background: var(--accent-warm); }

.progress-bar {
    height: 2px;
    background: var(--bg-sunken);
    border-radius: var(--r-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 25%;
    background: var(--accent);
    border-radius: var(--r-full);
    transition: width var(--slow) var(--ease);
}

.stage-info {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 12px;
    color: var(--ink-faint);
    letter-spacing: .01em;
}

/* ═══════════════════════════════════════════════════════════
   ФОРМА
   ═══════════════════════════════════════════════════════════ */
.form-container {
    flex: 1;
    padding: var(--gap-xl) 24px 120px;
}

.stage { display: none; }

.stage.active {
    display: block;
    animation: stageIn var(--slow) var(--ease);
}

@keyframes stageIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.stage-title {
    font-family: var(--font-voice);

    margin: 0 0 6px;
    font-size: 30px;
    line-height: 1.2;
    font-weight: 600;
    letter-spacing: -0.028em;
}

.stage-subtitle {
    margin: 0 0 var(--gap-xl);
    font-size: 15px;
    color: var(--ink-muted);
    line-height: 1.5;
}

/* ── Поля ─────────────────────────────────────────────────── */
.field-group { margin-bottom: var(--gap-lg); }

/* Вопрос читается так же, как утверждения на третьем этапе.
   Прежние 13px терялись рядом с вариантами ответа. */
.field-group > label {
    display: block;
    margin-bottom: var(--gap-sm);
    font-size: 16.5px;
    font-weight: 500;
    line-height: 1.45;
    letter-spacing: -0.012em;
    color: var(--ink);
    text-wrap: pretty;
}

.hint {
    font-size: 13.5px;
    font-weight: 400;
    color: var(--ink-faint);
    letter-spacing: 0;
}

input[type="text"],
input[type="date"],
input[type="email"],
input[type="number"] {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    outline: none;
    transition: border-color var(--fast) var(--ease),
                box-shadow  var(--fast) var(--ease);
}

input::placeholder { color: var(--ink-faint); }

input:hover { border-color: var(--ink-faint); }

input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(90,107,69,.14);
}

input.invalid {
    border-color: var(--error);
    box-shadow: 0 0 0 3px rgba(160,83,62,.10);
}

/* Диапазон возраста */
.range-group {
    display: flex;
    align-items: center;
    gap: var(--gap-sm);
}

.range-input {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    background: var(--bg);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    transition: border-color var(--fast) var(--ease);
}

.range-input:focus-within { border-color: var(--accent); }

.range-input span {
    font-size: 13px;
    color: var(--ink-faint);
    flex: 0 0 auto;
}

.range-input input {
    border: none;
    padding: 14px 0;
    background: transparent;
}

.range-input input:focus { box-shadow: none; }

.range-separator {
    color: var(--ink-faint);
    flex: 0 0 auto;
}

/* ═══════════════════════════════════════════════════════════
   ШКАЛА ЛАЙКЕРТА
   ═══════════════════════════════════════════════════════════ */
.likert-count {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: var(--gap-lg);
    font-size: 12px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

/* Сколько отмечено на этой странице. Пока не все — видно сразу,
   почему кнопка «далее» не срабатывает. */
.likert-done {
    flex: 0 0 auto;
    letter-spacing: .04em;
    transition: color var(--fast) var(--ease);
}

.likert-done.full { color: var(--accent-warm); }

.likert-host {
    display: flex;
    flex-direction: column;
    gap: var(--gap-lg);
}

.likert-item {
    padding-bottom: var(--gap-lg);
    border-bottom: 1px solid var(--line);
    animation: stageIn var(--slow) var(--ease) backwards;
}

.likert-item:last-child { border-bottom: none; padding-bottom: 0; }

.likert-item:nth-child(2) { animation-delay: .03s; }
.likert-item:nth-child(3) { animation-delay: .06s; }
.likert-item:nth-child(4) { animation-delay: .09s; }
.likert-item:nth-child(5) { animation-delay: .12s; }
.likert-item:nth-child(6) { animation-delay: .15s; }
.likert-item:nth-child(7) { animation-delay: .18s; }

.likert-text {
    margin: 0 0 var(--gap-sm);
    font-size: 16.5px;
    line-height: 1.5;
    font-weight: 500;
    letter-spacing: -0.012em;
    text-wrap: pretty;
}

/* Пять кружков + подписи по краям */
.likert-scale {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 4px 0;
}

.likert-dot {
    flex: 1 1 0;
    height: 44px;
    display: grid;
    place-items: center;
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
}

.likert-dot::before {
    content: '';
    width: 22px;
    height: 22px;
    border-radius: var(--r-full);
    border: 1.5px solid var(--line-strong);
    background: var(--bg);
    transition: all var(--fast) var(--ease);
}

/* Крайние — крупнее, середина — мельче. Подсказка глазу. */
.likert-dot[data-v="1"]::before,
.likert-dot[data-v="5"]::before { width: 26px; height: 26px; }
.likert-dot[data-v="3"]::before { width: 17px; height: 17px; }

.likert-dot:hover::before { border-color: var(--ink-faint); }

.likert-dot.selected::before {
    background: var(--accent);
    border-color: var(--accent);
    transform: scale(1.06);
}

.likert-ends {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 2px;
    font-size: 11.5px;
    line-height: 1.35;
    color: var(--ink-faint);
}

.likert-ends span { max-width: 42%; }
.likert-ends span:last-child { text-align: right; }

/* Подпись выбранного варианта */
.likert-picked {
    margin-top: 8px;
    font-size: 12.5px;
    color: var(--accent-warm);
    min-height: 17px;
    opacity: 0;
    transition: opacity var(--fast) var(--ease);
}

.likert-picked.visible { opacity: 1; }

.likert-item.unanswered .likert-text { color: var(--error); }

@media (max-width: 480px) {
    .likert-text { font-size: 15.5px; }
    .likert-dot  { height: 40px; }
    .likert-ends { font-size: 11px; }
}

/* ── Открытый вопрос ──────────────────────────────────────── */
.open-question {
    margin-top: var(--gap-xl);
    padding-top: var(--gap-lg);
    border-top: 1px solid var(--line);
}

textarea {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    font-family: inherit;
    font-size: 15px;
    line-height: 1.6;
    color: var(--ink);
    outline: none;
    resize: vertical;
    min-height: 108px;
    transition: border-color var(--fast) var(--ease),
                box-shadow  var(--fast) var(--ease);
}

textarea::placeholder { color: var(--ink-faint); }

textarea:hover { border-color: var(--ink-faint); }

textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(90,107,69,.14);
}

.char-count {
    margin-top: 6px;
    text-align: right;
    font-size: 11.5px;
    color: var(--ink-faint);
    font-variant-numeric: tabular-nums;
    opacity: 0;
    transition: opacity var(--fast) var(--ease);
}

.char-count.visible { opacity: 1; }

.char-count.near-limit { color: var(--error); }

/* ── Переключатели ────────────────────────────────────────── */
.toggle-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.toggle-group.three { grid-template-columns: repeat(3, 1fr); }

.toggle-btn {
    padding: 14px 12px;
    background: var(--bg);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    font-size: 15px;
    color: var(--ink-muted);
    transition: all var(--fast) var(--ease);
}

.toggle-btn:hover {
    border-color: var(--ink-faint);
    color: var(--ink);
}

.toggle-btn.selected {
    background: var(--accent);
    border-color: var(--accent);
    color: #FBFBF7;
    font-weight: 500;
}

/* ── Карточки выбора ──────────────────────────────────────── */
.cards-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card-btn {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 18px;
    background: var(--bg);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-lg);
    cursor: pointer;
    transition: all var(--fast) var(--ease);
}

.card-btn:hover {
    border-color: var(--ink-faint);
    box-shadow: var(--shadow-sm);
}

.card-btn.selected {
    border-color: var(--accent);
    background: var(--bg-soft);
    box-shadow: var(--shadow-md);
}

.card-icon {
    font-size: 22px;
    line-height: 1.2;
    flex: 0 0 auto;
    filter: grayscale(.25);
}

.card-text { display: flex; flex-direction: column; gap: 3px; }

.card-text strong {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.card-text span {
    font-size: 13.5px;
    color: var(--ink-muted);
    line-height: 1.45;
}

/* ── Устройство семьи ─────────────────────────────────────────
   Отдельный блок внутри этапа ценностей: это уже не «что важно»,
   а «как ты видишь совместную жизнь». */
.fam-block {
    margin-top: var(--gap-xl);
    padding-top: var(--gap-lg);
    border-top: 1px solid var(--line);
}

.fam-title {
    font-family: var(--font-voice);
    margin: 0 0 5px;
    font-size: 21px;
    font-weight: 400;
    letter-spacing: -0.018em;
}

.fam-sub {
    margin: 0 0 var(--gap-lg);
    font-size: 14px;
    line-height: 1.6;
    color: var(--ink-muted);
    text-wrap: pretty;
}

/* Компактные карточки — их тут пятнадцать, крупные не помещаются */
.cards-group.compact { gap: 8px; }

.cards-group.compact .card-btn { padding: 13px 15px; }

.cards-group.compact .card-text strong { font-size: 15.5px; }

.cards-group.compact .card-text span {
    font-size: 13.5px;
    line-height: 1.45;
}

/* ── Сводка устройства на экране профиля ──────────────────── */
.setup-recap:not(:empty) {
    margin-bottom: var(--gap-xl);
    padding: var(--gap-md);
    background: var(--bg-soft);
    border-radius: var(--r-lg);
}

.setup-title {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--accent-warm);
    margin-bottom: 6px;
}

.setup-line {
    font-size: 15px;
    line-height: 1.6;
    color: var(--ink);
}

/* ── Приоритеты ───────────────────────────────────────────── */
.priority-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.priority-item {
    position: relative;
    padding: 17px 16px;
    background: var(--bg);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    font-size: 15px;
    color: var(--ink-muted);
    cursor: pointer;
    user-select: none;
    transition: all var(--fast) var(--ease);
}

.priority-item:hover {
    border-color: var(--ink-faint);
    color: var(--ink);
}

.priority-item.selected {
    background: var(--bg-soft);
    border-color: var(--accent);
    color: var(--ink);
    font-weight: 500;
    padding-right: 44px;
}

.priority-item.selected::after {
    content: attr(data-rank);
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    background: var(--accent);
    color: #FBFBF7;
    border-radius: var(--r-full);
    font-size: 11.5px;
    font-weight: 600;
    animation: rankPop var(--fast) var(--ease);
}

@keyframes rankPop {
    from { transform: translateY(-50%) scale(.5); opacity: 0; }
    to   { transform: translateY(-50%) scale(1);  opacity: 1; }
}

.priority-order {
    margin-top: var(--gap-sm);
    padding: 14px 16px;
    background: var(--bg-sunken);
    border-radius: var(--r-md);
    font-size: 13px;
    color: var(--ink-muted);
    line-height: 1.6;
    min-height: 48px;
    display: flex;
    align-items: center;
}

/* ═══════════════════════════════════════════════════════════
   НАВИГАЦИЯ
   ═══════════════════════════════════════════════════════════ */
.nav-footer {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 620px;
    display: flex;
    gap: 12px;
    padding: 16px 24px calc(16px + env(safe-area-inset-bottom));
    background: rgba(251,251,247,.97);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-top: 1px solid var(--line);
    z-index: 20;
}

.btn-back {
    padding: 15px 22px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    font-size: 15px;
    color: var(--ink-muted);
    transition: all var(--fast) var(--ease);
}

.btn-back:hover {
    border-color: var(--ink);
    color: var(--ink);
}

.btn-next {
    flex: 1;
    padding: 15px 24px;
    background: var(--accent);
    color: #FBFBF7;
    border-radius: var(--r-md);
    font-size: 15px;
    font-weight: 500;
    letter-spacing: .01em;
    transition: all var(--fast) var(--ease);
}

.btn-next:hover {
    background: #11140D;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-next:active { transform: translateY(0); }

.btn-next.wide { width: 100%; flex: none; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%      { transform: translateX(-5px); }
    40%      { transform: translateX(5px); }
    60%      { transform: translateX(-3px); }
    80%      { transform: translateX(3px); }
}

/* ── Сообщение об ошибке ──────────────────────────────────── */
.validation-msg {
    position: fixed;
    bottom: 96px;
    left: 50%;
    transform: translate(-50%, 8px);
    max-width: 572px;
    width: calc(100% - 48px);
    padding: 13px 17px;
    background: var(--ink);
    color: #FBFBF7;
    border-radius: var(--r-md);
    font-size: 13.5px;
    line-height: 1.45;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--fast) var(--ease),
                transform var(--fast) var(--ease);
    z-index: 25;
}

.validation-msg.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ═══════════════════════════════════════════════════════════
   ПАУЗА ПЕРЕД ПРОФИЛЕМ
   Человек только что ответил на 42 утверждения о близости.
   Обрушивать на него семь шкал сразу — резко. Нужен вдох.
   ═══════════════════════════════════════════════════════════ */
.finish {
    position: fixed;
    inset: 0;
    z-index: 55;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    opacity: 0;
    visibility: hidden;
    transition: opacity .5s var(--ease), visibility .5s var(--ease);
}

.finish.visible { opacity: 1; visibility: visible; }

.finish-inner {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
    text-align: center;
    animation: introIn .9s var(--ease);
}

.finish-thanks {
    font-family: var(--font-voice);
    margin: 0 0 var(--gap-xl);
    font-size: 30px;
    line-height: 1.35;
    font-weight: 400;
    letter-spacing: -0.024em;
    color: var(--ink);
    text-wrap: balance;
}

.finish-btn {
    max-width: 260px;
    margin: 0 auto;
}

/* Тонкая полоска — сколько осталось до автоперехода */
.finish-timer {
    max-width: 260px;
    margin: var(--gap-sm) auto 0;
    height: 2px;
    background: var(--bg-sunken);
    border-radius: var(--r-full);
    overflow: hidden;
}

.finish-timer-fill {
    height: 100%;
    width: 0;
    background: var(--line-strong);
    border-radius: var(--r-full);
}

.finish-timer-fill.run {
    width: 100%;
    transition: width 5s linear;
}

@media (max-width: 480px) {
    .finish       { align-items: flex-start; padding-top: 64px; }
    .finish-thanks { font-size: 24px; }
    .finish-btn, .finish-timer { max-width: none; }
}

/* ═══════════════════════════════════════════════════════════
   ЭКРАН РЕЗУЛЬТАТА
   ═══════════════════════════════════════════════════════════ */
.result-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 50;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--slow) var(--ease),
                visibility var(--slow) var(--ease);
}

.result-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.result-card {
    max-width: 620px;
    margin: 0 auto;
    padding: var(--gap-xl) 24px 80px;
    animation: resultIn .6s var(--ease);
}

@keyframes resultIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Шапка результата */
.result-eyebrow {
    font-size: 12px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin-bottom: var(--gap-sm);
}

.result-type {
    font-family: var(--font-voice);

    margin: 0 0 var(--gap-sm);
    font-size: 38px;
    line-height: 1.12;
    font-weight: 600;
    letter-spacing: -0.032em;
}

/* ── Обобщение ────────────────────────────────────────────── */
.result-summary {
    margin-bottom: var(--gap-xl);
    padding-bottom: var(--gap-lg);
    border-bottom: 1px solid var(--line);
}

.result-summary p {
    margin: 0 0 var(--gap-md);
    font-size: 16.5px;
    line-height: 1.68;
    text-wrap: pretty;
}

.result-summary p:first-child {
    color: var(--ink-muted);
    font-size: 14.5px;
}

.result-summary p:last-child {
    margin-bottom: 0;
    color: var(--ink-muted);
    font-size: 14.5px;
}

/* ── Семь шкал ────────────────────────────────────────────── */
.scales {
    display: flex;
    flex-direction: column;
    gap: var(--gap-xl);
    margin-bottom: var(--gap-xl);
}

.scale-card {
    padding-bottom: var(--gap-xl);
    border-bottom: 1px solid var(--line);
}

.scale-card:last-child { border-bottom: none; padding-bottom: 0; }

.scale-head { margin-bottom: var(--gap-md); }

.scale-title {
    font-family: var(--font-voice);

    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 3px;
}

.scale-hint {
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--ink-muted);
    margin-bottom: var(--gap-sm);
}

.scale-bar {
    position: relative;
    height: 6px;
    background: var(--bg-sunken);
    border-radius: var(--r-full);
    overflow: hidden;
}

.scale-fill {
    height: 100%;
    background: var(--accent-warm);
    border-radius: var(--r-full);
    animation: fillIn .8s var(--ease);
}

@keyframes fillIn { from { width: 0 !important; } }

/* Отметка середины — чтобы «50%» читалось как норма, а не как половина успеха */
.scale-mark {
    position: absolute;
    left: 50%;
    top: -2px;
    bottom: -2px;
    width: 1px;
    background: var(--line-strong);
}

.scale-legend {
    display: flex;
    justify-content: space-between;
    margin-top: 7px;
    font-size: 12px;
    color: var(--ink-faint);
}

.scale-level { letter-spacing: .02em; }
.scale-value { font-variant-numeric: tabular-nums; }

.scale-lead {
    margin: 0 0 var(--gap-md);
    font-size: 15.5px;
    line-height: 1.65;
    padding: var(--gap-sm) var(--gap-md);
    background: var(--bg-soft);
    border-radius: var(--r-md);
    text-wrap: pretty;
}

.scale-part { margin-bottom: var(--gap-md); }
.scale-part:last-child { margin-bottom: 0; }

.scale-part h4 {
    margin: 0 0 5px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--accent-warm);
}

.scale-part p {
    margin: 0;
    font-size: 15px;
    line-height: 1.68;
    color: var(--ink);
    text-wrap: pretty;
}

.result-note.strong {
    background: var(--accent-tint);
    color: var(--ink);
}

@media (max-width: 480px) {
    .scale-title      { font-size: 18px; }
    .result-summary p { font-size: 15.5px; }
    .scales           { gap: var(--gap-lg); }
}

/* Дисклеймер */
.result-note {
    padding: var(--gap-md);
    background: var(--bg-sunken);
    border-radius: var(--r-md);
    font-size: 13px;
    line-height: 1.6;
    color: var(--ink-muted);
    margin-bottom: var(--gap-xl);
}

/* ── Waitlist ─────────────────────────────────────────────── */
.waitlist {
    padding: var(--gap-lg);
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    margin-bottom: var(--gap-md);
}

.waitlist h3 {
    margin: 0 0 8px;
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.018em;
}

.waitlist p {
    margin: 0 0 var(--gap-md);
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--ink-muted);
}

/* Подарок участникам — отдельно и заметно, но не вместо сути */
.waitlist-gift {
    margin: 0 0 var(--gap-md);
    padding: 12px 14px;
    background: var(--accent-tint);
    border-radius: var(--r-md);
    font-size: 14px;
    line-height: 1.55;
    color: var(--ink);
}

.waitlist-privacy {
    margin: 0 0 var(--gap-md);
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--ink-faint);
}

.waitlist-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Согласие на разговор */
.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 4px 2px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink-muted);
    transition: color var(--fast) var(--ease);
}

.checkbox-row:hover { color: var(--ink); }

.checkbox-row input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin: 2px 0 0;
    border: 1px solid var(--line-strong);
    border-radius: 5px;
    background: var(--bg);
    cursor: pointer;
    position: relative;
    transition: all var(--fast) var(--ease);
}

.checkbox-row input[type="checkbox"]:hover { border-color: var(--ink-faint); }

.checkbox-row input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}

.checkbox-row input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid #FBFBF7;
    border-width: 0 2px 2px 0;
    transform: rotate(43deg);
}

.waitlist-msg {
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--error);
    min-height: 20px;
}

.waitlist-msg.ok {
    color: var(--accent-warm);
    padding: 10px 12px;
    background: var(--accent-tint);
    border-radius: var(--r-sm);
    font-weight: 500;
}

.waitlist.done .waitlist-form { display: none; }

/* Вторичная кнопка */
.btn-ghost {
    width: 100%;
    padding: 15px 24px;
    background: transparent;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    font-size: 15px;
    color: var(--ink-muted);
    transition: all var(--fast) var(--ease);
}

.btn-ghost:hover {
    border-color: var(--ink);
    color: var(--ink);
}

/* ═══════════════════════════════════════════════════════════
   МОБИЛЬНЫЕ
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    .progress-header { padding: 12px 18px 12px; }
    .step span       { font-size: 10px; }
    .lang-switcher   { margin-bottom: 10px; }
    .lang-btn        { padding: 4px 7px; font-size: 11px; }
    .form-container  { padding: var(--gap-lg) 18px 120px; }
    .stage-title     { font-size: 25px; }
    .field-group > label { font-size: 15.5px; }
    .stage-subtitle  { margin-bottom: var(--gap-lg); }
    .nav-footer      { padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); }
    .result-card     { padding: var(--gap-lg) 18px 60px; }
    .result-type     { font-size: 30px; }
    .validation-msg  { width: calc(100% - 36px); bottom: 88px; }
    .toggle-group.three { grid-template-columns: 1fr; }
}

@media (max-width: 380px) {
    .priority-grid { grid-template-columns: 1fr; }
}

/* ── Доступность ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
