/*
 * Дизайн квиза v2 (ТЗ раздел 4).
 *
 * Токены взяты из работающего v1 — это не «похожий стиль», а тот же
 * самый: семья, которая видела рекламу и лендинг, должна узнать школу.
 *
 * Акцент задаётся веткой через body[data-age]. Отдельных тем нет: цвет
 * меняется в четырёх переменных, а вся вёрстка на них и опирается. На
 * жёлтом фоне текст тёмный, на фиолетовом и зелёном — белый; это не вкус,
 * а контраст, иначе на телефоне под солнцем кнопку не прочитать.
 *
 * Mobile-first: основной трафик из Instagram. Всё проверяется на 360px.
 */

:root {
  --bg: #FAF7F1;
  --card: #FFFFFF;
  --ink: #2B2B40;
  --muted: #8A8AA0;
  --line: #EDE8DE;
  --violet: #6247EA;
  --violet-deep: #4B34C7;
  --violet-soft: #EFEBFF;
  --coral: #FF7A6B;
  --gold: #FFC24B;
  --gold-deep: #E3A52E;
  --mint: #3FBF7F;
  --r: 20px;

  /* Акцент по умолчанию — фиолетовый, как в v1 */
  --acc: var(--violet);
  --acc-deep: var(--violet-deep);
  --acc-soft: var(--violet-soft);
  --on-acc: #FFFFFF;
}

body[data-age="kids"] {
  --acc: var(--gold);
  --acc-deep: var(--gold-deep);
  --acc-soft: #FFF4DC;
  /* На жёлтом белый текст не читается — здесь тёмный */
  --on-acc: var(--ink);
}
body[data-age="mid"] {
  --acc: var(--violet);
  --acc-deep: var(--violet-deep);
  --acc-soft: var(--violet-soft);
  --on-acc: #FFFFFF;
}
body[data-age="teen"] {
  --acc: #2E9E66;
  --acc-deep: #1F7A4D;
  --acc-soft: #E4F5EC;
  --on-acc: #FFFFFF;
}

* { box-sizing: border-box }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Nunito', system-ui, -apple-system, sans-serif;
  font-weight: 600;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.wrap { max-width: 500px; margin: 0 auto; padding: 16px 16px 40px }

.screen { display: none }
.screen.on { display: block }

h1 { font-size: 26px; font-weight: 900; line-height: 1.2; margin: 0 0 8px; text-wrap: balance }
h2 { font-size: 20px; font-weight: 800; margin: 0 0 10px }
h3 { font-size: 17px; font-weight: 800; margin: 0 0 6px }
p { margin: 0 0 12px }
.muted { color: var(--muted); font-size: 14px; font-weight: 600 }
.small { font-size: 13px }

/* ── Кнопки: узнаваемая «объёмная» форма из v1 ───────────────────────── */
.btn {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 17px;
  font-weight: 800;
  padding: 15px 18px;
  border: 0;
  border-radius: 16px;
  background: var(--acc);
  color: var(--on-acc);
  box-shadow: 0 5px 0 var(--acc-deep);
  cursor: pointer;
  transition: transform .06s, box-shadow .06s;
}
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--acc-deep) }
.btn:disabled { opacity: .45; cursor: not-allowed }
.btn.ghost {
  background: var(--card);
  color: var(--ink);
  border: 2px solid var(--line);
  box-shadow: 0 5px 0 var(--line);
}
.btn.link {
  background: none; box-shadow: none; border: 0;
  color: var(--muted); font-size: 14px; font-weight: 700;
  padding: 10px; text-decoration: underline; width: auto; margin: 0 auto;
}

:focus-visible { outline: 3px solid var(--acc-deep); outline-offset: 2px }

/* ── Карточки ────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--r);
  box-shadow: 0 5px 0 var(--line);
  padding: 16px;
  margin: 0 0 14px;
}

/* ── Старт ───────────────────────────────────────────────────────────── */
.logo { display: block; width: 150px; height: auto; margin: 4px auto 18px }
.facts { display: flex; gap: 8px; margin: 0 0 18px; flex-wrap: wrap }
.fact {
  flex: 1 1 0; min-width: 96px; text-align: center;
  background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 10px 6px;
}
.fact b { display: block; font-size: 19px; font-weight: 900 }
.fact span { font-size: 12px; color: var(--muted) }

.age-card {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  font: inherit; cursor: pointer;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--r);
  box-shadow: 0 5px 0 var(--line); padding: 14px; margin: 0 0 12px;
  transition: transform .06s, box-shadow .06s;
}
.age-card:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--line) }
.age-tile {
  flex: none; width: 56px; height: 56px; border-radius: 16px;
  display: grid; place-items: center; font-size: 28px;
}
/*
 * Три строки, а не одна фраза.
 *
 * Это вложенные span внутри span, то есть по умолчанию строчные: без
 * display:block «6–10 лет», «Карта талантов» и «Отвечает родитель»
 * сливались в сплошной текст, и карточка переставала читаться.
 */
.age-card .r, .age-card .n, .age-card .w { display: block }
.age-card .r { font-size: 13px; font-weight: 800; color: var(--muted) }
.age-card .n { font-size: 18px; font-weight: 900; line-height: 1.2 }
.age-card .w { font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 2px }

/* ── Поля ────────────────────────────────────────────────────────────── */
label { display: block; font-size: 14px; font-weight: 800; margin: 0 0 6px }
input[type="text"], input[type="tel"] {
  width: 100%; font: inherit; font-size: 17px; padding: 13px 14px;
  border: 2px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink);
}
input:focus { border-color: var(--acc); outline: none }

.chips { display: flex; flex-wrap: wrap; gap: 8px }
.chip {
  font: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
  padding: 10px 14px; border-radius: 999px;
  border: 2px solid var(--line); background: var(--card); color: var(--ink);
}
.chip[aria-pressed="true"] { background: var(--acc-soft); border-color: var(--acc); color: var(--ink) }

/* ── Прогресс ────────────────────────────────────────────────────────── */
.top { display: flex; align-items: center; gap: 10px; margin: 0 0 6px }
.bar { flex: 1; height: 14px; border-radius: 999px; background: var(--line); overflow: hidden }
.bar i { display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--acc), var(--acc-deep)); transition: width .25s }
.count { font-size: 13px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums }
.sect { font-size: 13px; font-weight: 800; color: var(--muted); margin: 0 0 12px }

/* ── Вопрос ──────────────────────────────────────────────────────────── */
.q {
  background: var(--card); border: 2px solid var(--line); border-radius: 24px;
  box-shadow: 0 5px 0 var(--line); padding: 18px; margin: 0 0 14px;
}
.q .ico { font-size: 34px; display: block; margin: 0 0 8px }
.q .txt { font-size: 18px; font-weight: 800; line-height: 1.35 }

.opts { display: grid; gap: 10px }
.opt {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  font: inherit; font-size: 16px; font-weight: 700; cursor: pointer;
  background: var(--card); border: 2px solid var(--line); border-radius: 18px;
  box-shadow: 0 5px 0 var(--line); padding: 13px 14px;
  transition: transform .06s, box-shadow .06s, background .1s;
}
.opt:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--line) }
.opt .num {
  flex: none; width: 28px; height: 28px; border-radius: 9px;
  display: grid; place-items: center; font-size: 14px; font-weight: 900;
  background: var(--acc-soft); color: var(--acc-deep);
}
.opt[aria-pressed="true"] { background: var(--acc-soft); border-color: var(--acc) }
.opt[aria-pressed="true"] .num { background: var(--acc); color: var(--on-acc) }

/* ── Пары картинок и ценностей ───────────────────────────────────────── */
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px }
.pair .opt { flex-direction: column; text-align: center; gap: 8px; padding: 18px 12px }
.pair .emoji { font-size: 64px; line-height: 1 }
.pair .cap { font-size: 15px; font-weight: 800 }
.say {
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
  background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 4px;
}

/* ── Игра ────────────────────────────────────────────────────────────── */
.seq { font-size: 34px; letter-spacing: 6px; text-align: center; margin: 10px 0 16px }
.game-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px }
.game-opts .opt { justify-content: center; font-size: 26px; padding: 18px 8px }

/* ── Результат ───────────────────────────────────────────────────────── */
.tcard { border-left: 6px solid var(--acc) }
.tcard .h { display: flex; align-items: center; gap: 10px; margin: 0 0 8px }
.tcard .e { font-size: 30px }
.tcard .n { font-size: 18px; font-weight: 900 }
.lvl { font-size: 13px; font-weight: 800; color: var(--acc-deep) }
.mark { font-size: 12px; font-weight: 800; color: var(--mint) }
.mark.pre { color: var(--muted) }

.map { display: grid; gap: 8px }
.row { display: grid; grid-template-columns: 26px 1fr 84px; gap: 8px; align-items: center; font-size: 14px }
.row .t { height: 12px; border-radius: 999px; background: var(--line); overflow: hidden }
.row .t i { display: block; height: 100%; background: var(--acc); border-radius: 999px }
.row .w { font-size: 12px; color: var(--muted); font-weight: 700; text-align: right }

.note { background: var(--acc-soft); border-radius: 14px; padding: 12px 14px; font-size: 14px }
.curator { background: #2B2B40; color: #fff; border-radius: var(--r); padding: 18px; margin: 0 0 14px }
.curator h3 { color: #fff }
.curator p { color: #D8D8E4; font-size: 14px; margin: 0 }

.disclaimer { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 18px 0 0 }

/* ── Разное ──────────────────────────────────────────────────────────── */
.pill {
  display: inline-block; font-size: 13px; font-weight: 800;
  background: var(--acc-soft); color: var(--acc-deep);
  border-radius: 999px; padding: 5px 12px; margin: 0 0 12px;
}
.err { color: var(--coral); font-size: 13px; font-weight: 800; margin: 6px 0 0 }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important }
  .btn:active, .opt:active, .age-card:active { transform: none }
}

@media (max-width: 360px) {
  .wrap { padding: 12px 12px 32px }
  h1 { font-size: 23px }
  .pair .emoji { font-size: 52px }
  .row { grid-template-columns: 24px 1fr 70px }
}
