:root {
  --bg: #f7f1e6;
  --surface: #fffaf1;
  --surface-2: #efe4d2;
  --text: #2a1d14;
  --muted: #6e5a48;
  --line: #dccbb2;
  --gold: #b47a0e;
  --gold-soft: #f3dfb2;
  --green: #2f7a4a;
  --green-soft: #d8eedd;
  --red: #b2412d;
  --red-soft: #f6dbd3;
  --on-accent: #fffaf1;
  --shadow: 0 1px 2px rgba(42, 29, 20, .08), 0 4px 16px rgba(42, 29, 20, .06);
  --radius: 14px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1410;
    --surface: #271c16;
    --surface-2: #33251c;
    --text: #f4eadb;
    --muted: #bba78f;
    --line: #47362a;
    --gold: #e7ac3c;
    --gold-soft: #4a3714;
    --green: #6cc28a;
    --green-soft: #1f3a29;
    --red: #ec8a73;
    --red-soft: #4a231b;
    --on-accent: #1c1410;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1c1410; --surface: #271c16; --surface-2: #33251c; --text: #f4eadb; --muted: #bba78f;
  --line: #47362a; --gold: #e7ac3c; --gold-soft: #4a3714; --green: #6cc28a; --green-soft: #1f3a29;
  --red: #ec8a73; --red-soft: #4a231b; --on-accent: #1c1410; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 var(--sans);
  min-height: 100vh;
  min-height: 100dvh;
}
main {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 20px) 16px calc(env(safe-area-inset-bottom) + 32px);
}
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0; }
h1 { font-size: 34px; letter-spacing: -.01em; }
h2 { font-size: 24px; }
h3 { font-size: 18px; }
p { margin: 0; }
button { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.brand svg { width: 44px; height: 44px; flex: none; }
.tagline { color: var(--muted); margin-bottom: 20px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.stat b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }

.btn {
  display: block; width: 100%; border: 0; border-radius: var(--radius);
  padding: 15px 18px; font-weight: 600; cursor: pointer; text-align: center;
  background: var(--gold); color: var(--on-accent);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.985); }
.btn.secondary { background: var(--surface-2); color: var(--text); }
.btn + .btn { margin-top: 10px; }
.link-btn { background: none; border: 0; padding: 8px 0; color: var(--muted); cursor: pointer; text-decoration: underline; }

.section-title { margin: 24px 0 10px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-family: var(--sans); font-weight: 600; }

.cards { display: grid; gap: 10px; }
.card {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow); cursor: pointer;
}
.card:disabled { cursor: default; opacity: .55; box-shadow: none; }
.card .icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--gold-soft); font-size: 22px; flex: none; }
.card .body { flex: 1; min-width: 0; }
.card .meta { font-size: 14px; color: var(--muted); }
.pips { display: flex; gap: 4px; margin-top: 6px; }
.pip { width: 22px; height: 6px; border-radius: 3px; background: var(--line); }
.pip.on { background: var(--gold); }
.pip.done { background: var(--green); }
.chev { color: var(--muted); font-size: 22px; }

.settings { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.setting { display: flex; align-items: center; gap: 12px; padding: 14px; }
.setting + .setting { border-top: 1px solid var(--line); }
.setting .body { flex: 1; }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch .track { position: absolute; inset: 0; border-radius: 16px; background: var(--line); transition: background .2s; pointer-events: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 2px solid var(--gold); outline-offset: 2px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.back { background: none; border: 0; padding: 6px 0; color: var(--muted); cursor: pointer; font-weight: 600; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-bottom: 18px; }
.progress > div { height: 100%; background: var(--gold); transition: width .3s; }
.timer { height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; margin: -10px 0 18px; }
.timer > div { height: 100%; background: var(--red); transform-origin: left; }

.question { font-family: var(--serif); font-size: 24px; line-height: 1.3; margin-bottom: 20px; }
.choices { display: grid; gap: 10px; }
.choice {
  width: 100%; text-align: left; padding: 15px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1.5px solid var(--line); cursor: pointer;
  box-shadow: var(--shadow);
}
.choice:disabled { cursor: default; box-shadow: none; }
.choice.correct { border-color: var(--green); background: var(--green-soft); }
.choice.wrong { border-color: var(--red); background: var(--red-soft); }
.choice.dim { opacity: .55; }

.feedback { margin-top: 18px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.feedback .verdict { font-weight: 700; margin-bottom: 6px; }
.feedback .verdict.ok { color: var(--green); }
.feedback .verdict.no { color: var(--red); }
.feedback .fact-label { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--gold); font-weight: 700; margin-bottom: 2px; }
.feedback + .btn { margin-top: 14px; }

.pill { display: inline-block; font-size: 13px; padding: 3px 10px; border-radius: 999px; background: var(--gold-soft); color: var(--text); font-weight: 600; }

.result { text-align: center; padding: 16px 0 8px; }
.result .big { font-family: var(--serif); font-size: 64px; line-height: 1; margin: 12px 0 4px; font-variant-numeric: tabular-nums; }
.result p { margin-bottom: 6px; }
.unlock { margin: 16px 0; padding: 14px; border-radius: var(--radius); background: var(--green-soft); color: var(--text); text-align: center; font-weight: 600; }
.review { margin: 18px 0; display: grid; gap: 8px; }
.review-item { font-size: 15px; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.review-item b { color: var(--muted); font-weight: 600; }

.footer { margin-top: 28px; text-align: center; font-size: 13px; color: var(--muted); }
.install-tip { margin-top: 20px; padding: 12px 14px; font-size: 14px; border-radius: var(--radius); background: var(--surface-2); color: var(--muted); }

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