/* Анкеты «Чемпиона». Бренд: красный #EC3754, бирюзовый #1ABBD2, жёлтый #FFBB2C, тёмный #09161D.
   Шрифты: Atiba Cyrillic только для слов-заголовков (цифры в ней читаются неверно), Comfortaa для карточек,
   Manrope для текста и всех цифр. Радиусы: карточки 14px, поля и кнопки 10px. Текст выровнен по ширине. */
@import url("fonts/fonts.css");

:root {
  --ink: #09161D;
  --cyan: #1ABBD2;
  --red: #EC3754;
  --yellow: #FFBB2C;

  --bg: #F3F6F7;
  --surface: #FFFFFF;
  --surface-2: #F7F9FA;
  --line: #E1E7EA;
  --line-2: #CBD3D8;
  --text: #09161D;
  --text-2: #33434C;
  --text-3: #5D6C75;
  --accent: #1ABBD2;
  --accent-fg: #0A7486;
  --on-accent: #09161D;
  --select: #EAF7FA;
  --warn-bg: #FFF4D9;
  --warn-fg: #7A4F00;
  --bad-bg: #FDEAEE;
  --bad-fg: #B01A38;
  --ok-fg: #1B7F52;

  --rail: #09161D;
  --rail-hover: #12262F;
  --rail-active: #133540;
  --rail-text: #B5C4CC;
  --rail-muted: #8CA1AB;
  --rail-line: #1A2F39;

  --font: Manrope, "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Atiba Cyrillic", "Arial Black", sans-serif;
  --font-head: Comfortaa, Manrope, "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --r-card: 14px;
  --r-ctl: 10px;
  --rail-w: 300px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #09161D; --surface: #0F2029; --surface-2: #142833; --line: #1E3542; --line-2: #2B4655;
    --text: #EEF4F6; --text-2: #C2D0D6; --text-3: #9DB1BA;
    --accent-fg: #5AD6E8; --select: #11303A;
    --warn-bg: #3A3014; --warn-fg: #FFD36B; --bad-bg: #3A1620; --bad-fg: #FF8095; --ok-fg: #4FD08F;
    --rail: #060F14; --rail-hover: #0C1C24; --rail-active: #12303B; --rail-line: #14262F;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.6;
  font-variant-numeric: tabular-nums;
}
::selection { background: var(--cyan); color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent-fg); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Выключка по ширине на всех многострочных текстовых блоках, без узких max-width */
.just, .lead, .p, .list li, .note, .opt-desc, .q-hint, .q-current, .w-note, .intro-points li, .lead-intro {
  text-align: justify; text-justify: inter-word; hyphens: auto; -webkit-hyphens: auto;
}

/* ── Каркас ─────────────────────────────────────────────────────────────── */
.app { min-height: 100dvh; display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); }
.rail {
  position: sticky; top: 0; height: 100dvh; background: var(--rail); color: var(--rail-text);
  display: flex; flex-direction: column; padding: 28px 18px 20px; gap: 20px; overflow-y: auto;
}
.rail-logo { width: 150px; height: auto; display: block; margin-left: 6px; }
.rail-title { font-family: var(--font-head); font-weight: 700; font-size: 15px; line-height: 1.35; color: #fff; padding: 0 6px; }
.rail-total { padding: 0 6px; display: grid; gap: 8px; }
.rail-total .t { font-size: 13px; color: var(--rail-muted); display: flex; justify-content: space-between; }
.bar { height: 6px; background: var(--rail-line); border-radius: 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--cyan); transform-origin: left; transition: transform 500ms var(--ease); }
.nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav button {
  width: 100%; text-align: left; background: transparent; border: 0; border-radius: var(--r-ctl); cursor: pointer;
  padding: 10px 12px; display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  color: var(--rail-text); font-size: 14.5px; line-height: 1.3; transition: background 160ms var(--ease), color 160ms var(--ease);
}
.nav button:hover { background: var(--rail-hover); color: #fff; }
.nav button[aria-current="step"] { background: var(--rail-active); color: #fff; font-weight: 700; }
.nav .cnt { font-size: 12.5px; color: var(--rail-muted); white-space: nowrap; }
.nav .cnt.done { color: var(--cyan); font-weight: 700; }
.rail-foot { margin-top: auto; padding: 0 6px; font-size: 12.5px; color: var(--rail-muted); line-height: 1.5; }
.save { color: var(--rail-text); }
.save.err { color: #FF8095; }

.stage { min-width: 0; padding: 48px clamp(20px, 5vw, 72px) 96px; }
.stage-in { max-width: 880px; margin: 0 auto; display: grid; gap: 36px; }
.topbar { display: none; }

/* ── Заголовки раздела ──────────────────────────────────────────────────── */
.s-head { display: grid; gap: 14px; }
.s-head h1 {
  font-family: var(--font-display); font-weight: 400; font-size: clamp(34px, 5.4vw, 58px); line-height: 1.04;
  letter-spacing: -0.01em; text-wrap: balance;
}
.lead { font-size: 19px; color: var(--text-2); }
.enter { animation: enter 460ms var(--ease) both; }
@keyframes enter { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.enter:nth-child(2) { animation-delay: 60ms; }
.enter:nth-child(3) { animation-delay: 110ms; }
.enter:nth-child(4) { animation-delay: 160ms; }

/* ── Блоки пояснений ────────────────────────────────────────────────────── */
.blocks { display: grid; gap: 22px; }
.p { font-size: 17px; color: var(--text); }
.p b, .list b, .note b, .opt-desc b { font-weight: 800; }
.list { margin: 0; padding-left: 22px; display: grid; gap: 10px; font-size: 17px; }
.note { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px 20px; color: var(--text-2); }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 15.5px; }
th, td { padding: 12px 18px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { font-size: 12.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-3); background: var(--surface-2); font-weight: 800; }
tr:last-child td { border-bottom: 0; }
td.pct { font-weight: 800; white-space: nowrap; }
td.rate-note { color: var(--text-2); }
.tbl-note { padding: 12px 18px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 14px; text-align: justify; }

/* ── Живые блоки (калькуляторы) ─────────────────────────────────────────── */
.widget { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-card); overflow: hidden; }
.w-head { padding: 14px 22px; background: var(--ink); color: #fff; font-family: var(--font-head); font-weight: 700; font-size: 15px; }
@media (prefers-color-scheme: dark) { .w-head { background: #12303B; } }
.w-body { padding: 22px; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 26px; align-items: start; }
.w-controls { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 13.5px; color: var(--text-3); font-weight: 600; }
.input, .select, .textarea {
  width: 100%; background: var(--surface); border: 1.5px solid var(--line-2); border-radius: var(--r-ctl); padding: 10px 14px; min-height: 44px;
  transition: border-color 140ms var(--ease);
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--accent-fg); outline-offset: 1px; border-color: var(--accent-fg); }
.textarea { resize: vertical; min-height: 88px; line-height: 1.5; }
.suffix { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.suffix em { font-style: normal; color: var(--text-3); font-weight: 700; }
input[type="range"] { width: 100%; accent-color: var(--accent-fg); min-height: 32px; }
.range-val { font-weight: 800; font-size: 15px; }
.seg { display: inline-grid; grid-auto-flow: column; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-ctl); }
.seg button {
  border: 0; background: transparent; border-radius: 8px; padding: 9px 14px; cursor: pointer; font-weight: 700; font-size: 14.5px; color: var(--text-2);
  min-height: 40px; transition: background 140ms var(--ease), color 140ms var(--ease);
}
.seg button:hover { background: var(--line); }
.seg button[aria-pressed="true"] { background: var(--cyan); color: var(--on-accent); }
.w-out { display: grid; gap: 14px; align-content: start; }
.calc-row { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 16px; }
.calc-row:last-child { border-bottom: 0; }
.calc-row span { color: var(--text-2); }
.calc-row b { font-weight: 800; white-space: nowrap; }
.big { background: var(--ink); color: #fff; border-radius: var(--r-card); padding: 20px 22px; display: grid; gap: 4px; }
@media (prefers-color-scheme: dark) { .big { background: #12303B; } }
.big small { font-size: 13.5px; color: #B5C4CC; font-weight: 600; }
.big strong { font-size: clamp(34px, 5vw, 46px); line-height: 1.05; font-weight: 800; letter-spacing: -0.02em; }
.big strong i { font-style: normal; color: var(--cyan); }
.how { color: var(--text-3); font-size: 14.5px; line-height: 1.55; text-align: justify; }
.w-note { color: var(--text-3); font-size: 13.5px; }
.w-full { grid-column: 1 / -1; }
.w-body.single { grid-template-columns: minmax(0, 1fr); }
.w-controls.row3 { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 18px; }
.w-body.single .cmp, .w-body.single .how { margin: 0; }

.ladder { display: grid; gap: 10px; }
.bars { display: grid; grid-template-columns: repeat(15, minmax(0, 1fr)); gap: 3px; height: 140px; align-items: end; border-bottom: 2px solid var(--line-2); padding-top: 6px; }
.bars span { display: block; height: 100%; background: var(--cyan); border-radius: 3px 3px 0 0; transform-origin: bottom; transform: scaleY(0); transition: transform 420ms var(--ease), opacity 240ms var(--ease); }
.bars span.zero { background: var(--line-2); }
.bars span.off { opacity: 0; }
.bar-axis { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-3); }
.cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cmp > div { border: 1px solid var(--line-2); border-radius: var(--r-ctl); padding: 14px 16px; display: grid; gap: 2px; background: var(--surface-2); }
.cmp > div[data-on="true"] { border: 2px solid var(--accent-fg); background: var(--select); padding: 13px 15px; }
.cmp small { font-size: 13px; color: var(--text-3); font-weight: 700; }
.cmp strong { font-size: 22px; font-weight: 800; }
.cmp span { font-size: 13.5px; color: var(--text-2); }

/* ── Вопросы ────────────────────────────────────────────────────────────── */
.qs { display: grid; gap: 22px; }
.qs-title { font-family: var(--font-head); font-size: 14px; font-weight: 700; color: var(--text-3); letter-spacing: 0.04em; text-transform: uppercase; }
.q { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-card); padding: 24px; display: grid; gap: 16px; }
.q[data-done="true"] { border-color: var(--cyan); }
.q-top { display: flex; justify-content: space-between; gap: 18px; align-items: start; }
.q-title { font-family: var(--font-head); font-weight: 700; font-size: 19px; line-height: 1.35; text-wrap: balance; }
.q-state { font-size: 13px; font-weight: 800; white-space: nowrap; padding: 4px 10px; border-radius: 8px; background: var(--surface-2); color: var(--text-3); border: 1px solid var(--line); }
.q[data-done="true"] .q-state { background: var(--cyan); color: var(--on-accent); border-color: var(--cyan); }
.q-hint { color: var(--text-2); font-size: 15.5px; }
.q-current { color: var(--text-3); font-size: 14.5px; background: var(--surface-2); border-radius: var(--r-ctl); padding: 10px 14px; }
.q-current b { color: var(--text-2); }
.opts { display: grid; gap: 10px; }
.opt {
  position: relative; display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 14px; padding: 16px 18px; cursor: pointer;
  border: 1.5px solid var(--line-2); border-radius: var(--r-ctl); background: var(--surface);
  transition: border-color 140ms var(--ease), background 140ms var(--ease), transform 140ms var(--ease);
}
.opt:hover { border-color: var(--text-3); }
.opt:active { transform: scale(0.995); }
.opt:has(input:checked) { border: 2px solid var(--accent-fg); background: var(--select); padding: 15.5px 17.5px; }
.opt:has(input:focus-visible) { outline: 2px solid var(--accent-fg); outline-offset: 2px; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.radio { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); background: var(--surface); margin-top: 2px; display: grid; place-items: center; transition: border-color 140ms var(--ease); }
.opt:has(input:checked) .radio { border-color: var(--accent-fg); }
.radio::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent-fg); transform: scale(0); transition: transform 200ms var(--ease); }
.opt:has(input:checked) .radio::after { transform: scale(1); }
.opt-body { display: grid; gap: 4px; min-width: 0; }
.opt-title { font-weight: 800; font-size: 16.5px; line-height: 1.35; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.opt-desc { color: var(--text-2); font-size: 15px; line-height: 1.5; }
.tag { font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 6px; background: var(--yellow); color: var(--ink); letter-spacing: 0.02em; }
.opt-extra { margin-top: 10px; display: grid; gap: 8px; }
.opt-extra[hidden] { display: none; }
.link-btn { background: none; border: 0; padding: 6px 0; color: var(--accent-fg); font-weight: 700; cursor: pointer; justify-self: start; font-size: 14.5px; min-height: 36px; }
.link-btn:hover { text-decoration: underline; }

.conf { display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--r-ctl); overflow: hidden; }
.conf-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; padding: 16px 18px; align-items: center; border-bottom: 1px solid var(--line); }
.conf-row:last-child { border-bottom: 0; }
.conf-row .t { font-size: 15.5px; text-align: justify; hyphens: auto; }
.conf-row[data-ok="true"] { background: var(--select); }
.conf-row[data-ok="false"] { background: var(--bad-bg); }
.conf-row .why { grid-column: 1 / -1; }
.conf-row .why[hidden] { display: none; }
.seg.yn button[aria-pressed="true"][data-v="no"] { background: var(--red); color: #fff; }

/* ── Кнопки и навигация ─────────────────────────────────────────────────── */
.btn {
  border: 1.5px solid var(--line-2); background: var(--surface); border-radius: var(--r-ctl); padding: 12px 22px; font-weight: 800; cursor: pointer;
  min-height: 48px; font-size: 16px; white-space: nowrap; transition: background 140ms var(--ease), transform 140ms var(--ease), border-color 140ms var(--ease);
}
.btn:hover { border-color: var(--text-3); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn.primary { background: var(--cyan); border-color: var(--cyan); color: var(--on-accent); }
.btn.primary:hover { background: #13A6BC; border-color: #13A6BC; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.pager { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.submit-card { background: var(--ink); color: #fff; border-radius: var(--r-card); padding: 28px; display: grid; gap: 14px; }
@media (prefers-color-scheme: dark) { .submit-card { background: #12303B; } }
.submit-card h2 { font-family: var(--font-head); font-size: 22px; font-weight: 700; }
.submit-card p { color: #C9D6DC; text-align: justify; hyphens: auto; }
.submit-card ul { margin: 0; padding-left: 20px; color: #C9D6DC; display: grid; gap: 4px; }
.submit-card a { color: var(--cyan); cursor: pointer; text-decoration: underline; }
.submit-card .btn { justify-self: start; }

/* ── Вступление и экран «Спасибо» ───────────────────────────────────────── */
.intro { display: grid; gap: 28px; align-content: start; min-height: 60vh; }
.intro h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(40px, 7vw, 76px); line-height: 1; letter-spacing: -0.015em; text-wrap: balance; }
.lead-intro { font-size: 20px; color: var(--text-2); }
.intro-points { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.intro-points li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px 20px; font-size: 16.5px; }
.intro-who { color: var(--text-3); font-size: 14.5px; }
.state { max-width: 640px; margin: 18vh auto; padding: 0 22px; display: grid; gap: 14px; }
.state h1 { font-family: var(--font-display); font-weight: 400; font-size: 40px; line-height: 1.05; }
.state p { color: var(--text-2); text-align: justify; hyphens: auto; }
.skel { height: 18px; border-radius: 8px; background: linear-gradient(90deg, var(--line) 0%, var(--surface-2) 50%, var(--line) 100%); background-size: 200% 100%; animation: sh 1.2s linear infinite; }
@keyframes sh { to { background-position: -200% 0; } }

/* ── Телефон и планшет ──────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .rail { display: none; }
  .topbar { display: grid; gap: 10px; position: sticky; top: 0; z-index: 5; background: var(--rail); padding: 12px 16px 14px; }
  .topbar .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .topbar img { width: 104px; height: auto; display: block; }
  .topbar select { background: var(--rail-active); color: #fff; border: 0; border-radius: var(--r-ctl); padding: 10px 12px; min-height: 44px; max-width: 62vw; }
  .stage { padding: 28px 16px 72px; }
  .w-body { grid-template-columns: 1fr; padding: 18px; }
  .w-controls.row3 { grid-template-columns: 1fr; }
  .q { padding: 18px; }
  .q-top { flex-direction: column; gap: 8px; }
  .cmp { grid-template-columns: 1fr; }
  .conf-row { grid-template-columns: 1fr; }
  .lead { font-size: 17.5px; }
}
@media (max-width: 420px) {
  .opt { grid-template-columns: 20px minmax(0, 1fr); gap: 12px; padding: 14px; }
  .opt:has(input:checked) { padding: 13.5px; }
  .bars { gap: 1px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.logo-dark { display: none; }
@media (prefers-color-scheme: dark) { .logo-light { display: none; } .logo-dark { display: block; } }
