/* ===== Design tokens ===== */
:root {
  --bg: #0d1117;
  --bg-side: #0f141c;
  --surface: #151b25;
  --surface-2: #1a2230;
  --line: #242e3d;
  --line-strong: #33405280;
  --text: #e5e9f0;
  --text-2: #c3cad5;
  --muted: #8e99a8;
  --accent: #7aa7ff;
  --accent-soft: #7aa7ff1f;
  --accent-ink: #0b1220;
  --ok: #4fc38f;
  --ok-soft: #4fc38f1c;
  --bad: #f2777f;
  --bad-soft: #f2777f1c;
  --warn: #e6b866;
  --warn-soft: #e6b8661a;
  --code-bg: #0a0e14;
  --code-text: #d6deeb;
  --shadow: 0 10px 30px #00000059;
  --radius: 10px;
  --side-w: 300px;
  --measure: 74ch;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f6f7f9;
  --bg-side: #eef1f5;
  --surface: #ffffff;
  --surface-2: #f2f4f8;
  --line: #e0e5ec;
  --line-strong: #c9d1dc;
  --text: #141922;
  --text-2: #2c3440;
  --muted: #5d6877;
  --accent: #2c66d6;
  --accent-soft: #2c66d614;
  --accent-ink: #ffffff;
  --ok: #17824f;
  --ok-soft: #17824f14;
  --bad: #c3343e;
  --bad-soft: #c3343e12;
  --warn: #9a6200;
  --warn-soft: #e6b86626;
  --code-bg: #f3f5f8;
  --code-text: #1f2733;
  --shadow: 0 10px 30px #1a223014;
  color-scheme: light;
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { overflow-anchor: none; scroll-padding-top: 24px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.68 var(--font); font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-soft); }
h1, h2, h3, h4, h5 { line-height: 1.25; letter-spacing: -0.01em; color: var(--text); }
p, li { color: var(--text-2); }
strong { color: var(--text); font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
img, svg { max-width: 100%; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 6px; z-index: 100; }
.skip:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ===== Layout ===== */
.layout { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg-side); border-right: 1px solid var(--line);
  padding: 22px 16px 40px; display: flex; flex-direction: column; gap: 16px;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
main { padding: 48px clamp(16px, 5vw, 72px) 120px; min-width: 0; }
.content { max-width: 960px; margin: 0 auto; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(135deg, var(--accent), #9b8cff); display: grid; place-items: center; color: #0b1220; font-size: 13px; font-weight: 800; }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }

.side-progress { font-size: 13px; color: var(--muted); }
.bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.bar > span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .5s ease; }

/* Search */
.search { position: relative; }
.search input {
  width: 100%; padding: 9px 12px 9px 34px; font: inherit; font-size: 14px; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search svg { position: absolute; left: 11px; top: 11px; width: 15px; height: 15px; color: var(--muted); }
.search kbd { position: absolute; right: 9px; top: 8px; }
kbd { font: 11px var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; background: var(--surface-2); }
.search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 50; max-height: 60vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px;
}
.search-results[hidden] { display: none; }
.search-results a { display: block; padding: 8px 10px; border-radius: 7px; color: var(--text); font-size: 14px; line-height: 1.35; }
.search-results a small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.search-results a.active, .search-results a:hover { background: var(--accent-soft); text-decoration: none; }
.search-results .empty { padding: 10px; color: var(--muted); font-size: 14px; }
.tag { display: inline-block; font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); margin-right: 6px; }

/* Nav */
.nav { font-size: 14px; flex: 1; }
.nav, .nav ul { list-style: none; margin: 0; padding: 0; }
.nav-group { margin-bottom: 2px; }
.nav-group > a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 10px; border-radius: 7px; color: var(--text-2); font-weight: 500;
}
.nav-group > a:hover { background: var(--surface); text-decoration: none; }
.nav-group.active > a { color: var(--text); background: var(--surface); }
.nav-count { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-topics { display: none; margin: 2px 0 8px 10px !important; border-left: 1px solid var(--line); }
.nav-group.open .nav-topics { display: block; }
.nav-topics a {
  display: flex; gap: 8px; align-items: baseline; padding: 4px 10px 4px 12px; margin-left: -1px;
  color: var(--muted); font-size: 13px; line-height: 1.4; border-left: 1px solid transparent;
}
.nav-topics a:hover { color: var(--text); text-decoration: none; }
.nav-topics a.active { color: var(--accent); border-left-color: var(--accent); }
.nav-topics a .tick { width: 12px; flex: none; color: var(--ok); font-size: 11px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 14px 10px 6px; font-weight: 600; }

.side-foot { display: flex; gap: 8px; font-size: 13px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 8px; cursor: pointer;
  font: 500 13.5px var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--line);
  transition: border-color .2s, background .2s;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Mobile top bar */
.topbar { display: none; }
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    position: sticky; top: 0; z-index: 40; padding: 10px 16px;
    background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
  }
  .sidebar {
    position: fixed; z-index: 60; left: 0; top: 0; width: min(88vw, 340px);
    transform: translateX(-102%); transition: transform .3s ease; box-shadow: var(--shadow);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  main { padding: 28px 16px 100px; }
  html { scroll-padding-top: 70px; }
}
.scrim { position: fixed; inset: 0; background: #0008; z-index: 55; opacity: 0; pointer-events: none; transition: opacity .3s; }

/* ===== Sections ===== */
section.module, section.page { padding-top: 24px; margin-bottom: 96px; }
.module-head { margin-bottom: 40px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); font-weight: 600; margin: 0 0 10px; }
.module-head h2, section.page > h2 { font-size: clamp(26px, 3.4vw, 36px); margin: 0 0 14px; }
.lead { font-size: 17.5px; color: var(--text-2); max-width: var(--measure); }
h1.hero { font-size: clamp(30px, 4.6vw, 46px); margin: 0 0 14px; letter-spacing: -0.025em; }

/* Topic article */
article.topic {
  margin: 0 0 64px; padding: 0 0 56px; border-bottom: 1px solid var(--line);
}
article.topic > *:not(pre):not(.table-wrap):not(figure):not(.quiz):not(table):not(.cheat-grid) { max-width: var(--measure); }
.topic-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
article.topic h3 { font-size: clamp(22px, 2.6vw, 27px); margin: 0 0 18px; }
article.topic h4 {
  font-size: 13px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted);
  margin: 36px 0 12px; font-weight: 600;
}
article.topic h5 { font-size: 16.5px; margin: 26px 0 8px; }
.done-btn {
  flex: none; display: inline-flex; align-items: center; gap: 6px; margin-top: 4px;
  font: 500 12.5px var(--font); color: var(--muted); background: transparent; cursor: pointer;
  border: 1px solid var(--line); border-radius: 99px; padding: 5px 11px; transition: all .25s;
}
.done-btn:hover { color: var(--text); border-color: var(--accent); }
.done-btn[aria-pressed="true"] { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, transparent); background: var(--ok-soft); }

.why { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; }
.why p { margin: 6px 0; }

/* Callouts */
.callout { border: 1px solid var(--line); border-left: 3px solid var(--accent); background: var(--surface); border-radius: 8px; padding: 12px 16px; margin: 18px 0; }
.callout > :last-child { margin-bottom: 0; }
.callout > p:first-child { margin-top: 0; }
.callout-title { font-size: 12px !important; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--accent) !important; margin: 0 0 6px !important; }
.callout.thm { border-left-color: #a990ff; }
.callout.thm .callout-title { color: #a990ff !important; }
.callout.tip { border-left-color: var(--ok); }
.callout.tip .callout-title { color: var(--ok) !important; }
.callout.warn { border-left-color: var(--bad); }
.callout.warn .callout-title { color: var(--bad) !important; }
.callout.check { border-left-color: var(--warn); background: var(--warn-soft); }
.callout.check .callout-title { color: var(--warn) !important; }
.check {
  display: inline-block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 55%, transparent); background: var(--warn-soft);
  border-radius: 4px; padding: 0 5px; vertical-align: 2px; line-height: 1.6;
}
.summary { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-top: 28px; background: linear-gradient(180deg, var(--accent-soft), transparent); }
.summary ul { margin: 0; padding-left: 20px; }
ul.mistakes { padding-left: 0; list-style: none; }
ul.mistakes li { position: relative; padding-left: 24px; margin: 6px 0; }
ul.mistakes li::before { content: "✕"; position: absolute; left: 2px; color: var(--bad); font-size: 12px; top: 3px; }

/* Exercises */
ol.exercises { padding-left: 22px; }
ol.exercises > li { margin: 0 0 18px; padding-left: 4px; }
ol.exercises > li > p:first-of-type { display: inline; }
ol.exercises > li::marker { color: var(--muted); font-weight: 600; }
.level {
  display: inline-block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  padding: 1px 6px; border-radius: 4px; margin-right: 6px; vertical-align: 1px; border: 1px solid var(--line); color: var(--muted);
}
.level:is(.easy) { color: var(--ok); }
details.solution { margin-top: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
details.solution > summary {
  cursor: pointer; padding: 8px 14px; font-size: 13.5px; font-weight: 500; color: var(--accent); list-style: none; user-select: none;
}
details.solution > summary::-webkit-details-marker { display: none; }
details.solution > summary::before { content: "▸"; display: inline-block; margin-right: 8px; transition: transform .2s; }
details.solution[open] > summary::before { transform: rotate(90deg); }
details.solution > div { padding: 2px 16px 12px; border-top: 1px solid var(--line); }

/* Tables */
table { border-collapse: collapse; width: 100%; font-size: 14.5px; margin: 16px 0; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--text-2); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
tbody tr:hover td { background: var(--surface); }
.table-wrap, .katex-display, .katex-wide { position: relative; }
.table-wrap { overflow-x: auto; max-width: 100%; }
:not(pre) > code { overflow-wrap: anywhere; }

/* Code */
code { font-family: var(--mono); font-size: .88em; background: var(--surface-2); border: 1px solid var(--line); padding: .08em .35em; border-radius: 5px; color: var(--text); }
pre {
  position: relative; background: var(--code-bg) !important; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; overflow-x: auto; margin: 14px 0; font-size: 13.5px; line-height: 1.6; tab-size: 4;
}
pre code { background: none !important; border: 0; padding: 0; font-size: inherit; color: var(--code-text); text-shadow: none !important; white-space: pre; }
pre.output { background: transparent !important; border-style: dashed; }
pre.output::before { content: "output"; position: absolute; top: 6px; right: 12px; font: 10.5px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.copy-btn {
  position: absolute; top: 8px; right: 8px; font: 500 11.5px var(--font); color: var(--muted);
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; cursor: pointer; opacity: 0; transition: opacity .2s;
}
pre:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
@media (hover: none) { .copy-btn { opacity: 1; } }
.copy-btn.done { color: var(--ok); }

/* Prism tokens */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #6b7a90; font-style: italic; }
.token.punctuation { color: #9aa6b8; }
.token.property, .token.tag, .token.constant, .token.symbol, .token.deleted { color: #f2777f; }
.token.boolean, .token.number { color: #f0a868; }
.token.selector, .token.attr-name, .token.string, .token.char, .token.builtin, .token.inserted { color: #9ad18b; }
.token.operator, .token.entity, .token.url { color: #89ddff; }
.token.atrule, .token.attr-value, .token.keyword { color: #c792ea; }
.token.function, .token.class-name { color: #82aaff; }
.token.regex, .token.important, .token.variable { color: #e6b866; }
:root[data-theme="light"] .token.comment { color: #7a8597; }
:root[data-theme="light"] .token.punctuation { color: #5b6574; }
:root[data-theme="light"] .token.property, :root[data-theme="light"] .token.constant, :root[data-theme="light"] .token.symbol { color: #c3343e; }
:root[data-theme="light"] .token.boolean, :root[data-theme="light"] .token.number { color: #b25b00; }
:root[data-theme="light"] .token.string, :root[data-theme="light"] .token.builtin, :root[data-theme="light"] .token.selector { color: #2f7d32; }
:root[data-theme="light"] .token.operator { color: #0b7a96; }
:root[data-theme="light"] .token.keyword, :root[data-theme="light"] .token.atrule { color: #7b3fc4; }
:root[data-theme="light"] .token.function, :root[data-theme="light"] .token.class-name { color: #2c66d6; }
:root[data-theme="light"] .token.variable, :root[data-theme="light"] .token.regex { color: #946200; }

/* Math */
.katex { font-size: 1.06em; color: var(--text); }
.katex-wide { display: inline-block; max-width: 100%; overflow-x: auto; overflow-y: hidden; vertical-align: middle; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 6px 0; }
figure { margin: 20px 0; }
figure svg { display: block; margin: 0 auto; color: var(--text-2); }
figcaption { font-size: 13px; color: var(--muted); text-align: center; margin-top: 8px; }

/* ===== Quiz ===== */
.quiz { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 6px 20px 16px; max-width: var(--measure); }
.quiz-q { padding: 16px 0; border-bottom: 1px solid var(--line); }
.quiz-q:last-of-type { border-bottom: 0; }
.quiz-q .q-text { color: var(--text); margin-bottom: 10px; }
.quiz-q .q-text p { color: var(--text); margin: 0 0 8px; }
.q-num { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; display: block; margin-bottom: 4px; }
.opts { display: grid; gap: 7px; }
.opt {
  display: flex; gap: 10px; align-items: flex-start; text-align: left; width: 100%; cursor: pointer;
  font: inherit; font-size: 15px; color: var(--text-2); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 12px; transition: border-color .2s, background .2s;
}
.opt:hover:not(:disabled) { border-color: var(--accent); }
.opt .key { flex: none; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 12px; font-weight: 600; border: 1px solid var(--line); color: var(--muted); margin-top: 1px; }
.opt:disabled { cursor: default; }
.opt.selected { border-color: var(--accent); background: var(--accent-soft); }
.opt.correct { border-color: var(--ok); background: var(--ok-soft); color: var(--text); }
.opt.correct .key { background: var(--ok); color: var(--accent-ink); border-color: var(--ok); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .key { background: var(--bad); color: #fff; border-color: var(--bad); }
.opt pre, .q-text pre { margin: 6px 0; font-size: 13px; }
.explain { margin-top: 10px; padding: 10px 14px; border-radius: 8px; background: var(--surface-2); font-size: 14.5px; color: var(--text-2); }
.explain b { color: var(--ok); }
.explain b.no { color: var(--bad); }
.quiz-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; font-size: 14px; color: var(--muted); }
.quiz-missing { color: var(--muted); font-size: 14px; padding: 12px 0; }

/* ===== Overview ===== */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.card h3 { margin: 0 0 10px; font-size: 18px; }
.card h4 { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.card ul { padding-left: 18px; margin: 8px 0; }
.card table { font-size: 14px; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .big { font-size: 28px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat .lbl { font-size: 13px; color: var(--muted); }
.prog-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; margin: 10px 0; font-size: 14px; }
.prog-row .bar { grid-column: 1 / -1; margin: 0; }
.prog-row a { color: var(--text-2); }
.task-list { list-style: none; padding: 0 !important; margin: 0; }
.task-list li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.task-list li:last-child { border-bottom: 0; }
.task-list input { margin-top: 5px; accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
.task-list label { cursor: pointer; }
.task-list input:checked + label { text-decoration: line-through; color: var(--muted); }
.date { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text); font-weight: 500; }
tr.deadline td { color: var(--text); }
tr.deadline td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pill.a { color: var(--accent); }
.pill.b { color: #a990ff; }
.planner-controls { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; margin: 12px 0 18px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.field input, .field select {
  font: inherit; font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px; min-width: 120px;
}
.plan-week { margin-bottom: 14px; }
.plan-week h4 { display: flex; justify-content: space-between; gap: 12px; margin: 0 0 8px !important; }
.plan-week ul { margin: 0; }
.plan-week li { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.plan-week li .h { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ===== Mocks ===== */
.mock-card { display: flex; flex-direction: column; gap: 8px; }
.mock-card .meta { font-size: 13px; color: var(--muted); }
.mock-card .best { font-size: 13px; color: var(--ok); }
.mock-card .note { font-size: 14px; }
.mock-card .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: auto; padding-top: 6px; }
.mock-card .actions input { width: 80px; font: inherit; font-size: 13px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.mock-bar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; margin: 0 0 20px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: 12px;
}
@media (max-width: 980px) { .mock-bar { top: 58px; } }
.timer { font: 600 22px var(--mono); font-variant-numeric: tabular-nums; color: var(--text); }
.timer.low { color: var(--bad); }
.mock-q { border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; margin-bottom: 14px; background: var(--surface); }
.mock-q .pts { float: right; font-size: 12px; color: var(--muted); }
.mock-q textarea { width: 100%; min-height: 110px; font: 14px var(--mono); color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; resize: vertical; }
.mock-q .model { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; }
.self-score { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 14px; color: var(--muted); }
.self-score input { width: 72px; font: inherit; padding: 5px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.result-box { border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 12px; padding: 16px 20px; margin-bottom: 18px; }
.result-box .big { font-size: 30px; font-weight: 700; color: var(--text); }

/* ===== Cheats & glossary ===== */
.cheat { margin-bottom: 48px; }
.cheat > h3 { font-size: 22px; margin: 0 0 16px; }
.cheat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); gap: 14px; }
.cheat-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; min-width: 0; }
.cheat-card h4 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.cheat-card pre { font-size: 12.5px; padding: 10px 12px; }
.cheat-card table { font-size: 13px; margin: 6px 0; }
.cheat-card td, .cheat-card th { padding: 5px 8px; }
.cheat-card ul { padding-left: 18px; margin: 6px 0; font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.chip { font: 500 13px var(--font); padding: 5px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); cursor: pointer; }
.chip[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.gloss-filter { width: 100%; max-width: 420px; padding: 9px 12px; font: inherit; font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
dl.glossary { margin: 18px 0 0; display: grid; gap: 0; }
dl.glossary .g { padding: 12px 0; border-bottom: 1px solid var(--line); max-width: var(--measure); }
dl.glossary dt { font-weight: 600; color: var(--text); }
dl.glossary dt .pill { margin-left: 8px; vertical-align: 2px; }
dl.glossary dd { margin: 4px 0 0; color: var(--text-2); font-size: 15px; }

footer.site-foot { border-top: 1px solid var(--line); padding-top: 24px; font-size: 13.5px; color: var(--muted); max-width: var(--measure); }
.to-top {
  position: fixed; right: 20px; bottom: 20px; z-index: 30; width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line); color: var(--text-2); cursor: pointer; opacity: 0; pointer-events: none; transition: opacity .3s;
}
.to-top.show { opacity: 1; pointer-events: auto; }

@media print {
  .sidebar, .topbar, .to-top, .copy-btn, .done-btn { display: none !important; }
  .layout { display: block; }
  details.solution { display: block; }
}
