:root {
  --bg: oklch(97.5% 0.004 85);
  --surface: #fff;
  --text: oklch(22% 0.01 260);
  --muted: oklch(50% 0.012 260);
  --faint: oklch(68% 0.01 260);
  --border: rgba(20, 24, 32, 0.09);
  --accent: oklch(45% 0.13 258);
  --accent-ink: #fff;
  --accent-soft: oklch(94% 0.03 258);
  --good: oklch(52% 0.13 155);
  --good-soft: oklch(95% 0.04 155);
  --bad: oklch(53% 0.18 25);
  --bad-soft: oklch(95% 0.035 25);
  --bar: oklch(91% 0.008 260);
  --shadow: 0 1px 1px rgba(16,20,28,.04), 0 2px 6px rgba(16,20,28,.04), 0 8px 24px rgba(16,20,28,.04);
  --radius: 16px;
  --tabs-h: 64px;
  --fw-normal: 400; --fw-medium: 520; --fw-semibold: 620; --fw-bold: 720;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181b; --surface: #1f2226; --text: oklch(94% 0.005 260); --muted: oklch(72% 0.01 260); --faint: oklch(58% 0.01 260);
    --border: #2c3036; --accent: oklch(72% 0.11 258); --accent-ink: #0d1420; --accent-soft: oklch(30% 0.05 258);
    --good: oklch(74% 0.13 155); --good-soft: oklch(30% 0.05 155); --bad: oklch(72% 0.14 25); --bad-soft: oklch(31% 0.06 25);
    --bar: #2c3036; --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom));
}
button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
.num { font-variant-numeric: tabular-nums; }
#app { max-width: 560px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 18px) 18px 24px; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; min-height: 44px; }
.top h1 { font-size: 26px; letter-spacing: -0.02em; font-weight: var(--fw-bold); }
.eyebrow { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: var(--fw-semibold); }
.link { background: none; border: 0; color: var(--accent); font-weight: var(--fw-medium); min-height: 44px; padding: 0 4px; cursor: pointer; }

/* Cards / surfaces */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 24px; font-weight: var(--fw-bold); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }
.hero h2 { font-size: 21px; letter-spacing: -0.01em; }
.hero p { margin: 6px 0 16px; color: var(--muted); font-size: 15px; }
.meter { height: 6px; border-radius: 6px; background: var(--bar); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .3s ease-out; }

/* Buttons */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 54px; border-radius: 14px; border: 0; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); font-weight: var(--fw-semibold); font-size: 17px; transition: transform .12s ease-out, background-color .15s ease-out; }
.btn.secondary { background: var(--accent-soft); color: var(--accent); }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--border); }
.btn:active { transform: scale(0.97); }

/* Lists */
.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 2px; border: 0; background: none; width: 100%; text-align: left; cursor: pointer; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: var(--fw-medium); }
.row .sub { font-size: 13px; color: var(--muted); }
.row .pct { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 15px; min-width: 3.2em; text-align: right; }
.row .meter { margin-top: 6px; }
.chev { width: 16px; height: 16px; stroke: var(--faint); fill: none; stroke-width: 2; flex: none; }

/* Quiz */
.quiz-top { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; min-height: 44px; }
.quiz-top .meter { flex: 1; }
.close { width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--border); display: grid; place-items: center; cursor: pointer; flex: none; }
.close svg { width: 18px; height: 18px; stroke: var(--text); stroke-width: 2; fill: none; }
.count { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 4.5em; text-align: right; }
.qcat { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); font-weight: var(--fw-semibold); margin-bottom: 8px; }
.sign { display: grid; place-items: center; margin: 4px 0 16px; }
.sign svg { width: 150px; height: 150px; user-select: none; pointer-events: none; }
.q { font-size: 20px; line-height: 1.35; font-weight: var(--fw-semibold); letter-spacing: -0.01em; margin: 0 0 18px; text-wrap: pretty; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 14px 16px; text-align: left; cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); font-size: 16.5px; line-height: 1.35;
  transition: transform .12s ease-out, border-color .15s ease-out, background-color .15s ease-out; }
.opt:active:not([disabled]) { transform: scale(0.98); }
.opt .key { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 13px; font-weight: var(--fw-semibold); color: var(--muted); background: var(--bg); border: 1px solid var(--border); }
.opt[disabled] { cursor: default; }
.opt.correct { border-color: var(--good); background: var(--good-soft); }
.opt.correct .key { background: var(--good); color: #fff; border-color: transparent; }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .key { background: var(--bad); color: #fff; border-color: transparent; }
.opt.dim { opacity: .55; }
.feedback { margin-top: 16px; padding: 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.verdict { display: flex; align-items: center; gap: 8px; font-weight: var(--fw-bold); margin-bottom: 6px; }
.verdict svg { width: 20px; height: 20px; fill: none; stroke-width: 2.4; stroke: currentColor; }
.verdict.good { color: var(--good); } .verdict.bad { color: var(--bad); }
.feedback p { margin: 0; font-size: 15.5px; }
.cite { margin-top: 10px; font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: baseline; }
.cite a { color: inherit; }
.next-wrap { position: sticky; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom)); margin: 6px -18px 0; padding: 16px 18px 12px; background: linear-gradient(to bottom, transparent, var(--bg) 22px); }
.feedback { scroll-margin-bottom: calc(var(--tabs-h) + 96px); }

/* Results */
.big { font-size: 56px; font-weight: var(--fw-bold); letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 14px; font-weight: var(--fw-semibold); }
.pill.good { background: var(--good-soft); color: var(--good); } .pill.bad { background: var(--bad-soft); color: var(--bad); }
.miss { padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 15px; }
.miss:last-child { border-bottom: 0; }
.miss .ans { color: var(--good); font-weight: var(--fw-medium); margin-top: 4px; }

/* About */
.about dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; font-size: 15.5px; }
.about dt { color: var(--muted); }
.about dd { margin: 0; font-weight: var(--fw-medium); }
.note { font-size: 14px; color: var(--muted); }
.note a, .about a { color: var(--accent); }
p { max-width: 65ch; }

/* Tabs */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); height: calc(var(--tabs-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: color-mix(in oklch, var(--bg) 88%, transparent); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-top: 1px solid var(--border); z-index: 100; }
.tab { border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--faint); font-size: 11.5px; font-weight: var(--fw-medium); cursor: pointer; transition: color .15s ease-out; }
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab[aria-current="page"] { color: var(--accent); }

/* Motion */
.enter { animation: rise .22s ease-out both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.flash { animation: flash 1s steps(1, end) infinite; }
@keyframes flash { 50% { opacity: .15; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.miss-sign { width: 56px; height: 56px; margin-bottom: 6px; }
.miss-sign svg { width: 100%; height: 100%; display: block; }
