/* Palette: asphalt navy + sunrise amber, warm paper background. All text pairs target WCAG AA (>= 4.5:1). */
:root {
  --bg: #f6f3ea; --card: #ffffff; --ink: #14213d; --muted: #4a5568; --line: #d9d4c5;
  --brand: #14213d; --on-brand: #ffffff; --accent: #ffb703; --on-accent: #14213d;
  --good: #0b6b4f; --good-bg: #dff3ea; --bad: #a3231b; --bad-bg: #fbe4e1; --warn-bg: #fff1c9;
  --focus: #1d4ed8; --shadow: 0 1px 2px rgba(20,33,61,.08), 0 6px 18px rgba(20,33,61,.06);
  --road: #2b3550; --r: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #0e1526; --card: #17223b; --ink: #eef1f8; --muted: #b3bdd3; --line: #2b3855; --brand: #0b1220; --on-brand: #fff; --good: #5fd3a8; --good-bg: #123a2e; --bad: #ff9a90; --bad-bg: #44201d; --warn-bg: #433512; --focus: #8ab4ff; --shadow: none; --road: #8793b0; }
}
:root[data-theme="dark"] { --bg: #0e1526; --card: #17223b; --ink: #eef1f8; --muted: #b3bdd3; --line: #2b3855; --brand: #0b1220; --on-brand: #fff; --good: #5fd3a8; --good-bg: #123a2e; --bad: #ff9a90; --bad-bg: #44201d; --warn-bg: #433512; --focus: #8ab4ff; --shadow: none; --road: #8793b0; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 1.0625rem/1.55 "Avenir Next", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; padding-bottom: 88px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; margin: 1.2rem 0 .5rem; }
h1 { font-size: clamp(1.6rem, 5vw, 2.2rem); } h2 { font-size: 1.3rem; }
p { margin: .5rem 0; } a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { outline: none; }
#next { scroll-margin-bottom: 100px; } .fb { scroll-margin-bottom: 100px; }
.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { position: fixed; top: 8px; left: 8px; z-index: 99; background: var(--accent); color: var(--on-accent); padding: .6rem 1rem; border-radius: 10px; }
.sub { display: block; color: var(--muted); font-size: .95rem; } .fine { color: var(--muted); font-size: .875rem; }
.lead { font-size: 1.15rem; max-width: 60ch; } .loading { padding: 2rem 1rem; }

.top { background: var(--brand); color: var(--on-brand); padding: .7rem 1rem calc(.7rem + env(safe-area-inset-top)); padding-top: calc(.7rem + env(safe-area-inset-top)); display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; justify-content: space-between; }
.brand { display: flex; gap: .55rem; align-items: center; font-weight: 800; }
.chips { display: flex; gap: .5rem; flex-wrap: nowrap; width: 100%; }
.chip { flex: 1 1 0; min-width: 0; background: rgba(255,255,255,.12); border-radius: 12px; padding: .3rem .6rem; display: grid; gap: 2px; font-size: .8rem; line-height: 1.25; }
.chip.streak { display: flex; flex-wrap: wrap; align-items: center; gap: 0 .4rem; flex: 0 1 auto; } .chip.streak .chip-s { flex-basis: 100%; }
.chip-t { font-weight: 700; } .chip-s { opacity: .85; font-size: .78rem; }
.chip.streak.on { background: #ffb703; color: #14213d; } .chip.streak.on .chip-s { opacity: 1; }
.bar { display: block; height: 8px; background: rgba(127,127,127,.28); border-radius: 99px; overflow: hidden; } .bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s; }
.bar.wide { height: 12px; } .bar.wide i { background: var(--good); } .bar.low i { background: var(--bad); }

main { max-width: 760px; margin: 0 auto; padding: .5rem 1rem 1rem; outline: none; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem 1.1rem; margin: .9rem 0; box-shadow: var(--shadow); }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin: .8rem 0; } .row.end { justify-content: flex-end; }
.btn { appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 700; min-height: 48px; padding: .6rem 1.2rem; border-radius: 14px; background: var(--accent); color: var(--on-accent); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.btn:hover { filter: brightness(1.05); } .btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); } .btn.danger { background: var(--bad); color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.danger { color: #14213d; } } :root[data-theme="dark"] .btn.danger { color: #14213d; }
.btn.sm { min-height: 40px; padding: .35rem .9rem; font-size: .95rem; }
.pill { display: inline-block; padding: .2rem .7rem; border-radius: 99px; background: var(--warn-bg); font-weight: 700; font-size: .9rem; } .pill.ok { background: var(--good-bg); color: var(--good); } .pill.no { background: var(--bad-bg); color: var(--bad); }

/* Quests + road trip map */
.quests { display: grid; gap: .6rem; margin-top: 1rem; }
.quest { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: .8rem 1rem; display: flex; justify-content: space-between; gap: .8rem; align-items: center; } .quest strong { display: block; }
.trip { list-style: none; margin: 1rem 0; padding: 0; position: relative; display: grid; gap: .9rem; }
.trip::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 8px; transform: translateX(-50%); background: repeating-linear-gradient(to bottom, var(--road) 0 18px, transparent 18px 30px); opacity: .35; border-radius: 4px; }
.trip li { position: relative; width: 88%; } .trip li.l { justify-self: start; } .trip li.r { justify-self: end; }
.stop { width: 100%; display: flex; align-items: center; gap: .8rem; text-align: left; background: var(--card); color: var(--ink); border: 2px solid var(--line); border-radius: 18px; padding: .75rem .9rem; min-height: 72px; text-decoration: none; font: inherit; cursor: pointer; box-shadow: var(--shadow); }
.stop:hover { border-color: var(--accent); } .stop.done { border-color: var(--good); } .stop.locked { background: var(--bg); border-style: dashed; color: var(--muted); }
.stop .num { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: var(--on-brand); font-weight: 800; }
.stop.done .num { background: var(--good); color: var(--bg); } .stop .txt { flex: 1; display: grid; } .stop .cn { color: var(--muted); font-size: .92rem; } .stop .st { font-size: .85rem; font-weight: 700; }
.ring { --p: 0; flex: none; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--good) calc(var(--p) * 1%), var(--line) 0); position: relative; }
.ring::before { content: ""; position: absolute; inset: 6px; background: var(--card); border-radius: 50%; } .ring b { position: relative; font-size: .78rem; }

.modes { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.mode { text-align: left; font: inherit; color: var(--ink); background: var(--card); border: 2px solid var(--line); border-radius: var(--r); padding: 1rem; cursor: pointer; display: grid; gap: .25rem; min-height: 96px; position: relative; }
.mode:hover { border-color: var(--accent); } .mode strong { font-size: 1.1rem; } .mode .tag { position: absolute; top: .7rem; right: .7rem; font-size: .75rem; font-weight: 800; background: var(--accent); color: var(--on-accent); border-radius: 99px; padding: .1rem .55rem; }

/* Quiz */
.qhead { display: grid; grid-template-columns: auto 1fr; gap: .5rem .8rem; align-items: center; margin-top: .6rem; } .qhead .prog { font-weight: 700; text-align: right; } .qhead .bar { grid-column: 1 / -1; }
.timer { position: relative; height: 26px; background: rgba(127,127,127,.25); border-radius: 99px; overflow: hidden; margin: .5rem 0; } .timer i { position: absolute; inset: 0 auto 0 0; width: 100%; background: var(--accent); } .timer b { position: absolute; right: .7rem; top: 0; line-height: 26px; font-size: .9rem; color: var(--on-accent); mix-blend-mode: normal; }
.q { position: relative; } .ribbon { position: absolute; top: -12px; left: 14px; background: var(--brand); color: var(--on-brand); padding: .1rem .8rem; border-radius: 99px; font-weight: 800; font-size: .8rem; }
.qsign { display: flex; justify-content: center; margin: .6rem 0; } .sign { max-width: 100%; height: auto; filter: drop-shadow(0 2px 3px rgba(0,0,0,.25)); }
.qtext { display: flex; gap: .6rem; align-items: flex-start; justify-content: space-between; } .qtext h1 { font-size: 1.3rem; margin: .4rem 0; outline: none; }
.opts { display: grid; gap: .6rem; margin: 1rem 0; } .optrow { display: flex; gap: .4rem; align-items: stretch; }
.opt { flex: 1; text-align: left; font: inherit; color: var(--ink); background: var(--bg); border: 2px solid var(--line); border-radius: 14px; padding: .7rem .9rem; min-height: 56px; cursor: pointer; display: grid; grid-template-columns: 32px 1fr; gap: .2rem .7rem; align-items: center; }
.opt:hover:not(:disabled) { border-color: var(--accent); } .opt.sel, .opt[aria-pressed="true"] { border-color: var(--focus); box-shadow: inset 0 0 0 1px var(--focus); }
.opt .ltr { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; font-weight: 800; font-size: .9rem; }
.opt:disabled { cursor: default; color: var(--ink); } .opt.right { background: var(--good-bg); border-color: var(--good); } .opt.wrong { background: var(--bad-bg); border-color: var(--bad); }
.opt .mark { grid-column: 2; font-weight: 800; font-size: .85rem; } .opt.right .mark { color: var(--good); } .opt.wrong .mark { color: var(--bad); }
.spk { flex: none; width: 48px; min-height: 48px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); cursor: pointer; font-size: 1.1rem; color: var(--ink); } .spk:hover { border-color: var(--accent); }
.fb { border-radius: 14px; padding: .8rem 1rem; margin: .8rem 0; outline: none; } .fb.ok { background: var(--good-bg); } .fb.no { background: var(--bad-bg); } .fb .xp { float: right; font-weight: 800; color: var(--good); }
.ref { color: var(--muted); font-size: .88rem; }
.enter { animation: rise .25s ease-out; } .pop { animation: pop .3s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } } @keyframes pop { 0% { transform: scale(.96); } 60% { transform: scale(1.02); } }

/* Results / progress */
.score { display: flex; align-items: baseline; gap: .8rem; font-size: 1.1rem; } .score b { font-size: 3rem; line-height: 1; }
.bars { list-style: none; padding: 0; margin: .6rem 0; display: grid; gap: .55rem; } .bars li { display: grid; grid-template-columns: minmax(110px, 1.2fr) 2fr 3.2rem; gap: .6rem; align-items: center; font-size: .95rem; } .bars b { text-align: right; }
.banner { border-radius: var(--r); padding: 1rem 1.2rem; margin: 1rem 0; border: 2px solid var(--line); background: var(--card); } .banner.ready { background: var(--good-bg); border-color: var(--good); } .banner.notyet { background: var(--warn-bg); border-color: var(--accent); } .banner h2 { margin-top: 0; }
.stats { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); } .stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: .7rem .9rem; display: grid; } .stat span { color: var(--muted); font-size: .85rem; } .stat b { font-size: 1.2rem; }
.chart { width: 100%; height: auto; } .chart .pass { fill: var(--good); } .chart .fail { fill: var(--muted); } .chart .lbl { fill: var(--ink); font-size: 10px; font-weight: 700; } .chart .passline { stroke: var(--bad); stroke-dasharray: 4 3; stroke-width: 1.5; } .chart .axis { stroke: var(--line); }
.badges { list-style: none; padding: 0; display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); } .badge { background: var(--card); border: 2px dashed var(--line); border-radius: 14px; padding: .7rem .9rem; display: grid; color: var(--muted); } .badge.on { border: 2px solid var(--accent); color: var(--ink); } .badge span { font-size: .88rem; } .badge.sm { display: inline-block; margin: 0 .3rem .3rem 0; padding: .1rem .6rem; border-radius: 99px; }
.levels { padding-left: 1.2rem; } .levels .cur { font-weight: 800; color: var(--good); } .levels .past { color: var(--muted); }
.facts { list-style: none; padding: 0; display: grid; gap: .6rem; } .fact { display: flex; gap: .8rem; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: .8rem 1rem; } .fact > div { flex: 1; } .fact p { margin: 0; }
details.rv summary { cursor: pointer; font-weight: 700; padding: .3rem 0; min-height: 44px; display: flex; align-items: center; }
.form { display: grid; gap: .5rem; } .form label { font-weight: 700; margin-top: .4rem; } .form input:not([type=checkbox]):not([type=range]), .form select { font: inherit; padding: .6rem .8rem; min-height: 48px; border-radius: 12px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); width: 100%; }
.rng { display: flex; gap: .8rem; align-items: center; } .rng input { flex: 1; min-height: 40px; } .chk { display: flex !important; gap: .7rem; align-items: center; font-weight: 600 !important; min-height: 48px; } .chk input { width: 24px; height: 24px; }
table { width: 100%; border-collapse: collapse; } th, td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--line); }

/* Nav + footer */
.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--card); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, 1fr); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { text-decoration: none; display: grid; justify-items: center; gap: 0; padding: .45rem 0 .5rem; min-height: 60px; font-size: .8rem; font-weight: 700; color: var(--muted); } .tabs a span { font-size: 1.35rem; line-height: 1.3; } .tabs a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 3px 0 var(--accent); }
.foot { max-width: 760px; margin: 1.5rem auto 0; padding: 1rem; border-top: 1px solid var(--line); font-size: .92rem; color: var(--muted); } .foot h2 { font-size: 1rem; margin: 0 0 .3rem; color: var(--ink); }
.dlg { border: 0; border-radius: var(--r); padding: 1.2rem; max-width: min(92vw, 420px); background: var(--card); color: var(--ink); } .dlg::backdrop { background: rgba(0,0,0,.55); }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--brand); color: var(--on-brand); padding: .7rem 1.1rem; border-radius: 14px; max-width: 92vw; z-index: 60; box-shadow: 0 6px 24px rgba(0,0,0,.3); transition: opacity .5s; } .toast.good { background: var(--good); color: #fff; } .toast.warn { background: #7a4b00; color: #fff; } .toast.out { opacity: 0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast.good { color: #0e1526; } } :root[data-theme="dark"] .toast.good { color: #0e1526; }

@media (min-width: 720px) { .chips { width: auto; } .chip { min-width: 10rem; flex: none; } .trip li { width: 70%; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@media (forced-colors: active) { .opt, .stop, .btn { border: 2px solid ButtonText; } }

/* Daily goal + cats */
.catcard { display: flex; gap: 1rem; align-items: center; } .catcard h2 { margin: .1rem 0 .3rem; } .catpic { flex: none; } .cat { display: block; filter: drop-shadow(0 0 1.2px rgba(20,33,61,.65)); }
.kicker { margin: 0; font-size: .8rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.cats { list-style: none; padding: 0; display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.cat-slot { background: var(--card); border: 2px dashed var(--line); border-radius: 14px; padding: .6rem; display: grid; justify-items: center; text-align: center; gap: .2rem; } .cat-slot.got { border: 2px solid var(--accent); }
.cat-slot .lock { width: 84px; height: 84px; display: grid; place-items: center; font-size: 2rem; font-weight: 800; color: var(--muted); }
@media (max-width: 420px) { .catcard { flex-direction: column; text-align: center; } }
