/* Polymath. Layout: a full-height app; the feed is a vertical scroll-snap stack of full-screen cards,
   other sections are single-column pages. Every card takes its topic's hue (--h) for accent and glow.
   Dark-first (it replaces late-evening scrolling), with a light palette from the system setting. */

@font-face { font-family: "Newsreader"; src: url("fonts/Newsreader-normal-latin.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Newsreader"; src: url("fonts/Newsreader-normal-latin-ext.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Newsreader"; src: url("fonts/Newsreader-italic-latin.woff2") format("woff2"); font-weight: 400 600; font-style: italic; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Newsreader"; src: url("fonts/Newsreader-italic-latin-ext.woff2") format("woff2"); font-weight: 400 600; font-style: italic; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Schibsted Grotesk"; src: url("fonts/SchibstedGrotesk-normal-latin.woff2") format("woff2"); font-weight: 400 800; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Schibsted Grotesk"; src: url("fonts/SchibstedGrotesk-normal-latin-ext.woff2") format("woff2"); font-weight: 400 800; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --bg: #11131a; --raised: #191c25; --sunk: #0c0e13;
  --line: #dfe3f01f; --line-strong: #dfe3f047;
  --fg: #eceef4; --fg-2: #a9afbf; --fg-3: #767d90;
  --good: oklch(0.79 0.15 152); --bad: oklch(0.72 0.17 27);
  --h: 255; --acc-l: 0.81; --acc-c: 0.12; --soft-a: 0.13; --glow-l: 0.55; --glow-c: 0.16; --glow-a: 0.34; --ink-l: 0.22;
  --font-read: "Newsreader", "Iowan Old Style", "New York", Georgia, serif;
  --font-ui: "Schibsted Grotesk", -apple-system, "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --gutter-l: max(20px, env(safe-area-inset-left, 0px)); --gutter-r: max(20px, env(safe-area-inset-right, 0px));
  --top: env(safe-area-inset-top, 0px); --bottom: env(safe-area-inset-bottom, 0px);
  --tabs: 58px; --radius: 14px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f2f3f6; --raised: #ffffff; --sunk: #e7e9ee;
    --line: #1a1f2e1c; --line-strong: #1a1f2e40;
    --fg: #161a24; --fg-2: #4b5263; --fg-3: #737a8b;
    --good: oklch(0.55 0.15 152); --bad: oklch(0.55 0.19 27);
    --acc-l: 0.5; --acc-c: 0.15; --soft-a: 0.1; --glow-l: 0.78; --glow-c: 0.12; --glow-a: 0.4; --ink-l: 0.99;
    color-scheme: light;
  }
}
/* An explicit light choice (used when the page is shown inside another app) */
:root[data-theme="light"] {
  --bg: #f2f3f6; --raised: #ffffff; --sunk: #e7e9ee;
  --line: #1a1f2e1c; --line-strong: #1a1f2e40;
  --fg: #161a24; --fg-2: #4b5263; --fg-3: #737a8b;
  --good: oklch(0.55 0.15 152); --bad: oklch(0.55 0.19 27);
  --acc-l: 0.5; --acc-c: 0.15; --soft-a: 0.1; --glow-l: 0.78; --glow-c: 0.12; --glow-a: 0.4; --ink-l: 0.99;
  color-scheme: light;
}

/* Hue-bearing tokens are recomputed wherever an element sets its own --h (topic colour). */
:root, [style*="--h"] {
  --accent: oklch(var(--acc-l) var(--acc-c) var(--h)); --accent-ink: oklch(var(--ink-l) 0.04 var(--h));
  --accent-soft: oklch(var(--acc-l) var(--acc-c) var(--h) / var(--soft-a)); --glow: oklch(var(--glow-l) var(--glow-c) var(--h) / var(--glow-a));
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--fg); }
body { font: 400 16px/1.5 var(--font-ui); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; overflow: hidden; overscroll-behavior: none; }
button, input, select { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app { height: 100%; display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.view { min-height: 0; position: relative; }
.view--page { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }

/* ---------- Top bar over the feed ---------- */
.topbar {
  position: absolute; z-index: 5; inset: 0 0 auto;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: calc(var(--top) + 10px) var(--gutter-r) 10px var(--gutter-l);
  background: linear-gradient(var(--bg) 30%, transparent); pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand { display: grid; justify-items: start; gap: 0; padding: 4px 0; border: 0; background: none; cursor: pointer; text-align: left; min-width: 0; }
.brand__name { font: 600 21px/1.1 var(--font-read); letter-spacing: -0.01em; font-style: italic; }
.brand__filter { font-size: 12px; color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }
.brand__filter::after { content: " ▾"; }
.today { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border: 1px solid var(--line); border-radius: 99px; background: color-mix(in srgb, var(--raised) 80%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); cursor: pointer; }
.ring { width: 30px; height: 30px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3.5; }
.ring__track { stroke: var(--line-strong); }
.ring__fill { stroke: var(--good); stroke-linecap: round; stroke-dasharray: 0 100; transition: stroke-dasharray 0.5s; }
.today__text { font-size: 14px; font-variant-numeric: tabular-nums; color: var(--fg-2); }
.today__text b { color: var(--fg); font-weight: 600; }
.today__streak { font-size: 12px; color: var(--fg-3); }
.today__streak:empty { display: none; }

/* ---------- Feed ---------- */
.feed { height: 100%; overflow-y: auto; scroll-snap-type: y mandatory; overscroll-behavior-y: contain; scrollbar-width: none; }
.feed::-webkit-scrollbar { display: none; }
.loading { position: absolute; inset: 45% 0 auto; text-align: center; color: var(--fg-3); }

.card {
  --pad-top: calc(var(--top) + 76px);
  position: relative; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; overflow: hidden;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  padding: var(--pad-top) var(--gutter-r) 14px var(--gutter-l);
  background: radial-gradient(130% 55% at 105% -5%, var(--glow), transparent 62%), radial-gradient(90% 40% at -20% 110%, oklch(0.5 0.1 calc(var(--h) + 40) / 0.12), transparent 70%), var(--bg);
}
.card__meta { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.eyebrow { margin: 0; font: 600 12px/1.4 var(--font-ui); letter-spacing: 0.13em; text-transform: uppercase; color: var(--accent); }
.kind { margin: 0; font: 500 12px/1.4 var(--font-mono); color: var(--fg-3); white-space: nowrap; }
.card__main { min-height: 0; display: flex; flex-direction: column; overflow-y: auto; scrollbar-width: none; padding-block: 12px; max-width: 34rem; width: 100%; margin-inline: auto; }
.card__main::-webkit-scrollbar { display: none; }
/* Auto margins centre the stack but, unlike justify-content, never push overflow out of reach */
.stack { margin-block: auto; display: grid; gap: 18px; }
.headline { margin: 0; font: 500 clamp(29px, 7.6vw, 42px)/1.08 var(--font-read); letter-spacing: -0.018em; text-wrap: balance; }
.body { margin: 0; font: 400 clamp(18px, 4.8vw, 20px)/1.5 var(--font-read); color: var(--fg); text-wrap: pretty; }
.body + .body { margin-top: -6px; }
.card__actions { display: flex; gap: 8px; justify-content: space-between; align-items: center; max-width: 34rem; width: 100%; margin-inline: auto; }
.card__actions .spacer { flex: 1; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border: 1px solid transparent; border-radius: 99px; font: 600 15px/1 var(--font-ui); cursor: pointer; text-decoration: none; -webkit-user-select: none; user-select: none; transition: background 0.2s, border-color 0.2s, transform 0.1s; }
.btn:active { transform: scale(0.97); }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--ghost { background: transparent; border-color: var(--line-strong); }
.btn--soft { background: var(--accent-soft); color: var(--accent); }
.btn--wide { width: 100%; }
.btn--danger { color: var(--bad); }
.btn[disabled] { opacity: 0.55; cursor: default; }
.iconbtn { display: inline-grid; place-items: center; width: 46px; height: 46px; border: 1px solid var(--line); border-radius: 50%; background: color-mix(in srgb, var(--raised) 70%, transparent); cursor: pointer; flex: none; }
.iconbtn svg, .tab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.iconbtn[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.iconbtn[aria-pressed="true"] svg { fill: currentColor; }
.linkbtn { padding: 8px 0; border: 0; background: none; color: var(--accent); font-weight: 600; cursor: pointer; }

/* Quiz */
.question { margin: 0; font: 500 clamp(24px, 6.2vw, 33px)/1.15 var(--font-read); letter-spacing: -0.012em; text-wrap: balance; }
.big { font-size: clamp(96px, 30vw, 150px); line-height: 1; text-align: center; margin: -6px 0; }
.tile { align-self: center; display: grid; width: 132px; aspect-ratio: 1; max-width: 100%; padding: 10px 12px; border: 2px solid var(--accent); border-radius: 10px; background: var(--accent-soft); }
.tile__n { font: 500 15px/1 var(--font-mono); color: var(--fg-2); }
.tile__sym { font: 600 64px/1 var(--font-read); text-align: center; align-self: center; }
.options { display: grid; gap: 10px; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: color-mix(in srgb, var(--raised) 75%, transparent); text-align: left; font: 500 17px/1.3 var(--font-ui); cursor: pointer; transition: border-color 0.2s, background 0.2s, opacity 0.3s; }
.opt__key { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--sunk); font: 600 13px/1 var(--font-mono); color: var(--fg-2); }
.opt:not([disabled]):active { background: var(--accent-soft); }
.opt[disabled] { cursor: default; }
.opt.is-right { border-color: var(--good); background: color-mix(in srgb, var(--good) 16%, transparent); }
.opt.is-right .opt__key { background: var(--good); color: var(--bg); }
.opt.is-wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }
.opt.is-wrong .opt__key { background: var(--bad); color: var(--bg); }
.opt.is-dim { opacity: 0.45; }
.reveal { display: grid; gap: 6px; padding: 14px 16px; border-radius: 12px; background: var(--sunk); animation: rise 0.35s ease-out; }
.reveal__verdict { margin: 0; font: 700 13px/1.3 var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; }
.reveal__verdict.good { color: var(--good); }
.reveal__verdict.bad { color: var(--bad); }
.reveal__text { margin: 0; font: 400 17px/1.45 var(--font-read); color: var(--fg); }
.card--compact .stack { gap: 14px; }
.card--compact .question { font-size: clamp(21px, 5.4vw, 27px); }
.card--compact .opt { min-height: 48px; font-size: 16px; }
.card--compact .reveal__text { font-size: 16px; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Lesson: horizontal slides inside the card, with story-style progress segments */
.card--lesson { padding-inline: 0; }
.card--lesson .card__meta, .card--lesson .card__actions { padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
.card--lesson .card__actions { max-width: calc(34rem + 40px); }
.segs { display: flex; gap: 4px; padding: 10px var(--gutter-r) 0 var(--gutter-l); max-width: calc(34rem + 40px); width: 100%; margin-inline: auto; }
.segs span { flex: 1; height: 3px; border-radius: 3px; background: var(--line-strong); transition: background 0.3s; }
.segs span.on { background: var(--accent); }
.lesson { display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: 0; }
.slides { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none; min-height: 0; }
.slides::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: start; scroll-snap-stop: always; display: flex; flex-direction: column; gap: 14px; padding: 12px var(--gutter-r) 12px var(--gutter-l); min-width: 0; overflow-y: auto; scrollbar-width: none; }
.slide::-webkit-scrollbar { display: none; }
.slide > * { max-width: 34rem; width: 100%; margin-inline: auto; }
/* Centred by auto margins, so a slide taller than the screen still scrolls from its top */
.slide > :first-child { margin-top: auto; }
.slide > :last-child { margin-bottom: auto; }
.slide__n { margin: 0 auto 0; font: 500 13px/1 var(--font-mono); color: var(--accent); }
.slide__h { margin: 0 auto; font: 500 clamp(23px, 6.2vw, 32px)/1.12 var(--font-read); letter-spacing: -0.012em; text-wrap: balance; }
.slide .body { margin-inline: auto; font-size: clamp(17px, 4.5vw, 19px); line-height: 1.47; }
/* A soft fade at the bottom says there is more to scroll */
.is-more { -webkit-mask-image: linear-gradient(#000 calc(100% - 36px), transparent); mask-image: linear-gradient(#000 calc(100% - 36px), transparent); }
.subtitle { margin: 0 auto; font: italic 400 clamp(19px, 5vw, 22px)/1.4 var(--font-read); color: var(--fg-2); }
.swipe-hint { margin: 6px auto 0; font: 500 13px/1.4 var(--font-ui); color: var(--fg-3); display: flex; align-items: center; gap: 8px; }
.swipe-hint::after { content: "→"; color: var(--accent); animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateX(5px); } }

/* Prompt card in the feed (teach-me, AI top-up, finished topic) */
.card--prompt .stack { gap: 22px; }
.card--prompt .teach__row { display: flex; gap: 8px; }

/* ---------- Tabs ---------- */
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); background: var(--bg); padding: 0 env(safe-area-inset-right, 0px) var(--bottom) env(safe-area-inset-left, 0px); }
.tab { display: grid; justify-items: center; align-content: center; gap: 3px; height: var(--tabs); border: 0; background: none; color: var(--fg-3); font: 500 11px/1 var(--font-ui); letter-spacing: 0.02em; cursor: pointer; }
.tab[aria-current="page"] { color: var(--fg); }
.tab[aria-current="page"] svg { stroke: var(--accent); }

/* ---------- Pages ---------- */
.page { max-width: 40rem; margin: 0 auto; display: grid; gap: 30px; padding: calc(var(--top) + 28px) var(--gutter-r) 48px var(--gutter-l); }
.page__head { display: grid; gap: 8px; }
h1 { margin: 0; font: 500 clamp(36px, 9vw, 48px)/1.05 var(--font-read); letter-spacing: -0.02em; text-wrap: balance; }
.lead { margin: 0; font: 400 18px/1.5 var(--font-read); color: var(--fg-2); max-width: 36rem; }
.label { margin: 0; padding: 0; font: 600 12px/1.4 var(--font-ui); letter-spacing: 0.13em; text-transform: uppercase; color: var(--fg-3); }
.hint { margin: 0; font-size: 14px; line-height: 1.5; color: var(--fg-3); }
.group { display: grid; gap: 12px; margin: 0; padding: 0; border: 0; min-width: 0; }
fieldset.group legend { margin-bottom: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-between { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.count { font: 500 14px/1 var(--font-mono); color: var(--fg-2); font-variant-numeric: tabular-nums; }
.input { width: 100%; min-height: 48px; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--raised); font-size: 16px; }
.input:focus { outline: none; border-color: var(--accent); }
.select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--fg-3) 50%), linear-gradient(135deg, var(--fg-3) 50%, transparent 50%); background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
.field { display: grid; gap: 6px; }
.field__label { font-size: 13px; color: var(--fg-2); }
.switch { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; color: var(--fg-2); cursor: pointer; line-height: 1.4; }
.switch input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--accent); }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { min-height: 42px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: 99px; background: none; font-size: 15px; font-weight: 500; cursor: pointer; }
.seg button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.teach { display: grid; gap: 10px; padding: 18px; border-radius: var(--radius); background: var(--raised); border: 1px solid var(--line); }
.teach__row { display: flex; gap: 8px; }
.teach__row .input { flex: 1; min-width: 0; }
.topic-actions { display: flex; gap: 20px; margin-bottom: -18px; }

.topics { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.topic { position: relative; display: grid; gap: 10px; align-content: space-between; min-height: 112px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--raised); text-align: left; cursor: pointer; overflow: hidden; transition: border-color 0.2s, opacity 0.2s; }
.topic::before { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 80% at 110% -10%, var(--glow), transparent 60%); opacity: 0.8; pointer-events: none; }
.topic > * { position: relative; }
.topic[aria-pressed="false"] { opacity: 0.5; }
.topic[aria-pressed="false"]::before { opacity: 0; }
.topic[aria-pressed="true"] { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.topic__name { font: 500 20px/1.15 var(--font-read); }
.topic__sub { font-size: 12px; color: var(--fg-3); line-height: 1.35; }
.topic__bar { height: 4px; border-radius: 4px; background: var(--line-strong); overflow: hidden; }
.topic__bar i { display: block; height: 100%; background: var(--accent); }
.topic__nums { display: flex; justify-content: space-between; font: 500 11px/1 var(--font-mono); color: var(--fg-3); font-variant-numeric: tabular-nums; }
.topic__check { position: absolute; top: 12px; right: 12px; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; }
.topic[aria-pressed="true"] .topic__check { background: var(--accent); border-color: var(--accent); }
.topic[aria-pressed="true"] .topic__check::after { content: ""; width: 8px; height: 5px; border: solid var(--accent-ink); border-width: 0 0 2px 2px; transform: translateY(-1px) rotate(-45deg); }
.customs, .saved { display: grid; gap: 8px; }
.item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--raised); text-align: left; cursor: pointer; min-width: 0; }
.item__dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.item__text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.item__title { font: 500 17px/1.25 var(--font-read); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.item__sub { font-size: 12px; color: var(--fg-3); }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { display: grid; gap: 4px; padding: 14px 16px; border-radius: var(--radius); background: var(--raised); border: 1px solid var(--line); }
.stat__v { font: 500 32px/1 var(--font-read); font-variant-numeric: tabular-nums; }
.stat__k { font-size: 13px; color: var(--fg-3); }
.chart { display: grid; gap: 8px; }
.chart__bars { display: grid; grid-template-columns: repeat(14, 1fr); align-items: end; gap: 4px; height: 96px; padding-bottom: 2px; border-bottom: 1px solid var(--line-strong); }
.chart__bar { position: relative; border-radius: 3px 3px 0 0; background: var(--accent); min-height: 2px; opacity: 0.75; }
.chart__bar.met { opacity: 1; background: var(--good); }
.chart__bar.today { outline: 2px solid var(--fg); outline-offset: 1px; }
.chart__axis { display: flex; justify-content: space-between; font: 500 11px/1 var(--font-mono); color: var(--fg-3); }
.colophon { margin: 0; font-size: 12px; color: var(--fg-3); }

/* Sprint run */
.sprint { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.sprint__bar { display: flex; align-items: center; gap: 12px; padding: calc(var(--top) + 12px) var(--gutter-r) 8px var(--gutter-l); }
.sprint__bar .progress { flex: 1; height: 4px; border-radius: 4px; background: var(--line-strong); overflow: hidden; }
.sprint__bar .progress i { display: block; height: 100%; background: var(--accent); transition: width 0.3s; }
.sprint__score { font: 600 14px/1 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--fg-2); }
.sprint .card { height: 100%; scroll-snap-align: none; --pad-top: 8px; background: var(--bg); }
.clock { height: 3px; margin-top: -4px; border-radius: 3px; background: var(--accent); transform-origin: left; }
.clock.run { animation: clock linear forwards; }
@keyframes clock { to { transform: scaleX(0); } }
.wedges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.wedge { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: none; text-align: left; font-size: 15px; font-weight: 500; cursor: pointer; }
.wedge::before { content: ""; flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); }
.wedge[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.result { display: grid; gap: 22px; padding: 24px var(--gutter-r) 48px var(--gutter-l); max-width: 40rem; width: 100%; margin: 0 auto; align-content: start; overflow-y: auto; }
.result__score { font: 500 clamp(64px, 20vw, 96px)/1 var(--font-read); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.result > div:first-child { display: grid; gap: 10px; }
.result p { margin: 0; }
.miss { display: grid; gap: 4px; padding: 12px 14px; border-radius: 12px; background: var(--raised); border: 1px solid var(--line); }
.miss__q { font: 500 16px/1.35 var(--font-read); }
.miss__a { font-size: 14px; color: var(--good); }

/* ---------- Sheet ---------- */
.sheet { width: 100%; max-width: 40rem; max-height: 88dvh; margin: auto auto 0; padding: 0; border: 1px solid var(--line); border-bottom: 0; border-radius: 20px 20px 0 0; background: var(--raised); color: var(--fg); display: none; flex-direction: column; }
.sheet[open] { display: flex; animation: sheet-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1); }
.sheet::backdrop { background: #05060a99; }
@keyframes sheet-in { from { transform: translateY(40%); opacity: 0.4; } to { transform: none; opacity: 1; } }
.sheet__grip { width: 40px; height: 5px; margin: 8px auto 0; border-radius: 5px; background: var(--line-strong); flex: none; }
.sheet__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 10px var(--gutter-r) 6px var(--gutter-l); flex: none; }
.sheet__title { margin: 6px 0 0; font: 500 24px/1.15 var(--font-read); letter-spacing: -0.01em; text-wrap: balance; }
.sheet__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px var(--gutter-r) 16px var(--gutter-l); display: grid; gap: 14px; align-content: start; }
.sheet__foot { flex: none; padding: 10px var(--gutter-r) calc(var(--bottom) + 12px) var(--gutter-l); border-top: 1px solid var(--line); display: grid; gap: 10px; }
.sheet__foot:empty { display: none; }
.prose { font: 400 18px/1.55 var(--font-read); }
.prose p, .prose ul, .prose ol, .prose h3, .prose h4 { margin: 0 0 0.7em; }
.prose h3, .prose h4 { font: 600 17px/1.3 var(--font-ui); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose code { font: 0.85em var(--font-mono); background: var(--sunk); padding: 1px 4px; border-radius: 4px; }
.prose > :last-child { margin-bottom: 0; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin-inline: calc(-1 * var(--gutter-l)) calc(-1 * var(--gutter-r)); padding-inline: var(--gutter-l) var(--gutter-r); }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 38px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 99px; background: none; font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.chip:active { background: var(--accent-soft); }
.msg { display: grid; gap: 4px; }
.msg--user { justify-self: end; max-width: 85%; padding: 10px 14px; border-radius: 16px 16px 4px 16px; background: var(--accent-soft); font-size: 16px; }
.msg--ai .prose { color: var(--fg); }
.msg__err { color: var(--bad); font-size: 15px; }
.typing::after { content: "▍"; animation: blink 1s steps(2) infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }
.ask-row { display: flex; gap: 8px; }
.ask-row .input { flex: 1; min-width: 0; }

.toast { position: fixed; z-index: 50; left: 50%; bottom: calc(var(--bottom) + var(--tabs) + 14px); transform: translate(-50%, 20px); max-width: calc(100% - 40px); padding: 11px 16px; border-radius: 12px; background: var(--fg); color: var(--bg); font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 720px) {
  .card { padding-left: max(40px, var(--gutter-l)); padding-right: max(40px, var(--gutter-r)); }
}
@media (max-height: 700px) {
  .body { font-size: 17px; }
  .slide .body { font-size: 16.5px; }
  .question { font-size: 22px; }
  .headline { font-size: 28px; }
  .card { --pad-top: calc(var(--top) + 66px); }
  .stack { gap: 12px; }
  .opt { min-height: 46px; padding-block: 8px; }
  .big { font-size: 88px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .feed, .slides { scroll-behavior: auto; }
}
