/* Civique sans faute — design system */
@font-face {
  font-family: "Figtree";
  src: url("/fonts/figtree-latin-wght.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #f1efe8;
  --surface-3: #e9e6dd;
  --line: #e5e2d9;
  --line-strong: #cfcabd;
  --ink: #15171c;
  --ink-2: #3b404c;
  --muted: #6a6f7c;
  --brand: #4338ca;
  --brand-fill: #4338ca;
  --brand-press: #3730a3;
  --brand-soft: #ecebff;
  --brand-line: #c9c6fa;
  --on-brand: #ffffff;
  --ok: #127a43;
  --ok-fill: #16a34a;
  --ok-soft: #e7f6ed;
  --ok-line: #9ad6b2;
  --bad: #c0262d;
  --bad-fill: #dc2626;
  --bad-soft: #fdebeb;
  --bad-line: #f0a5a5;
  --warn: #9a5800;
  --warn-soft: #fff3dc;
  --warn-line: #f0c978;
  --flame: #f97316;
  --shadow-1: 0 1px 2px rgba(20, 20, 30, 0.06);
  --shadow-2: 0 1px 2px rgba(20, 20, 30, 0.05), 0 8px 24px rgba(20, 20, 30, 0.07);
  --shadow-sheet: 0 -8px 30px rgba(20, 20, 30, 0.14);
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --font: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115; --surface: #171a21; --surface-2: #1f232c; --surface-3: #282d38;
    --line: #2a2f3a; --line-strong: #3b4250; --ink: #eef0f4; --ink-2: #c6cbd5; --muted: #8f96a4;
    --brand: #a9a6ff; --brand-fill: #5b57ee; --brand-press: #4c48dc; --brand-soft: rgba(99, 95, 240, 0.16); --brand-line: rgba(140, 136, 255, 0.45);
    --ok: #4cd68a; --ok-fill: #22a85a; --ok-soft: rgba(34, 168, 90, 0.14); --ok-line: rgba(76, 214, 138, 0.42);
    --bad: #ff7a7a; --bad-fill: #e5484d; --bad-soft: rgba(229, 72, 77, 0.14); --bad-line: rgba(255, 122, 122, 0.42);
    --warn: #ffc261; --warn-soft: rgba(255, 176, 32, 0.13); --warn-line: rgba(255, 194, 97, 0.42);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4); --shadow-2: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-sheet: 0 -8px 30px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115; --surface: #171a21; --surface-2: #1f232c; --surface-3: #282d38;
  --line: #2a2f3a; --line-strong: #3b4250; --ink: #eef0f4; --ink-2: #c6cbd5; --muted: #8f96a4;
  --brand: #a9a6ff; --brand-fill: #5b57ee; --brand-press: #4c48dc; --brand-soft: rgba(99, 95, 240, 0.16); --brand-line: rgba(140, 136, 255, 0.45);
  --ok: #4cd68a; --ok-fill: #22a85a; --ok-soft: rgba(34, 168, 90, 0.14); --ok-line: rgba(76, 214, 138, 0.42);
  --bad: #ff7a7a; --bad-fill: #e5484d; --bad-soft: rgba(229, 72, 77, 0.14); --bad-line: rgba(255, 122, 122, 0.42);
  --warn: #ffc261; --warn-soft: rgba(255, 176, 32, 0.13); --warn-line: rgba(255, 194, 97, 0.42);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4); --shadow-2: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-sheet: 0 -8px 30px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

/* text size setting */
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
html[data-text="l"] { font-size: 112.5%; }
html[data-text="xl"] { font-size: 125%; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 1.0625rem; line-height: 1.5; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); text-underline-offset: 3px; text-decoration-thickness: 1px; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

.view { min-height: 100dvh; }
.page { max-width: 640px; margin: 0 auto; padding: 0 16px calc(40px + env(safe-area-inset-bottom)); }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 10px; padding: 14px 0 6px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 750; font-size: 1.05rem; letter-spacing: -0.015em; margin-right: auto; min-width: 0; }
.brand svg { width: 32px; height: 32px; flex-shrink: 0; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 44px; height: 44px; flex-shrink: 0; display: grid; place-items: center; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); box-shadow: var(--shadow-1); padding: 0; }
.icon-btn svg { width: 21px; height: 21px; }
.icon-btn.plain { border-color: transparent; background: transparent; box-shadow: none; }
.icon-btn:disabled { opacity: 0.4; cursor: default; }

.header-back { display: flex; align-items: center; gap: 12px; padding: 14px 0 8px; }
.header-back h1 { font-size: 1.35rem; }
.header-back .sub { color: var(--muted); font-size: 0.9rem; }

/* ---------- generic ---------- */
.section { margin-top: 26px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.section-head h2 { font-size: 1.12rem; }
.section-head a, .section-head button { font-size: 0.9rem; font-weight: 650; color: var(--brand); background: none; border: 0; padding: 4px 0; text-decoration: none; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-2); }
.pad { padding: 18px; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: 999px; font-size: 0.82rem; font-weight: 700; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.chip svg { width: 15px; height: 15px; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.brand { background: var(--brand-soft); color: var(--brand); }
.chip.flame { background: var(--warn-soft); color: var(--warn); }
.chip.flame svg { color: var(--flame); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 22px; border-radius: var(--r-md); border: 1px solid transparent; font-weight: 750; font-size: 1.02rem; letter-spacing: -0.005em; text-decoration: none; white-space: nowrap; transition: transform 0.08s, background 0.15s, box-shadow 0.15s; user-select: none; }
.btn svg { width: 20px; height: 20px; }
.btn:active:not(:disabled) { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--brand-fill); color: var(--on-brand); box-shadow: 0 2px 0 var(--brand-press); }
.btn.ok { background: var(--ok-fill); color: #fff; box-shadow: 0 2px 0 #0f6e37; }
.btn.bad { background: var(--bad-fill); color: #fff; box-shadow: 0 2px 0 #a3171d; }
.btn.light { background: rgba(255, 255, 255, 0.96); color: var(--brand-press); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12); }
.btn.secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); box-shadow: 0 2px 0 var(--line); }
.btn.ghost { background: transparent; color: var(--ink-2); }
.btn.block { width: 100%; }
.btn.sm { min-height: 42px; padding: 0 16px; font-size: 0.94rem; border-radius: 12px; }
.text-btn { background: none; border: 0; padding: 8px 4px; color: var(--brand); font-weight: 700; font-size: 0.95rem; }
.btn-stack { display: grid; gap: 10px; }
@media (hover: hover) {
  .btn.primary:hover:not(:disabled) { background: var(--brand-press); }
  .btn.secondary:hover:not(:disabled) { border-color: var(--muted); }
  .btn.ghost:hover:not(:disabled) { background: var(--surface-2); }
  .icon-btn:hover:not(:disabled) { border-color: var(--line-strong); }
}
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- onboarding ---------- */
.onboard { max-width: 560px; margin: 0 auto; padding: 0 18px calc(32px + env(safe-area-inset-bottom)); }
.onboard .hero { padding: 26px 0 22px; }
.onboard .hero h1 { font-size: clamp(2rem, 8.5vw, 2.6rem); line-height: 1.08; letter-spacing: -0.035em; }
.onboard .hero p { margin-top: 12px; color: var(--ink-2); font-size: 1.08rem; }
.trust { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.q-label { font-size: 1.15rem; font-weight: 750; margin: 6px 0 12px; }
.exam-cards { display: grid; gap: 10px; }
.exam-card { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow-2); transition: border-color 0.15s, transform 0.08s; }
.exam-card:active { transform: scale(0.99); }
.exam-card .badge { width: 52px; height: 52px; border-radius: 16px; flex-shrink: 0; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.exam-card .badge svg { width: 26px; height: 26px; }
.exam-cards.compact .exam-card { padding: 12px; box-shadow: none; }
.exam-cards.compact .badge { width: 42px; height: 42px; border-radius: 13px; }
.exam-cards.compact .badge svg { width: 22px; height: 22px; }
.exam-line { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 6px; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); text-align: left; box-shadow: var(--shadow-1); }
.exam-line .ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex-shrink: 0; }
.exam-line .ic svg { width: 20px; height: 20px; }
.exam-line .grow { flex: 1; min-width: 0; }
.exam-line .k { display: block; font-size: 0.78rem; color: var(--muted); font-weight: 650; }
.exam-line .v { display: block; font-weight: 750; }
.exam-line .chg { color: var(--brand); font-weight: 700; font-size: 0.9rem; flex-shrink: 0; }
@media (hover: hover) { .exam-line:hover { border-color: var(--line-strong); } }
.exam-card .t { font-weight: 750; font-size: 1.08rem; }
.exam-card .d { color: var(--muted); font-size: 0.9rem; margin-top: 2px; line-height: 1.35; }
.exam-card .chev { margin-left: auto; color: var(--muted); flex-shrink: 0; }
.exam-card[aria-checked="true"] { border-color: var(--brand-fill); box-shadow: 0 0 0 3px var(--brand-soft); }
@media (hover: hover) { .exam-card:hover { border-color: var(--line-strong); } }

/* ---------- home ---------- */
.next-card { position: relative; overflow: hidden; border-radius: var(--r-lg); padding: 20px; color: #fff; background: linear-gradient(135deg, #4338ca 0%, #5b4ee6 55%, #7c5cf0 100%); box-shadow: 0 10px 30px rgba(67, 56, 202, 0.28); }
.next-card::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255, 255, 255, 0.08); }
.next-card .kicker { font-size: 0.8rem; font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.85; }
.next-card h2 { font-size: 1.4rem; line-height: 1.2; margin-top: 6px; letter-spacing: -0.02em; position: relative; z-index: 1; }
.next-card p { margin-top: 6px; opacity: 0.9; font-size: 0.98rem; position: relative; z-index: 1; }
.next-card .btn { margin-top: 16px; position: relative; z-index: 1; }
.next-card .track { height: 8px; background: rgba(255, 255, 255, 0.22); border-radius: 999px; margin-top: 14px; overflow: hidden; position: relative; z-index: 1; }
.next-card .track i { display: block; height: 100%; background: #fff; border-radius: 999px; }
.next-card .alt { display: block; margin-top: 4px; min-height: 44px; color: #fff; opacity: 0.9; font-weight: 650; font-size: 0.92rem; background: none; border: 0; padding: 10px 0; text-decoration: underline; text-underline-offset: 3px; position: relative; z-index: 1; }

.level { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; padding: 18px; width: 100%; text-align: left; border: 1px solid var(--line); }
.ring { position: relative; width: 92px; height: 92px; flex-shrink: 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .bg { stroke: var(--surface-3); }
.ring .fg { stroke: var(--ok-fill); stroke-linecap: round; transition: stroke-dashoffset 0.6s var(--ease); }
.ring .val { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1.05; }
.ring .val b { font-size: 1.35rem; letter-spacing: -0.03em; }
.ring .val span { display: block; font-size: 0.72rem; color: var(--muted); font-weight: 650; }
.level h3 { font-size: 1.05rem; }
.level .lines { margin-top: 6px; display: grid; gap: 3px; font-size: 0.88rem; color: var(--ink-2); }
.level .lines span { display: flex; align-items: center; gap: 8px; }
.dotc { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.dotc.m { background: var(--ok-fill); }
.dotc.e { background: var(--bad-fill); }
.dotc.s { background: var(--brand-fill); opacity: 0.55; }
.dotc.n { background: var(--surface-3); }
.level .chips { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); align-items: center; }
.level .chips .more { margin-left: auto; color: var(--brand); font-weight: 700; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 2px; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; min-height: 132px; box-shadow: var(--shadow-2); transition: transform 0.08s, border-color 0.15s; }
.tile:active:not(:disabled) { transform: scale(0.985); }
.tile:disabled { opacity: 0.55; cursor: default; }
.tile .ico { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); margin-bottom: 8px; }
.tile .ico svg { width: 22px; height: 22px; }
.tile .ico.red { background: var(--bad-soft); color: var(--bad); }
.tile .ico.green { background: var(--ok-soft); color: var(--ok); }
.tile .ico.amber { background: var(--warn-soft); color: var(--warn); }
.tile .t { font-weight: 750; font-size: 1.02rem; line-height: 1.2; }
.tile .d { color: var(--muted); font-size: 0.84rem; line-height: 1.3; }
.tile .badge { position: absolute; top: 14px; right: 14px; }
.tile-bar { display: block; width: 100%; height: 5px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: auto; }
.tile-bar i { display: block; height: 100%; background: var(--brand-fill); border-radius: 999px; }
.tile .d + .tile-bar { margin-top: 10px; }
@media (hover: hover) { .tile:hover:not(:disabled) { border-color: var(--line-strong); } }

.resume { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.resume + .resume { border-top: 1px solid var(--line); }
.resume .grow { flex: 1; min-width: 0; }
.resume .t { font-weight: 700; }
.resume .d { color: var(--muted); font-size: 0.86rem; }
.mini-track { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.mini-track i { display: block; height: 100%; background: var(--brand-fill); border-radius: 999px; }

details.facts { padding: 0; }
details.facts summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; font-weight: 750; cursor: pointer; }
details.facts summary::-webkit-details-marker { display: none; }
details.facts summary svg { width: 20px; height: 20px; color: var(--muted); transition: transform 0.2s; }
details.facts[open] summary svg { transform: rotate(180deg); }
.facts-body { padding: 0 18px 18px; }
.fact-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.fact-nums div { background: var(--surface-2); border-radius: var(--r-md); padding: 12px 6px; text-align: center; }
.fact-nums b { display: block; font-size: 1.4rem; letter-spacing: -0.03em; }
.fact-nums span { display: block; font-size: 0.76rem; color: var(--muted); line-height: 1.25; }
.fact-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.fact-list li { display: flex; gap: 10px; font-size: 0.95rem; color: var(--ink-2); }
.fact-list li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--brand-fill); margin-top: 0.55em; flex-shrink: 0; }
.source { margin-top: 14px; font-size: 0.82rem; color: var(--muted); }

.footer { margin-top: 34px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.82rem; line-height: 1.55; }
.footer p + p { margin-top: 8px; }

/* ---------- lists (themes, progress) ---------- */
.list-card { overflow: hidden; }
.list-item { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; background: none; border: 0; padding: 15px 16px; }
.list-item + .list-item { border-top: 1px solid var(--line); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .t { font-weight: 700; line-height: 1.3; }
.list-item .d { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.list-item .chev { color: var(--muted); flex-shrink: 0; width: 20px; height: 20px; }
.list-item:disabled { opacity: 0.5; cursor: default; }
@media (hover: hover) { button.list-item:hover:not(:disabled) { background: var(--surface-2); } }
.stack-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--surface-3); margin-top: 8px; }
.stack-bar i { display: block; height: 100%; }
.stack-bar .m { background: var(--ok-fill); }
.stack-bar .s { background: var(--brand-fill); opacity: 0.55; }
.stack-bar .e { background: var(--bad-fill); opacity: 0.85; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--surface-2); border-radius: var(--r-md); padding: 12px 8px; text-align: center; }
.stat b { display: block; font-size: 1.35rem; letter-spacing: -0.02em; }
.stat span { font-size: 0.78rem; color: var(--muted); }
.stat.ok b { color: var(--ok); }
.stat.bad b { color: var(--bad); }

.sim-row .score { font-weight: 800; font-size: 1.05rem; white-space: nowrap; }
.sim-row .score.ok { color: var(--ok); }
.sim-row .score.bad { color: var(--bad); }

/* ---------- quiz ---------- */
.quiz { max-width: 720px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.qtop { position: sticky; top: 0; z-index: 10; background: var(--bg); padding: 10px 16px 8px; display: flex; align-items: center; gap: 12px; }
.qtop .mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.qtop .count { font-weight: 750; font-size: 0.92rem; display: flex; justify-content: space-between; gap: 8px; }
.qtop .count span:first-child { white-space: nowrap; flex-shrink: 0; }
.qtop .count span + span { color: var(--muted); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.segs { display: flex; gap: 3px; height: 8px; }
.segs i { flex: 1; border-radius: 999px; background: var(--surface-3); transition: background 0.2s; }
.segs i.ok { background: var(--ok-fill); }
.segs i.bad { background: var(--bad-fill); }
.segs i.done { background: var(--brand-fill); opacity: 0.7; }
.segs i.cur { background: var(--ink-2); }
.pbar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--brand-fill); border-radius: 999px; transition: width 0.25s var(--ease); }
.timer { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-weight: 800; font-variant-numeric: tabular-nums; font-size: 0.98rem; }
.timer svg { width: 17px; height: 17px; color: var(--muted); }
.timer.low { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }
.timer.low svg { color: var(--bad); }

.qmain { flex: 1; padding: 12px 16px 24px; }
.qmain.enter { animation: qin 0.22s var(--ease); }
@keyframes qin { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.qkicker { font-size: 0.8rem; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 8px 0 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.qkicker .flagged { color: var(--warn); display: inline-flex; align-items: center; gap: 4px; }
.qkicker .flagged svg { width: 15px; height: 15px; }
.scenario { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; margin-bottom: 16px; color: var(--ink-2); font-size: 1.02rem; box-shadow: var(--shadow-1); position: relative; }
.scenario::before { content: "Situation"; display: block; font-size: 0.74rem; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: var(--brand); margin-bottom: 4px; }
.qtext { font-size: 1.36rem; line-height: 1.32; font-weight: 750; letter-spacing: -0.018em; margin-bottom: 20px; }
.options { display: grid; gap: 10px; }
.opt { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; background: var(--surface); border: 2px solid var(--line); border-radius: var(--r-md); padding: 14px 14px; min-height: 60px; font-size: 1.04rem; line-height: 1.38; box-shadow: 0 2px 0 var(--line); transition: border-color 0.12s, background 0.12s, transform 0.08s, box-shadow 0.12s; }
.opt:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
.opt .k { width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0; display: grid; place-items: center; font-weight: 800; font-size: 0.92rem; background: var(--surface-2); color: var(--ink-2); border: 1.5px solid var(--line); transition: all 0.12s; }
.opt .v { flex: 1; }
.opt .mk { width: 26px; height: 26px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; color: #fff; }
.opt .mk svg { width: 16px; height: 16px; }
.opt[aria-pressed="true"] { border-color: var(--brand-fill); background: var(--brand-soft); box-shadow: 0 2px 0 var(--brand-line); }
.opt[aria-pressed="true"] .k { background: var(--brand-fill); border-color: var(--brand-fill); color: #fff; }
.opt.correct { border-color: var(--ok-fill); background: var(--ok-soft); box-shadow: 0 2px 0 var(--ok-line); }
.opt.correct .k { background: var(--ok-fill); border-color: var(--ok-fill); color: #fff; }
.opt.correct .mk { background: var(--ok-fill); }
.opt.wrong { border-color: var(--bad-fill); background: var(--bad-soft); box-shadow: 0 2px 0 var(--bad-line); }
.opt.wrong .k { background: var(--bad-fill); border-color: var(--bad-fill); color: #fff; }
.opt.wrong .mk { background: var(--bad-fill); }
.opt.dim { opacity: 0.55; }
.opt:disabled { cursor: default; }
.opt.wait { opacity: 0.8; }
@media (hover: hover) { .opt:hover:not(:disabled) { border-color: var(--line-strong); } .opt[aria-pressed="true"]:hover:not(:disabled) { border-color: var(--brand-fill); } }
.idk { display: flex; justify-content: center; margin-top: 18px; }
.notice { margin-top: 16px; border-radius: var(--r-md); padding: 12px 14px; background: var(--warn-soft); border: 1px solid var(--warn-line); color: var(--warn); font-size: 0.92rem; font-weight: 650; display: flex; align-items: center; gap: 10px; }
.notice .grow { flex: 1; }
.locked { text-align: center; padding: 48px 12px; color: var(--muted); }
.locked .btn { margin-top: 16px; }

.qbottom { position: sticky; bottom: 0; z-index: 10; background: var(--bg); border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 10px; }
.qbottom .btn { flex: 1; }
.flag-btn[aria-pressed="true"] { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }

/* feedback sheet */
.fb { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center; pointer-events: none; }
.fb-inner { pointer-events: auto; width: 100%; max-width: 720px; background: var(--surface); border-radius: 22px 22px 0 0; box-shadow: var(--shadow-sheet); padding: 18px 18px calc(16px + env(safe-area-inset-bottom)); max-height: 72dvh; overflow-y: auto; animation: up 0.24s var(--ease); border-top: 4px solid var(--line); }
.fb-inner.ok { border-top-color: var(--ok-fill); }
.fb-inner.bad { border-top-color: var(--bad-fill); }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
.fb-head { display: flex; align-items: center; gap: 10px; }
.fb-head .ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.fb-head .ic svg { width: 20px; height: 20px; }
.fb-inner.ok .ic { background: var(--ok-fill); }
.fb-inner.bad .ic { background: var(--bad-fill); }
.fb-head h2 { font-size: 1.25rem; }
.fb-inner.ok h2 { color: var(--ok); }
.fb-inner.bad h2 { color: var(--bad); }
.fb-answer { margin-top: 10px; font-weight: 700; font-size: 1.02rem; }
.fb-answer span { color: var(--muted); font-weight: 650; }
.fb-exp { margin-top: 10px; color: var(--ink-2); font-size: 0.97rem; line-height: 1.55; }
.fb-exp.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.fb-more { margin-top: 2px; }
.fb-src { margin-top: 8px; font-size: 0.9rem; }
.fb-src a { font-weight: 650; }
.fb-src svg { width: 15px; height: 15px; display: inline-block; vertical-align: -2px; margin-left: 3px; }
.fb .btn { margin-top: 14px; }

/* bottom sheet (dialogs, grid, settings) */
.sheet-back { position: fixed; inset: 0; z-index: 40; background: rgba(15, 17, 25, 0.5); display: flex; align-items: flex-end; justify-content: center; animation: fade 0.18s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet { width: 100%; max-width: 560px; background: var(--surface); border-radius: 24px 24px 0 0; padding: 10px 18px calc(18px + env(safe-area-inset-bottom)); max-height: 88dvh; overflow-y: auto; animation: up 0.24s var(--ease); }
.sheet .grab { width: 40px; height: 5px; border-radius: 999px; background: var(--line-strong); margin: 0 auto 12px; }
.sheet h2 { font-size: 1.25rem; }
.sheet .lead { color: var(--ink-2); margin-top: 6px; font-size: 0.98rem; }
.sheet .btn-stack { margin-top: 18px; }
.sheet-section { margin-top: 20px; }
.sheet-section h3 { font-size: 0.82rem; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
@media (min-width: 700px) { .sheet-back { align-items: center; } .sheet { border-radius: 24px; } }

.seg { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 14px; }
.seg button { flex: 1; min-height: 44px; border: 0; border-radius: 10px; background: transparent; font-weight: 700; font-size: 0.95rem; color: var(--ink-2); }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

.dots { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 8px; margin-top: 16px; }
.dot { position: relative; height: 46px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 750; font-size: 0.95rem; }
.dot.done { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand); }
.dot.cur { box-shadow: 0 0 0 2.5px var(--ink); }
.dot.flag { border-color: var(--warn-line); background: var(--warn-soft); color: var(--warn); }
.dot.flag::after { content: ""; position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--flame); }
.legend-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 0.84rem; color: var(--muted); }
.legend-row span { display: inline-flex; align-items: center; gap: 6px; }
.legend-row i { width: 12px; height: 12px; border-radius: 4px; border: 1.5px solid var(--line); }
.legend-row .l-done { background: var(--brand-soft); border-color: var(--brand-line); }
.legend-row .l-flag { background: var(--warn-soft); border-color: var(--warn-line); }

.danger-link { color: var(--bad); background: none; border: 0; padding: 10px 0; min-height: 44px; font-weight: 700; font-size: 0.92rem; }

/* ---------- results ---------- */
.result-hero { text-align: center; padding: 24px 18px 20px; }
.result-hero .kicker { font-size: 0.82rem; font-weight: 750; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.result-hero .ring { width: 150px; height: 150px; margin: 16px auto 12px; }
.result-hero .ring .val b { font-size: 2.6rem; }
.result-hero .ring .val span { font-size: 0.9rem; }
.result-hero .ring .fg { stroke-width: 10; }
.result-hero .ring .bg { stroke-width: 10; }
.verdict { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 999px; font-weight: 800; font-size: 1rem; }
.verdict svg { width: 18px; height: 18px; }
.verdict.ok { background: var(--ok-soft); color: var(--ok); }
.verdict.bad { background: var(--warn-soft); color: var(--warn); }
.result-hero .sub { margin-top: 10px; color: var(--ink-2); }
.result-hero .stat-grid { margin-top: 18px; }
.delta { margin-top: 12px; display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ok); }

.brows { display: grid; gap: 14px; padding: 18px; }
.brow .top { display: flex; justify-content: space-between; gap: 10px; font-size: 0.93rem; }
.brow .top b { white-space: nowrap; }
.brow .track { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: 6px; }
.brow .track i { display: block; height: 100%; border-radius: 999px; }
.brow .track .hi { background: var(--ok-fill); }
.brow .track .mid { background: #e0a100; }
.brow .track .lo { background: var(--bad-fill); }

.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 14px; margin-bottom: 12px; }
.tab { flex: 1; min-height: 42px; border: 0; border-radius: 10px; background: transparent; font-weight: 700; font-size: 0.93rem; color: var(--ink-2); }
.tab[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.rcard { padding: 16px; }
.rcard + .rcard { margin-top: 10px; }
.rcard .meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.8rem; color: var(--muted); font-weight: 650; margin-bottom: 8px; }
.rcard .meta .chip { height: 24px; font-size: 0.76rem; }
.rcard .scen { color: var(--ink-2); font-size: 0.93rem; margin-bottom: 8px; padding-left: 10px; border-left: 3px solid var(--line-strong); }
.rcard .q { font-weight: 750; margin-bottom: 10px; line-height: 1.35; }
.ans-line { display: flex; gap: 10px; align-items: flex-start; padding: 9px 11px; border-radius: 10px; font-size: 0.95rem; margin-top: 6px; }
.ans-line svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; }
.ans-line.right { background: var(--ok-soft); color: var(--ok); font-weight: 700; }
.ans-line.yours { background: var(--bad-soft); color: var(--bad); }
.rcard details { margin-top: 10px; }
.rcard summary { cursor: pointer; color: var(--brand); font-weight: 700; font-size: 0.92rem; list-style: none; display: inline-flex; align-items: center; gap: 4px; }
.rcard summary::-webkit-details-marker { display: none; }
.rcard summary svg { width: 16px; height: 16px; transition: transform 0.2s; }
.rcard details[open] summary svg { transform: rotate(180deg); }
.rcard details p { margin-top: 8px; color: var(--ink-2); font-size: 0.94rem; line-height: 1.55; }
.empty { text-align: center; padding: 26px 12px; color: var(--muted); }

/* ---------- toast & banners ---------- */
@media (max-width: 380px) { .wide-only { display: none; } .timer svg { display: none; } .timer { padding: 0 10px; } }
.toast { position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 60; width: max-content; text-align: center; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 650; font-size: 0.94rem; box-shadow: var(--shadow-2); max-width: calc(100% - 32px); animation: drop 0.22s var(--ease); }
@keyframes drop { from { opacity: 0; transform: translate(-50%, -10px); } to { opacity: 1; transform: translate(-50%, 0); } }
.offline { position: fixed; left: 0; right: 0; top: 0; z-index: 55; background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid var(--warn-line); text-align: center; font-weight: 700; font-size: 0.88rem; padding: calc(6px + env(safe-area-inset-top)) 12px 6px; }
.banner { margin-top: 12px; border-radius: var(--r-md); padding: 12px 14px; background: var(--bad-soft); border: 1px solid var(--bad-line); color: var(--bad); font-weight: 650; display: flex; align-items: center; gap: 10px; }
.banner .grow { flex: 1; }
.loadbar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 70; overflow: hidden; }
.loadbar::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 40%; background: var(--brand-fill); border-radius: 0 3px 3px 0; animation: load 1s var(--ease) infinite; }
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.qtext:focus { outline: none; }
.skeleton { border-radius: var(--r-lg); background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* inline content inside buttons/links laid out as blocks */
.list-item .grow, .list-item .t, .list-item .d, .exam-card .t, .exam-card .d, .tile .t, .tile .d { display: block; }
.level { color: inherit; text-decoration: none; }
.level .chips .more svg { width: 16px; height: 16px; }
.ring.bad .fg { stroke: var(--bad-fill); }
.ring.warn .fg { stroke: #e0a100; }
[aria-busy="true"] { cursor: progress; }

/* ---------- static content pages (exam lists, questions, home guide) ---------- */
.seo-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; padding-bottom: 6px; }
.seo-top .brand { margin-right: 0; }
.seo { padding-bottom: 8px; }
.seo h1 { font-size: clamp(1.55rem, 6vw, 2.1rem); line-height: 1.15; letter-spacing: -0.03em; margin: 10px 0 14px; }
.seo h2 { font-size: 1.2rem; margin-bottom: 10px; }
.seo p { margin-bottom: 10px; }
.seo .muted { font-weight: 500; }
.crumbs { font-size: 0.85rem; color: var(--muted); margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs a { color: var(--muted); }
.seo-kicker { font-size: 0.8rem; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 18px 0 0 !important; }
.answer-card { padding: 18px; border-left: 5px solid var(--ok-fill); }
.answer-card .k { font-size: 0.8rem; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ok); margin-bottom: 4px; }
.answer-card .v { font-size: 1.15rem; font-weight: 700; margin: 0; }
.seo-sec { margin-top: 26px; }
.seo-sec p { color: var(--ink-2); }
.seo-sec .src { font-size: 0.92rem; }
.chips-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-row .chip { text-decoration: none; }
.cta-card { margin-top: 26px; padding: 20px; background: var(--brand-soft); border-color: var(--brand-line); box-shadow: none; }
.cta-card h2 { margin-bottom: 6px; }
.cta-card p { color: var(--ink-2); }
.q-links { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.q-links a { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 600; }
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 26px; }
.prevnext a { display: block; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); text-decoration: none; color: var(--ink); font-weight: 600; font-size: 0.92rem; line-height: 1.35; }
.prevnext a span { display: block; color: var(--brand); font-size: 0.8rem; font-weight: 750; margin-bottom: 4px; }
.prevnext .next { text-align: right; }
.lead-p { font-size: 1.05rem; color: var(--ink-2); }
.cta-row { margin: 16px 0; }
.facts-card { padding: 18px; margin-top: 18px; }
.toc { margin-top: 26px; }
.toc ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.qa-list { margin: 0; padding-left: 22px; display: grid; gap: 14px; }
.qa-list li::marker { color: var(--muted); font-weight: 700; }
.qa-list a { font-weight: 700; color: var(--ink); text-decoration: none; }
.qa-list a:hover { color: var(--brand); text-decoration: underline; }
.qa-ans { margin: 4px 0 0 !important; color: var(--ok) !important; font-weight: 600; font-size: 0.95rem; }
.guide { margin-top: 34px; padding-top: 26px; border-top: 1px solid var(--line); }
.guide h2 { font-size: 1.2rem; line-height: 1.25; margin-bottom: 8px; }
.guide .seo-sec { margin-top: 30px; }
.guide .fact-nums { margin-top: 12px; }
.guide .exam-links { display: grid; gap: 10px; margin-top: 12px; }
.guide .exam-links a { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); text-decoration: none; color: var(--ink); font-weight: 700; box-shadow: var(--shadow-1); }
.guide .exam-links a span { color: var(--muted); font-weight: 600; font-size: 0.88rem; }
@media (min-width: 700px) { .guide .exam-links { grid-template-columns: repeat(3, 1fr); } .guide .exam-links a { flex-direction: column; align-items: flex-start; } }

/* ---------- desktop ---------- */
@media (min-width: 960px) {
  .page.wide { max-width: 1040px; }
  .home-grid { display: grid; grid-template-columns: 1.2fr 1fr; column-gap: 28px; align-items: start;
    grid-template-areas: "next level" "tiles facts" "resume facts"; }
  .a-next { grid-area: next; } .a-level { grid-area: level; } .a-tiles { grid-area: tiles; } .a-resume { grid-area: resume; } .a-facts { grid-area: facts; }
  .a-level { margin-top: 26px; }
  .qtext { font-size: 1.5rem; }
}
