/* Визуальный язык взят из MTA Prüfungstrainer (feuerwehr-lernbar); карточки, точечная сетка и игры — из панели touchflow. */
:root {
  --primary: #C8102E; --primary-dark: #9B0B22; --primary-light: #FDE8EC;
  --surface: #FFFFFF; --bg: #F4F5F7;
  --text: #1A1D23; --text-2: #5F6368; --muted: #9AA0A6;
  --ok: #0F7B3F; --ok-bg: #E6F4EA; --bad: #C8102E; --bad-bg: #FDE8EC;
  --warn: #D4890A; --warn-bg: #FEF3CD;
  --selected: #E3E8F0; --selected-border: #6B7B8D;
  --border: rgba(0,0,0,.08); --border-strong: rgba(0,0,0,.15);
  --glass: rgba(255,255,255,.72); --glass-border: rgba(255,255,255,.5);
  --r: 18px; --r-md: 12px;
  --fast: 150ms ease-out; --normal: 250ms ease-out;
  --dot: rgba(26,29,35,.16); --line: var(--border-strong); --ink: var(--text); --purple: var(--primary);
  --dots: radial-gradient(circle, var(--dot) .75px, transparent 1.25px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #E8364D; --primary-dark: #C8102E; --primary-light: #3D1520;
    --surface: #1E1E2E; --bg: #11111B;
    --text: #CDD6F4; --text-2: #A6ADC8; --muted: #6C7086;
    --ok: #40C057; --ok-bg: #1A2E1A; --bad: #E8364D; --bad-bg: #3D1520;
    --warn: #E8A830; --warn-bg: #3D3015;
    --selected: #2A2B3D; --selected-border: #7C8DB5;
    --border: rgba(255,255,255,.06); --border-strong: rgba(255,255,255,.12);
    --glass: rgba(30,30,46,.78); --glass-border: rgba(255,255,255,.08);
    --dot: rgba(205,214,244,.16);
  }
}
:root[data-theme="dark"] {
    --primary: #E8364D; --primary-dark: #C8102E; --primary-light: #3D1520;
    --surface: #1E1E2E; --bg: #11111B;
    --text: #CDD6F4; --text-2: #A6ADC8; --muted: #6C7086;
    --ok: #40C057; --ok-bg: #1A2E1A; --bad: #E8364D; --bad-bg: #3D1520;
    --warn: #E8A830; --warn-bg: #3D3015;
    --selected: #2A2B3D; --selected-border: #7C8DB5;
    --border: rgba(255,255,255,.06); --border-strong: rgba(255,255,255,.12);
    --glass: rgba(30,30,46,.78); --glass-border: rgba(255,255,255,.08);
    --dot: rgba(205,214,244,.16);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; }
body { font-family: -apple-system, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif; font-size: 16px; line-height: 1.5;
  color: var(--text); background: var(--bg); min-height: 100dvh; overflow-x: hidden; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .3; cursor: default; }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { line-height: 1.2; }
#app { max-width: 480px; margin: 0 auto; padding: 16px; padding-top: max(16px, env(safe-area-inset-top)); padding-bottom: 60px; min-height: 100dvh; }
.screen { animation: enter var(--normal) both; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- шапка экрана ---------- */
.bar-top { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.back { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; font-size: 22px; color: var(--muted); flex-shrink: 0; margin-left: -10px; }
.back:active { color: var(--text); }
.screen-title { font-size: 28px; font-weight: 700; flex: 1; }

/* ---------- главная ---------- */
.home-header { text-align: center; padding: 4px 0 16px; }
/* земля и язык справа вверху — подсвеченные значки */
.home-top { display: flex; align-items: center; justify-content: space-between; min-height: 48px; margin-bottom: 4px; }
/* земля и язык: один блок из двух половин под заголовком */
.ctx { display: flex; margin: 20px 0 0; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 18px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 20px rgba(0,0,0,.06); overflow: hidden; }
/* флаги: круглые, с тонкой обводкой */
.ctx-flag, .sheet-flag { flex-shrink: 0; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1px var(--border-strong), 0 2px 6px rgba(0,0,0,.12); }
.ctx-flag { width: 30px; height: 30px; }
.sheet-flag { width: 34px; height: 34px; }
.flag-code { display: flex; align-items: center; justify-content: center; background: var(--selected); font-size: 12px; font-weight: 700; }
.card-title, .card-desc, .card-badge, .screen-title, .sheet-sub, .ready-hint, .ready-label, .home-sub, .lab span, .list-name { unicode-bidi: plaintext; }
.ctx-half { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 12px; text-align: left; }
.ctx-half + .ctx-half { border-left: 1px solid var(--border-strong); }
.ctx-half:active { background: var(--selected); }
@media (hover: hover) { .ctx-half:hover { background: var(--selected); } }
.ctx-ico { width: 30px; height: 34px; object-fit: contain; flex-shrink: 0; }
.ctx-svg { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 10px; background: var(--primary-light); color: var(--primary); }
.ctx-svg svg { width: 22px; height: 22px; }
.ctx-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.ctx-txt small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ctx-txt b { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx-chev { margin-left: auto; font-size: 20px; color: var(--muted); }
.theme-btn { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.theme-btn svg { width: 22px; height: 22px; transition: transform 500ms var(--spring, ease); }
.theme-btn:active svg { transform: rotate(40deg) scale(.9); }
.home-icon { width: 120px; height: 120px; margin: 0 auto 8px; object-fit: contain; }
.home-title { font-size: 28px; font-weight: 700; margin-bottom: 4px; }
.home-sub { font-size: 14px; color: var(--text-2); }
.home-region { display: inline-block; margin-top: 6px; font-size: 14px; color: var(--text-2); text-decoration: underline; text-underline-offset: 2px; }
.section-label { font-size: 14px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin: 24px 0 4px; }
.cards { display: flex; flex-direction: column; gap: 14px; }
.card { position: relative; isolation: isolate; overflow: hidden; display: flex; align-items: flex-start; width: 100%; min-height: 112px;
  padding: 20px 80px 20px 22px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r); text-align: left; box-shadow: 0 1px 2px rgba(0,0,0,.04);
  transition: transform var(--fast), box-shadow var(--fast), border-color var(--fast); }
.card::after { content: ""; position: absolute; right: -50px; bottom: -50px; width: 160px; height: 130px; border-radius: 50%; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, rgba(var(--ic, 200,190,255), .42), rgba(var(--ic, 200,190,255), .14) 55%, rgba(var(--ic, 200,190,255), 0)); }
/* светлая тема (Сергей DM 9430: угол «грязный»): свечение шире и мягче, без плотного пятна у края */
.card::after { right: -110px; bottom: -120px; width: 300px; height: 260px;
  background: radial-gradient(closest-side, rgba(var(--ic, 200,190,255), .26), rgba(var(--ic, 200,190,255), .10) 50%, rgba(var(--ic, 200,190,255), 0)); }
:root[data-theme="dark"] .card::after { right: -50px; bottom: -50px; width: 160px; height: 130px;
  background: radial-gradient(closest-side, rgba(var(--ic, 200,190,255), .42), rgba(var(--ic, 200,190,255), .14) 55%, rgba(var(--ic, 200,190,255), 0)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .card::after { right: -50px; bottom: -50px; width: 160px; height: 130px;
  background: radial-gradient(closest-side, rgba(var(--ic, 200,190,255), .42), rgba(var(--ic, 200,190,255), .14) 55%, rgba(var(--ic, 200,190,255), 0)); } }
button.card:active { transform: scale(.98); }
@media (hover: hover) { button.card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.08); border-color: rgba(var(--ic), .7); }
  button.card:hover .card-img { transform: rotate(-4deg) scale(1.06); } }
.card-img { position: absolute; right: 12px; bottom: 10px; width: 60px; height: 60px; object-fit: contain; pointer-events: none;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.12)); transition: transform var(--normal); }
.card-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.card-title { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.card-badge { font-size: 14px; font-weight: 600; color: var(--text-2); }
.card-desc { font-size: 15px; color: var(--text-2); }
.card-reset { font-size: 14px; color: var(--muted); text-decoration: underline; text-underline-offset: 2px; align-self: flex-end; padding: 0 8px; }
.card-wrap { display: flex; flex-direction: column; gap: 4px; }

/* готовность */
.ready { display: block; padding: 20px 22px 20px; }
.ready .card-img { width: 52px; height: 52px; right: 12px; bottom: 10px; }
.ready-hint { padding-right: 48px; }
.ready-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ready-label { font-size: 18px; font-weight: 700; }
.ready-pill { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.ready-pill.ok { color: var(--ok); background: var(--ok-bg); }
.ready-pill.warn { color: var(--warn); background: var(--warn-bg); }
.ready-pill.no { color: var(--text-2); background: var(--bg); }
.ready-rows { margin-top: 12px; display: grid; gap: 10px; }
.ready-row { font-size: 14px; color: var(--text-2); }
.ready-row .lab { display: flex; justify-content: space-between; margin-bottom: 4px; }
.meter { height: 6px; background: var(--border-strong); border-radius: 3px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--ok); border-radius: 3px; transition: width var(--normal); }
.exam-dots { display: flex; gap: 6px; }
.exam-dots span { width: 26px; height: 8px; border-radius: 4px; background: var(--border-strong); }
.exam-dots .p { background: var(--ok); } .exam-dots .f { background: var(--bad); }
.ready-hint { margin-top: 12px; font-size: 14px; color: var(--text-2); }

/* источник */
.footer { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-top: 32px; padding: 16px 0;
  font-size: 12px; color: var(--muted); text-align: center; line-height: 1.4; }
.footer a, .link { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.verified { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ok); background: var(--ok-bg);
  padding: 4px 10px; border-radius: 999px; margin-bottom: 6px; }

/* ---------- списки (темы, земли) ---------- */
.list { display: flex; flex-direction: column; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; width: 100%; padding: 16px 24px; background: var(--surface); text-align: left; }
.list-row:active { background: var(--selected); }
.list-row.sel { background: var(--selected); }
.list-name { flex: 1; font-weight: 500; }
.list-count { font-size: 14px; color: var(--muted); white-space: nowrap; }
.list-count .c { color: var(--ok); }

/* ---------- вопрос ---------- */
.quiz { display: flex; flex-direction: column; min-height: calc(100dvh - 76px); }
.quiz-top { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.quiz-close { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; font-size: 22px; color: var(--muted); flex-shrink: 0; margin-left: -10px; }
.quiz-close:active { color: var(--text); }
.quiz-progress { flex: 1; }
.progress-label { font-size: 14px; font-weight: 500; color: var(--text-2); margin-bottom: 4px; }
.progress-bar { width: 100%; height: 4px; background: var(--border); overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); transition: width var(--normal); }
.timer { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-2); min-width: 60px; text-align: right; }
.timer.warn { color: var(--primary); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.qcard { flex: 1; margin-bottom: 24px; animation: slide 250ms ease-out both; }
.qcard.back-anim { animation-name: slide-back; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slide-back { from { transform: translateX(-40px); opacity: 0; } to { transform: none; opacity: 1; } }
.topic-badge { display: block; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.qref { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.question { font-size: 18px; font-weight: 500; line-height: 1.5; margin-bottom: 24px; word-break: break-word; }
.question img { max-width: 100%; margin: 12px auto 0; border-radius: var(--r-md); background: #fff; }
.options { display: flex; flex-direction: column; gap: 8px; }
.opt { display: flex; align-items: center; gap: 16px; width: 100%; padding: 16px 24px; min-height: 56px; background: var(--surface);
  border: 2px solid var(--border); border-radius: var(--r); text-align: left; transition: all var(--fast); }
.opt:active { transform: scale(.96); background: var(--selected); }
.opt.sel { border-color: var(--text-2); background: var(--selected); }
.opt.ok { border-color: var(--ok); background: var(--ok-bg); }
.opt.bad { border-color: var(--bad); background: var(--bad-bg); }
.opt-letter { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--r);
  background: var(--bg); font-weight: 600; font-size: 14px; flex-shrink: 0; transition: all var(--fast); }
.opt.sel .opt-letter { background: var(--text-2); color: #fff; }
.opt.ok .opt-letter { background: var(--ok); color: #fff; }
.opt.bad .opt-letter { background: var(--bad); color: #fff; }
.opt-text { flex: 1; line-height: 1.4; }
.opt-text img { max-width: 140px; border-radius: 8px; background: #fff; }
.feedback { margin-top: 16px; font-weight: 700; font-size: 18px; }
.feedback.ok { color: var(--ok); } .feedback.bad { color: var(--bad); }

/* плавающая панель */
.nav { position: sticky; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); display: flex; align-items: center; gap: 8px; padding: 8px;
  margin: auto 0 0; border-radius: 100px; background: var(--glass); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-border); box-shadow: 0 8px 32px rgba(0,0,0,.1), 0 2px 8px rgba(0,0,0,.06); }
.nav-arrow { width: 44px; height: 44px; font-size: 20px; color: var(--text); background: var(--bg); border-radius: 50%; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0; transition: background var(--fast), transform var(--fast), opacity var(--fast); line-height: 1; }
.nav-arrow:active:not(:disabled) { transform: scale(.92); background: var(--primary); color: #fff; }
.nav-arrow:disabled { opacity: .25; }
.nav-arrow.go { background: var(--primary); color: #fff; }
.nav-center { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.dots { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; }
.dot { width: 10px; height: 10px; border-radius: 2px; background: var(--border-strong); padding: 0; transition: all var(--fast); }
.dot.done { background: var(--muted); }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); }
.dot.cur { background: var(--primary); transform: scale(1.3); }
.nav-link { font-size: 12px; color: var(--text-2); text-decoration: underline; text-underline-offset: 2px; }
.nav-status { font-size: 14px; font-weight: 600; color: var(--text-2); }
.toggle { display: flex; align-items: center; gap: 6px; font-size: 12px; user-select: none; }
.toggle-track { position: relative; width: 34px; height: 20px; background: var(--border-strong); border-radius: 10px; transition: background var(--fast); }
.toggle-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform var(--fast); }
.toggle.on .toggle-track { background: var(--primary); }
.toggle.on .toggle-track::after { transform: translateX(14px); }

/* ---------- результат ---------- */
.results { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 32px; }
.score { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 160px; height: 160px; border-radius: 50%;
  border: 4px solid var(--border); margin-bottom: 24px; }
.score.p { border-color: var(--ok); } .score.f { border-color: var(--bad); }
.score-num { font-size: 36px; font-weight: 700; line-height: 1; }
.score-total { color: var(--text-2); }
.score-pct { font-size: 18px; font-weight: 600; color: var(--text-2); margin-top: 4px; }
.verdict { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.verdict.p { color: var(--ok); } .verdict.f { color: var(--bad); }
.needed { font-size: 14px; color: var(--text-2); margin-bottom: 24px; }
.stats { display: flex; gap: 32px; margin-bottom: 32px; }
.stat-v { font-size: 22px; font-weight: 700; }
.stat-l { font-size: 14px; color: var(--text-2); }
.stat-ok .stat-v { color: var(--ok); } .stat-bad .stat-v { color: var(--bad); } .stat-skip .stat-v { color: var(--muted); }
.actions { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 320px; }
.btn { width: 100%; padding: 16px 24px; font-weight: 600; border-radius: var(--r); transition: transform var(--fast); text-align: center; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: var(--surface); border: 1px solid var(--border); }

/* ---------- разбор и каталог ---------- */
.filters { display: flex; gap: 1px; margin-bottom: 24px; background: var(--border); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.filter { flex: 1; padding: 8px 16px; font-size: 14px; font-weight: 500; background: var(--surface); white-space: nowrap; text-align: center; }
.filter.on { background: var(--text); color: var(--surface); }
.rev-list { display: flex; flex-direction: column; gap: 12px; }
.rev { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 20px; }
.rev .question { font-size: 16px; margin-bottom: 12px; }
.rev .opt { padding: 10px 14px; min-height: 0; border-width: 1.5px; }
.rev .opt-letter { width: 26px; height: 26px; font-size: 12px; }
.search { width: 100%; padding: 12px 16px; font: inherit; border-radius: var(--r); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); margin-bottom: 16px; }
.empty { padding: 32px 16px; text-align: center; color: var(--text-2); }
.more { display: block; margin: 16px auto 0; }
.nav-controls { display: flex; align-items: center; gap: 16px; }
.opt-text, .question, .list-name { overflow-wrap: anywhere; hyphens: auto; }
.ready-row .lab span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.tr { display: block; margin-top: 6px; font-size: 15px; font-weight: 400; color: var(--text-2); line-height: 1.4; }
.opt-text .tr { font-size: 14px; margin-top: 2px; }
.tr[dir="auto"]:lang(ar), .tr:dir(rtl) { text-align: right; }
.why { margin-top: 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); font-size: 15px; color: var(--text-2); line-height: 1.45; }
.why b { color: var(--text); }
.why-ref { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); }
.rev .why { background: var(--bg); }
.tr-pick { display: block; margin-top: 8px; font-size: 14px; color: var(--text-2); }
.tr-pick select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; padding: 4px 8px; margin-left: 4px; }

/* ---------- выбор на весь экран (земля, язык) ---------- */
.sheet { min-height: calc(100dvh - 76px); }
.sheet-top { display: flex; align-items: center; gap: 12px; margin: 4px 0 6px; }
.sheet-close { width: 44px; height: 44px; margin-right: -8px; border-radius: 50%; font-size: 20px; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); }
.sheet-sub { font-size: 15px; color: var(--text-2); margin-bottom: 16px; }
.sheet-list { display: flex; flex-direction: column; gap: 8px; }
.sheet-row { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 10px 16px; text-align: left;
  background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: 16px; transition: transform var(--fast), border-color var(--fast); }
.sheet-row:active { transform: scale(.98); }
@media (hover: hover) { .sheet-row:hover { border-color: var(--text); } }
.sheet-row.sel { border-color: var(--text); box-shadow: 0 6px 18px rgba(0,0,0,.10); }
.sheet-ico { width: 40px; height: 46px; object-fit: contain; flex-shrink: 0; filter: drop-shadow(0 2px 3px rgba(0,0,0,.15)); }
.sheet-code { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  background: var(--primary-light); color: var(--primary); font-weight: 800; font-size: 14px; letter-spacing: .04em; }
.sheet-row .list-name { font-size: 17px; font-weight: 600; display: flex; flex-direction: column; }
.sheet-row .list-name small { font-size: 13px; font-weight: 400; color: var(--text-2); }
.sheet-check { font-size: 18px; font-weight: 700; color: var(--text); }
@media (min-width: 700px) { .sheet-list { display: grid; grid-template-columns: 1fr 1fr; } }

/* ---------- фон: точечная сетка, на широком экране — тетрис и крестики-нолики (dotgames.js) ---------- */
html { background-color: var(--bg); }
body { background: transparent; }
/* сетка из точек проявляется сверху вниз: у заголовка её нет, ниже — до полного цвета */
#stage { position: relative; isolation: isolate; min-height: 100dvh; }
#stage::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: var(--dots); background-size: 16px 16px; background-position: 8px 8px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, transparent 80px, #000 720px); mask-image: linear-gradient(to bottom, transparent 0, transparent 80px, #000 720px); }
@media (min-width: 768px) { #app { max-width: 560px; } }
.why .tr { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border-strong); font-size: 14px; }

/* ---------- тема, движение, отклик ---------- */
:root { --spring: cubic-bezier(.34,1.56,.64,1); --ease-out: cubic-bezier(.22,1,.36,1); color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; } }

/* переходы между экранами — View Transitions (Сергей DM 9423: мягче и медленнее).
   Новый снимок плавно ложится поверх старого без провала в фон — пятна и сетка не моргают. */
.vt .screen, .vt .sheet, .vt .qcard { animation: none; }
/* внутри перехода экран едет целиком: лесенки карточек и строк после него читались как мерцание (Сергей DM 9431) */
.vt .sheet-row, .vt .cards .card, .vt .ready, .vt .qcard .opt:not(.pop):not(.shake):not(.tap):not(.ok) { animation: none; }
:root { --vt-d: 520ms; }
::view-transition-group(*) { animation-duration: var(--vt-d); animation-timing-function: var(--ease-out); }
::view-transition-old(root), ::view-transition-new(root) { mix-blend-mode: normal; animation-duration: var(--vt-d); animation-timing-function: var(--ease-out); animation-fill-mode: both; }
::view-transition-old(root) { animation-name: vt-hold; }
::view-transition-new(root) { animation-name: vt-in; }
@keyframes vt-hold { to { transform: scale(.985); } }
@keyframes vt-in { from { opacity: 0; } }
/* вглубь (тренировка, экзамен, список) — новый экран поднимается */
.vt-fwd::view-transition-new(root) { animation-name: vt-rise; }
@keyframes vt-rise { from { opacity: 0; transform: translateY(26px); } }
/* на главную — новый экран чуть «приближается» */
.vt-back::view-transition-new(root) { animation-name: vt-settle; }
@keyframes vt-settle { from { opacity: 0; transform: scale(1.015); } }
/* выбор земли/языка выезжает снизу, при выборе — уезжает вниз, открывая главную */
.vt-up::view-transition-old(root) { animation-name: vt-sink; }
.vt-up::view-transition-new(root) { animation-name: vt-sheet-in; animation-duration: 560ms; }
@keyframes vt-sink { to { transform: scale(.96); } }
@keyframes vt-sheet-in { from { opacity: 0; transform: translateY(70px); } }
.vt-down::view-transition-old(root) { z-index: 2; animation-name: vt-sheet-out; animation-duration: 480ms; }
.vt-down::view-transition-new(root) { z-index: 1; animation-name: vt-under; }
@keyframes vt-sheet-out { to { opacity: 0; transform: translateY(80px); } }
@keyframes vt-under { from { transform: scale(.97); } }
/* следующий вопрос — сдвиг вбок, назад — в другую сторону */
.vt-next::view-transition-old(root) { animation-name: q-out; }
.vt-next::view-transition-new(root) { animation-name: q-in; }
.vt-prev::view-transition-old(root) { animation-name: q-out-r; }
.vt-prev::view-transition-new(root) { animation-name: q-in-r; }
@keyframes q-out { to { transform: translateX(-36px); } }
@keyframes q-in { from { opacity: 0; transform: translateX(44px); } }
@keyframes q-out-r { to { transform: translateX(36px); } }
@keyframes q-in-r { from { opacity: 0; transform: translateX(-44px); } }
.theme-vt::view-transition-old(root), .theme-vt::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
.theme-vt::view-transition-new(root) { animation: theme-reveal 1100ms cubic-bezier(.45,0,.2,1) both; }
@keyframes theme-reveal { from { clip-path: circle(0 at var(--tx, 90%) var(--ty, 40px)); } to { clip-path: circle(150% at var(--tx, 90%) var(--ty, 40px)); } }
/* выбор на весь экран выезжает снизу, строки — лесенкой */
.sheet { animation: sheet-up 380ms var(--ease-out) both; }
@keyframes sheet-up { from { opacity: 0; transform: translateY(40px); } }
.sheet-row { animation: row-in 520ms var(--ease-out) both; }
.sheet-row:nth-child(2) { animation-delay: 45ms } .sheet-row:nth-child(3) { animation-delay: 90ms } .sheet-row:nth-child(4) { animation-delay: 135ms }
.sheet-row:nth-child(5) { animation-delay: 180ms } .sheet-row:nth-child(6) { animation-delay: 225ms } .sheet-row:nth-child(n+7) { animation-delay: 270ms }
@keyframes row-in { from { opacity: 0; transform: translateY(18px); } }
/* карточки главной — лесенкой, нажатие с пружиной */
.cards .card, .ready { animation: row-in 600ms var(--ease-out) both; }
.cards .card:nth-child(2) { animation-delay: 70ms } .cards .card:nth-child(3) { animation-delay: 140ms } .cards .card:nth-child(4) { animation-delay: 210ms }
button.card, .btn, .opt, .sheet-row, .theme-btn, .nav-arrow { transition: transform 260ms var(--spring), background var(--fast), border-color var(--fast), box-shadow var(--fast); }
button.card:active, .sheet-row:active { transform: scale(.97); }
/* варианты ответа появляются по очереди */
.qcard .opt { animation: row-in 480ms var(--ease-out) both; }
.qcard .opt:nth-child(2) { animation-delay: 60ms } .qcard .opt:nth-child(3) { animation-delay: 120ms } .qcard .opt:nth-child(4) { animation-delay: 180ms }
.revealed .opt { animation: none; }
/* верно: вариант подпрыгивает и светится, вокруг — конфетти; неверно — встряска */
.opt.pop { animation: pop 520ms var(--spring) both; box-shadow: 0 0 0 4px rgba(64,192,87,.18), 0 8px 24px rgba(64,192,87,.30); }
@keyframes pop { 0% { transform: scale(.96); } 45% { transform: scale(1.04); } 100% { transform: scale(1); } }
.opt.pop .opt-letter { animation: tick 600ms var(--spring) both; }
@keyframes tick { 0% { transform: scale(.4) rotate(-30deg); } 60% { transform: scale(1.25) rotate(8deg); } 100% { transform: none; } }
.opt.shake { animation: shake 420ms cubic-bezier(.36,.07,.19,.97) both; }
@keyframes shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-7px); } 40%, 60% { transform: translateX(7px); } }
.opt.tap { animation: tap 300ms var(--spring); }
@keyframes tap { 40% { transform: scale(.97); } }
.feedback, .why { animation: row-in 360ms var(--ease-out) both; }
.why { animation-delay: 120ms; }
.burst { position: fixed; z-index: 100; width: 0; height: 0; pointer-events: none; }
.burst i { position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 2px; opacity: 0; animation: confetti 900ms var(--ease-out) both; }
.burst i:nth-child(3n) { border-radius: 50%; } .burst i:nth-child(4n) { width: 5px; height: 12px; }
@keyframes confetti { 0% { opacity: 1; transform: translate(0,0) rotate(0) scale(.6); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--x), calc(var(--y) + 60px)) rotate(var(--r)) scale(1); } }
.plus { position: fixed; z-index: 101; pointer-events: none; font-weight: 800; font-size: 20px; color: var(--ok); animation: plus 800ms var(--ease-out) both; }
@keyframes plus { from { opacity: 0; transform: translate(-50%, 0) scale(.6); } 20% { opacity: 1; } to { opacity: 0; transform: translate(-50%, -48px) scale(1.1); } }
.streak { font-size: 14px; font-weight: 800; color: var(--warn); background: var(--warn-bg); padding: 4px 10px; border-radius: 999px; white-space: nowrap; animation: pop 500ms var(--spring) both; }
.score { animation: score-in 700ms var(--spring) both; }
@keyframes score-in { from { transform: scale(.6); opacity: 0; } }
.score.p { box-shadow: 0 0 0 8px var(--ok-bg), 0 12px 40px rgba(64,192,87,.25); }
@media (prefers-reduced-motion: reduce) {
  *, ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; transition-duration: 1ms !important; }
}

/* ---------- нижняя панель: стекло, иконка + подпись (как BottomNav портала МЦТ, Сергей DM 9409) ---------- */
:root { --accent: #2F6BE0; --accent-bg: rgba(47,107,224,.12); --bar-hi: rgba(255,255,255,.85); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --accent: #8AB0FF; --accent-bg: rgba(138,176,255,.16); --bar-hi: rgba(255,255,255,.10); } }
:root[data-theme="dark"] { --accent: #8AB0FF; --accent-bg: rgba(138,176,255,.16); --bar-hi: rgba(255,255,255,.10); }
.dock { position: sticky; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); margin-top: auto; padding-top: 18px; z-index: 5; view-transition-name: dock; }
.dock::before { content: ''; position: absolute; left: -16px; right: -16px; top: -24px; bottom: calc(-14px - env(safe-area-inset-bottom, 0px)); z-index: -1; pointer-events: none;
  background: linear-gradient(to bottom, transparent 0, var(--bg) 62%); }
.dock-top { display: flex; align-items: center; gap: 12px; margin: 0 6px 10px; }
.dock-top .dots { flex: 1; justify-content: flex-start; }
.dock-fin { font-size: 13px; font-weight: 600; color: var(--text-2); padding: 6px 12px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border-strong); white-space: nowrap; }
.bar { display: flex; align-items: center; gap: 2px; padding: 6px; border-radius: 40px; background: var(--glass);
  backdrop-filter: blur(16px) saturate(180%) brightness(105%); -webkit-backdrop-filter: blur(16px) saturate(180%) brightness(105%);
  border: 1px solid var(--bar-hi);
  box-shadow: 0 8px 32px rgba(0,0,0,.12), 0 4px 16px rgba(0,0,0,.08), inset 0 1px 0 var(--bar-hi), inset 0 -1px 0 rgba(0,0,0,.08);
  animation: bar-up .45s var(--ease-out) both; }
@keyframes bar-up { from { transform: translateY(24px); opacity: 0; } }
.vt .bar { animation: none; }
.bar-btn { flex: 1 1 0; min-width: 0; min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 5px 2px; border-radius: 22px; color: var(--muted); -webkit-tap-highlight-color: transparent;
  transition: color 300ms var(--ease-out), transform 260ms var(--spring); }
.bar-ico { display: flex; align-items: center; justify-content: center; width: 40px; height: 28px; border-radius: 14px; transition: background 300ms var(--ease-out), transform 300ms var(--spring); }
.bar-ico svg { width: 22px; height: 22px; }
.bar-label { max-width: 100%; font-size: 10.5px; font-weight: 500; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-btn.on { color: var(--accent); }
.bar-btn.on .bar-ico { background: var(--accent-bg); transform: scale(1.06); }
.bar-btn.on .bar-label { font-weight: 700; }
.bar-btn:active { transform: scale(.92); }
.bar-next { flex: 0 0 auto; width: 54px; height: 54px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--text); color: var(--bg); box-shadow: 0 4px 14px rgba(0,0,0,.18); transition: transform 260ms var(--spring), opacity 300ms, background 300ms; }
.bar-next svg { width: 24px; height: 24px; stroke-width: 2.2; }
.bar-next:disabled { opacity: .22; box-shadow: none; }
.bar-next:active:not(:disabled) { transform: scale(.9); }
.bar-next.go { animation: next-ready .5s var(--spring) both; }
@keyframes next-ready { 0% { transform: scale(.8); } 60% { transform: scale(1.08); } }
.bar-prev { width: 44px; height: 44px; background: transparent; color: var(--text); box-shadow: none; border: 1px solid var(--border-strong); }
.dot.cur { background: var(--text); }
.tr { max-height: 40em; transition: opacity 280ms var(--ease-out), max-height 340ms var(--ease-out), margin 340ms var(--ease-out), padding 340ms var(--ease-out), border-width 340ms; }
.tr-anim .tr { overflow: hidden; }
.tr-hide .tr { opacity: 0; max-height: 0; margin-top: 0; padding-top: 0; border-top-width: 0; overflow: hidden; visibility: hidden; transition-property: opacity, max-height, margin, padding, border-width, visibility; transition-delay: 0s, 0s, 0s, 0s, 0s, 340ms; }
/* панель въезжает только при первом появлении */
.bar { animation: none; } .bar.in { animation: bar-up .45s var(--ease-out) both; } .vt .bar.in { animation: none; }
/* картинка, не успевшая загрузиться, проявляется */
img.ld { opacity: 0; } img.ldd { animation: img-in 320ms var(--ease-out) both; }
@keyframes img-in { from { opacity: 0; } }
/* тема без View Transitions — плавная смена цветов */
.theme-fade, .theme-fade * { transition: background-color 400ms var(--ease-out), color 400ms var(--ease-out), border-color 400ms var(--ease-out), fill 400ms, stroke 400ms !important; }
/* после ответа верный вариант окрашивается плавно */
.revealed .opt.ok:not(.pop) { animation: ok-in 420ms var(--ease-out) both; }
@keyframes ok-in { from { background: var(--surface); border-color: var(--border); } }
.sheet-row .sheet-check { animation: tick 420ms var(--spring) both; }
@media (prefers-reduced-motion: reduce) { .bar, .bar-next.go { animation: none; } }

/* шапка главной: мягкие плывущие пятна в цветах флага страны (Сергей DM 9421) */
.flagglow { position: absolute; left: 0; right: 0; top: 0; height: 460px; z-index: -1; pointer-events: none; overflow: hidden; opacity: 0;
  transition: opacity 700ms var(--ease-out);
  -webkit-mask-image: linear-gradient(to bottom, #000 35%, transparent); mask-image: linear-gradient(to bottom, #000 35%, transparent); }
[data-view="home"] .flagglow { opacity: 1; }
.flagglow span { position: absolute; width: 380px; height: 380px; border-radius: 50%; opacity: .15; filter: blur(70px); will-change: transform; }
.flagglow span:nth-child(1) { left: calc(50% - 400px); top: -150px; animation: drift1 9s ease-in-out infinite alternate; }
.flagglow span:nth-child(2) { left: calc(50% - 150px); top: -190px; animation: drift2 11s ease-in-out infinite alternate; }
.flagglow span:nth-child(3) { left: calc(50% + 90px); top: -130px; animation: drift3 10s ease-in-out infinite alternate; }
.flagglow span.k { opacity: .07; }
@keyframes drift1 { 0% { transform: translate(0, 0) scale(1); } 50% { transform: translate(130px, 50px) scale(1.18); } 100% { transform: translate(-50px, 90px) scale(.9); } }
@keyframes drift2 { 0% { transform: translate(0, 0) scale(1.05); } 50% { transform: translate(-110px, 80px) scale(.88); } 100% { transform: translate(90px, 30px) scale(1.15); } }
@keyframes drift3 { 0% { transform: translate(0, 0) scale(.95); } 50% { transform: translate(-140px, 40px) scale(1.15); } 100% { transform: translate(40px, 100px) scale(.92); } }
:root[data-theme="dark"] .flagglow span { opacity: .12; } :root[data-theme="dark"] .flagglow span.k { background: #6B6B80 !important; opacity: .10; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .flagglow span { opacity: .12; } :root:not([data-theme="light"]) .flagglow span.k { background: #6B6B80 !important; opacity: .10; } }
@media (prefers-reduced-motion: reduce) { .flagglow span { animation: none; } }

.vt .flagglow { transition: none; }   /* в переходе угасание делает сам переход — иначе двойное мигание */

/* загрузка: экран не показываем, пока картинки не в памяти; кольцо — настоящий прогресс (Сергей DM 9424) */
#boot { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; background: var(--bg);
  opacity: 0; animation: boot-in 400ms var(--ease-out) 180ms both; transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out); }
@keyframes boot-in { to { opacity: 1; } }
#boot.out { opacity: 0 !important; animation: none; transform: scale(1.04); pointer-events: none; }
.boot-ring { position: relative; width: 84px; height: 84px; }
.boot-ring::before { content: ''; position: absolute; inset: -26px; border-radius: 50%; filter: blur(22px); opacity: .45;
  background: conic-gradient(from 0deg, #2F6BE0, #DD0000, #FFCE00, #2F6BE0); animation: boot-spin 3.2s linear infinite, boot-breathe 2.4s ease-in-out infinite; }
.boot-ring svg { position: relative; width: 100%; height: 100%; transform: rotate(-90deg); }
.boot-ring circle { fill: none; stroke-width: 5; stroke-linecap: round; }
.boot-track { stroke: var(--border-strong); opacity: .6; }
#boot-arc { stroke: var(--text); stroke-dasharray: 176; stroke-dashoffset: 176; transition: stroke-dashoffset 400ms var(--ease-out); }
.boot-ring .boot-dot { position: absolute; inset: 0; animation: boot-spin 1.4s linear infinite; }
.boot-ring .boot-dot::after { content: ''; position: absolute; left: 50%; top: 9px; width: 7px; height: 7px; margin-left: -3.5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
@keyframes boot-spin { to { transform: rotate(360deg); } }
@keyframes boot-breathe { 50% { opacity: .25; transform: scale(.85) rotate(180deg); } }
@media (prefers-reduced-motion: reduce) { .boot-ring::before, .boot-ring .boot-dot { animation: none; } }

/* после ответа (Сергей DM 9429): отсчёт «Авто» заливкой в нажатом варианте, стрелка в нём — тап и дальше */
.opt { position: relative; overflow: hidden; }
.opt > .opt-letter, .opt > .opt-text { position: relative; z-index: 1; }
.opt-fill { position: absolute; inset: 0; z-index: 0; pointer-events: none; transform: scaleX(0); transform-origin: left center;
  background: linear-gradient(90deg, rgba(64,192,87,.10), rgba(64,192,87,.34)); }
[data-ui="ar"] .opt-fill, [data-ui="fa"] .opt-fill { transform-origin: right center; }
.opt-go { position: relative; z-index: 1; margin-left: auto; flex-shrink: 0; width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: var(--ok); color: #fff; animation: go-in 420ms var(--spring) 250ms both, arrow-nudge 1.4s ease-in-out 900ms infinite; }
.opt-go svg { width: 20px; height: 20px; stroke-width: 2.4; }
[data-ui="ar"] .opt-go svg, [data-ui="fa"] .opt-go svg { transform: scaleX(-1); }
@keyframes go-in { from { opacity: 0; transform: scale(.4) translateX(-8px); } }
@keyframes arrow-nudge { 0%, 100% { transform: translateX(0); } 45% { transform: translateX(4px); } 60% { transform: translateX(0); } }
/* неверно или «Авто» выключено — круглая «Дальше» на панели дышит, стрелка в ней подталкивает */
@media (prefers-reduced-motion: reduce) { .opt-go { animation: none; } }

/* выбор языка: флаг из кружка разливается на всю кнопку и переливается (Сергей DM 9433) */
.sheet-row { position: relative; overflow: hidden; }
.sheet-row > :not(.row-flag) { position: relative; z-index: 1; }
.row-flag { position: absolute; inset: 0; z-index: 0; overflow: hidden; border-radius: inherit;
  clip-path: circle(var(--f0) at var(--fx) var(--fy)); animation: flag-spread 560ms cubic-bezier(.65,0,.35,1) forwards; }
.row-flag svg { display: block; width: 100%; height: 100%; }
.row-flag i { position: absolute; inset: 0; mix-blend-mode: soft-light;
  background: repeating-linear-gradient(105deg, rgba(0,0,0,.38) 0, rgba(255,255,255,.55) 46px, rgba(0,0,0,.38) 92px);
  background-size: 184px 100%; animation: flag-wave 1.1s linear infinite; }
.row-flag::after { content: ''; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.45) 50%, transparent 70%); animation: flag-sheen 900ms 380ms ease-in-out forwards; }
@keyframes flag-spread { to { clip-path: circle(var(--fr) at var(--fx) var(--fy)); } }
@keyframes flag-wave { to { background-position: 184px 0; } }
@keyframes flag-sheen { to { transform: translateX(120%); } }
.sheet-row.flagged { border-color: transparent; }
.sheet-row.flagged > :not(.row-flag) { opacity: 0; transform: scale(.92); transition: opacity 220ms, transform 300ms var(--ease-out); }
.sheet-row.flagged .row-flag { animation: flag-spread 520ms cubic-bezier(.65,0,.35,1) forwards, flag-gone 300ms ease-in 700ms forwards; }
@keyframes flag-gone { to { opacity: 0; transform: scale(1.04); } }

/* «Дальше» после неверного ответа — стрелка в верном блоке, блик по нему (DM 9446, 9451) */
.opt.wait { box-shadow: 0 0 0 1px var(--ok), 0 0 18px color-mix(in srgb, var(--ok) 35%, transparent); }
.opt.wait::after { content: ''; position: absolute; inset: 0; pointer-events: none; transform: translateX(-100%);
  background: linear-gradient(100deg, transparent 25%, color-mix(in srgb, var(--ok) 28%, transparent) 50%, transparent 75%); animation: ok-sheen 2.2s ease-in-out 600ms infinite; }
@keyframes ok-sheen { 60%, 100% { transform: translateX(100%); } }
.opt-go.late { animation-delay: 650ms, 1300ms; }
@media (prefers-reduced-motion: reduce) { .opt.wait::after { animation: none; } }
.row-flag-em { position: absolute; top: 0; bottom: 0; left: 50%; aspect-ratio: 1; transform: translateX(-50%); }
.row-flag-em svg { display: block; width: 100%; height: 100%; }

/* тренировка: шапка с прогрессом прилипает сверху (DM 9461) */
.quiz-top { position: sticky; top: 0; z-index: 6; margin: -16px -16px 18px; padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4); }
/* стрелка вниз над панелью, когда ниже есть текст */
.scroll-dn { position: absolute; right: 8px; bottom: calc(100% - 8px); width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--glass, var(--surface)); color: var(--text); border: 1px solid var(--border-strong); box-shadow: 0 6px 18px rgba(0,0,0,.18);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  opacity: 0; transform: translateY(10px) scale(.8); pointer-events: none; transition: opacity 260ms, transform 320ms var(--spring); }
.scroll-dn.on { opacity: 1; transform: none; pointer-events: auto; }
.scroll-dn svg { width: 22px; height: 22px; stroke-width: 2.4; }
.scroll-dn.on svg { animation: dn-bob 1.6s ease-in-out 1s infinite; }
@keyframes dn-bob { 0%, 100% { transform: none; } 50% { transform: translateY(3px); } }
@media (prefers-reduced-motion: reduce) { .scroll-dn.on svg { animation: none; } }

/* главная: компактная шапка — иконка слева, название справа (DM 9459) */
.home-header { display: grid; grid-template-columns: 76px 1fr; align-items: center; gap: 4px 14px; text-align: left; padding: 0 0 14px; }
.home-icon { width: 76px; height: 76px; margin: 0; }
.home-name { min-width: 0; }
.home-title { font-size: 23px; line-height: 1.15; margin-bottom: 3px; }
.home-header > :not(.home-icon):not(.home-name) { grid-column: 1 / -1; margin-top: 12px; }
.ready-head { justify-content: flex-start; } .ready-head .ready-pill { margin-left: auto; }
.ready-i { flex-shrink: 0; width: 26px; height: 26px; margin-left: 8px; border-radius: 50%; border: 1px solid var(--border-strong); color: var(--text-2);
  font: italic 700 13px/1 Georgia, serif; display: inline-flex; align-items: center; justify-content: center; transition: background var(--fast), color var(--fast); }
.ready-i.on { background: var(--text); color: var(--bg); }

/* готовность под экзаменом при первом входе — отступ, а не впритык (DM 9467) */
.cards ~ .card.ready { margin-top: 26px; }

/* установка на телефон: всплывашка на главной (DM 9470) и страница с макетами меню (DM 9463, 9470) */
.ipop { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.ipop-bg { position: absolute; inset: 0; background: rgba(0,0,0,.38); animation: ipop-fade 300ms ease-out both; }
.ipop-card { position: relative; width: 100%; max-width: 480px; margin: 0 8px calc(8px + env(safe-area-inset-bottom, 0px)); padding: 10px 18px 18px;
  border-radius: 26px; background: var(--surface); box-shadow: 0 -6px 40px rgba(0,0,0,.25); animation: ipop-up 420ms cubic-bezier(.2,.9,.25,1.15) both; }
.ipop.out .ipop-bg { animation: ipop-fade 280ms ease-in reverse both; }
.ipop.out .ipop-card { animation: ipop-down 280ms ease-in both; }
@keyframes ipop-fade { from { opacity: 0; } }
@keyframes ipop-up { from { transform: translateY(110%); } }
@keyframes ipop-down { to { transform: translateY(110%); } }
.ipop-grip { display: block; width: 38px; height: 5px; margin: 0 auto 14px; border-radius: 3px; background: var(--border-strong); }
.ipop-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.ipop-ico { width: 64px; height: 64px; border-radius: 16px; flex-shrink: 0; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.ipop-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; unicode-bidi: plaintext; text-align: start; }
.ipop-txt b { font-size: 19px; font-weight: 700; line-height: 1.2; } .ipop-txt small { font-size: 14px; color: var(--text-2); line-height: 1.35; }
.ipop-btns { display: flex; gap: 10px; }
.ipop-btns .btn { padding: 14px 12px; }
.ipop-later { background: var(--bg); color: var(--text); }
.inst-link { margin-top: 10px; }

.seg { display: flex; gap: 4px; padding: 4px; margin: 4px 0 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.seg button { flex: 1; height: 44px; border-radius: 10px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background var(--fast), color var(--fast); }
.seg button.on { background: var(--text); color: var(--bg); }
.os-logo { width: 20px; height: 20px; flex-shrink: 0; }
.seg button[data-os="ios"] .os-logo { margin-top: -3px; }
.inst-steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.inst-steps li { padding: 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); animation: row-in 480ms var(--ease-out) both; }
.inst-li { display: flex; align-items: flex-start; gap: 12px; font-size: 16px; line-height: 1.4; unicode-bidi: plaintext; margin-bottom: 12px; }
.inst-steps li:nth-child(2) { animation-delay: 70ms; } .inst-steps li:nth-child(3) { animation-delay: 140ms; }
.inst-n { flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; background: var(--accent-bg); color: var(--accent); }
.inst-btn { width: 100%; margin: 0 0 16px; }

/* макет экрана телефона: как выглядит нужное меню, место для нажатия пульсирует */
.mk { --mk-bg: #f2f2f7; --mk-el: #fff; --mk-ink: #1c1c1e; --mk-mute: #8e8e93; --mk-sk: rgba(60,60,67,.13); --mk-blue: #0a84ff;
  position: relative; height: 160px; border-radius: 14px; overflow: hidden; background: var(--mk-bg); color: var(--mk-ink); direction: ltr;
  font: 500 12px/1.25 -apple-system, system-ui, sans-serif; border: 1px solid var(--border); }
:root[data-theme="dark"] .mk { --mk-bg: #1c1c1e; --mk-el: #2c2c2e; --mk-ink: #f2f2f7; --mk-mute: #98989f; --mk-sk: rgba(235,235,245,.14); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mk { --mk-bg: #1c1c1e; --mk-el: #2c2c2e; --mk-ink: #f2f2f7; --mk-mute: #98989f; --mk-sk: rgba(235,235,245,.14); } }
.mk svg { width: 16px; height: 16px; flex-shrink: 0; }
.mk-page { position: absolute; left: 14px; right: 14px; top: 14px; display: flex; flex-direction: column; gap: 9px; }
.mk-and .mk-page { top: 58px; }
.mk-sk { display: block; height: 9px; width: var(--w); border-radius: 5px; background: var(--mk-sk); }
.mk-sk.row { height: 26px; width: 100%; border-radius: 8px; opacity: .7; }
.mk-iosbar, .mk-andbar { position: absolute; left: 8px; right: 8px; display: flex; align-items: center; gap: 6px; }
.mk-iosbar { bottom: 8px; height: 42px; padding: 0 6px; border-radius: 22px; background: var(--mk-el); box-shadow: 0 2px 12px rgba(0,0,0,.12); }
.mk-andbar { top: 8px; height: 40px; }
.mk-b { width: 30px; height: 30px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 20px; color: var(--mk-ink); }
.mk-url { flex: 1; min-width: 0; height: 30px; display: flex; align-items: center; justify-content: center; gap: 4px; padding: 0 10px; border-radius: 15px;
  white-space: nowrap; overflow: hidden; color: var(--mk-ink); }
.mk-url svg { width: 12px; height: 12px; color: var(--mk-mute); }
.mk-andbar .mk-url { justify-content: flex-start; background: var(--mk-el); height: 34px; border-radius: 17px; }
.mk-pop { position: absolute; right: 10px; bottom: 58px; width: 64%; padding: 6px; border-radius: 14px; background: var(--mk-el); box-shadow: 0 6px 24px rgba(0,0,0,.2);
  display: flex; flex-direction: column; gap: 5px; }
.mk-row { display: flex; align-items: center; gap: 8px; min-height: 28px; padding: 4px 8px; border-radius: 8px; background: var(--mk-el); unicode-bidi: plaintext; }
.mk-two { display: flex; gap: 8px; padding: 8px; }
.mk-sheet, .mk-dlg { flex: 1 1 0; min-width: 0; border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 6px; background: var(--mk-bg); }
.mk-sheet { background: var(--mk-sk); background: color-mix(in srgb, var(--mk-ink) 5%, var(--mk-bg)); justify-content: center; }
.mk-sheet .mk-sk.row { background: var(--mk-el); opacity: 1; }
.mk-dlg { background: var(--mk-el); justify-content: center; gap: 12px; flex-grow: 1.25; }
.mk-dlg-top span, .mk-dlg-btns span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-dlg-top b, .mk-dlg-btns b { flex-shrink: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-dlg-top, .mk-dlg-btns { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: var(--mk-blue); }
.mk-dlg-btns { justify-content: flex-end; gap: 10px; }
.mk-dlg-top b, .mk-dlg-btns b { padding: 4px 6px; border-radius: 8px; font-weight: 700; }
.mk-dlg-btns b { background: var(--mk-blue); color: #fff; border-radius: 14px; padding: 5px 12px; }
.mk-and .mk-dlg-top, .mk-and .mk-dlg-btns { color: var(--mk-blue); }
.mk-dlg-app { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mk-dlg-app span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-app { width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0; }
.mk .hl { position: relative; z-index: 1; outline: 2px solid var(--primary); outline-offset: -1px; animation: mk-pulse 1.6s ease-out infinite; }
@keyframes mk-pulse { 0% { box-shadow: 0 0 0 0 rgba(232,54,77,.55); } 70%, 100% { box-shadow: 0 0 0 10px rgba(232,54,77,0); } }
@media (prefers-reduced-motion: reduce) { .mk .hl { animation: none; } .ipop-card, .ipop-bg { animation: none; } }

/* нижняя панель закреплена у края экрана, не зависит от высоты страницы (DM 9463) */
.dock { position: fixed; left: 0; right: 0; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); margin: 0 auto; max-width: 480px; padding: 0 16px; }
@media (min-width: 768px) { .dock { max-width: 560px; } }
.quiz { padding-bottom: 96px; min-height: 0; }
.quiz:has(.dock-top) { padding-bottom: 136px; }

/* полная версия: замки, экран покупки, ключ (DM 9490) */
.lock-chip { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
  color: var(--accent); background: var(--accent-bg); unicode-bidi: plaintext; }
.lock-chip svg { width: 14px; height: 14px; flex-shrink: 0; }
.why-lock { background: transparent; border: 0; padding: 0; }
.pro-feats { list-style: none; padding: 0; margin: 6px 0 20px; display: flex; flex-direction: column; gap: 10px; }
.pro-feats li { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border);
  font-size: 16px; font-weight: 600; animation: row-in 480ms var(--ease-out) both; unicode-bidi: plaintext; }
.pro-feats li:nth-child(2) { animation-delay: 60ms; } .pro-feats li:nth-child(3) { animation-delay: 120ms; } .pro-feats li:nth-child(4) { animation-delay: 180ms; }
.pro-ok { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 800;
  background: var(--ok-bg); color: var(--ok); }
.pro-price { text-align: center; font-size: 26px; font-weight: 800; margin: 4px 0 12px; }
.pro-buy { width: 100%; }
.pro-soon { margin-top: 10px; text-align: center; font-size: 14px; color: var(--text-2); }
.pro-key { margin-top: 18px; padding: 4px 2px; }
.pro-key summary { cursor: pointer; text-align: center; font-size: 15px; font-weight: 600; color: var(--text-2); list-style: none; padding: 8px; }
.pro-key summary::-webkit-details-marker { display: none; }
.pro-key input { width: 100%; margin-top: 8px; padding: 14px; border-radius: 14px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: 14px/1.3 ui-monospace, monospace; }
.pro-act { width: 100%; margin-top: 10px; background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); }
.pro-msg { margin-top: 8px; min-height: 1.2em; text-align: center; font-size: 14px; color: var(--bad); }
.pro-on { margin: 4px 0 14px; padding: 14px 16px; border-radius: 16px; background: var(--ok-bg); color: var(--ok); font-weight: 700; text-align: center; }
.pro-card { width: 100%; margin-top: 22px; display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-radius: var(--r); text-align: start;
  background: linear-gradient(135deg, #1f7aec, #6a5cff); color: #fff; box-shadow: 0 8px 24px rgba(31,122,236,.3); }
.pro-card-t { flex: 1; display: flex; flex-direction: column; gap: 2px; unicode-bidi: plaintext; }
.pro-card-t b { font-size: 17px; } .pro-card-t small { font-size: 14px; opacity: .85; }
.pro-card-go { font-size: 28px; line-height: 1; opacity: .85; }
