:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #f1efe8;
  --border: #e3dfd3;
  --border-strong: #cbc5b4;
  --text: #1b1a17;
  --muted: #6b675d;
  --gold: #cfb991;
  --gold-strong: #8e6f3e;
  --gold-soft: #f4ecdc;
  --ok: #1d7f47;
  --ok-soft: #e4f3ea;
  --bad: #b8322f;
  --bad-soft: #fbe7e5;
  --ok-fill: #3b855b;
  --bad-fill: #b34f4d;
  --sel: #2d5bd7;
  --sel-soft: #e8eefc;
  --d1: #2e9d58;
  --d2: #d8a80f;
  --d3: #e2731e;
  --shadow: 0 1px 2px rgba(27, 26, 23, .05), 0 4px 14px rgba(27, 26, 23, .05);
  --radius: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

/* Dark theme: set on <html> from the saved choice, or the system setting when there is none. */
:root[data-theme="dark"] {
  --bg: #141412;
  --surface: #1c1c19;
  --surface-2: #24231f;
  --border: #2f2e29;
  --border-strong: #46443c;
  --text: #ecebe6;
  --muted: #a19d92;
  --gold: #cfb991;
  --gold-strong: #d9c39a;
  --gold-soft: #2c271c;
  --ok: #4cc382;
  --ok-soft: #16291e;
  --bad: #f0726c;
  --bad-soft: #321a19;
  --ok-fill: #59a77c;
  --bad-fill: #d27a76;
  --sel: #7ea0ff;
  --sel-soft: #1b2340;
  --d1: #4cc382;
  --d2: #e6c443;
  --d3: #f08c45;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  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(--text);
  font: 16px/1.55 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--sel); outline-offset: 2px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 20px;
  height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; letter-spacing: -.01em; }
.brand-mark { display: block; flex: none; width: 28px; height: 28px; }
.topnav { display: flex; gap: 4px; }
.topnav a {
  text-decoration: none; padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; font-size: 15px;
}
.topnav a:hover { background: var(--surface-2); color: var(--text); }
.topnav a.active { color: var(--text); background: var(--surface-2); }
.topbar-end { display: flex; align-items: center; gap: 6px; }
.theme-toggle {
  width: 34px; height: 34px; display: grid; place-items: center; flex: none; border-radius: 8px;
  border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer;
}
.theme-toggle:hover { background: var(--surface-2); color: var(--text); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .i-sun, [data-theme="dark"] .theme-toggle .i-moon { display: none; }
[data-theme="dark"] .theme-toggle .i-sun { display: block; }

.app { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 20px 48px; }
.loading, .error { color: var(--muted); padding: 40px 0; text-align: center; }
/* Footer: the name and the archive it draws on at the left; your data, and the button that moves it, at the right. */
.footer { color: var(--muted); font-size: 13px; border-top: 1px solid var(--border); background: var(--surface); }
.footer-inner {
  max-width: 1180px; margin: 0 auto; padding: 22px 20px 26px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 24px;
}
.footer p { margin: 0; line-height: 1.5; }
.footer a { color: inherit; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 2px; }
.footer a:hover { color: var(--text); text-decoration-color: currentColor; }
.footer-src a + a { margin-left: 10px; }
.footer-brand {
  justify-self: start; display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 14px; letter-spacing: -.01em; color: var(--text) !important; text-decoration: none !important;
}
.footer-brand .brand-mark { width: 22px; height: 22px; }
.footer-btn {
  justify-self: end; display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--border-strong); background: var(--bg); color: var(--text);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: border-color .12s, background .12s;
}
.footer-btn:hover { border-color: var(--text); background: var(--surface-2); }
.footer-btn svg { width: 15px; height: 15px; color: var(--muted); }
.footer-note { justify-self: end; text-align: right; }
@media (max-width: 640px) {
  .footer-inner { grid-template-columns: minmax(0, 1fr); }
  .footer-src { order: 1; }
  .footer-src a + a { display: table; margin: 4px 0 0; }
  .footer-note { order: 2; justify-self: start; text-align: left; margin-top: 6px !important; }
  .footer-btn { order: 3; justify-self: start; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); cursor: pointer; font-weight: 600; font-size: 15px; text-decoration: none;
  transition: background .12s, border-color .12s, transform .05s, box-shadow .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn-primary:hover { background: color-mix(in srgb, var(--text) 85%, var(--bg)); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #111; }
.btn-gold:hover { background: color-mix(in srgb, var(--gold) 85%, #000); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 14px; border-radius: 8px; }
kbd {
  font: 12px var(--mono); padding: 1px 5px; border-radius: 4px;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--muted);
}

/* Home */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; align-items: end; margin-bottom: 36px; }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gold-strong); margin: 0 0 8px; }
.hero h1 { font-size: clamp(30px, 4vw, 42px); line-height: 1.1; letter-spacing: -.025em; margin: 0 0 12px; }
.hero p.lede { color: var(--muted); font-size: 17px; margin: 0 0 20px; max-width: 560px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 14px; flex-wrap: wrap; }
.section-head h2 { font-size: 20px; margin: 0; letter-spacing: -.01em; }
.filters { display: flex; gap: 6px; }
.chip {
  border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 4px 12px;
  font-size: 14px; cursor: pointer; color: var(--muted);
}
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

.exam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.exam-card {
  display: flex; flex-direction: column; gap: 10px; padding: 16px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.exam-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.exam-card-top { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.exam-title { font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.exam-meta { color: var(--muted); font-size: 13px; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.badge-gold { background: var(--gold-soft); color: var(--gold-strong); border-color: transparent; }
.badge-warn { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
/* Progress: wrong spans everything answered and right sits on top, so each fill ends in a rounded cap. */
.progress { position: relative; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; }
.progress .p-ok { background: var(--ok-fill); }
.progress .p-bad { background: var(--bad-fill); }
.exam-card-foot { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Exam layout */
.exam-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 24px; align-items: start; }
.sidebar {
  position: sticky; top: 76px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 16px;
}
.crumb { font-size: 13px; color: var(--muted); text-decoration: none; }
.crumb:hover { color: var(--text); }
.sidebar h1 { font-size: 20px; margin: 2px 0 0; letter-spacing: -.015em; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 10px; padding: 3px; }
.segmented button {
  border: 0; background: transparent; border-radius: 8px; padding: 6px 0; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--muted);
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.qgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.qcell {
  aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--border); background: var(--surface);
  font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer; color: var(--muted);
  display: grid; place-items: center; text-decoration: none;
}
.qcell:hover { border-color: var(--border-strong); color: var(--text); }
.qcell.s-selected { background: var(--sel-soft); border-color: var(--sel); color: var(--sel); }
.qcell.s-correct { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.qcell.s-wrong { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.qcell.s-skipped { border-style: dashed; }
.qcell.current { outline: 2px solid var(--text); outline-offset: 1px; color: var(--text); }
.tally { display: flex; gap: 14px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.tally b { color: var(--text); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.dot-ok { background: var(--ok); } .dot-bad { background: var(--bad); } .dot-none { background: var(--border-strong); } .dot-sel { background: var(--sel); }
.sidebar-foot { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--border); padding-top: 12px; }
.sidebar-foot a, .sidebar-foot button {
  font-size: 13px; color: var(--muted); text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; text-align: left;
}
.sidebar-foot a:hover, .sidebar-foot button:hover { color: var(--text); text-decoration: underline; }
.timer { font: 600 22px var(--mono); letter-spacing: -.02em; }
.timer-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.timer.is-paused { color: var(--muted); animation: timer-paused 1.6s ease-in-out infinite; }
@keyframes timer-paused { 50% { opacity: .45; } }
.timer-btn { height: 30px; padding: 0 10px 0 8px; gap: 5px; font-size: 13px; }
.timer-btn svg, .pause-card .btn svg { width: 13px; height: 13px; }
/* While a test is paused only the pause card shows in the problem column. */
.exam-layout.is-paused .qpanel > :not(.pause-card) { display: none; }
.pause-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 48px 24px; }
.pause-card h2 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.pause-card p { margin: 0 0 6px; max-width: 34ch; color: var(--muted); line-height: 1.5; }
.pause-icon {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
  background: var(--gold-soft); color: var(--gold-strong);
}
.pause-icon svg { width: 22px; height: 22px; }
@media (prefers-reduced-motion: reduce) { .timer.is-paused { animation: none; } }
.test-box { display: flex; flex-direction: column; gap: 10px; }
.score-big { font-size: 34px; font-weight: 800; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }

/* Question */
.qpanel { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 28px; }
.qhead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.qnum { font-size: 14px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.qnum b { color: var(--text); }
.context { background: var(--gold-soft); border-left: 3px solid var(--gold); border-radius: 6px; padding: 10px 14px; margin-bottom: 14px; }
.md { font-size: 17px; line-height: 1.65; overflow-wrap: anywhere; }
.md p { margin: 0 0 .75em; }
.md p:last-child { margin-bottom: 0; }
.md img { max-width: 100%; height: auto; vertical-align: middle; }
/* Let the white paper of equation crops take on the tint of a selected or graded choice. */
.md img.kind-equation, .md img.kind-choice, .md img.kind-context { mix-blend-mode: multiply; }
.md img.kind-figure, .md img.kind-question { display: block; margin: 10px 0; }
.md ol { margin: 0 0 .75em; padding-left: 1.5em; }
.md table { border-collapse: collapse; margin: 8px 0 12px; font-size: 15px; }
.md th, .md td { border: 1px solid var(--border-strong); padding: 4px 12px; text-align: center; }
.md th { background: var(--surface-2); }
.md .tex-raw { font-family: "Times New Roman", serif; font-style: italic; }
.md .katex { font-size: 1.08em; }
.md .katex-display { margin: .5em 0; overflow-x: auto; overflow-y: hidden; }

.notice { margin: 14px 0 0; padding: 10px 14px; border-radius: 8px; background: var(--surface-2); color: var(--muted); font-size: 14px; }
.choices { list-style: none; margin: 20px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.choice {
  width: 100%; display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 10px 14px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--surface);
  cursor: pointer; transition: border-color .1s, background .1s;
}
.choice:hover:not(:disabled) { border-color: var(--border-strong); background: var(--surface-2); }
.choice:disabled { cursor: default; }
.letter {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid var(--border-strong); font-weight: 700; font-size: 14px; color: var(--muted); background: var(--surface);
}
.choice-body { flex: 1; min-width: 0; }
.choice-body.md { font-size: 16.5px; }
.choice-mark { flex: none; font-size: 13px; font-weight: 700; }
.choice.is-selected { border-color: var(--sel); background: var(--sel-soft); }
.choice.is-selected .letter { background: var(--sel); border-color: var(--sel); color: #fff; }
.choice.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.choice.is-correct .letter { background: var(--ok); border-color: var(--ok); color: #fff; }
.choice.is-correct .choice-mark { color: var(--ok); }
.choice.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.choice.is-wrong .letter { background: var(--bad); border-color: var(--bad); color: #fff; }
.choice.is-wrong .choice-mark { color: var(--bad); }
.choice.is-dim { opacity: .6; }
.choices.letters-only { flex-direction: row; flex-wrap: wrap; }
.choices.letters-only .choice { width: auto; padding: 8px 18px 8px 10px; }

.feedback { margin-top: 16px; padding: 12px 16px; border-radius: 10px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.feedback[hidden] { display: none; }
.feedback.ok { background: var(--ok-soft); color: var(--ok); }
.feedback.bad { background: var(--bad-soft); color: var(--bad); }
.feedback.info { background: var(--surface-2); color: var(--muted); }
.feedback .fb-icon { font-size: 18px; line-height: 1; }

.qactions { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.qactions .mid { display: flex; gap: 8px; }
.hint { color: var(--muted); font-size: 13px; text-align: center; }
.hint kbd { margin: 0 2px; }

details.source { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
details.source summary { cursor: pointer; padding: 12px 18px; font-size: 14px; font-weight: 600; color: var(--muted); list-style: none; }
details.source summary::-webkit-details-marker { display: none; }
details.source summary::before { content: "▸"; display: inline-block; margin-right: 8px; transition: transform .15s; }
details.source[open] summary::before { transform: rotate(90deg); }
.source-imgs { padding: 0 18px 18px; display: flex; flex-direction: column; gap: 10px; }
.source-imgs img { max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: 6px; }

.start-card { text-align: center; padding: 48px 28px; }
.start-card h2 { margin: 0 0 8px; font-size: 24px; letter-spacing: -.02em; }
.start-card p { color: var(--muted); margin: 0 auto 20px; max-width: 460px; }
.results-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.results-banner .score-big { font-size: 30px; }
.history { font-size: 13px; color: var(--muted); }

@media (max-width: 880px) {
  .hero { grid-template-columns: 1fr; }
  .exam-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .qgrid { grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); }
  .card { padding: 18px; }
  .md { font-size: 16px; }
}
@media (max-width: 520px) {
  .app { padding: 18px 14px 40px; }
  .topnav a { padding: 6px 7px; }
  .topnav { gap: 0; }
  .topbar-end { gap: 2px; }
  .brand-name { display: none; }
  .hint { display: none; }
}

/* Equation crops are black ink on white paper: invert them so they sit in the dark page. */
[data-theme="dark"] .md img.kind-equation, [data-theme="dark"] .md img.kind-choice, [data-theme="dark"] .md img.kind-context { filter: invert(1) hue-rotate(180deg); mix-blend-mode: lighten; }
[data-theme="dark"] .md img.kind-figure, [data-theme="dark"] .md img.kind-question, [data-theme="dark"] .source-imgs img { background: #fff; border-radius: 6px; padding: 4px; }

/* Tags */
.tag {
  display: inline-flex; align-items: center; white-space: nowrap; text-decoration: none;
  font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px;
  background: var(--surface-2); color: var(--muted); border: 1px solid transparent;
}
a.tag:hover { border-color: var(--border-strong); color: var(--text); }
.tag-topic { background: var(--gold-soft); color: var(--gold-strong); }
.tag.is-match { border-color: currentColor; }
.qtags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.qtags-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-right: 4px; }

/* Home: topics */
.exams-section { margin-bottom: 40px; }
.section-sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.topic-group a.is-empty { opacity: .4; }
.topic-groups { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.topic-group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 8px 8px; }
.topic-group h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--gold-strong); margin: 0 8px 6px; }
.topic-group ul { list-style: none; margin: 0; padding: 0; }
.topic-group a {
  display: flex; justify-content: space-between; gap: 8px; padding: 5px 8px; border-radius: 6px;
  text-decoration: none; font-size: 14px;
}
.topic-group a:hover { background: var(--surface-2); }
.fcount { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

/* Search page */
.search-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; align-items: start; }
.filters-panel {
  position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0 14px 14px;
}
.filters-details > summary { display: none; }
/* A fixed thin scrollbar: the macOS overlay one widens when the pointer is over it. */
.filters-panel::-webkit-scrollbar { width: 8px; }
.filters-panel::-webkit-scrollbar-track { background: transparent; }
.filters-panel::-webkit-scrollbar-thumb { background: transparent; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
.filters-panel:hover::-webkit-scrollbar-thumb, .filters-panel:focus-within::-webkit-scrollbar-thumb { background-color: var(--border-strong); }
.filters-panel::-webkit-scrollbar-thumb:hover { background-color: var(--muted); }
@supports not selector(::-webkit-scrollbar) { .filters-panel { scrollbar-width: thin; } }
.fgroup { padding: 12px 0; border-bottom: 1px solid var(--border); }
.fgroup:last-child { border-bottom: 0; }
.fgroup h3, .fsection-head { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 8px; }
/* Topic is one filter: its areas sit inside it as subheadings, on an indented rule. */
.fsection { padding: 12px 0; }
.fsub { border-bottom: 0; padding: 3px 0 3px 10px; margin: 0 0 8px 2px; border-left: 2px solid var(--border); }
.fsub:last-child { margin-bottom: 0; }
.fsub h4 { font-size: 13px; font-weight: 600; color: var(--text); letter-spacing: 0; }
/* Folding sections: the heading row toggles, a chevron shows which way, and a folded one says what's chosen. */
.fsum { display: flex; align-items: center; gap: 8px; list-style: none; cursor: pointer; user-select: none; border-radius: 6px; }
.fsum::-webkit-details-marker { display: none; }
.fsum .fhead { flex: 1; min-width: 0; margin: 0; }
.fsum:focus-visible { outline: 2px solid var(--sel); outline-offset: 2px; }
.fchev { flex: none; width: 14px; height: 14px; color: var(--muted); transition: transform .15s; }
details[open] > .fsum > .fchev { transform: rotate(90deg); }
.fsum:hover .fhead, .fsum:hover .fchev { color: var(--text); }
.fhint { flex: none; max-width: 78%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fhint:empty, details[open] > .fsum > .fhint { display: none; }
.fhint.is-set { color: var(--gold-strong); font-weight: 600; }
.fgroup > .fbody, .fsection > .fbody { padding-top: 8px; }
.fsub > .fbody { padding-top: 4px; }
.fopt { display: flex; align-items: center; gap: 8px; padding: 3px 2px; font-size: 14px; cursor: pointer; border-radius: 6px; }
.fopt:hover { color: var(--text); background: var(--surface-2); }
.fopt input { margin: 0; accent-color: var(--text); flex: none; }
.fopt-label { flex: 1; min-width: 0; }
.fopt.is-empty { opacity: .4; }
.fopt-lead { margin-bottom: 4px; padding-bottom: 6px; border-bottom: 1px dashed var(--border); border-radius: 6px 6px 0 0; }
.seg-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.select {
  width: 100%; height: 34px; border-radius: 8px; border: 1px solid var(--border-strong);
  -webkit-appearance: none; appearance: none; cursor: pointer;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%236b675d' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center / 12px;
  color: var(--text); font: inherit; font-size: 14px; padding: 0 30px 0 10px;
}
[data-theme="dark"] .select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23a19d92' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.select:hover { border-color: var(--text); }
.search-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.search-bar {
  display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 14px;
  background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: 12px;
}
.search-bar:focus-within { border-color: var(--text); }
.search-bar svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.search-bar input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 17px; color: var(--text); }
.search-bar input::-webkit-search-cancel-button { cursor: pointer; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.active-filters:empty { display: none; }
.chip-x { color: var(--text); }
.chip-x span { color: var(--muted); margin-left: 2px; }
.results-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 10px; font-size: 14px; color: var(--muted); min-height: 32px; }
.results-head b { color: var(--text); }
.results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.result {
  display: block; text-decoration: none; padding: 14px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color .12s, box-shadow .12s;
}
.result:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.result-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.result-title { font-weight: 700; font-size: 14px; }
.result-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.result-body { font-size: 15.5px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.more-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 4px 0; }
.more-left { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.more-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

@media (max-width: 880px) {
  .topic-groups { grid-template-columns: 1fr 1fr; }
  .search-layout { grid-template-columns: 1fr; }
  .filters-panel { position: static; max-height: none; padding: 0 14px; }
  .filters-details > summary { display: block; cursor: pointer; padding: 12px 0; font-weight: 600; }
}
@media (max-width: 520px) {
  .topic-groups { grid-template-columns: 1fr; }
  .search-kbd { display: none; }
}

/* Icon tips */
.tip {
  position: relative; display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
  width: 20px; height: 20px; border-radius: 50%; color: var(--muted); cursor: help; outline-offset: 1px;
}
.tip svg, .tip img { width: 16px; height: 16px; display: block; }
.tip:hover, .tip:focus-visible, .tip:focus { color: var(--text); }
.tip-pop {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: -6px; width: max-content; max-width: 250px;
  padding: 9px 11px; border-radius: 8px; background: var(--text); color: var(--bg);
  font-size: 12.5px; line-height: 1.45; font-weight: 400; text-transform: none; letter-spacing: 0; text-align: left; white-space: normal;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .18); opacity: 0; visibility: hidden; transform: translateY(-2px);
  transition: opacity .12s, transform .12s, visibility 0s .12s; pointer-events: none;
}
.tip-pop b { display: block; font-weight: 700; margin-bottom: 2px; }
.tip-end .tip-pop { left: auto; right: -6px; }
.tip:hover .tip-pop, .tip:focus .tip-pop { opacity: 1; visibility: visible; transform: none; transition: opacity .12s, transform .12s; }
.exam-icons { display: flex; gap: 2px; margin: -2px -4px 0 0; }
/* A tip that opens a page: pointer cursor and a ring on hover. */
.tip[data-href] { cursor: pointer; }
.tip[data-href]:hover { background: var(--surface-2); box-shadow: 0 0 0 1px var(--border-strong); }
.badge-tip { position: relative; cursor: help; }
.badge-tip svg { width: 12px; height: 12px; margin-right: -2px; opacity: .75; }
.badge-tip:hover .tip-pop, .badge-tip:focus .tip-pop { opacity: 1; visibility: visible; transform: none; transition: opacity .12s, transform .12s; }
.sidebar h1 .tip { margin-left: 2px; vertical-align: -2px; }

/* Difficulty */
.diff { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.pips { display: inline-flex; gap: 2px; }
.pips i { width: 4px; height: 10px; border-radius: 1.5px; background: var(--border-strong); opacity: .55; }
.pips i.on { opacity: 1; }
.diff[data-level="1"] .pips i.on { background: var(--d1); }
.diff[data-level="2"] .pips i.on { background: var(--d2); }
.diff[data-level="3"] .pips i.on { background: var(--d3); }
.diff[data-level="4"] .pips i.on, .diff[data-level="5"] .pips i.on { background: var(--bad); }
.qhead .diff { margin-left: auto; }
.result-title .diff { margin-left: 6px; vertical-align: 0; }
.fopt-label .diff { margin-right: 8px; }
.fopt-label .diff + span { vertical-align: 1px; }

/* Twists (hints) */
.tag-twist { background: var(--sel-soft); color: var(--sel); }
details.twists { margin-top: 12px; }
details.twists[hidden] { display: none; }
details.twists summary {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none;
  font-size: 13px; font-weight: 600; color: var(--muted);
}
details.twists summary::-webkit-details-marker { display: none; }
details.twists summary::before { content: "▸"; transition: transform .15s; }
details.twists[open] summary::before { transform: rotate(90deg); }
details.twists summary:hover { color: var(--text); }
details.twists ul { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
details.twists li .tag { margin-right: 4px; }

/* Practice set sidebar */
.set-desc { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.set-details > summary { display: none; }
.set-list {
  list-style: none; margin: 0 -8px; padding: 0 2px; position: relative;
  max-height: max(180px, calc(100vh - 400px)); overflow-y: auto; overscroll-behavior: contain;
}
.srow {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; text-decoration: none;
  border: 1px solid transparent;
}
.srow:hover { background: var(--surface-2); }
.srow.current { background: var(--surface-2); border-color: var(--border-strong); }
.srow .dot { flex: none; margin: 0; background: var(--border-strong); }
.srow.s-correct .dot { background: var(--ok); }
.srow.s-missed .dot { background: var(--bad); }
.srow-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.srow-title { font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.srow-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srow .pips i { width: 3px; height: 8px; }

/* Year range slider */
.yr { --r: 8px; display: flex; flex-direction: column; gap: 2px; }
.yr-head { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-bottom: 8px; }
.yr-label { font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.yr-label b { font-weight: 700; }
/* Each season and year is a one-line window: words share one grid cell, an invisible sizer fixes its width
   (the season's is always as wide as "Spring"), and a changing word rolls out as the new one rolls in. */
.yr-label .roll { display: inline-grid; clip-path: inset(0 -40px); }
.yr-label .roll > span { grid-area: 1 / 1; }
.yr-label .roll-sizer { visibility: hidden; }
.yr-label .season {
  grid-template-columns: minmax(0, 1fr); justify-items: end; color: var(--muted);
  transition: width .4s cubic-bezier(.3, .6, .35, 1);
}
.yr-label .season.is-wide { transition-duration: .15s; } /* opening up for a change is quick; settling is gentle */
.yr-label .year { justify-items: start; }
.yr-label.is-single .yr-dash, .yr-label.is-single .yr-end-hi { display: none; }
/* Both words share one curve, so they stay exactly a line apart, like an odometer. */
.yr-label .roll > span { --roll: .2s cubic-bezier(.3, .6, .35, 1); }
.roll-in.up { animation: roll-in-up var(--roll); }
.roll-in.down { animation: roll-in-down var(--roll); }
.roll-out.up { animation: roll-out-up var(--roll) forwards; }
.roll-out.down { animation: roll-out-down var(--roll) forwards; }
@keyframes roll-in-up { from { transform: translateY(100%); opacity: 0; } }
@keyframes roll-in-down { from { transform: translateY(-100%); opacity: 0; } }
@keyframes roll-out-up { to { transform: translateY(-100%); opacity: 0; } }
@keyframes roll-out-down { to { transform: translateY(100%); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .yr-label .roll > span { animation: none; }
  .yr-label .season { transition: none; }
  .yr-label .roll-out { display: none; }
}
.yr-toggle {
  display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted);
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.yr-toggle:hover { color: var(--text); border-color: var(--text); }
.yr-hist { position: relative; height: 26px; }
.yr-inner { position: absolute; left: var(--r); right: var(--r); top: 0; bottom: 0; }
.yr-hist i {
  --rest: color-mix(in srgb, var(--gold) 70%, transparent);
  position: absolute; bottom: 0; width: 3px; margin-left: -1.5px; height: 2px; border-radius: 1.5px 1.5px 0 0;
  background: var(--rest); opacity: .4; transition: height .15s, opacity .12s;
}
.yr-hist i.in { opacity: 1; }
/* Practice fills each bar from the bottom: wrong spans everything answered and right sits on top,
   each with the bar's rounded top. Bars outside the year range keep these colours, faded. */
.yr-hist i::before, .yr-hist i::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; border-radius: inherit; }
.yr-hist i::before { height: var(--p-done, 0%); background: var(--bad-fill); }
.yr-hist i::after { height: var(--p-ok, 0%); background: var(--ok-fill); }
.yr-slider { position: relative; height: 20px; }
.yr-track { position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px; background: var(--border); }
.yr-fill { position: absolute; top: 0; bottom: 0; border-radius: 2px; background: var(--gold-strong); }
.yr-slider input[type="range"] {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0;
  background: none; pointer-events: none; -webkit-appearance: none; appearance: none;
}
.yr-slider input[type="range"]:focus { outline: none; }
.yr-slider input[type="range"]::-webkit-slider-runnable-track { height: 20px; background: transparent; }
.yr-slider input[type="range"]::-moz-range-track { height: 20px; background: transparent; }
.yr-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; pointer-events: auto; cursor: grab;
  width: 16px; height: 16px; margin-top: 2px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--gold-strong); box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
.yr-slider input[type="range"]::-moz-range-thumb {
  pointer-events: auto; cursor: grab; width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--gold-strong); box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
.yr-slider input[type="range"]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--sel); outline-offset: 2px; }
.yr-slider input[type="range"]:focus-visible::-moz-range-thumb { outline: 2px solid var(--sel); outline-offset: 2px; }
.yr-slider input[type="range"]:active::-webkit-slider-thumb { cursor: grabbing; }
.yr-ends { display: flex; justify-content: space-between; align-items: baseline; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; padding: 0 2px; }

.exams-section .section-head { align-items: end; }

/* Search extras */
.results-tools { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.results-tools .btn { white-space: nowrap; }
.shuffle { height: 32px; padding: 0 10px; gap: 6px; font-size: 13px; }
.shuffle svg { width: 14px; height: 14px; }
.select-sm { width: auto; height: 32px; font-size: 13px; padding: 0 28px 0 10px; background-position: right 9px center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 880px) {
  .set-details > summary { display: block; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--muted); }
  .set-details[open] > summary { margin-bottom: 8px; }
  .set-list { max-height: 320px; }
}
@media (max-width: 620px) {
  .results-head { flex-wrap: wrap; }
}

/* Filter search */
.filter-search {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px;
  margin: 0 -14px; padding: 12px 14px 10px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.filter-search svg { position: absolute; left: 24px; width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.filter-search input {
  width: 100%; height: 34px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font: inherit; font-size: 14px; padding: 0 8px 0 30px;
}
.filter-search input:focus { outline: none; border-color: var(--text); }
.filter-empty { margin: 14px 0 0; color: var(--muted); font-size: 14px; }
.fopt mark { background: var(--gold-soft); color: inherit; border-radius: 2px; box-shadow: 0 0 0 1px var(--gold-soft); }
@media (max-width: 880px) {
  .filter-search { position: static; margin: 0; padding: 0 0 10px; border-bottom: 0; }
  .filter-search svg { left: 10px; }
}

/* Gridlines behind the bars; only the large chart shows them. */
.yr-grid { position: absolute; inset: 0; pointer-events: none; display: none; }
.yr-grid b { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--border); }
.yr-hist .yr-inner { z-index: 1; }

/* Large chart (home page): y-axis of questions, gridlines, five-year labels. */
.yr-large { display: grid; grid-template-columns: 26px minmax(0, 1fr); column-gap: 6px; row-gap: 0; }
.yr-large .yr-head { grid-column: 1 / -1; margin-bottom: 10px; }
.yr-large .yr-label { font-size: 16px; }
.yr-large .yr-axis { grid-column: 1; grid-row: 2; position: relative; }
.yr-large .yr-axis span {
  position: absolute; right: 0; transform: translateY(50%); font-size: 11px; line-height: 1; color: var(--muted); font-variant-numeric: tabular-nums;
}
.yr-large .yr-hist { grid-column: 2; grid-row: 2; height: 120px; }
.yr-large .yr-grid { display: block; }
.yr-large .yr-hist i { width: 5px; margin-left: -2.5px; border-radius: 2px 2px 0 0; }
.yr-large .yr-slider { grid-column: 2; grid-row: 3; margin-top: 6px; }
.yr-years { grid-column: 2; grid-row: 4; position: relative; height: 16px; }
.yr-years span { position: absolute; transform: translateX(-50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }


/* Crossing out choices */
.choice-row { display: flex; align-items: center; gap: 6px; }
.choice-row .choice { flex: 1; min-width: 0; }
.strike {
  flex: none; width: 34px; height: 34px; border-radius: 8px; border: 1px solid transparent; background: transparent;
  color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; opacity: 0; transition: opacity .12s;
}
.strike s { text-decoration-thickness: 1.5px; }
.choice-row:hover .strike, .strike:focus-visible, .strike[aria-pressed="true"] { opacity: 1; }
.strike:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.strike[aria-pressed="true"] { color: var(--text); border-color: var(--border-strong); }
.strike:disabled { cursor: default; }
.strike:disabled:not([aria-pressed="true"]) { visibility: hidden; }
@media (hover: none) { .strike { opacity: .7; } }
.choice.is-struck .letter { opacity: .45; }
.choice.is-struck .choice-body { color: var(--muted); }
/* A drawn line, since text-decoration doesn't reach into rendered math. */
.choice-row .choice-body { flex: 0 1 auto; position: relative; }
.choice-row .choice-mark { margin-left: auto; }
.choice.is-struck .choice-body::after {
  content: ""; position: absolute; left: -4px; right: -4px; top: 50%; border-top: 2px solid var(--text);
}
.choice.is-struck .choice-body img { opacity: .6; }
.choice.is-struck.is-correct .letter { opacity: 1; }
.choice.is-struck.is-correct .choice-body { color: inherit; }
.choices.letters-only .choice-row { display: inline-flex; }
.choices.letters-only .choice.is-struck .letter { text-decoration: line-through; }

/* Hide topics, difficulty and hints */
.switch-row { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.switch {
  -webkit-appearance: none; appearance: none; flex: none; margin: 0; cursor: pointer;
  width: 32px; height: 18px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background .15s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s;
}
.switch:checked { background: var(--gold-strong); }
.switch:checked::after { transform: translateX(14px); }
.switch:checked + span { color: var(--text); }
.hide-info .qtags, .hide-info .qhead .diff, .hide-info details.twists,
.hide-info .srow-sub, .hide-info .srow .diff { display: none !important; }

/* Your tags and note */
.tag .icon { width: 11px; height: 11px; margin-right: 3px; }
.tag-user { background: var(--sel-soft); color: var(--sel); gap: 2px; }
.tag-user a { color: inherit; text-decoration: none; }
.tag-user a:hover { text-decoration: underline; }
.tag-user button { border: 0; background: none; padding: 0 0 0 4px; color: inherit; opacity: .6; cursor: pointer; font-size: 13px; line-height: 1; }
.tag-user button:hover { opacity: 1; }
.mine-card { padding: 14px 20px; display: flex; flex-direction: column; gap: 12px; }
.mine-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.mine-tags { display: contents; }
.tag-add { cursor: pointer; border: 1px dashed var(--border-strong); background: transparent; }
.tag-add:hover, .tag-add[aria-expanded="true"] { color: var(--text); border-color: var(--text); }
.tag-editor { display: flex; flex-direction: column; gap: 8px; }
.tag-input {
  height: 34px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px; padding: 0 10px; max-width: 320px;
}
.tag-input:focus { outline: none; border-color: var(--text); }
.tag-suggest { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.suggest-label { font-size: 12px; color: var(--muted); margin-right: 2px; }
.tag-pick { cursor: pointer; border: 0; }
.tag-pick:hover { border-color: currentColor; box-shadow: inset 0 0 0 1px currentColor; }
.tag-pick .fcount { color: inherit; opacity: .7; margin-left: 4px; }
.note { display: flex; flex-direction: column; gap: 6px; }
.note-status { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--ok); margin-left: 6px; }
.note-input {
  width: 100%; min-height: 56px; resize: vertical; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-size: 15px; line-height: 1.5; padding: 8px 10px;
}
.note-input:focus { outline: none; border-color: var(--text); }

/* Filter search: the alias that matched */
.fopt-alias { color: var(--muted); font-size: 12px; }
@media (max-width: 520px) { .yr-large .yr-hist i { width: 3px; margin-left: -1.5px; } }

/* About */
.about { display: grid; grid-template-columns: 200px minmax(0, 720px); gap: 40px; align-items: start; }
.about-toc { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 1px; padding-top: 6px; }
.about-toc-title { margin: 0 0 6px; padding: 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.about-toc button {
  text-align: left; border: 0; background: none; font: inherit; font-size: 14px; color: var(--muted);
  padding: 5px 10px; border-radius: 8px; cursor: pointer;
}
.about-toc button:hover { color: var(--text); background: var(--surface-2); }
.about-head h1 { font-size: clamp(28px, 3.6vw, 38px); line-height: 1.1; letter-spacing: -.025em; margin: 0 0 12px; }
.about-head .lede { color: var(--muted); font-size: 17px; margin: 0 0 8px; }
.about-sec { padding: 24px 0 4px; border-top: 1px solid var(--border); margin-top: 20px; scroll-margin-top: 72px; }
.about-sec h2 { font-size: 20px; letter-spacing: -.01em; margin: 0 0 10px; }
.about-sec p { margin: 0 0 12px; line-height: 1.6; }
.about-sec a { color: inherit; text-decoration-color: var(--border-strong); text-underline-offset: 2px; }
.about-sec a:hover { text-decoration-color: currentColor; }
.about-sec code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); border-radius: 5px; padding: 1px 5px; }
.about-dl { margin: 0 0 12px; display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 10px 20px; }
.about-dl dt { font-weight: 600; }
.about-dl dd { margin: 0; line-height: 1.6; color: var(--muted); }
.about-dl dd b, .about-dl dd a, .about-dl dd .linklike { color: var(--text); }
.about-dl .badge { vertical-align: 1px; }
.about-scale, .about-twists { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 10px; }
.about-scale li { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: baseline; line-height: 1.55; }
.about-scale .diff { justify-self: start; }
.about-scale b, .about-twists b { color: var(--text); margin-right: 4px; }
.about-scale li > span, .about-twists li { color: var(--muted); }
.about-twists li { line-height: 1.55; padding-left: 12px; border-left: 2px solid var(--gold); }
.about-count { display: inline-block; margin-left: 6px; font-size: 12.5px; font-variant-numeric: tabular-nums; opacity: .8; }
.about-icon { display: inline-flex; vertical-align: -3px; color: var(--muted); }
.about-icon svg, .about-icon img { width: 17px; height: 17px; display: block; }
.about-strike { display: inline-block; font-size: 12px; font-weight: 600; padding: 0 6px; border: 1px solid var(--border-strong); border-radius: 6px; color: var(--text); }
.linklike { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 2px; cursor: pointer; }
.linklike:hover { text-decoration-color: currentColor; }
.about-keys { border-collapse: collapse; width: 100%; font-size: 15px; }
.about-keys td { padding: 8px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.about-keys tr:last-child td { border-bottom: 0; }
.about-keys td:first-child { width: 220px; padding-right: 16px; white-space: nowrap; color: var(--muted); }
@media (max-width: 880px) {
  .about { grid-template-columns: 1fr; gap: 16px; }
  .about-toc { position: static; flex-direction: row; gap: 6px; padding: 0 20px 2px; margin: 0 -20px; overflow-x: auto; scrollbar-width: none; }
  .about-toc::-webkit-scrollbar { display: none; }
  .about-toc-title { display: none; }
  .about-toc button { flex: none; white-space: nowrap; border: 1px solid var(--border); border-radius: 999px; padding: 4px 11px; font-size: 13px; background: var(--surface); }
}
@media (max-width: 560px) {
  .about-dl { grid-template-columns: 1fr; gap: 2px; }
  .about-dl dd { margin-bottom: 10px; }
  .about-keys td:first-child { width: auto; white-space: normal; }
}

/* Home: the hero is a full-width band, and the chart's bars rise behind the text from its bottom edge. */
.home .hero { grid-template-columns: 1fr; position: relative; isolation: isolate; }
.home .hero::before {
  content: ""; position: absolute; z-index: -1; top: -28px; bottom: 42px; left: 50%; width: 100vw; transform: translateX(-50%);
  background: var(--surface); border-bottom: 1px solid var(--border);
}
body { overflow-x: clip; }
.home .hero-text { grid-area: 1 / 1; z-index: 2; align-self: start; max-width: 600px; padding-top: 6px; pointer-events: none; }
.home .hero-text a, .home .hero-text button { pointer-events: auto; }
/* The buttons sit on a raised plane above the bars: a tight contact shadow plus a wider shadow cast onto
   the chart, and they rise a little more on hover. */
.home .hero-actions .btn {
  box-shadow: 0 1px 2px rgba(27, 26, 23, .14), 0 6px 14px -4px rgba(27, 26, 23, .22), 0 16px 30px -10px rgba(27, 26, 23, .28);
}
.home .hero-actions .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 3px rgba(27, 26, 23, .14), 0 10px 20px -6px rgba(27, 26, 23, .26), 0 22px 40px -12px rgba(27, 26, 23, .3);
}
.home .hero-actions .btn:active { transform: translateY(1px); }
[data-theme="dark"] .home .hero-actions .btn {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 1px 2px rgba(0, 0, 0, .6), 0 8px 18px -4px rgba(0, 0, 0, .75), 0 18px 36px -10px rgba(0, 0, 0, .8);
}
[data-theme="dark"] .home .hero-actions .btn:hover {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .09), 0 2px 3px rgba(0, 0, 0, .6), 0 12px 24px -6px rgba(0, 0, 0, .8), 0 24px 44px -12px rgba(0, 0, 0, .85);
}
.home .hero-text h1, .home .hero-text .lede, .home .hero-text .eyebrow {
  text-shadow: 0 0 2px var(--surface), 0 0 10px var(--surface), 0 0 22px var(--surface);
}
.home .hero-text .lede { color: var(--text); opacity: .82; }
[data-theme="dark"] .home .hero-text .lede {
  opacity: 1; color: #f3f1ea;
  text-shadow: 0 0 2px var(--surface), 0 0 4px var(--surface), 0 1px 8px var(--surface), 0 0 16px var(--surface), 0 0 28px var(--surface);
  background: radial-gradient(closest-side, color-mix(in srgb, var(--surface) 70%, transparent), transparent);
}
.home .home-chart { grid-area: 1 / 1; z-index: 1; padding-top: 4px; }
.home .yr-head { align-items: flex-end; }
.home .yr-large { grid-template-columns: minmax(0, 1fr) 22px 14px; column-gap: 4px; }
.home .yr-large .yr-axis { grid-column: 2; }
/* The axis title reads down the right edge, beside the numbers it names. */
.yr-axis-title {
  grid-row: 2; align-self: center; justify-self: center; writing-mode: vertical-rl;
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); white-space: nowrap;
}
.home .yr-axis-title { grid-column: 3; }
.home .yr-large .yr-axis span { right: auto; left: 0; }
.home .yr-large .yr-hist, .home .yr-large .yr-slider, .home .yr-years { grid-column: 1; }
.home .yr-large .yr-hist { height: 240px; }
.home .yr-grid b.major { border-top: 1px solid color-mix(in srgb, var(--border-strong) 75%, transparent); }
.home .yr-grid b.minor { border-top: 1px dashed var(--border); }

/* Home bars are wide, with paler "not done" so the fills stand out. */
.home .yr-large .yr-hist i {
  --bw: clamp(3px, 1.05vw, 12px); --rest: color-mix(in srgb, var(--gold) 42%, transparent);
  width: var(--bw); margin-left: calc(var(--bw) / -2); border-radius: 3px 3px 0 0;
  transition: height .15s, opacity .12s, box-shadow .12s;
}
.home .yr-hist i.is-hot { opacity: 1; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--text); }
.home .yr-hist.has-hot { cursor: pointer; }

/* The summary beside a hovered bar */
.bar-pop {
  position: absolute; z-index: 5; width: 232px; padding: 11px 13px 10px; pointer-events: none;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .16); font-size: 13px; line-height: 1.4;
}
.bar-pop-head { font-weight: 700; font-size: 14.5px; }
.bar-pop-sub, .bar-pop-notes { color: var(--muted); font-size: 12.5px; }
.bar-pop-notes { margin-top: 7px; }
.bar-pop-meter { margin: 9px 0 8px; }
.bar-pop-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 18px; margin: 0; }
.bar-pop-stats div { display: flex; justify-content: space-between; gap: 8px; }
.bar-pop-stats dt { color: var(--muted); }
.bar-pop-stats dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar-pop-stats .ok { color: var(--ok); }
.bar-pop-stats .bad { color: var(--bad); }
.bar-pop-foot { margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }

/* Narrow screens: the text sits above the chart instead of over it. */
@media (max-width: 640px) {
  .home .hero { row-gap: 20px; }
  .home .hero-text, .home .home-chart { grid-area: auto; }
  .home .hero-text { padding-top: 0; pointer-events: auto; }
  .home .hero-text h1, .home .hero-text .lede, .home .hero-text .eyebrow { text-shadow: none; }
  [data-theme="dark"] .home .hero-text .lede { background: none; text-shadow: none; color: var(--muted); }
  .home .hero-text .lede { color: var(--muted); opacity: 1; }
  .home .yr-head { align-items: flex-start; }
}
@media (max-width: 520px) {
  .home .hero::before { top: -18px; }
}

/* Your data: export and import */
.data-dialog {
  width: min(540px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto;
  padding: 22px 24px 20px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgba(0, 0, 0, .28);
}
.data-dialog::backdrop { background: rgba(20, 20, 18, .45); backdrop-filter: blur(2px); }
.data-dialog h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: -.01em; }
.data-x {
  position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border: 0; border-radius: 8px;
  background: none; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer;
}
.data-x:hover { background: var(--surface-2); color: var(--text); }
.data-lede { margin: 0 0 8px; color: var(--muted); font-size: 14.5px; line-height: 1.55; }
.data-here { margin: 0; font-size: 14px; color: var(--muted); }
.data-here b { font-weight: 600; color: var(--text); }
.data-sec { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.data-sec h3 { margin: 0 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.data-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.data-status, .data-or { font-size: 13px; color: var(--muted); }
.data-file:focus-within { outline: 2px solid var(--sel); outline-offset: 2px; }
.data-paste {
  display: block; width: 100%; min-height: 84px; margin-top: 10px; resize: vertical; padding: 8px 10px;
  border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: 12px/1.45 var(--mono);
}
.data-paste:focus { outline: none; border-color: var(--text); }
.data-found { margin: 6px 0 0; font-size: 13px; color: var(--ok); }
.data-found:empty { display: none; }
.data-found.is-bad { color: var(--bad); }
.data-mode { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; padding: 0; border: 0; }
.data-mode label { display: flex; align-items: baseline; gap: 8px; font-size: 14px; color: var(--muted); cursor: pointer; }
.data-mode b { color: var(--text); }
.data-mode input { margin: 0; accent-color: var(--text); transform: translateY(1px); }
