/* АТОМДАТА — анкета для студентов. Мобильная версия — основная, десктоп — надстройка от 960px. */

@font-face {
	font-family: "Onest";
	src: url("fonts/onest-variable.woff2") format("woff2");
	font-weight: 100 900;
	font-style: normal;
	font-display: swap;
}

:root {
	--bg: #F2F4FA;
	--surface: #FFFFFF;
	--surface-2: #F7F8FC;
	--ink: #0E1433;
	--ink-2: #465070;
	--ink-3: #626A88;
	--placeholder: #9AA0B8;
	--line: #DCE0EC;
	--line-strong: #B8BED2;
	--title: #00197E;
	--blue: #0033FF;
	--blue-press: #0029CC;
	--accent-text: #0033FF;
	--cyan: #06B2FE;
	--tint: #EDF1FF;
	--seg-bg: #E8EBF5;
	--danger: #C81E3A;
	--danger-tint: #FDEFF1;
	--danger-line: #E39AA7;
	--warn-bg: #FFF4D9;
	--warn-ink: #6B4A00;
	--top-bg: rgba(242, 244, 250, .86);
	--nav-bg: rgba(255, 255, 255, .9);
	--glow: rgba(6, 178, 254, .14);
	--shadow-panel: 0 1px 2px rgba(0, 25, 126, .05), 0 18px 48px rgba(0, 25, 126, .08);
	--shadow-sheet: 0 -1px 0 rgba(0, 25, 126, .04), 0 -10px 30px rgba(0, 25, 126, .05);
	--focus: 0 0 0 3px rgba(0, 51, 255, .3);


	--r: 14px;
	--r-lg: 24px;
	--font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	--mono: ui-monospace, "SF Mono", "JetBrains Mono", "Roboto Mono", Menlo, Consolas, monospace;
	color-scheme: light dark;
	accent-color: var(--blue);
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #070B1F;
		--surface: #0D1330;
		--surface-2: #111839;
		--ink: #E8EBF7;
		--ink-2: #A6AECB;
		--ink-3: #8790AF;
		--placeholder: #5E6789;
		--line: #232C55;
		--line-strong: #3A4580;
		--title: #F2F4FC;
		--blue: #2E5BFF;
		--blue-press: #2449D9;
		--accent-text: #5FC8FF;
		--tint: rgba(46, 91, 255, .16);
		--seg-bg: #151C42;
		--danger: #FF7A8E;
		--danger-tint: rgba(255, 122, 142, .1);
		--danger-line: rgba(255, 122, 142, .55);
		--warn-bg: rgba(255, 196, 64, .12);
		--warn-ink: #F2CD7A;
		--top-bg: rgba(7, 11, 31, .82);
		--nav-bg: rgba(13, 19, 48, .88);
		--glow: rgba(6, 178, 254, .12);
		--shadow-panel: 0 0 0 1px #1A2250, 0 24px 60px rgba(0, 0, 0, .45);
		--shadow-sheet: 0 0 0 1px #161E48;
		--focus: 0 0 0 3px rgba(95, 150, 255, .5);
	}
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-padding-top: 96px;
	scroll-padding-bottom: 110px;
}

body {
	margin: 0;
	min-height: 100vh;
	min-height: 100dvh;
	background: radial-gradient(120% 420px at 50% -120px, var(--glow), transparent 70%) no-repeat, var(--bg);
	color: var(--ink);
	font-family: var(--font);
	font-size: 16px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	overflow-x: hidden;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); text-underline-offset: 3px; }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
::selection { background: rgba(0, 51, 255, .18); }
@media (prefers-color-scheme: dark) { ::selection { background: rgba(95, 200, 255, .3); } }
input, textarea { caret-color: var(--blue); }

.sr-only {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- Верхняя панель (телефон и планшет) ---------- */

.top {
	position: sticky;
	top: 0;
	z-index: 20;
	padding-top: env(safe-area-inset-top);
	background: var(--top-bg);
	-webkit-backdrop-filter: saturate(1.6) blur(14px);
	backdrop-filter: saturate(1.6) blur(14px);
}
.top-inner {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	max-width: 1080px;
	height: 56px;
	margin: 0 auto;
	padding: 0 16px;
}

.brand {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
	color: var(--ink-2);
	text-decoration: none;
	border-radius: 8px;
	transition: opacity .25s cubic-bezier(.22, 1, .36, 1), transform .25s cubic-bezier(.22, 1, .36, 1);
}

.brand-logo { display: block; width: auto; height: 22px; }

.brand-tag {
	display: none;
	padding-left: 12px;
	border-left: 1px solid var(--line-strong);
	font-size: 14px;
	line-height: 18px;
}

/* Название раздела: появляется на месте логотипа, когда заголовок шага ушёл под панель */
.top-title {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 16px;
	right: 136px;
	display: flex;
	align-items: center;
	overflow: hidden;
	font-size: 17px;
	font-weight: 700;
	letter-spacing: -.01em;
	color: var(--title);
	white-space: nowrap;
	text-overflow: ellipsis;
	opacity: 0;
	transform: translateY(8px);
	pointer-events: none;
	transition: opacity .25s cubic-bezier(.22, 1, .36, 1), transform .25s cubic-bezier(.22, 1, .36, 1);
}
body.title-out .brand { opacity: 0; transform: translateY(-8px); pointer-events: none; }
body.title-out .top-title { opacity: 1; transform: none; }

/* «Шаг 2 из 5 ⌄» — раскрывает список этапов */
.top-steps {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	min-height: 44px;
	margin-right: -8px;
	padding: 0 8px 0 12px;
	border: 0;
	border-radius: 12px;
	background: transparent;
	font-size: 14px;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	color: var(--accent-text);
	white-space: nowrap;
	-webkit-tap-highlight-color: transparent;
}
.top-chev { transition: transform .2s cubic-bezier(.22, 1, .36, 1); }
body.steps-open .top-chev { transform: rotate(180deg); }
body[data-view="welcome"] .top-steps,
body[data-view="done"] .top-steps { display: none; }

/* Прогресс на телефоне: синий — пройдено и текущий шаг, серый — впереди */
.meter {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 5px;
	max-width: 1080px;
	margin: 0 auto;
	padding: 0 16px 10px;
}

.meter i {
	height: 4px;
	border-radius: 2px;
	background: var(--line);
	transition: background-color .3s;
}

.meter i.is-done { background: var(--blue); }
.meter i.is-current { background: var(--blue); }
body[data-view="welcome"] .meter,
body[data-view="done"] .meter { display: none; }

/* ---------- Сетка ---------- */

.layout { max-width: 1080px; margin: 0 auto; }

/* ---------- Этапы анкеты ---------- */

/* Телефон и планшет: список раскрывается под шапкой по кнопке «Шаг N из 5» */
.steps {
	display: none;
	position: fixed;
	top: calc(env(safe-area-inset-top) + 70px);
	left: 0;
	right: 0;
	z-index: 19;
	max-height: calc(100dvh - 140px);
	padding: 8px 16px 16px;
	overflow-y: auto;
	overscroll-behavior: contain;
	border-bottom: 1px solid var(--line);
	background: var(--surface);
	box-shadow: 0 20px 36px -18px rgba(4, 10, 40, .4);
}
body.steps-open .steps { display: block; }
.steps-brand, .steps-label { display: none; }

.steps-list { margin: 0; padding: 0; list-style: none; }
.step { position: relative; }
.step + .step { margin-top: 4px; }
/* Линия между кружками; пройденный отрезок — синий */
.step:not(:last-child)::after {
	content: "";
	position: absolute;
	top: 41px;
	left: 24px;
	width: 2px;
	height: 15px;
	border-radius: 1px;
	background: var(--line);
}
.step.is-done:not(:last-child)::after { background: var(--blue); }

.step-btn {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	min-height: 48px;
	margin: 0;
	padding: 8px 10px;
	border: 0;
	border-radius: 12px;
	background: transparent;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.3;
	text-align: left;
	color: var(--ink-2);
	cursor: default;
	transition: background-color .18s, color .18s;
}
.step-dot {
	position: relative;
	display: grid;
	place-items: center;
	flex: none;
	width: 30px;
	height: 30px;
	border: 1.5px solid var(--line-strong);
	border-radius: 50%;
	background: var(--surface);
	font-size: 13px;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	color: var(--ink-3);
	transition: background-color .2s, border-color .2s, color .2s;
}
.step-check { display: none; }
.step.is-current .step-dot { border-color: var(--blue); background: var(--blue); color: #FFFFFF; }
.step.is-current .step-name { font-weight: 600; color: var(--title); }
.step.is-done .step-dot { border-color: var(--blue); background: var(--tint); color: var(--blue); }
@media (prefers-color-scheme: dark) { .step.is-done .step-dot { color: var(--accent-text); border-color: var(--accent-text); } }
.step.is-done .step-num { display: none; }
.step.is-done .step-check { display: block; }
.step.is-done .step-name { color: var(--ink); }
.step.is-reachable .step-btn { cursor: pointer; }
@media (hover: hover) { .step.is-reachable .step-btn:hover { background: var(--surface-2); color: var(--ink); } }

.steps-foot { margin: 12px 10px 0; font-size: 13px; line-height: 1.5; color: var(--ink-3); }

/* ---------- Лист анкеты ---------- */

.panel {
	position: relative;
	display: flex;
	flex-direction: column;
	min-height: calc(100vh - 70px);
	min-height: calc(100dvh - 70px);
	margin-top: 8px;
	border-radius: var(--r-lg) var(--r-lg) 0 0;
	background: var(--surface);
	box-shadow: var(--shadow-sheet);
}

body[data-view="welcome"] .panel,
body[data-view="done"] .panel { min-height: calc(100dvh - 64px); }

.demo {
	margin: 0;
	padding: 9px 20px;
	border-radius: var(--r-lg) var(--r-lg) 0 0;
	background: var(--warn-bg);
	color: var(--warn-ink);
	font-size: 13px;
	line-height: 1.35;
	text-align: center;
	text-wrap: balance;
}

/* На приветствии плашку тестового режима не показываем */
body[data-view="welcome"] .demo { display: none; }

.screen { flex: 1; padding: 22px 20px 32px; }
.screen.enter-fwd { animation: enter-fwd .22s cubic-bezier(.22, 1, .36, 1); }
.screen.enter-back { animation: enter-back .22s cubic-bezier(.22, 1, .36, 1); }
@keyframes enter-fwd { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes enter-back { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }

/* ---------- Типографика ---------- */

.hero {
	margin: 0 0 16px;
	font-size: clamp(32px, 9.2vw, 56px);
	line-height: 1.02;
	font-weight: 700;
	letter-spacing: -.04em;
	color: var(--title);
	text-wrap: balance;
}
.hero span { color: var(--blue); }
@media (prefers-color-scheme: dark) { .hero span { color: var(--cyan); } }

.welcome-kicker { margin: 0 0 12px; font-size: 15px; font-weight: 600; color: var(--accent-text); }
.hero-sub { max-width: 60ch; margin: 0 0 14px; font-size: 17px; line-height: 1.5; color: var(--ink-2); text-wrap: pretty; }

.resume {
	margin: 0 0 20px;
	padding: 12px 14px;
	border-radius: 12px;
	background: var(--tint);
	font-size: 14px;
	line-height: 1.45;
}

.note {
	margin: 0;
	padding-top: 16px;
	border-top: 1px solid var(--line);
	font-size: 14px;
	line-height: 1.5;
	color: var(--ink-2);
}
.note b { font-weight: 600; color: var(--ink); }

.step-title {
	margin: 0 0 8px;
	font-size: 30px;
	line-height: 1.1;
	font-weight: 700;
	letter-spacing: -.028em;
	color: var(--title);
	text-wrap: balance;
}
.step-title:focus, .hero:focus { outline: none; box-shadow: none; }

.step-lead { margin: 0 0 26px; font-size: 15.5px; line-height: 1.5; color: var(--ink-2); text-wrap: pretty; }

/* ---------- Поля ---------- */

fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }

.field { margin: 0 0 24px; }
.group { margin: 0 0 32px; }
.group > .field:last-child { margin-bottom: 0; }

/* legend ведёт себя как обычный блок */
.field > legend,
.group > legend { float: left; width: 100%; padding: 0; }
.field > legend + *,
.group > legend + * { clear: both; }

.label {
	display: block;
	margin: 0 0 9px;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.4;
	color: var(--ink);
}

.optional { margin-left: 2px; font-size: 13px; font-weight: 400; color: var(--ink-3); white-space: nowrap; }

.group-title {
	margin: 0 0 6px;
	font-size: 18px;
	font-weight: 700;
	letter-spacing: -.012em;
	color: var(--title);
}
.group > legend.group-title { margin-bottom: 12px; }
.group > legend.group-title + .hint { margin-top: -6px; }

.hint { margin: -3px 0 11px; font-size: 14px; line-height: 1.45; color: var(--ink-2); }

.input,
.textarea {
	display: block;
	width: 100%;
	min-height: 54px;
	padding: 14px 16px;
	border: 1.5px solid var(--line);
	border-radius: 12px;
	background: var(--surface);
	font-size: 17px;
	line-height: 1.35;
	transition: border-color .15s, box-shadow .15s, background-color .15s;
	-webkit-appearance: none;
	appearance: none;
}
.textarea { min-height: 132px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--placeholder); opacity: 1; }
.input:focus, .textarea:focus { outline: none; border-color: var(--blue); box-shadow: var(--focus); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); background: var(--danger-tint); }
input::-webkit-calendar-picker-indicator { display: none !important; }

@media (hover: hover) {
	.input:hover:not(:focus), .textarea:hover:not(:focus) { border-color: var(--line-strong); }
}

.affix-field { position: relative; }
.affix {
	position: absolute;
	top: 0; bottom: 0; left: 16px;
	display: flex;
	align-items: center;
	font-size: 17px;
	color: var(--ink-3);
	pointer-events: none;
}
.affix-field .input { padding-left: 36px; }

/* Телефон: код +7 зафиксирован, маска подсказывает формат */
.phone-field {
	position: relative;
	display: flex;
	align-items: stretch;
	min-height: 54px;
	border: 1.5px solid var(--line);
	border-radius: 12px;
	background: var(--surface);
	overflow: hidden;
	transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.phone-field:focus-within { border-color: var(--blue); box-shadow: var(--focus); }
.phone-field.is-invalid { border-color: var(--danger); background: var(--danger-tint); }
@media (hover: hover) { .phone-field:hover:not(:focus-within) { border-color: var(--line-strong); } }

.phone-cc {
	display: flex;
	align-items: center;
	padding: 0 14px 0 16px;
	border-right: 1px solid var(--line);
	background: var(--surface-2);
	font-family: var(--mono);
	font-size: 17px;
	font-weight: 500;
	color: var(--ink);
	user-select: none;
	-webkit-user-select: none;
}
.phone-field.is-invalid .phone-cc { background: transparent; }
.phone-slot { position: relative; display: flex; flex: 1; min-width: 0; }
.phone-input, .phone-mask {
	font-family: var(--mono);
	font-size: 17px;
	line-height: 24px;
	letter-spacing: .02em;
	font-variant-numeric: tabular-nums;
}
.phone-input {
	position: relative;
	z-index: 1;
	flex: 1;
	width: 100%;
	min-width: 0;
	margin: 0;
	padding: 0 14px;
	border: 0;
	border-radius: 0;
	background: transparent;
	caret-color: var(--blue);
	outline: none;
	box-shadow: none;
	-webkit-appearance: none;
	appearance: none;
}
.phone-input:focus, .phone-input:focus-visible { box-shadow: none; }
.phone-mask {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	padding: 0 14px;
	overflow: hidden;
	white-space: pre;
	color: var(--placeholder);
	pointer-events: none;
}
.phone-mask .m-typed { color: transparent; }
.phone-ok {
	display: flex;
	align-items: center;
	padding: 0 16px 0 4px;
	color: var(--blue);
	opacity: 0;
	transform: scale(.6);
	transition: opacity .2s, transform .2s;
}
@media (prefers-color-scheme: dark) { .phone-ok { color: var(--cyan); } }
.phone-field.is-complete .phone-ok { opacity: 1; transform: none; }

.counter { margin-top: 6px; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--ink-3); text-align: right; }

.error { display: flex; align-items: flex-start; gap: 7px; margin: 9px 0 0; font-size: 14px; line-height: 1.4; color: var(--danger); }
.error:empty { display: none; }
.error svg { flex: none; margin-top: 2px; }

.alert {
	margin: 0 0 22px;
	padding: 12px 14px;
	border-radius: 12px;
	background: var(--danger-tint);
	color: var(--danger);
	font-size: 14px;
	font-weight: 500;
	line-height: 1.45;
}

.divider { height: 1px; margin: 4px 0 28px; background: var(--line); }

.reveal { margin-top: 10px; animation: reveal .25s ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- Сегментированный переключатель ---------- */

.seg {
	display: grid;
	grid-auto-columns: minmax(0, 1fr);
	grid-auto-flow: column;
	gap: 4px;
	padding: 4px;
	border-radius: 14px;
	background: var(--seg-bg);
	transition: box-shadow .15s, background-color .15s;
}
.seg label { position: relative; display: block; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg span {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 46px;
	height: 100%;
	padding: 6px 8px;
	border-radius: 10px;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.2;
	text-align: center;
	color: var(--ink-2);
	transition: background-color .18s, color .18s, box-shadow .18s, transform .1s;
}
.seg input:checked + span {
	background: var(--blue);
	color: #FFFFFF;
	font-weight: 600;
	box-shadow: 0 1px 2px rgba(4, 10, 40, .18), 0 4px 10px -4px rgba(4, 10, 40, .3);
}
.seg input:focus-visible + span { box-shadow: var(--focus); }
.seg label:active span { transform: scale(.97); }
@media (hover: hover) { .seg label:hover input:not(:checked) + span { color: var(--ink); background: rgba(127, 140, 190, .12); } }
.has-error .seg { background: var(--danger-tint); box-shadow: inset 0 0 0 1.5px var(--danger-line); }
.seg-6 span { font-size: 17px; font-variant-numeric: tabular-nums; }

/* ---------- Чипы ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; display: block; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.chip span {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding: 0 16px;
	border: 1.5px solid var(--line);
	border-radius: 999px;
	background: var(--surface);
	font-size: 15px;
	font-weight: 500;
	line-height: 1.2;
	color: var(--ink);
	transition: background-color .15s, border-color .15s, color .15s, transform .1s;
}
.chip span::before {
	content: "";
	display: none;
	width: 5px;
	height: 10px;
	margin: -3px 1px 0 2px;
	border: solid currentColor;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}
.chip input:checked + span { border-color: var(--blue); background: var(--tint); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--blue); }
.chip input:checked + span::before { display: block; }
.chip input:focus-visible + span { box-shadow: var(--focus); }
.chip:active span { transform: scale(.97); }
.chip.is-alt span { color: var(--ink-2); font-weight: 400; }
.has-error .chip span { border-color: var(--danger-line); }
.chip.is-alt input:checked + span { color: var(--accent-text); font-weight: 500; }
@media (hover: hover) { .chip:hover input:not(:checked) + span { border-color: var(--line-strong); } }

/* ---------- Карточки выбора ---------- */

.choices { display: grid; gap: 10px; }
.choice { position: relative; display: block; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.choice input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.choice-box {
	display: flex;
	align-items: flex-start;
	gap: 14px;
	min-height: 56px;
	padding: 15px 16px;
	border: 1.5px solid var(--line);
	border-radius: var(--r);
	background: var(--surface);
	transition: border-color .15s, background-color .15s, box-shadow .15s, transform .1s;
}
.choice-text { flex: 1; min-width: 0; }
.choice-title { display: block; font-size: 16px; font-weight: 500; line-height: 1.35; color: var(--ink); }
.choice-desc { display: block; margin-top: 4px; font-size: 14px; line-height: 1.42; color: var(--ink-2); }
.choice.is-alt .choice-title { color: var(--ink-2); }

.tick {
	position: relative;
	flex: none;
	width: 22px;
	height: 22px;
	border: 1.5px solid var(--line-strong);
	border-radius: 7px;
	background: var(--surface);
	transition: background-color .15s, border-color .15s;
}
.choice-box .tick { margin-top: 0; }
input[type="radio"] + .choice-box .tick { border-radius: 50%; }
.tick::after {
	content: "";
	position: absolute;
	opacity: 0;
	transform: scale(.5);
	transition: opacity .15s, transform .15s;
}
input[type="radio"] + .choice-box .tick::after {
	top: 50%; left: 50%;
	width: 8px; height: 8px;
	margin: -4px 0 0 -4px;
	border-radius: 50%;
	background: #FFFFFF;
}
input[type="checkbox"] + .choice-box .tick::after,
.check .tick::after {
	top: 3px; left: 6.5px;
	width: 6px; height: 11px;
	border: solid #FFFFFF;
	border-width: 0 2.4px 2.4px 0;
	transform: rotate(45deg) scale(.5);
}

.choice input:checked + .choice-box { border-color: var(--blue); background: var(--tint); box-shadow: inset 0 0 0 1px var(--blue); }
.choice input:checked + .choice-box .tick { border-color: var(--blue); background: var(--blue); }
.choice input:checked + .choice-box .tick::after { opacity: 1; transform: none; }
.choice input[type="checkbox"]:checked + .choice-box .tick::after { transform: rotate(45deg); }
.choice input:focus-visible + .choice-box { box-shadow: var(--focus); }
.choice input:checked:focus-visible + .choice-box { box-shadow: inset 0 0 0 1px var(--blue), var(--focus); }
.choice:active .choice-box { transform: scale(.992); }
@media (hover: hover) { .choice:hover input:not(:checked) + .choice-box { border-color: var(--line-strong); } }
.has-error .choice-box { border-color: var(--danger-line); }

.choice.is-card .choice-box { padding: 14px 16px 14px 14px; }
.choice.is-card .tick { margin-top: 10px; }
.choice.is-card .choice-title { font-weight: 600; }
.choice-icon {
	display: grid;
	place-items: center;
	flex: none;
	width: 42px;
	height: 42px;
	border-radius: 12px;
	background: var(--tint);
	color: var(--blue);
	transition: background-color .15s, color .15s;
}
@media (prefers-color-scheme: dark) { .choice-icon { color: var(--cyan); } }
.choice.is-card input:checked + .choice-box .choice-icon { background: var(--blue); color: #FFFFFF; }

/* ---------- Согласие и переключатель ---------- */

.check {
	position: relative;
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 15px 16px;
	border: 1.5px solid var(--line);
	border-radius: var(--r);
	background: var(--surface-2);
	font-size: 15px;
	line-height: 1.45;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	transition: border-color .15s, background-color .15s;
}
.check input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.check .tick { margin-top: 0; }
.check input:checked ~ .tick { border-color: var(--blue); background: var(--blue); }
.check input:checked ~ .tick::after { opacity: 1; transform: rotate(45deg); }
.check input:checked ~ span { color: var(--ink); }
.check input:focus-visible ~ .tick { box-shadow: var(--focus); }
.has-error .check { border-color: var(--danger-line); background: var(--danger-tint); }

.consent-links { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 14px 0 0 2px; font-size: 15px; }

.linkish {
	display: inline-block;
	padding: 12px 0;
	margin: -12px 0;
	border: 0;
	background: none;
	color: var(--accent-text);
	font-size: inherit;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
	cursor: pointer;
}


/* ---------- Нижняя панель с кнопками ---------- */

.nav {
	position: sticky;
	bottom: 0;
	z-index: 10;
	display: flex;
	gap: 10px;
	padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
	border-top: 1px solid var(--line);
	background: var(--nav-bg);
	-webkit-backdrop-filter: saturate(1.6) blur(14px);
	backdrop-filter: saturate(1.6) blur(14px);
}
body[data-view="done"] .nav { display: none; }

/* Условие допуска — небольшим текстом под кнопкой, только на приветствии */
.nav { flex-wrap: wrap; }
.nav-note { display: none; flex-basis: 100%; margin: 0; font-size: 13px; line-height: 1.45; color: var(--ink-2); text-align: center; text-wrap: balance; }
body[data-view="welcome"] .nav-note { display: block; }

.skip-note { margin: -14px 0 24px; font-size: 14px; font-weight: 600; color: var(--accent-text); }

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 54px;
	padding: 0 20px;
	border: 1.5px solid transparent;
	border-radius: 14px;
	font-size: 16px;
	font-weight: 600;
	letter-spacing: -.005em;
	text-decoration: none;
	-webkit-tap-highlight-color: transparent;
	transition: background-color .15s, border-color .15s, color .15s, transform .1s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { flex: 1; background: var(--blue); color: #FFFFFF; box-shadow: 0 1px 2px rgba(4, 10, 40, .14), 0 8px 18px -8px rgba(4, 10, 40, .4); }
.btn-primary:hover { background: var(--blue-press); }
.btn-ghost { flex: none; background: var(--surface); border-color: var(--line); color: var(--ink); }
@media (hover: hover) { .btn-ghost:hover { border-color: var(--line-strong); } }
.btn-small { min-height: 44px; padding: 0 16px; border-radius: 12px; font-size: 14px; }

/* ---------- Проверка ---------- */

.review-section { margin: 0 0 14px; border: 1.5px solid var(--line); border-radius: var(--r); overflow: hidden; }
.review-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 10px 10px 16px;
	border-bottom: 1px solid var(--line);
	background: var(--surface-2);
}
.review-head h3 { margin: 0; font-size: 16px; font-weight: 700; color: var(--title); }
.review-list { margin: 0; padding: 4px 16px 8px; }
.review-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.review-row:last-child { border-bottom: 0; }
.review-row dt { font-size: 13px; line-height: 1.4; color: var(--ink-3); }
.review-row dd { margin: 3px 0 0; font-size: 15px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.review-row dd.empty { color: var(--ink-3); }

/* ---------- Готово ---------- */

.done { padding-top: 28px; }
.done-badge {
	display: grid;
	place-items: center;
	width: 64px;
	height: 64px;
	margin-bottom: 22px;
	border-radius: 50%;
	background: var(--blue);
	color: #FFFFFF;
	box-shadow: 0 1px 2px rgba(4, 10, 40, .16), 0 12px 24px -10px rgba(4, 10, 40, .45);
	animation: pop .5s cubic-bezier(.22, 1, .36, 1) both;
}
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.done-more { margin-top: 28px; }
.link-card {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 10px;
	padding: 14px 16px;
	border: 1.5px solid var(--line);
	border-radius: var(--r);
	color: var(--ink);
	text-decoration: none;
	transition: border-color .15s;
}
.link-card b { display: block; font-size: 15px; font-weight: 600; }
.link-card small { display: block; margin-top: 2px; font-size: 13px; color: var(--ink-2); }
.link-card svg { flex: none; color: var(--accent-text); }
@media (hover: hover) { .link-card:hover { border-color: var(--line-strong); } }
.done-restart { margin-top: 14px; font-size: 15px; }

/* ---------- Закреплённое название раздела в листе анкеты (десктоп) ---------- */

.step-bar { display: none; }

/* ---------- Адаптивность ---------- */

@media (max-width: 359px) {
	.screen { padding-left: 16px; padding-right: 16px; }
	.seg span { font-size: 14px; padding: 6px 4px; }
	.btn-back-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
	.btn-ghost { padding: 0 16px; }
}

@media (min-width: 400px) {
	.brand-tag { display: block; }
}

/* Планшет: лист анкеты — карточка по центру */
@media (min-width: 640px) {
	.top-inner { height: 68px; padding: 0 24px; }
	.top-title { left: 24px; right: 150px; font-size: 19px; }
	.steps { top: calc(env(safe-area-inset-top) + 82px); padding: 8px max(24px, calc(50% - 340px)) 16px; }
	.brand-logo { height: 28px; }
	.meter { padding: 0 24px 12px; max-width: 728px; }
	.layout { padding: 0 24px 48px; }
	.panel,
	body[data-view="welcome"] .panel,
	body[data-view="done"] .panel {
		max-width: 680px;
		min-height: 0;
		margin: 16px auto 0;
		border-radius: var(--r-lg);
		box-shadow: var(--shadow-panel);
	}
	.screen { padding: 36px 40px 40px; }
	.nav { padding: 16px 40px; border-radius: 0 0 var(--r-lg) var(--r-lg); }
	.step-title { font-size: 36px; }
	.choices.cols-2 { grid-template-columns: 1fr 1fr; }
}

/* Десктоп: стойка слева — оглавление и прогресс, анкета справа */
@media (min-width: 960px) {
	html { scroll-padding-top: 84px; }
	/* Логотип и разделы — в стойке слева, верхняя панель анкете на десктопе не нужна */
	body[data-view] .top { display: none; }
	.layout {
		display: grid;
		grid-template-columns: 240px minmax(0, 1fr);
		align-items: start;
		gap: 40px;
		padding: 32px 24px 64px;
	}
	/* Светлая колонка этапов: продолжает страницу, а не спорит с анкетой */
	.steps,
	body.steps-open .steps {
		position: sticky;
		top: 32px;
		display: block;
		max-height: none;
		padding: 4px 0 0;
		overflow: visible;
		border: 0;
		background: transparent;
		box-shadow: none;
	}
	.steps-brand { display: flex; align-items: center; gap: 12px; padding: 8px 10px 0; color: var(--ink-2); text-decoration: none; border-radius: 8px; }
	.steps-logo { display: block; width: auto; height: 26px; }
	.steps-body { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
	/* До начала заполнения — только логотип: этапы появляются после «Заполнить анкету» */
	body[data-view="welcome"] .steps-body { display: none; }
	/* Приветствие: одна колонка по центру, логотип над карточкой */
	body[data-view="welcome"] .layout { grid-template-columns: minmax(0, 720px); justify-content: center; row-gap: 20px; }
	body[data-view="welcome"] .steps { position: static; padding: 0; }
	body[data-view="welcome"] .steps-brand { padding: 0 4px; }
	.steps-label { display: block; margin: 0 10px 8px; font-size: 13px; font-weight: 600; color: var(--ink-3); }
	.panel,
	body[data-view="welcome"] .panel,
	body[data-view="done"] .panel { max-width: 720px; margin: 0; }
	.screen { padding: 44px 48px 44px; }
	.welcome { padding-top: 56px; padding-bottom: 48px; }
	.nav { padding: 16px 48px; }
	.btn-primary { flex: 0 1 auto; min-width: 240px; margin-left: auto; }
	body[data-view="welcome"] .btn-primary { margin-left: 0; }
	body[data-view="welcome"] .nav-note { text-align: left; }
	body[data-view="welcome"] .nav { padding-top: 0; padding-bottom: 48px; border-top-color: transparent; background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }

	.step-bar { display: block; position: sticky; top: 0; z-index: 8; flex: none; height: 0; }
	.step-bar-inner {
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 16px;
		height: 60px;
		padding: 0 48px;
		border-bottom: 1px solid var(--line);
		background: var(--nav-bg);
		-webkit-backdrop-filter: saturate(1.6) blur(14px);
		backdrop-filter: saturate(1.6) blur(14px);
		box-shadow: 0 12px 24px -20px rgba(4, 10, 40, .45);
		opacity: 0;
		transform: translateY(-8px);
		pointer-events: none;
		transition: opacity .25s cubic-bezier(.22, 1, .36, 1), transform .25s cubic-bezier(.22, 1, .36, 1);
	}
	body.title-out .step-bar-inner { opacity: 1; transform: none; }
	.step-bar-title { min-width: 0; overflow: hidden; font-size: 18px; font-weight: 700; letter-spacing: -.01em; color: var(--title); white-space: nowrap; text-overflow: ellipsis; }
	.step-bar-count { font-size: 14px; font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
	/* Состояния меняются мгновенно, без движения: смена экрана, мигание и «загорание» индикаторов отключены */
	.screen.enter-fwd, .screen.enter-back, .reveal, .done-badge { animation: none; }
	.brand, .top-title, .step-bar-inner { transform: none !important; }
	*, *::before, *::after { transition-duration: .01ms !important; }
}
