/* NCEA Level 2 Revision Guides — shared styles */
:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #f0efe9;
  --ink: #1c1c22;
  --muted: #5d5e69;
  --line: #e2e0d8;
  --shadow: 0 1px 2px rgba(20, 20, 30, .06), 0 6px 20px rgba(20, 20, 30, .06);
  --accent: #4f46e5;
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 11%, var(--surface));
  --accent-line: color-mix(in srgb, var(--accent) 35%, var(--line));
  --good: #0d8a5f;
  --good-soft: color-mix(in srgb, var(--good) 12%, var(--surface));
  --bad: #c2362b;
  --bad-soft: color-mix(in srgb, var(--bad) 10%, var(--surface));
  --warn: #b26a00;
  --warn-soft: color-mix(in srgb, var(--warn) 12%, var(--surface));
  --gA: #0f7f6a;
  --gM: #2459d6;
  --gE: #7a3bd9;
  --radius: 14px;
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: "JetBrains Mono", Consolas, "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111317;
    --surface: #1a1c22;
    --surface-2: #22252c;
    --ink: #ececf1;
    --muted: #a2a4ae;
    --line: #2d3038;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    --good: #3cc58f;
    --bad: #f0746a;
    --warn: #f0b04a;
    --gA: #36c2a3;
    --gM: #6d9bff;
    --gE: #b58cff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111317;
  --surface: #1a1c22;
  --surface-2: #22252c;
  --ink: #ececf1;
  --muted: #a2a4ae;
  --line: #2d3038;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  --good: #3cc58f;
  --bad: #f0746a;
  --warn: #f0b04a;
  --gA: #36c2a3;
  --gM: #6d9bff;
  --gE: #b58cff;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.15rem; margin-top: 1.4em; }
p { margin: 0 0 .9em; }
ul, ol { margin: 0 0 1em; padding-left: 1.3em; }
li { margin: .25em 0; }
code, .mono { font-family: var(--mono); font-size: .92em; }
sub, sup { line-height: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .back { text-decoration: none; color: var(--muted); font-weight: 600; font-size: .92rem; white-space: nowrap; }
.topbar .back:hover { color: var(--ink); }
.topbar .crumb { font-weight: 700; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.topbar .crumb span { color: var(--accent); }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--ink);
  font-size: .82rem; font-weight: 700; white-space: nowrap;
  border: 1px solid var(--accent-line);
}
.icon-btn {
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 10px; padding: 6px 10px; font-size: .9rem;
}
.icon-btn:hover { border-color: var(--accent-line); }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 36px; max-width: 1180px; margin: 0 auto; padding: 24px 20px 80px; }
.toc { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 96px); overflow: auto; font-size: .9rem; }
.toc a { display: block; padding: 5px 10px; border-radius: 8px; text-decoration: none; color: var(--muted); border-left: 3px solid transparent; }
.toc a:hover { color: var(--ink); background: var(--surface-2); }
.toc a.active { color: var(--ink); background: var(--accent-soft); border-left-color: var(--accent); font-weight: 700; }
.toc .toc-label { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; font-weight: 800; color: var(--muted); margin: 14px 10px 4px; }
.toc a.sub { padding-left: 20px; }
main { min-width: 0; }
main > section { margin-bottom: 56px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; gap: 0; padding: 12px 16px 60px; }
  .toc {
    position: sticky; top: 53px; z-index: 15; max-height: none;
    display: flex; gap: 6px; overflow-x: auto; padding: 8px 0; margin: 0 -16px 12px; padding-left: 16px; padding-right: 16px;
    background: var(--bg); border-bottom: 1px solid var(--line);
    scrollbar-width: none;
  }
  .toc::-webkit-scrollbar { display: none; }
  .toc .toc-label { display: none; }
  .toc a, .toc a.sub { white-space: nowrap; padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
  .toc a.active { border-color: var(--accent); }
  html { scroll-padding-top: 116px; }
  h2 { font-size: 1.35rem; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--accent-soft), var(--surface) 70%);
  border: 1px solid var(--accent-line);
  border-radius: 22px; padding: 34px 32px; box-shadow: var(--shadow);
}
.hero .eyebrow { font-size: .8rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); margin: 8px 0 12px; max-width: 26ch; }
.hero .tagline { font-size: 1.1rem; color: var(--muted); max-width: 60ch; }
.hero .deco { position: absolute; right: -10px; top: -18px; font-size: 130px; opacity: .13; pointer-events: none; transform: rotate(-8deg); }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.badge { padding: 5px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: .85rem; font-weight: 600; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 12px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-ink); text-decoration: none; font-weight: 700; font-size: .95rem;
}
.btn:hover { filter: brightness(1.07); }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--accent); }
.btn.small { padding: 6px 12px; font-size: .86rem; border-radius: 10px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }

/* ---------- Cards / generic ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }
.card h3:first-child, .card h4:first-child { margin-top: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.section-intro { color: var(--muted); max-width: 70ch; }
.kicker { font-size: .75rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.callout { border-radius: 12px; padding: 14px 16px; border: 1px solid var(--accent-line); background: var(--accent-soft); margin: 14px 0; }
.callout.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.callout.good { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 40%, var(--line)); }
.callout > :last-child { margin-bottom: 0; }
.callout-title { font-weight: 800; margin-bottom: 4px; }
table.simple { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.simple th, table.simple td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.simple th { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.table-wrap { overflow-x: auto; }

/* ---------- Concept map ---------- */
.map-wrap { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; align-items: stretch; margin-top: 18px; }
.map-svg { width: 100%; height: auto; display: block; }
.map-svg .edge { stroke: var(--accent-line); stroke-width: 2; }
.map-svg .edge.link { stroke-dasharray: 5 5; stroke: var(--muted); opacity: .45; }
.map-svg .node rect { fill: var(--surface); stroke: var(--accent-line); stroke-width: 1.5; transition: fill .15s; }
.map-svg .node text { fill: var(--ink); font-size: 13px; font-weight: 700; font-family: var(--font); pointer-events: none; }
.map-svg .node { cursor: pointer; }
.map-svg .node:hover rect, .map-svg .node.sel rect { fill: var(--accent-soft); stroke: var(--accent); }
.map-svg .hub circle { fill: var(--accent); }
.map-svg .hub text { fill: var(--accent-ink); font-weight: 800; font-size: 14px; font-family: var(--font); }
.map-svg .node:focus { outline: none; }
.map-svg .node:focus-visible rect { stroke-width: 3; stroke: var(--accent); }
.map-detail h4 { font-size: 1.1rem; }
.map-list { display: none; flex-direction: column; gap: 8px; margin-top: 14px; }
.map-list button { text-align: left; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; }
.map-list button.sel { border-color: var(--accent); background: var(--accent-soft); }
@media (max-width: 700px) {
  .map-wrap { grid-template-columns: 1fr; }
  .map-svg { display: none; }
  .map-list { display: flex; }
}

/* ---------- Grade ladder ---------- */
.ladder { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0; }
.rung { border-radius: 14px; padding: 16px; border: 1px solid var(--line); background: var(--surface); position: relative; }
.rung .g { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: #fff; font-weight: 800; margin-bottom: 8px; }
.rung.A .g { background: var(--gA); } .rung.M .g { background: var(--gM); } .rung.E .g { background: var(--gE); }
.rung.N .g { background: var(--muted); } .rung.N { border-top: 4px solid var(--muted); }
.ladder.single { grid-template-columns: minmax(0, 520px); }
.tab.N[aria-selected="true"] { background: var(--muted); }
.answer-box.N { border-left-color: var(--muted); }
.passage { font-family: "Literata", Georgia, serif; font-size: 1.05rem; line-height: 1.85; background: var(--surface-2); border-radius: 12px; padding: 18px 20px; white-space: pre-line; }
.passage mark { background: color-mix(in srgb, var(--accent) 16%, transparent); color: inherit; border-bottom: 2px solid var(--accent); cursor: pointer; padding: 1px 2px; border-radius: 3px; }
.passage mark.seen { background: color-mix(in srgb, var(--good) 18%, transparent); border-bottom-color: var(--good); }
.passage mark:focus-visible { outline: 2px solid var(--accent); }
.level-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-top: 30px; }
.level-head h2 { margin: 0; }
.subject-label { font-size: .78rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 22px 0 -6px; }
.rung.A { border-top: 4px solid var(--gA); } .rung.M { border-top: 4px solid var(--gM); } .rung.E { border-top: 4px solid var(--gE); }
.rung .word { font-weight: 800; }
.rung p { font-size: .93rem; margin: 6px 0 0; }
@media (max-width: 700px) { .ladder { grid-template-columns: 1fr; } }

.tabs { display: flex; gap: 6px; margin: 12px 0; flex-wrap: wrap; }
.tab { border: 1px solid var(--line); background: var(--surface); padding: 7px 14px; border-radius: 10px; font-weight: 700; font-size: .9rem; }
.tab[aria-selected="true"] { color: #fff; border-color: transparent; }
.tab.A[aria-selected="true"] { background: var(--gA); }
.tab.M[aria-selected="true"] { background: var(--gM); }
.tab.E[aria-selected="true"] { background: var(--gE); }
.tab.plain[aria-selected="true"] { background: var(--accent); }
.answer-box { border-left: 4px solid var(--line); padding: 14px 16px; background: var(--surface-2); border-radius: 0 12px 12px 0; }
.answer-box.A { border-left-color: var(--gA); } .answer-box.M { border-left-color: var(--gM); } .answer-box.E { border-left-color: var(--gE); }
.answer-box .why { margin-top: 10px; font-size: .92rem; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 10px; }

/* ---------- Topic ---------- */
.topic-head { display: flex; gap: 16px; align-items: flex-start; }
.topic-icon { flex: none; width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 28px; background: var(--accent-soft); border: 1px solid var(--accent-line); }
.topic-head h2 { margin-bottom: 4px; }
.topic-head p { color: var(--muted); margin: 0; }
.keys { list-style: none; padding: 0; }
.keys li { position: relative; padding: 10px 14px 10px 40px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); margin: 8px 0; }
.keys li::before { content: "★"; position: absolute; left: 14px; top: 10px; color: var(--accent); font-size: .95rem; }
.formula-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.formula { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.formula .f { font-family: "Cambria Math", Cambria, Georgia, serif; font-size: 1.25rem; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.formula .m { font-size: .88rem; color: var(--muted); }
.formula.given::after { content: "on the resource sheet"; display: inline-block; margin-top: 6px; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--good); }
.formula.learn::after { content: "learn this one"; display: inline-block; margin-top: 6px; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--warn); }

.example { margin-top: 12px; }
.example .q { font-weight: 600; }
.steps { list-style: none; padding: 0; counter-reset: step; margin: 10px 0; }
.steps li { counter-increment: step; position: relative; padding: 8px 12px 8px 46px; margin: 6px 0; border-radius: 10px; background: var(--surface-2); animation: pop .25s ease; }
.steps li::before { content: counter(step); position: absolute; left: 10px; top: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: .8rem; display: grid; place-items: center; }
@keyframes pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.myths { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.myth { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 14px 16px; text-align: left; width: 100%; }
.myth .lbl { font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.myth .wrong .lbl { color: var(--bad); }
.myth .right .lbl { color: var(--good); }
.myth .wrong p, .myth .right p { margin: 4px 0 0; }
.myth .right { display: none; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.myth.open .right { display: block; animation: pop .25s ease; }
.myth .hint { font-size: .8rem; color: var(--muted); margin-top: 8px; }
.myth.open .hint { display: none; }

.check { margin-top: 16px; }
.reveal { display: none; margin-top: 10px; }
.reveal.show { display: block; animation: pop .25s ease; }

/* ---------- Widgets ---------- */
.widget { margin: 18px 0; background: var(--surface); border: 1px solid var(--accent-line); border-radius: 16px; padding: 18px 20px; box-shadow: var(--shadow); }
.widget .w-title { font-weight: 800; display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.widget .w-title::before { content: "▶ Try it"; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; background: var(--accent); color: var(--accent-ink); padding: 3px 8px; border-radius: 6px; }
.widget .w-sub { color: var(--muted); font-size: .92rem; margin-bottom: 12px; }
.controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 18px; margin: 10px 0; }
.ctrl label { display: flex; justify-content: space-between; font-size: .88rem; font-weight: 600; }
.ctrl label output { font-family: var(--mono); color: var(--accent); }
input[type="range"] { width: 100%; accent-color: var(--accent); }
select, input[type="text"], input[type="number"], textarea {
  font: inherit; color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; width: 100%;
}
textarea { min-height: 90px; resize: vertical; }
canvas.plot { width: 100%; height: auto; display: block; background: var(--surface-2); border-radius: 12px; border: 1px solid var(--line); }
.readout { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-top: 10px; }
.readout div { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; font-size: .85rem; }
.readout b { display: block; font-family: var(--mono); font-size: 1.05rem; color: var(--ink); }
.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); font-size: .85rem; margin: 3px; }
.chip.ok { border-color: var(--good); background: var(--good-soft); }
.chip.no { border-color: var(--bad); background: var(--bad-soft); }

/* ---------- Flashcards ---------- */
.deck { display: grid; place-items: center; gap: 14px; }
.flash { width: min(560px, 100%); height: 260px; perspective: 1200px; border: 0; background: none; padding: 0; }
.flash-inner { position: relative; width: 100%; height: 100%; transition: transform .5s; transform-style: preserve-3d; }
.flash.flipped .flash-inner { transform: rotateY(180deg); }
.flash-face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 18px; padding: 24px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; border: 1px solid var(--line); box-shadow: var(--shadow); overflow: auto; }
.flash-front { background: var(--surface); font-size: 1.2rem; font-weight: 700; }
.flash-back { background: var(--accent-soft); transform: rotateY(180deg); border-color: var(--accent-line); font-size: 1rem; }
.flash-face .tag { position: absolute; top: 12px; left: 16px; font-size: .7rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.deck-controls { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
.deck-count { font-weight: 700; color: var(--muted); min-width: 90px; text-align: center; }

/* ---------- Quiz ---------- */
.quiz-card { max-width: 720px; }
.quiz-progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-bottom: 14px; }
.quiz-progress div { height: 100%; background: var(--accent); width: 0; transition: width .3s; }
.quiz-q { font-weight: 700; font-size: 1.08rem; margin-bottom: 12px; }
.opts { display: grid; gap: 8px; }
.opt { text-align: left; padding: 11px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); font-size: .97rem; }
.opt:hover:not([disabled]) { border-color: var(--accent); }
.opt.correct { border-color: var(--good); background: var(--good-soft); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt[disabled] { cursor: default; }
.feedback { margin-top: 12px; padding: 12px 14px; border-radius: 12px; font-size: .95rem; }
.feedback.ok { background: var(--good-soft); }
.feedback.no { background: var(--bad-soft); }
.score-big { font-size: 3rem; font-weight: 800; color: var(--accent); line-height: 1; }

/* ---------- Checklist ---------- */
.checklist { list-style: none; padding: 0; }
.checklist li { margin: 6px 0; }
.checklist label { display: flex; gap: 12px; align-items: flex-start; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; }
.checklist input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--good); flex: none; }
.checklist input:checked + span { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--good); }
.progress-bar { height: 12px; background: var(--surface-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.progress-bar div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--good)); width: 0; transition: width .4s; }

.traps { counter-reset: trap; list-style: none; padding: 0; }
.traps li { counter-increment: trap; position: relative; padding: 12px 14px 12px 52px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); margin: 8px 0; }
.traps li::before { content: "⚠"; position: absolute; left: 16px; top: 11px; font-size: 1.15rem; color: var(--warn); }

footer.foot { max-width: 1180px; margin: 0 auto; padding: 24px 20px 50px; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); }

/* ---------- Home page ---------- */
.home-hero { max-width: 1100px; margin: 0 auto; padding: 48px 20px 20px; }
.home-hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); max-width: 18ch; margin-bottom: 14px; }
.home-hero p.lead { font-size: 1.15rem; color: var(--muted); max-width: 62ch; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; margin: 20px 0 50px; }
.guide-card { display: flex; flex-direction: column; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); transition: transform .15s, border-color .15s; position: relative; overflow: hidden; }
.guide-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.guide-card .emoji { font-size: 34px; }
.guide-card .code { font-size: .78rem; font-weight: 800; letter-spacing: .08em; color: var(--accent); text-transform: uppercase; margin-top: 8px; }
.guide-card h3 { margin: 4px 0 6px; font-size: 1.1rem; }
.guide-card p { color: var(--muted); font-size: .92rem; flex: 1; }
.guide-card .meta { display: flex; justify-content: space-between; align-items: center; font-size: .82rem; font-weight: 700; color: var(--muted); }
.guide-card .bar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 10px; }
.guide-card .bar div { height: 100%; background: var(--accent); width: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 24px; }
.steps-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 16px 0; }
.step-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.step-card .n { font-weight: 800; color: var(--accent); font-size: 1.4rem; }

@media (max-width: 520px) {
  .hero { padding: 24px 18px; }
  .card { padding: 16px; }
  .topic-head { gap: 12px; }
  .topic-icon { width: 46px; height: 46px; font-size: 22px; }
  .topbar { padding: 10px 14px; }
  .flash { height: 300px; }
}
@media print {
  .topbar, .toc, .widget, #practice, .btn-row { display: none !important; }
  .layout { display: block; }
  .reveal, .myth .right { display: block !important; }
}

/* ---------- Entry page: level chooser ---------- */
.level-choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; margin: 14px 0 10px; }
.level-card { position: relative; display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, var(--surface)), var(--surface) 70%);
  border: 2px solid color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: 22px; padding: 26px; box-shadow: var(--shadow); transition: transform .15s, border-color .15s; }
.level-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.level-card .lvl { font-size: clamp(2rem, 6vw, 2.8rem); font-weight: 800; color: var(--accent); line-height: 1.1; }
.level-card .lvl-sub { font-weight: 700; color: var(--muted); font-size: .9rem; }
.level-card p { color: var(--muted); margin: 6px 0; }
.level-card .meta { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: .85rem; font-weight: 700; color: var(--muted); }
.level-card .bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 4px 0 12px; }
.level-card .bar div { height: 100%; width: 0; background: var(--accent); }
.level-card .btn { align-self: flex-start; background: var(--accent); border-color: var(--accent); }
.level-card.last::after { content: "Last visited"; position: absolute; top: 16px; right: 16px; font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 99px; background: var(--accent); color: #fff; }

/* past papers & curveballs */
.curveballs { margin: 10px 0 16px; }
.curve { border-left: 4px solid var(--warn); padding: 16px 18px; }
.curve h4 { margin: 2px 0 6px; }
.curve p { margin: 0; }
.curve .kicker { color: var(--warn); }
