/* Rorsch — AMBOSS-style dense layout in a light theme (Amboss-light base + Claude-coral highlights). */
:root {
  --bg: #f5f6f8;          /* app background (Amboss cool light gray) */
  --rail: #ffffff;        /* left icon rail (white) */
  --surface: #ffffff;     /* cards / panels (white) */
  --surface-2: #eef1f5;   /* hover / insets (light gray) */
  --ink: #1f2630;         /* primary text (dark slate) */
  --muted: #5b6573;       /* secondary text */
  --faint: #656e7c;       /* tertiary (darkened so small labels pass AA) */
  --line: #e4e8ee;        /* borders */
  --accent: #d97757;      /* Claude coral — for FILLS/borders/active indicator (needs 3:1) */
  --accent-2: #c0603d;    /* coral hover fill (darker on light) */
  --accent-text: #b84d2a; /* coral as TEXT — darker so it passes AA on white/soft tints */
  --accent-ink: #1a0d07;  /* readable text on coral buttons (passes AA on hover fill too) */
  --accent-soft: rgba(217, 119, 87, 0.12);
  --good: #107253;        /* correct (green, AA on white + soft tint) */
  --good-soft: rgba(16, 114, 83, 0.12);
  --bad: #c22f2f;         /* incorrect (red, AA on white + soft tint) */
  --bad-soft: rgba(194, 47, 47, 0.10);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.04);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 13.5px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* ---------------- Shell ---------------- */
.app { display: flex; min-height: 100vh; }

.rail {
  width: 68px; flex: 0 0 68px; background: var(--rail);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: stretch;
  position: sticky; top: 0; height: 100vh; padding: 10px 0;
}
.rail-brand { text-align: center; font-size: 1.3rem; padding: 6px 0 12px; display: block; width: 100%;
  background: transparent; border: none; cursor: pointer; }
.rail-brand:hover img { filter: drop-shadow(0 1px 3px rgba(217,119,87,0.45)); transform: translateY(-1px); }
.rail-brand img { width: 30px; height: 30px; display: block; margin: 0 auto;
  filter: drop-shadow(0 1px 2px rgba(16,24,40,0.10)); transition: transform 0.12s ease, filter 0.12s ease; }
.rail-nav { display: flex; flex-direction: column; gap: 2px; }
.rail .tab, .rail .quit {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: transparent; border: none; cursor: pointer;
  color: var(--muted); padding: 9px 4px; font-size: 10px; font-weight: 500;
  letter-spacing: 0.02em; position: relative; width: 100%;
}
.rail .tab svg, .rail .quit svg {
  width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.rail .tab:hover { color: var(--ink); background: var(--surface-2); }
.rail .tab.active { color: var(--accent); }
.rail .tab.active::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px;
  background: var(--accent); border-radius: 0 2px 2px 0;
}
.quit { margin-top: auto; color: var(--faint) !important; }
.quit:hover { color: var(--bad) !important; background: var(--bad-soft); }
.quit.armed { color: var(--bad) !important; background: var(--bad-soft); }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 46px; flex: 0 0 46px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; border-bottom: 1px solid var(--line); background: var(--surface);
  position: sticky; top: 0; z-index: 10;
}
.topbar-title { font-weight: 600; font-size: 0.92rem; letter-spacing: 0.01em; }
.topbar-right { display: flex; align-items: center; gap: 14px; }

/* Centered content column ~60% of the available width (AMBOSS proportions). */
main { padding: 22px 0 40px; width: 60%; min-width: 460px; max-width: 1040px; margin: 0 auto;
  transition: margin .16s ease, width .16s ease; }
@media (max-width: 900px) { main { width: 92%; min-width: 0; } }
/* Phones (the owner studies on mobile): tighten the fixed topbar so its row of controls is less likely to
   overflow into a sideways scroll, and move the auth "signed in" chip off the Elo badge it otherwise covers
   (the chip is injected by auth.js as #ra-chip; this rule restyles it on narrow screens only). */
@media (max-width: 560px) {
  .topbar { padding: 0 12px; }
  .topbar-right { gap: 8px; }
  #ra-chip { top: auto; bottom: 12px; right: 12px; }
}
/* The question column is "resistant" to moving (see layoutQuestion() in app.js): it stays CENTERED until a
   side window — the question index (left) or Labs (right) — would actually overlap it; then it shifts the
   MINIMUM needed to clear that panel, and only SHRINKS once the free space is narrower than its natural
   width. A panel that doesn't reach it does not move it. The Reference window is a read-over overlay and
   never pushes the column. (JS sets margin-left/width inline; this rule is the default/centered state.) */
.view { display: none; }
/* The study card HUGS its content: the white card ends just below the last answer choice (no
   min-height), so a short question leaves grey space below it rather than a tall empty white card. */
.view.active { display: block; }
.muted { color: var(--muted); font-size: 0.82rem; }
footer { margin-top: 34px; font-size: 0.76rem; text-align: center; color: var(--faint); }
h3 { font-size: 0.95rem; font-weight: 600; margin: 24px 0 10px; color: var(--ink); }
h4 { font-size: 0.85rem; font-weight: 600; margin: 0 0 8px; }

/* ---------------- Elo badge ---------------- */
.elo-badge {
  display: inline-flex; align-items: center; gap: 7px; background: var(--surface);
  border: 1px solid var(--line); padding: 4px 11px; border-radius: 999px;
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: 0.85rem; color: var(--accent-text);
}
.elo-badge .elo-label { font-size: 0.6rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); font-weight: 600; }

/* ---------------- Cards / inputs ---------------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px 22px;
  box-shadow: var(--shadow);
}
select {
  padding: 6px 10px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--surface); color: var(--ink); font-size: 0.84rem; font-family: inherit;
}
.study-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }

/* ---------------- Study: question ---------------- */
.tagrow { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.chip {
  font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;
  background: var(--surface-2); color: var(--muted); padding: 3px 8px; border-radius: 4px;
}
.chip.kind { background: var(--accent-soft); color: var(--accent-text); }
.chip.diff { background: var(--surface-2); color: var(--faint); margin-left: auto; }
/* Study-only builds hide the difficulty until the question is answered (.flag-btn keeps its own
   margin-left:auto, so the flag stays right-aligned while this is hidden). */
.chip.diff.diff-hidden { display: none; }
/* Hammer difficulty (1–5, AMBOSS-style): filled hammers + the canonical Elo */
.chip.diff { display: inline-flex; align-items: center; gap: 7px; }
.hammers { display: inline-flex; gap: 1px; line-height: 1; }
.ham { font-size: 0.95rem; }
.ham.on { color: var(--accent-text); }
.ham.off { color: var(--line); }
.diff-elo { font-size: 0.62rem; color: var(--faint); letter-spacing: 0.03em; font-variant-numeric: tabular-nums; }
.chip.cl { background: #e6f0fb; color: #1f5fa6; }
/* Master-only question-ID chip — click to copy the canonical id for feedback (not rendered in study-only
   builds). Monospace + not uppercased so the id reads as a literal you can quote back. */
.chip.qid-chip {
  text-transform: none; letter-spacing: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); cursor: pointer;
}
.chip.qid-chip:hover { color: var(--accent-text); border-color: var(--accent); }
.chip.qid-chip.copied { color: var(--good); border-color: var(--good); }
/* Destructive ghost action (e.g. delete a past session) — red text, red fill on hover. */
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad); border-color: var(--bad); color: #fff; }
/* Board domain/topic chips shown only after answering. */
.reveal-tags { margin: 12px 0 2px; }
/* Domains view cards */
.dom-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dom-head h4 { margin: 0; }
.dom-summary { margin-bottom: 12px; font-size: 0.82rem; }
.stem { font-size: calc(0.97rem * var(--q-font-scale, 1)); line-height: 1.6; margin: 2px 0 18px; }

/* ---- Contiguous answer list (AMBOSS-style): full-width rows, inset hairline dividers, NO bubbles.
   The whole question→answer block reads as one unit; highlighted rows tint the full row + carry a
   left accent bar (inset box-shadow, no layout shift). ---- */
/* Full-bleed answer list: cancel the card's 22px side padding so the rows — and the dividers between
   them — reach the complete sides of the white card (AMBOSS-style). The option's own left padding puts
   the text back under the stem; the right padding reserves room for the × eliminate button. */
#options { margin: 6px -22px 0; }
/* The study card hugs its content: no empty white space below the last answer (the Submit row is gone). */
#card { padding-bottom: 12px; }
.option-block { margin: 0; position: relative; }
.option {
  position: relative; display: flex; gap: 11px; align-items: center; width: 100%; text-align: left;
  border: none; border-radius: 0; background: transparent; margin: 0;
  padding: 9px 38px 9px 22px; cursor: pointer; font-size: 0.88rem; color: var(--ink);
  transition: background .12s; line-height: 1.4;
}
/* Inset hairline between consecutive rows — starts after the letter, stops short of the right edge
   (the "variable-length separating line", not a box around each choice). */
.option-block + .option-block > .option::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: var(--line);
}
.option:hover:not(.correct):not(.wrong):not(.selected) { background: var(--surface-2); }
.option .label {
  flex: 0 0 auto; width: 21px; height: 21px; border-radius: 50%; border: 1.5px solid var(--faint);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700; color: var(--muted);
}
.option.selected { background: var(--accent-soft); }
.option.selected .label { border-color: var(--accent); color: var(--accent-text); }
.option.correct { background: var(--good-soft); box-shadow: inset 3px 0 0 var(--good); }
.option.correct .label { border-color: var(--good); color: var(--good); }
.option.wrong { background: var(--bad-soft); box-shadow: inset 3px 0 0 var(--bad); }
.option.wrong .label { border-color: var(--bad); color: var(--bad); }
/* A highlighted row absorbs the divider on its own top and the next row's top -> the contiguous,
   variable-length-line look. (:has is supported in current browsers; degrades to a visible line.) */
.option.correct::before, .option.wrong::before, .option.selected::before { display: none; }
.option-block:has(> .option.correct) + .option-block > .option::before,
.option-block:has(> .option.wrong) + .option-block > .option::before,
.option-block:has(> .option.selected) + .option-block > .option::before { display: none; }
.option:disabled { cursor: default; }
/* Eliminate-an-option visual aid (× button or right-click; toggles off on a second click) */
.option.struck { opacity: 0.5; }
.option.struck .opt-text { text-decoration: line-through; }
/* The × eliminate button per option (AMBOSS-style) — shown before answering, hidden once revealed. */
.opt-elim { position: absolute; top: 0; right: 11px; height: 100%; width: 22px; padding: 0; border: none;
  background: transparent; color: var(--faint); font-size: 0.82rem; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; opacity: 0.4; transition: opacity .12s, color .12s; }
.option-block:hover .opt-elim { opacity: 0.85; }
.opt-elim:hover, .opt-elim.on { opacity: 1; color: var(--bad); }
.opt-elim[hidden] { display: none; }

/* Per-option estimated-pick % + ✓/− marker (shown after answering). */
.option .opt-text { flex: 1; min-width: 0; font-size: calc(0.88rem * var(--q-font-scale, 1)); }
.option .opt-meta { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 9px; margin-left: 10px; }
.option .opt-pct { display: none; font-size: 0.82rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
#options.stats-on .opt-pct { display: inline; }
.option.correct .opt-pct { color: var(--good); }
.option.wrong .opt-pct { color: var(--bad); }
.opt-ic { flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-size: 0.82rem; font-weight: 700; line-height: 1; }
.opt-ic.ok { background: var(--good); color: #fff; }
.opt-ic.no { border: 1.5px solid var(--bad); color: var(--bad); }
/* A revealed option is clickable to expand its explanation (correct one opens by default). */
.option-block.revealed .option { cursor: pointer; }
.opt-explain { padding: 2px 22px 12px 54px; }
/* Indent + a subtle left rule so the eye can tell at a glance which options are expanded. */
.opt-explain .opt-rat { font-size: calc(0.85rem * var(--q-font-scale, 1)); line-height: 1.6; color: var(--ink);
  border-left: 2px solid var(--line); padding-left: 12px; margin-left: 2px; }

/* ---- End-of-session block-percentile figure (modeled cohort score distribution) ---- */
.block-dist { margin: 14px 0 2px; }
.block-dist-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.block-dist-badge { font-size: 0.8rem; font-weight: 700; color: var(--accent-text); background: var(--accent-soft);
  border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.block-dist-svg { width: 100%; height: auto; display: block; }
.bd-bar { fill: var(--surface-2, #eef1f5); }
.bd-bar.you { fill: var(--accent); }
.bd-axis { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.bd-tick { fill: var(--muted); font-size: 11px; }
.block-dist-caveat { font-size: 0.72rem; margin: 2px 0 0; }

/* ---- Post-answer toolbar (show-all-explanations / show-stats / reset / text-size / feedback) ---- */
.reveal-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px;
  padding: 9px 2px; margin: 10px 0 4px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.rtool { background: transparent; border: none; color: var(--muted); font-family: inherit;
  font-size: 0.79rem; font-weight: 600; cursor: pointer; padding: 3px 2px;
  display: inline-flex; align-items: center; gap: 5px; }
.rtool:hover { color: var(--accent-text); }
.rtool.on { color: var(--accent-text); }
.rtool.subtle { color: var(--faint); font-weight: 500; }
.rtool.subtle:hover { color: var(--bad); }
.rtool-spacer { flex: 1 1 12px; }

/* ---- Persistent control bar BELOW the white card (AMBOSS-style): Show answer · % stats · Reset · Aa ---- */
/* Centered under the card (justify-content: center) so the toggles follow the question window — it and
   the card share a column, so they shift together when the navigator pushes the column aside. */
.study-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 22px; padding: 11px 4px 2px; margin: 4px 2px 0; }
.ctl { background: transparent; border: none; color: var(--muted); font-family: inherit; font-size: 0.73rem;
  font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; cursor: pointer; padding: 4px 2px;
  display: inline-flex; align-items: center; gap: 6px; }
.ctl:hover:not(:disabled) { color: var(--accent-text); }
.ctl.on { color: var(--accent-text); }
.ctl:disabled { opacity: 0.38; cursor: default; }
.ctl-spacer { flex: 1 1 12px; }
/* Reveal detail (below the bar): the Elo-movement chip + the "try another" drip hint. */
.reveal-elo { margin: 8px 0 2px; }
.drip-hint { font-size: 0.8rem; margin: 6px 0 2px; }
.fontsize { display: inline-flex; align-items: center; gap: 6px; }
.fz { width: 22px; height: 22px; border: 1px solid var(--line); background: var(--surface);
  border-radius: 5px; color: var(--muted); cursor: pointer; font-size: 0.95rem; line-height: 1; }
.fz:hover { border-color: var(--accent); color: var(--accent-text); }
.fz-aa { font-size: 0.78rem; color: var(--faint); }
/* Honest-labeling caption for the modeled pick-% (visible, not just a tooltip); hidden when stats off. */
.stats-note { font-size: 0.72rem; margin: 2px 2px 0; }
#options:not(.stats-on) ~ #result .stats-note { display: none; }

.actions { display: flex; gap: 9px; margin-top: 16px; align-items: center; }
/* Reset/Report row now lives in the explanation, just above the teaching point — a hairline divider
   keeps it visually distinct from the per-option rationales above it. */
.reveal-actions { margin: 14px 0 2px; padding-top: 12px; border-top: 1px solid var(--line); }
/* Feedback panel: a textarea revealed under the Feedback button (stores a note, never quarantines). */
.feedback-panel { margin-top: 10px; }
.feedback-text {
  width: 100%; resize: vertical; min-height: 56px;
  font-family: inherit; font-size: 13px; line-height: 1.5;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px;
}
.feedback-text:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.feedback-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.feedback-status { font-size: 0.8rem; }
/* Settings rows (Manage > Study settings): checkbox + label, top-aligned. */
.setting-row { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; line-height: 1.5; }
.setting-row input { margin-top: 4px; flex: 0 0 auto; }
.btn {
  padding: 8px 18px; border: none; border-radius: 7px; font-size: 0.85rem; font-weight: 600;
  cursor: pointer; background: var(--accent); color: var(--accent-ink); font-family: inherit;
}
.btn:hover:not(:disabled) { background: var(--accent-2); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn.ghost:hover { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn.small { padding: 5px 12px; font-size: 0.78rem; }

.verdict { font-weight: 700; margin: 18px 0 10px; font-size: 0.92rem; }
.verdict.correct { color: var(--good); }
.verdict.wrong { color: var(--bad); }
.explain { background: var(--surface-2); border-radius: 8px; padding: 14px 16px; margin-top: 8px; }
.explain h4 { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); }
.explain > div { font-size: calc(0.88rem * var(--q-font-scale, 1)); line-height: 1.65; }
.teaching {
  border-left: 3px solid var(--good); padding: 9px 13px; margin-top: 12px;
  background: var(--good-soft); border-radius: 0 6px 6px 0; font-size: 0.86rem;
}
.citation { font-size: 0.8rem; margin-top: 9px; }
.citation .src { font-weight: 600; color: var(--accent-text); }
.citation .quote { color: var(--muted); font-style: italic; }

/* Per-option rationales (AMBOSS-style; letters match the shuffled serve) */
.key-point {
  font-size: 0.9rem; line-height: 1.6; margin-bottom: 12px; color: var(--ink);
  border-left: 3px solid var(--accent); padding: 8px 13px; background: var(--accent-soft);
  border-radius: 0 6px 6px 0;
}
.rationales { display: flex; flex-direction: column; gap: 8px; }
.rationale {
  display: grid; grid-template-columns: 1.4em 1.2em 1fr; gap: 6px; align-items: start;
  font-size: 0.86rem; line-height: 1.6; padding: 8px 10px; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--surface-2);
}
.rationale.opt-correct { border-color: var(--good); background: var(--good-soft); }
.rationale.opt-wrong { border-color: var(--surface-2); }
.rationale .rat-label { font-weight: 700; color: var(--faint); }
.rationale.opt-correct .rat-label { color: var(--good); }
.rationale .rat-mark { font-weight: 700; }
.rationale.opt-correct .rat-mark { color: var(--good); }
.rationale.opt-wrong .rat-mark { color: var(--bad); }

/* Per-answer rating change — a tiny toolbar chip; the per-scope breakdown is a click-to-open popover
   (the old always-on 3-row block was visually distracting). */
.elo-mini { position: relative; display: inline-flex; outline: none; }
.elo-mini-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 0.79rem; font-weight: 600;
  color: var(--muted); cursor: help; border-bottom: 1px dotted var(--line); padding: 2px 0; }
.elo-mini-chip.up { color: var(--good); }
.elo-mini-chip.down { color: var(--bad); }
.elo-mini-chip.flat { color: var(--muted); }
.elo-mini-delta { font-variant-numeric: tabular-nums; }
/* Breakdown popover — hidden until you hover (or keyboard-focus) the simplified chip. */
.elo-detail { display: none; position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 30; min-width: 230px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow);
  padding: 9px 11px; gap: 6px; }
.elo-mini:hover .elo-detail, .elo-mini:focus-within .elo-detail { display: grid; }
.elo-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; font-size: 0.78rem; }
.elo-row-label { color: var(--muted); }
.elo-move { font-variant-numeric: tabular-nums; font-weight: 600; }
.elo-delta { margin-left: 7px; padding: 1px 6px; border-radius: 4px; font-size: 0.72rem; }
.elo-move.up .elo-delta { background: var(--good-soft); color: var(--good); }
.elo-move.down .elo-delta { background: var(--bad-soft); color: var(--bad); }
.elo-move.flat .elo-delta { background: var(--line); color: var(--muted); }

/* Top-up banner */
.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--accent-soft); border: 1px solid var(--accent); color: var(--accent-text);
  border-radius: 8px; padding: 9px 13px; margin-bottom: 14px; font-size: 0.83rem;
}
/* Data-home warning (e.g. newer-app downgrade notice) — spans the content column. */
#data-warning:empty { display: none; }
#data-warning { padding: 12px 22px 0; max-width: 1040px; margin: 0 auto; width: 60%; min-width: 460px; }
@media (max-width: 900px) { #data-warning { width: 92%; min-width: 0; } }
.banner.warn { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }

/* About / version (toolbar pill + Manage detail rows) */
.about-badge {
  font-size: 0.7rem; font-weight: 600; color: var(--faint); letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums; padding: 2px 8px; border: 1px solid var(--line);
  border-radius: 999px;
}
.about-badge:empty { display: none; }
.about-rows { display: grid; gap: 6px; }
.about-row { display: flex; justify-content: space-between; gap: 14px; font-size: 0.84rem; }
.about-k { color: var(--muted); }
.about-v { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Reset progress (armed state mirrors the Quit two-click confirm) */
#reset-progress-btn.armed { color: var(--bad); border-color: var(--bad); background: var(--bad-soft); }
#reset-status { margin-left: 10px; }

/* Question pack drop zone */
.dropzone {
  border: 1.5px dashed var(--line); border-radius: 9px; padding: 20px; text-align: center;
  color: var(--muted); font-size: 0.85rem; transition: border-color .12s, background .12s;
}
.dropzone p { margin: 0; }
.dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.dz-link { color: var(--accent-text); cursor: pointer; text-decoration: underline; }
.pack-errs { margin: 8px 0 0; padding-left: 18px; color: var(--bad); font-size: 0.8rem; }

/* ---------------- Dashboard ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px; margin-bottom: 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 13px 15px; box-shadow: var(--shadow); }
.stat .n { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .k { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }

table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line);
  border-radius: 9px; overflow: hidden; font-size: 0.82rem; }
th, td { text-align: left; padding: 8px 13px; border-bottom: 1px solid var(--line); }
th { background: var(--surface-2); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: none; }
td { color: var(--ink); }

.tax-domain { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 13px 16px; margin-bottom: 10px; }
.tax-domain h4 { margin: 0 0 8px; }
.tax-topics { display: flex; flex-wrap: wrap; gap: 5px; }

.status-indexed { color: var(--good); font-weight: 600; }
.status-cataloged { color: var(--muted); }
.status-pending { color: var(--accent-text); }

/* ---------------- Question sessions ---------------- */
.setup-card { max-width: 660px; }
.setup-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 16px; margin: 16px 0; }
.setup-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 0.76rem; color: var(--muted);
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.setup-grid input[type="number"] { padding: 6px 10px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--surface); color: var(--ink); font-size: 0.9rem; font-family: inherit; }
.setup-grid select { font-size: 0.88rem; }

/* Difficulty (hammer) selector in session setup */
.hammer-select { margin: 2px 0 16px; }
.hammer-head { display: block; margin-bottom: 7px; font-size: 0.76rem; color: var(--muted);
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.hammer-head .muted { text-transform: none; font-weight: 400; letter-spacing: 0; }
.hammer-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.hammer-opt { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none;
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px 5px 9px; background: var(--surface); }
.hammer-opt:hover { border-color: var(--accent); }
.hammer-opt input { width: 14px; height: 14px; accent-color: var(--accent); flex: 0 0 auto; }

/* Topic selector (checkbox tree: master select-all + per-domain groups + topics) */
.topic-select { margin: 4px 0 16px; }
.topic-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.topic-all { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; font-weight: 600; color: var(--ink); cursor: pointer; }
.topic-all input, .topic-group-head input, .topic-item input { width: 15px; height: 15px; accent-color: var(--accent); flex: 0 0 auto; }
.topic-list { max-height: 244px; overflow-y: auto; border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px; background: var(--surface); }
.topic-group { margin-bottom: 8px; }
.topic-group-head { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; font-weight: 600; color: var(--ink); cursor: pointer; padding: 3px 0; }
.topic-items { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 1px 14px; padding: 2px 0 4px 22px; }
.topic-item { display: flex; align-items: center; gap: 7px; font-size: 0.76rem; color: var(--muted); cursor: pointer; padding: 2px 0; }
.topic-item:hover { color: var(--ink); }

.session-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
/* The stem column keeps the full content width; the navigator pops out as an overlay (below). */
.session-layout { display: block; }
.session-main { width: 100%; min-width: 0; }
/* Previous/Next pinned to the bottom of the viewport (AMBOSS-style), clear of the 68px left rail.
   The runner gets bottom padding so card content never hides behind the fixed bar. */
#session-runner { padding-bottom: 52px; }
/* AMBOSS-style nav: a free-floating, CENTERED pair of flat, right-angled (square) boxes that sit next
   to each other — they read as plain boxes, not emphasised buttons. The bar is transparent and lets
   clicks pass through to the content behind it; only the boxes themselves are interactive. */
#session-footer-bar {
  position: fixed; left: 68px; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: center; align-items: center; gap: 0; padding: 9px 16px;
  background: transparent; pointer-events: none;
}
.navbtn {
  pointer-events: auto; flex: 0 0 auto; min-width: 116px; padding: 7px 18px; border-radius: 0;
  font-size: 0.82rem; font-weight: 500; cursor: pointer; font-family: inherit;
  background: var(--surface); color: var(--muted); border: 1px solid var(--line);
}
.navbtn.prev { border-right: none; }      /* adjacent boxes share the middle edge */
.navbtn:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.navbtn:disabled { opacity: 0.4; cursor: not-allowed; }
/* "Next" is the primary forward action — highlight it in the theme orange (keeps the flat square shape). */
.navbtn.next { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.navbtn.next:hover:not(:disabled) { background: var(--accent-2); border-color: var(--accent-2); color: var(--accent-ink); }

/* Question navigator: a fixed drawer docked to the left icon rail. It floats ABOVE the content
   (so it never shrinks the stem) and slides away when collapsed. */
#nav-drawer {
  position: fixed; top: 46px; left: 68px; bottom: 0; width: 224px; z-index: 40;
  transition: transform .16s ease;
}
.session-nav {
  position: absolute; inset: 0; padding-left: 18px;   /* clear the toggle tab overlapping the left edge */
  display: flex; flex-direction: column; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--line);
  box-shadow: 6px 0 22px rgba(16, 24, 40, 0.12);
}
#session-runner.nav-collapsed #nav-drawer { transform: translateX(calc(-100% - 80px)); }

/* ONE toggle tab, fixed at the rail edge in BOTH states (same position, same shape) — only the arrow
   direction and the drawer flip. A very subtle theme tint marks its location/presence. */
#nav-toggle-tab {
  position: fixed; left: 68px; top: 50%; transform: translateY(-50%); z-index: 42;
  width: 16px; height: 56px; padding: 0; cursor: pointer;
  border: 1px solid var(--line); border-left: none; border-radius: 0 8px 8px 0;
  background: var(--accent-soft); color: var(--accent-text);
  font-size: 0.9rem; line-height: 56px; text-align: center;
  box-shadow: 3px 0 12px rgba(16, 24, 40, 0.10);
  transition: background .14s ease, color .14s ease, border-color .14s ease;
}
#nav-toggle-tab::before { content: "‹"; }                                  /* expanded: collapse */
#session-runner.nav-collapsed #nav-toggle-tab::before { content: "›"; }    /* collapsed: expand */
#nav-toggle-tab:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* One thin row per question. A left accent bar carries status; the stem's opening text fills in
   once the question has been viewed. Rows (not squares): full-width, flat, hairline separators. */
.nav-row {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; cursor: pointer;
  background: transparent; border: none; border-left: 3px solid transparent;
  border-bottom: 1px solid var(--line); padding: 7px 10px; color: var(--ink);
}
.nav-row:last-child { border-bottom: none; }
.nav-row:hover { background: var(--surface-2); }
.nav-row .nav-num { flex: 0 0 auto; min-width: 14px; font-size: 0.74rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--faint); }
.nav-row .nav-text { flex: 1; min-width: 0; font-size: 0.7rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-row.correct { border-left-color: var(--good); }
.nav-row.correct .nav-num { color: var(--good); }
.nav-row.incorrect { border-left-color: var(--bad); }
.nav-row.incorrect .nav-num { color: var(--bad); }
/* The current item changes ONLY its background (orange highlight). It deliberately does NOT touch
   the status left-bar or the number's color, so the correct/incorrect coding stays stable while you
   scroll the index. */
.nav-row.current { background: var(--accent-soft); }
.nav-row.flagged .nav-num::after { content: " ⚑"; color: #d6a400; font-size: 0.7em; }

.flag-btn { margin-left: auto; background: transparent; border: 1px solid var(--line); color: var(--muted);
  border-radius: 6px; padding: 3px 10px; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; cursor: pointer; }
.flag-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.flag-btn.flagged { background: #fff7e0; color: #8a6d00; border-color: #e3c869; }

/* Stem highlights (drag to create, click to remove; deeper shade where they overlap) */
.stem { cursor: text; }
.stem mark.hl { background: #fff3a8; color: inherit; cursor: pointer; border-radius: 2px;
  -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.stem mark.hl.hl-2 { background: #ffd84d; }
.stem mark.hl:hover { background: #ffe27a; }

@media (max-width: 760px) {
  /* The navigator stays a left-docked overlay; just trim its width on small screens. */
  #nav-drawer { width: 200px; }
}

/* ---------------- End-of-session recap ---------------- */
.recap-card { max-width: 760px; }
.recap-head { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.recap-ring { flex: 0 0 auto; }
.recap-pct { fill: var(--ink); font-size: 23px; font-weight: 700; font-variant-numeric: tabular-nums; }
.recap-frac { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.recap-summary { flex: 1; min-width: 210px; }
.recap-list { display: flex; flex-direction: column; gap: 7px; }
.recap-row { display: grid; grid-template-columns: 1.4em 1.6em 1fr; gap: 8px; align-items: start;
  padding: 9px 12px; border-radius: 7px; background: var(--surface); border: 1px solid var(--surface-2);
  border-left: 3px solid transparent; }
.recap-row.correct { border-left-color: var(--good); background: var(--good-soft); }
.recap-row.incorrect { border-left-color: var(--bad); background: var(--bad-soft); }
.recap-mark { font-weight: 700; }
.recap-row.correct .recap-mark { color: var(--good); }
.recap-row.incorrect .recap-mark { color: var(--bad); }
.recap-num { font-weight: 700; color: var(--faint); font-variant-numeric: tabular-nums; font-size: 0.82rem; }
.recap-stem { font-size: 0.82rem; color: var(--muted); margin-bottom: 3px; }
.recap-tp { font-size: 0.86rem; color: var(--ink); line-height: 1.5; }

/* ---------------- Case labs/vitals (Phase B: shown with the stem) ---------------- */
/* Compact, narrow panels (don't span the full stem width); two sit side-by-side, then wrap. */
.case-labs { display: flex; flex-wrap: wrap; gap: 10px 14px; margin: 0 0 18px; max-width: 640px; }
.cl-panel { flex: 0 1 300px; min-width: 200px; max-width: 320px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--surface-2); padding: 7px 11px 9px; }
.cl-panel-title { font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--faint); font-weight: 700; margin-bottom: 4px; }
.cl-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.cl-table td { padding: 2px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.cl-table tr:last-child td { border-bottom: none; }
.cl-test { color: var(--muted); padding-right: 10px; }
.cl-val { color: var(--ink); text-align: right; white-space: nowrap; font-weight: 600; }
.cl-ref { display: block; color: var(--faint); font-size: 0.72rem; font-weight: 400; white-space: nowrap; }
.cl-row.cl-low .cl-val { color: #1f5fa6; }
.cl-row.cl-high .cl-val { color: var(--accent-text); }
.cl-row.cl-critical .cl-val { color: var(--bad); }

/* ---------------- Lab reference drawer ---------------- */
.labs-drawer {
  position: fixed; top: 0; right: 0; width: 380px; max-width: 92vw; height: 100vh; z-index: 50;
  background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: -6px 0 22px rgba(16, 24, 40, 0.10); display: flex; flex-direction: column;
}
.labs-drawer[hidden] { display: none; }
.labs-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px;
  border-bottom: 1px solid var(--line); font-size: 0.95rem; }
.labs-close { background: transparent; border: none; font-size: 0.95rem; cursor: pointer; color: var(--muted); padding: 2px 6px; }
.labs-close:hover { color: var(--ink); }
.labs-tabs { display: flex; flex-wrap: wrap; gap: 5px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.labs-tab { background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px;
  font-size: 0.72rem; font-weight: 600; cursor: pointer; color: var(--muted); }
.labs-tab:hover { border-color: var(--accent); }
.labs-tab.active { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent); }
.labs-body { overflow-y: auto; padding: 6px 16px 28px; flex: 1; }
.labs-section { margin-top: 16px; }
.labs-section-name { font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint);
  font-weight: 700; margin-bottom: 4px; }
.labs-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.labs-table td { padding: 5px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.lt-test { color: var(--ink); font-weight: 500; padding-right: 10px; }
.lt-val { color: var(--muted); text-align: right; white-space: nowrap; }
.lt-si { display: block; color: var(--faint); font-size: 0.72rem; }

/* Reference drawer: wider (≈ half the screen), smaller font, and WRAPPING tables so nothing ever
   scrolls sideways (the DSM/CYP/mechanism rows are long; the narrow labs width forced h-scroll). */
.ref-drawer { width: clamp(380px, 50vw, 760px); max-width: 96vw; }
.ref-drawer .labs-body { padding: 4px 18px 30px; }
.ref-drawer .labs-table { font-size: 0.72rem; table-layout: fixed; }
.ref-drawer .labs-table td { padding: 4px 8px 4px 0; word-break: break-word; overflow-wrap: anywhere; vertical-align: top; }
.ref-drawer .lt-test { width: 36%; font-weight: 600; color: var(--ink); }
.ref-drawer .lt-val { white-space: normal; text-align: left; color: var(--ink); }
.ref-drawer .labs-section-name { font-size: 0.62rem; }

/* Scrollbars (subtle, light) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #8190a4; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #6f7d92; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================ Dark mode ============================ */
/* A second variable set; everything (incl. the SVG charts) reads these, so the whole app re-themes. */
:root[data-theme="dark"] {
  --bg: #14171c;
  --rail: #181c22;
  --surface: #1e232b;
  --surface-2: #272d37;
  --ink: #e7eaef;
  --muted: #a6afbc;
  --faint: #939cab;
  --line: #2d343f;
  --accent: #e08a6e;
  --accent-2: #e8a088;
  --accent-text: #edb09a;
  --accent-ink: #1a0d07;
  --accent-soft: rgba(224, 138, 110, 0.16);
  --good: #46c191;
  --good-soft: rgba(70, 193, 145, 0.16);
  --bad: #e76d6d;
  --bad-soft: rgba(231, 109, 109, 0.16);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}
:root[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #3a434f; }
:root[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #4a5560; }
:root[data-theme="dark"] .stem mark.hl { color: #1f2630; }          /* keep yellow highlights legible */
:root[data-theme="dark"] .stem mark.hl.hl-2 { color: #1f2630; }
#theme-toggle { font-size: 0.95rem; line-height: 1; }

/* ===================== Source drill-down (citation -> real passage) ===================== */
.citation .src-toggle {
  margin-left: 8px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase;
  color: var(--accent-text); background: var(--accent-soft); border: 1px solid var(--line);
  border-radius: 6px; padding: 1px 7px; cursor: pointer;
}
.citation .src-toggle:hover { border-color: var(--accent); }
.src-passages { margin: 8px 0 4px; border-left: 3px solid var(--accent); background: var(--surface-2);
  border-radius: 0 8px 8px 0; padding: 10px 12px; }
.src-passages .src-meta { font-size: 0.72rem; color: var(--muted); margin-bottom: 6px; }
.src-passages .src-para { font-size: 0.84rem; line-height: 1.5; color: var(--ink); margin: 6px 0; white-space: pre-wrap; }
.src-passages .src-para.neighbor { color: var(--muted); }
.src-passages .src-para mark { background: #fff3a8; color: #1f2630; border-radius: 2px; padding: 0 1px; }
.src-passages .src-loc { font-size: 0.66rem; color: var(--faint); font-variant-numeric: tabular-nums; }

/* ===================== In-session timer + pace benchmark ===================== */
.q-timer { font-variant-numeric: tabular-nums; font-size: 0.74rem; font-weight: 700; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; }
.q-timer.over { color: var(--bad); border-color: var(--bad); }
.pace-line { font-size: 0.78rem; color: var(--muted); margin: 6px 0 0; }
.pace-line strong { color: var(--ink); }

/* ===================== Home hub (progress + recent sessions) ===================== */
.hub-card { margin-bottom: 16px; }
.hub-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.hub-progress { display: flex; gap: 18px; flex-wrap: wrap; }
.hub-stat .n { font-size: 1.5rem; font-weight: 700; color: var(--ink); line-height: 1.1; }
.hub-stat .k { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
/* Home proficiency bell curve — your Elo vs a MODELED examinee population (not real peer data). */
.bell-card .bell-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.bell-you-badge { font-size: 0.8rem; font-weight: 700; color: var(--accent-text); background: var(--accent-soft);
  padding: 3px 10px; border-radius: 999px; }
.bell-svg { width: 100%; height: auto; display: block; margin: 6px 0 2px; }
.bell-area-all { fill: var(--surface-2); }
.bell-area-left { fill: var(--accent-soft); }
.bell-line { fill: none; stroke: var(--faint); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.bell-axis { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.bell-you-line { stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.bell-you-dot { fill: var(--accent); }
.bell-tick { fill: var(--faint); font-size: 11px; }
.bell-caveat { font-size: 0.72rem; margin: 2px 0 0; }
.hub-bar { height: 8px; border-radius: 5px; background: var(--surface-2); overflow: hidden; margin: 10px 0 2px; }
.hub-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.session-list { display: flex; flex-direction: column; gap: 8px; }
.session-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--surface); }
.session-row .sr-badge { font-size: 0.64rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 2px 8px; border-radius: 999px; }
.session-row .sr-badge.suspended { color: #8a6d00; background: #fff7e0; border: 1px solid #e3c869; }
.session-row .sr-badge.ended { color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); }
.session-row .sr-meta { flex: 1; min-width: 0; }
.session-row .sr-title { font-size: 0.86rem; color: var(--ink); }
.session-row .sr-sub { font-size: 0.72rem; color: var(--muted); }
.session-row .sr-score { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); }
/* Thin correct/incorrect/unanswered bar under each prior-session row (green · red · grey). */
.sr-bar { display: flex; height: 5px; border-radius: 3px; overflow: hidden; margin-top: 6px; background: var(--surface-2); }
.sr-bar i { display: block; height: 100%; }
.sr-bar .b-correct { background: var(--good); }
.sr-bar .b-incorrect { background: var(--bad); }
.sr-bar .b-unanswered { background: var(--line); }
.session-row .sr-actions { display: flex; gap: 6px; flex: 0 0 auto; }
:root[data-theme="dark"] .session-row .sr-badge.suspended { color: #e7c66a; background: rgba(231,198,106,0.12); border-color: #6b5a1e; }

/* ===================== Activity heatmap + streaks (GitHub/Claude-style) ===================== */
.activity-head { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; margin-bottom: 12px; }
.activity-head h3 { margin: 0; }
.activity-streak { font-size: 0.9rem; color: var(--muted); }
.activity-streak .fire { color: var(--accent-text); font-weight: 700; }
.heatmap-scroll { overflow-x: auto; padding-bottom: 4px; }
.heatmap { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 11px); gap: 3px; width: max-content; }
.heatmap .cell { width: 11px; height: 11px; border-radius: 2px; background: var(--surface-2); }
.heatmap .cell.a1 { background: rgba(217, 119, 87, 0.30); }
.heatmap .cell.a2 { background: rgba(217, 119, 87, 0.55); }
.heatmap .cell.a3 { background: rgba(217, 119, 87, 0.80); }
.heatmap .cell.a4 { background: var(--accent); }
.heatmap-legend { display: flex; align-items: center; gap: 5px; font-size: 0.7rem; color: var(--muted); margin-top: 8px; }
.heatmap-legend .cell { width: 11px; height: 11px; border-radius: 2px; }

/* ===================== Reference drawer disclaimer (NOT for use during questions) ===================== */
.ref-drawer .ref-disclaimer {
  margin: 0; padding: 10px 14px; font-size: 0.76rem; line-height: 1.45; font-weight: 600;
  color: var(--bad); background: var(--bad-soft); border-bottom: 1px solid var(--line);
}
.ref-warn-pill { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: #fff; background: var(--bad); border-radius: 999px; padding: 2px 8px; margin-right: 6px; }

/* ===================== Keyboard-shortcuts overlay (toggled by "?") ===================== */
#kbd-overlay { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  background: rgba(16, 24, 40, 0.45); }
.kbd-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  padding: 20px 24px; min-width: 320px; }
.kbd-title { font-weight: 700; color: var(--ink); margin-bottom: 12px; }
.kbd-table { width: 100%; border-collapse: collapse; }
.kbd-table td { padding: 6px 8px; font-size: 0.86rem; color: var(--ink); }
.kbd-table td:first-child { white-space: nowrap; color: var(--muted); }
.kbd-hint { margin-top: 12px; font-size: 0.74rem; color: var(--muted); }
kbd { font-family: inherit; font-size: 0.78rem; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 5px; padding: 1px 6px; color: var(--ink); }

/* Welcome / milestone modal (warm-up intro + completion) */
.app-modal-overlay { position: fixed; inset: 0; z-index: 210; display: flex; align-items: center;
  justify-content: center; background: rgba(16, 24, 40, 0.45); padding: 20px; }
.app-modal-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); padding: 26px 28px; max-width: 420px; text-align: center; }
.app-modal-card .modal-emoji { font-size: 2rem; line-height: 1; margin-bottom: 8px; }
.app-modal-card .modal-title { font-weight: 700; font-size: 1.05rem; color: var(--ink); margin-bottom: 8px; }
.app-modal-card .modal-body { font-size: 0.9rem; line-height: 1.6; color: var(--muted); margin: 0; }
.app-modal-card .modal-tip { font-size: 0.82rem; color: var(--faint); margin: 12px 0 0; }
.app-modal-actions { margin-top: 18px; }
.bell-you-badge.calibrating { background: var(--surface-2); color: var(--muted); }
