/* Layout: one reading column like an exercise book; sticky nav; each day is a timed run of
   blocks; highlighter yellow marks anything that repeats in past papers. */
:root {
  --bg: #F3F5F1; --surface: #FFFFFF; --sunk: #E9EEE8; --ink: #16231D; --muted: #56665E; --line: #D5DDD6;
  --accent: #0E6A4E; --accent-ink: #FFFFFF; --accent-soft: #DCEEE5;
  --hl: #F7DE5A; --hl-ink: #2A2200; --bad: #B42318; --bad-soft: #FBE4E1; --good: #0E7A4F; --good-soft: #DDF3E8;
  --rev: #6B4FA0; --rev-soft: #ECE6F6;
  --f-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1412; --surface: #16201C; --sunk: #1D2925; --ink: #E4ECE7; --muted: #9DB0A6; --line: #2B3833;
    --accent: #4CC197; --accent-ink: #06231A; --accent-soft: #183A2F;
    --hl: #E3C845; --hl-ink: #1E1800; --bad: #FF8A7A; --bad-soft: #3A1E1B; --good: #5DD6A6; --good-soft: #163428;
    --rev: #B79BEA; --rev-soft: #2A2238;
    color-scheme: dark;
  }
}
* { box-sizing: border-box }
[hidden] { display: none !important }
html { -webkit-text-size-adjust: 100% }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 17px; line-height: 1.6 }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface) }
.wrap { max-width: 800px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)) }
h1, h2, h3 { font-family: var(--f-display); line-height: 1.15; text-wrap: balance; margin: 0 }
h1 { font-size: clamp(1.7rem, 5.5vw, 2.3rem); letter-spacing: -.02em }
h2 { font-size: 1.4rem; letter-spacing: -.01em }
h3 { font-size: 1.1rem }
p { margin: 0 }
ol, ul { margin: 0; padding-left: 1.25em; display: flex; flex-direction: column; gap: 4px }
a { color: var(--accent) }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px }
.stack { display: flex; flex-direction: column; gap: 14px }
.stack-lg { display: flex; flex-direction: column; gap: 28px }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center }
.between { justify-content: space-between }
.muted { color: var(--muted) }
.small { font-size: .88rem }
.eyebrow { font-family: var(--f-mono); font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted) }
.m, code { font-family: var(--f-mono); font-size: .92em }
.src { font-family: var(--f-mono); font-size: .78rem; color: var(--muted) }

/* header */
header.top { background: var(--surface); border-bottom: 1px solid var(--line) }
header.top .wrap { padding-block: 14px 10px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px }
.brand { font-family: var(--f-display); font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--ink) }
.brand span { color: var(--accent) }
nav.main { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line) }
nav.main .wrap { display: flex; gap: 6px; overflow-x: auto; padding-block: 8px; scrollbar-width: none }
nav.main .wrap::-webkit-scrollbar { display: none }
.chip { flex: 0 0 auto; font-family: var(--f-mono); font-size: .82rem; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); text-decoration: none; white-space: nowrap }
.chip[aria-current="page"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent) }
main .wrap { padding-block: 22px 72px }

/* surfaces */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px }
.banner { border-radius: 10px; padding: 14px 16px; border: 1px solid var(--hl); background: color-mix(in srgb, var(--hl) 22%, var(--surface)) }
.warn { border: 1px solid var(--bad); background: var(--bad-soft); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px }
.tip { border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 12px 14px }
.hl { background: var(--hl); color: var(--hl-ink); padding: 1px 7px; border-radius: 3px; font-family: var(--f-mono); font-size: .76rem; font-weight: 600; white-space: nowrap }
.pill { font-family: var(--f-mono); font-size: .74rem; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap }
.pill.ready { border-color: var(--good); color: var(--good) }
.pill.partial { border-color: var(--hl); color: var(--ink) }
.pill.awaiting-materials { border-color: var(--bad); color: var(--bad) }
.q { background: var(--sunk); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px }
.stat { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: var(--surface) }
.stat .v { font-family: var(--f-display); font-size: 1.7rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums }
.stat .k { font-size: .84rem; color: var(--muted); margin-top: 6px }

/* blocks (a day's timeline) */
.blocks { display: flex; flex-direction: column; gap: 10px }
.blk { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 12px; align-items: start; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px; padding: 12px }
.blk.drill { border-left-color: var(--hl) }
.blk.mock, .blk.review { border-left-color: var(--rev) }
.blk.done { opacity: .6 }
.blk .t { font-family: var(--f-mono); font-size: .78rem; color: var(--muted); line-height: 1.3 }
.blk .t b { display: block; font-size: 1.05rem; color: var(--ink) }
.blk .what { min-width: 0; display: flex; flex-direction: column; gap: 2px }
.blk .what b { font-family: var(--f-display); font-size: 1.05rem }

/* notes / solutions */
.note { display: flex; flex-direction: column; gap: 12px }
details.sol { border: 1px solid var(--line); border-radius: 8px; background: var(--surface) }
details.sol > summary { cursor: pointer; padding: 10px 14px; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 10px }
details.sol > summary::-webkit-details-marker { display: none }
details.sol > summary::after { content: "Show"; font-family: var(--f-mono); font-size: .8rem; font-weight: 400; color: var(--accent) }
details.sol[open] > summary::after { content: "Hide" }
details.sol > .in { padding: 2px 14px 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0 }
.step { font-family: var(--f-mono); font-size: .9rem; line-height: 1.75; overflow-x: auto; white-space: pre; background: var(--sunk); border-radius: 6px; padding: 10px 12px }
@media (max-width: 520px) { .step { font-size: .78rem } }
.ans { font-weight: 700; border-top: 1px dashed var(--line); padding-top: 8px }
.mat { display: inline-grid; grid-template-columns: repeat(var(--c, 3), auto); gap: 2px 14px; padding: 4px 10px; border-left: 2px solid var(--ink); border-right: 2px solid var(--ink); border-radius: 6px; font-family: var(--f-mono); font-size: .95rem; text-align: right; vertical-align: middle; margin: 2px 4px }
.frac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; font-family: var(--f-mono); font-size: .9em; margin: 0 3px; line-height: 1.3 }
.frac > span:first-child { border-bottom: 1.5px solid currentColor; padding: 0 3px }
.mrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-family: var(--f-mono) }

/* tables */
.tw { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px }
table { border-collapse: collapse; width: 100%; font-size: .92rem }
th, td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top }
tr:last-child td { border-bottom: none }
th { font-family: var(--f-mono); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--sunk); font-weight: 600 }
table.tt td, table.tt th { text-align: center; font-family: var(--f-mono); white-space: nowrap }
table.tt td.res { font-weight: 700; background: var(--accent-soft) }

/* frequency bars */
.freq { display: flex; flex-direction: column; gap: 10px }
.fr { display: grid; grid-template-columns: minmax(0, 1fr) 110px 44px; gap: 12px; align-items: center; text-decoration: none; color: inherit }
.fr .lab { min-width: 0 }
.fr .lab b { display: block }
.bar { display: grid; gap: 3px }
.bar i { height: 14px; border-radius: 2px; background: var(--sunk); border: 1px solid var(--line) }
.bar i.on { background: var(--accent); border-color: var(--accent) }
.fr .n { font-family: var(--f-mono); font-variant-numeric: tabular-nums; text-align: right }

/* quiz + cards */
.qq { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: var(--surface) }
.qq .stem { font-weight: 700; margin-bottom: 10px }
.opts { display: grid; gap: 8px }
.opt { font: inherit; text-align: left; padding: 10px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer }
.opt:hover:not([disabled]) { border-color: var(--accent) }
.opt.right { background: var(--good-soft); border-color: var(--good) }
.opt.wrong { background: var(--bad-soft); border-color: var(--bad) }
.why { margin-top: 10px; font-size: .92rem; color: var(--muted) }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px }
.card { font: inherit; text-align: left; min-height: 104px; border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: var(--surface); color: var(--ink); cursor: pointer; display: flex; flex-direction: column; gap: 8px }
.card .side { font-family: var(--f-mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted) }
.card .back { display: none; color: var(--accent); font-weight: 700 }
.card.flipped .front { display: none }
.card.flipped .back { display: block }
.card.flipped { border-color: var(--accent) }
.bigcard { min-height: 200px; justify-content: center; text-align: center; font-size: 1.25rem; cursor: default }

/* buttons + forms */
.btn { font: inherit; font-family: var(--f-mono); font-size: .85rem; padding: 9px 14px; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px }
.btn.ghost { background: transparent; color: var(--accent) }
.btn.bad { border-color: var(--bad); background: transparent; color: var(--bad) }
label.check { display: flex; gap: 10px; align-items: center; font-weight: 700; cursor: pointer }
label.check input { width: 22px; height: 22px; accent-color: var(--accent) }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 160px }
.field span { font-size: .8rem; color: var(--muted) }
input[type=text], input[type=date], select { font: inherit; padding: 9px 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); width: 100% }
.timer { font-family: var(--f-mono); font-size: 2rem; font-variant-numeric: tabular-nums }

/* plan */
.week { display: flex; flex-direction: column; gap: 6px }
.dayrow { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; padding: 8px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: inherit }
.dayrow.today { border: 2px solid var(--accent) }
.dayrow.rest { background: transparent }
.dayrow.revision { background: var(--rev-soft) }
.dayrow .d { font-family: var(--f-mono); font-size: .82rem }
.dayrow .d .tick { color: var(--good) }
.dayrow .bl { min-width: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .9rem }

@media (prefers-reduced-motion: no-preference) { .opt, .card, .chip { transition: background-color .15s, border-color .15s } }

/* audio player bar */
.player { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 2px solid var(--accent); padding-bottom: env(safe-area-inset-bottom, 0px); box-shadow: 0 -6px 18px rgb(0 0 0 / .08) }
.pl-wrap { max-width: 800px; margin: 0 auto; padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 8px }
.pl-info { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; min-width: 0 }
.pl-info .eyebrow { grid-column: 1 / -1 }
.pl-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0 }
.pl-seek { grid-column: 1 / -1; width: 100%; accent-color: var(--accent) }
.pl-btns { display: flex; gap: 6px; justify-content: space-between }
.pl-b { font: inherit; font-family: var(--f-mono); font-size: .85rem; min-width: 44px; min-height: 40px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer }
.pl-b.pl-main { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); min-width: 56px; font-size: 1rem }
.pl-b.on { border-color: var(--accent); color: var(--accent) }
body.has-player main .wrap { padding-bottom: 190px }
.seg { font: inherit; font-family: var(--f-mono); font-size: .82rem; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer }
.seg.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent) }
ol.tracks { list-style: none; padding: 0; gap: 8px }
ol.tracks li { display: flex; align-items: center; gap: 12px }
.track { font: inherit; flex: 1; min-width: 0; text-align: left; display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer }
.track.now { border: 2px solid var(--accent) }
.track .tn { font-family: var(--f-mono); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; font-size: .8rem }
.track .tt { display: flex; flex-direction: column; min-width: 0 }

/* print: "Save as PDF" from the browser's print dialog */
@media print {
  :root { --bg: #fff; --surface: #fff; --sunk: #f2f2f2; --ink: #000; --muted: #444; --line: #bbb }
  header.top, nav.main, .noprint, .quiz, .cards { display: none !important }
  details.sol { border: none }
  details.sol > .in { display: flex !important; padding: 0 }
  details.sol > summary::after { content: "" }
  .blk, .panel, .q { break-inside: avoid }
  body { font-size: 12pt }
  main .wrap { padding: 0 }
}
