:root {
  --bg: #0b0710;
  --glass: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.09);
  --border-soft: rgba(255, 255, 255, 0.16);
  --text: #fdf2f8;
  --text-muted: #c4a8bb;
  --accent: #f472b6;
  --accent-2: #2dd4bf;
  --ok: #4ade80;
  --partial: #fbbf24;
  --error: #ff6b81;
  --radius: 20px;
  --radius-sm: 13px;
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  overscroll-behavior-y: none;
}

/* ---- red atmosphere: aurora + a faint graph of y' = y with its tangent ---- */
.aurora-bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: var(--bg); }
.aurora-blob { position: absolute; border-radius: 50%; filter: blur(85px); opacity: 0.34; will-change: transform; }
.blob-1 {
  width: 60vh; height: 60vh; top: -20%; left: -14%;
  background: radial-gradient(circle, #f472b6 0%, transparent 70%);
  animation: drift1 32s ease-in-out infinite alternate;
}
.blob-2 {
  width: 52vh; height: 52vh; top: 34%; right: -24%;
  background: radial-gradient(circle, #7c3aed 0%, transparent 70%);
  opacity: 0.4;
  animation: drift2 38s ease-in-out infinite alternate;
}
.blob-3 {
  width: 46vh; height: 46vh; bottom: -22%; left: 6%;
  background: radial-gradient(circle, #2dd4bf 0%, transparent 70%);
  opacity: 0.16;
  animation: drift3 44s ease-in-out infinite alternate;
}
@keyframes drift1 { from { transform: translate(0,0); } to { transform: translate(8%,10%); } }
@keyframes drift2 { from { transform: translate(0,0); } to { transform: translate(-10%,8%); } }
@keyframes drift3 { from { transform: translate(0,0); } to { transform: translate(6%,-8%); } }

.graph-bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  color: rgba(255, 255, 255, 0.055);
  opacity: 0.45;
}

.grain {
  position: absolute; inset: -10%; opacity: 0.035; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

#app {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  height: 100dvh; height: 100vh;
  max-width: 560px; margin: 0 auto;
}

.view-container {
  flex: 1; overflow-y: auto;
  padding: 30px 18px calc(116px + env(safe-area-inset-bottom, 0px));
  -webkit-overflow-scrolling: touch;
}

.view-header { margin-bottom: 22px; }
.view-title { font-family: var(--font-display); font-size: 25px; font-weight: 700; letter-spacing: -0.01em; }
.title-math {
  font-size: 40px; font-style: italic; letter-spacing: 0.01em; line-height: 1.05;
  background: linear-gradient(135deg, #fff 0%, #fbcfe8 40%, var(--accent-2) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.title-math .prime { color: var(--accent); -webkit-text-fill-color: var(--accent); padding: 0 1px; }
.view-subtitle { font-size: 12.5px; color: var(--text-muted); margin-top: 6px; line-height: 1.4; }

.section-title {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted); margin: 30px 0 14px; opacity: 0.85;
}

.glass, .packet-card, .flash-card, .summary-card, .global-stat-card, .stat-packet-row {
  background: var(--glass);
  border: 1px solid var(--border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 12px 30px -18px rgba(0,0,0,0.7);
}

@keyframes riseIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.packet-card, .flash-card, .summary-card { animation: riseIn 0.4s cubic-bezier(.2,.7,.3,1) both; }

.sub-chip, .btn-packet-all, .btn-packet-errors, .btn-packet-partial, .btn-packet-review, .tier-chip, .nav-btn, .assess-btn, .btn-primary, .packet-card, .quick-start-btn {
  transition: transform 0.12s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.sub-chip:active, .btn-packet-all:active, .btn-packet-errors:active, .btn-packet-partial:active, .btn-packet-review:active, .tier-chip:active, .nav-btn:active, .assess-btn:active, .btn-primary:active, .quick-start-btn:active {
  transform: scale(0.96);
}

/* ---- quick start ---- */
.quick-start-card {
  display: flex; align-items: center; gap: 14px;
  border-radius: 24px;
  padding: 18px 18px 18px 20px;
  margin-bottom: 14px;
  background: linear-gradient(135deg, rgba(244,114,182,0.2), rgba(45,212,191,0.1));
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.09), 0 16px 36px -18px rgba(244,114,182,0.55);
  animation: riseIn 0.4s cubic-bezier(.2,.7,.3,1) both;
}
.quick-start-icon { font-size: 28px; }
.quick-start-info { flex: 1; min-width: 0; }
.quick-start-label { font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.quick-start-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.quick-start-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #2a0a1a; border: none; border-radius: var(--radius-sm);
  padding: 12px 18px; font-size: 13px; font-weight: 700; font-family: var(--font-body);
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  box-shadow: 0 8px 20px -8px rgba(244,114,182,0.7);
}

/* ---- error summary ---- */
.error-summary {
  font-size: 12.5px; color: var(--error); font-weight: 600;
  padding: 4px 4px 14px;
}
.error-summary.ok { color: var(--ok); }

/* ---- packets ---- */
.packet-list { display: flex; flex-direction: column; gap: 12px; }
.packet-card { border-radius: var(--radius); padding: 16px; }
.packet-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; gap: 10px; }
.packet-title { font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.packet-count { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.packet-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 8px; vertical-align: 1px;
  box-shadow: 0 0 10px currentColor;
}
.packet-title sup, .stat-packet-label sup { font-size: 0.7em; }

.mini-bar { display: flex; height: 7px; border-radius: 99px; overflow: hidden; background: rgba(255,255,255,0.07); }
.mini-bar-seg { height: 100%; }
.seg-ok { background: var(--ok); }
.seg-partial { background: var(--partial); }
.seg-error { background: var(--error); }
.seg-new { background: transparent; }

.packet-actions { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.btn-packet-all {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #2a0a1a; border: none; border-radius: var(--radius-sm);
  padding: 11px; font-size: 13px; font-weight: 700; font-family: var(--font-body); cursor: pointer;
  box-shadow: 0 8px 20px -10px rgba(244,114,182,0.7);
}
.sub-chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.sub-chip {
  flex: 1; min-width: 40px; background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  color: var(--text-muted); border-radius: var(--radius-sm); padding: 9px 4px;
  font-size: 12px; font-weight: 700; cursor: pointer; font-family: var(--font-display);
}
.btn-packet-errors {
  background: rgba(255,107,129,0.14); border: 1px solid rgba(255,107,129,0.42);
  color: var(--error); border-radius: var(--radius-sm); padding: 10px;
  font-size: 12.5px; font-weight: 700; font-family: var(--font-body); cursor: pointer;
}
.btn-packet-partial {
  background: color-mix(in srgb, var(--partial) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--partial) 45%, transparent);
  color: var(--partial); border-radius: var(--radius-sm); padding: 10px;
  font-size: 12.5px; font-weight: 700; font-family: var(--font-body); cursor: pointer;
}
.btn-packet-review {
  background: rgba(255,255,255,0.05); border: 1px solid var(--border-soft);
  color: var(--text); border-radius: var(--radius-sm); padding: 10px;
  font-size: 12.5px; font-weight: 700; font-family: var(--font-body); cursor: pointer;
}
.tier-chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.tier-chip {
  background: color-mix(in srgb, var(--ok) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent);
  color: var(--ok); border-radius: var(--radius-sm); padding: 8px 11px;
  font-size: 12px; font-weight: 700; font-family: var(--font-body); cursor: pointer;
}

/* ---- session ---- */
.bottom-nav.hidden { display: none; }
.session-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 8px;
}
.session-exit {
  background: var(--glass); border: 1px solid var(--border); color: var(--text);
  border-radius: 99px; padding: 8px 14px; font-size: 12px; font-weight: 600; cursor: pointer;
  font-family: var(--font-body); white-space: nowrap;
}
.session-progress-label {
  font-size: 12px; color: var(--text-muted); font-weight: 600;
  min-width: 0; flex: 1; display: flex; justify-content: center; gap: 6px;
}
.spl-scope { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spl-count { flex-shrink: 0; white-space: nowrap; color: var(--text); }
.spl-count::before { content: "· "; color: var(--text-muted); }
.type-tag {
  font-size: 10.5px; font-weight: 700; padding: 5px 11px; border-radius: 99px;
  background: color-mix(in srgb, var(--tag-color) 20%, transparent);
  border: 1px solid color-mix(in srgb, var(--tag-color) 50%, transparent);
  color: var(--tag-color); white-space: nowrap;
}

.progress-bar-track { height: 5px; background: rgba(255,255,255,0.07); border-radius: 99px; margin-bottom: 22px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.3s ease; box-shadow: 0 0 12px rgba(244,114,182,0.7); }

.flash-card {
  position: relative;
  border-radius: 26px;
  padding: 34px 22px 26px;
  text-align: center;
  min-height: 320px;
  display: flex; flex-direction: column; align-items: center;
  justify-content: flex-start;
  border-top: 1px solid rgba(244,114,182,0.35);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 18px 44px -22px rgba(244,114,182,0.45);
}
.flash-card.tappable { cursor: pointer; }
.q-text {
  font-family: var(--font-display); font-size: 21px; font-weight: 700; line-height: 1.38;
  overflow-wrap: anywhere;
}
.q-text sup, .a-text sup { font-size: 0.68em; line-height: 0; }
.reveal-stack { width: 100%; margin-top: 26px; display: flex; flex-direction: column; gap: 14px; }
.reveal-row {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  animation: riseIn 0.3s ease both;
}
.reveal-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent-2); margin-bottom: 8px; }
.a-text {
  text-align: left; font-size: 16px; line-height: 1.62; color: var(--text);
  overflow-wrap: anywhere;
  font-family: 'Inter', 'Cambria Math', 'STIX Two Math', system-ui, sans-serif;
}

.session-footer { margin-top: 22px; }
.session-tap-hint { text-align: center; font-size: 12.5px; color: var(--text-muted); }
.assess-row { display: flex; gap: 10px; }
.assess-btn {
  flex: 1; border: none; border-radius: var(--radius-sm); padding: 15px 8px;
  font-size: 14px; font-weight: 700; font-family: var(--font-body); cursor: pointer;
}
.assess-wrong { background: rgba(255,107,129,0.16); color: var(--error); border: 1px solid rgba(255,107,129,0.42); }
.assess-correct { background: rgba(74,222,128,0.16); color: var(--ok); border: 1px solid rgba(74,222,128,0.4); }

.summary-card { border-radius: 26px; padding: 32px 22px; text-align: center; }
.summary-pct { font-family: var(--font-display); font-size: 46px; font-weight: 700; }
.summary-sub { font-size: 13px; color: var(--text-muted); margin: 8px 0 22px; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #2a0a1a; border: none; border-radius: var(--radius-sm);
  padding: 13px; font-size: 14px; font-weight: 700; font-family: var(--font-body); cursor: pointer;
}
.btn-full { width: 100%; }

/* ---- stats ---- */
.global-stat-grid { display: flex; gap: 10px; }
.global-stat-card { flex: 1; border-radius: var(--radius); padding: 16px; text-align: center; }
.global-stat-num { font-family: var(--font-display); font-size: 26px; font-weight: 700; }
.global-stat-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.stat-packet-list { display: flex; flex-direction: column; gap: 10px; }
.stat-packet-row { border-radius: var(--radius-sm); padding: 14px; }
.stat-packet-label { font-family: var(--font-display); font-weight: 700; font-size: 13px; margin-bottom: 8px; }
.stat-packet-nums { font-size: 11px; color: var(--text-muted); margin-top: 8px; }

.btn-reset {
  display: block; width: 100%; margin-top: 30px;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); border-radius: var(--radius-sm);
  padding: 12px; font-size: 12.5px; font-weight: 600; font-family: var(--font-body);
  cursor: pointer; transition: border-color 0.15s ease, color 0.15s ease;
}
.btn-reset:active { border-color: var(--error); color: var(--error); }

/* ---- floating bottom nav ---- */
.bottom-nav {
  position: absolute; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); left: 16px; right: 16px;
  display: flex; background: rgba(20, 6, 11, 0.7); border: 1px solid var(--border-soft);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-radius: 22px; padding: 8px;
  box-shadow: 0 16px 40px -12px rgba(0,0,0,0.7);
}
.nav-btn {
  flex: 1; background: none; border: none; color: var(--text-muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 2px; cursor: pointer; border-radius: 16px; font-family: var(--font-body);
}
.nav-btn.active { color: var(--accent-2); background: linear-gradient(135deg, rgba(244,114,182,0.22), rgba(45,212,191,0.1)); }
.nav-icon { font-size: 19px; }
.nav-label { font-size: 9.5px; font-weight: 600; }

/* ---- courses (home) ---- */
.course-list { display: flex; flex-direction: column; gap: 14px; }
.course-card {
  display: flex; align-items: center; gap: 16px;
  width: 100%; text-align: left; font-family: var(--font-body); color: var(--text);
  padding: 18px; border-radius: 24px; cursor: pointer;
  background: linear-gradient(135deg, rgba(244,114,182,0.16), rgba(255,255,255,0.04));
  border: 1px solid var(--border-soft);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.07), 0 16px 36px -20px rgba(244,114,182,0.55);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  animation: riseIn 0.4s cubic-bezier(.2,.7,.3,1) both;
  transition: transform 0.12s ease, border-color 0.15s ease;
}
.course-card:active { transform: scale(0.98); border-color: rgba(244,114,182,0.5); }
.course-num {
  flex: 0 0 56px; height: 56px; border-radius: 17px; display: grid; place-items: center;
  font-family: var(--font-display); font-size: 30px; font-weight: 700; font-style: italic;
  color: #2a0a1a; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 24px -10px rgba(244,114,182,0.85);
}
.course-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 9px; }
.course-title { font-family: var(--font-display); font-weight: 700; font-size: 19px; }
.course-sub { font-size: 12px; color: var(--text-muted); line-height: 1.35; margin-top: -5px; }
.course-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; font-size: 11.5px; color: var(--text-muted); }
.course-errors { color: var(--error); font-weight: 600; white-space: nowrap; }
.course-meta > span:first-child { white-space: nowrap; }
.course-arrow { font-size: 28px; color: var(--accent-2); flex-shrink: 0; line-height: 1; }
.back-btn { margin-bottom: 18px; }
.course-heading { font-size: 30px; }

/* ---- LaTeX (KaTeX) ---- */
.katex { font-size: 1.1em; }
.q-text .katex { font-size: 1.05em; }
.a-text .katex-display { margin: 0.7em 0; overflow-x: auto; overflow-y: hidden; }
.tex-fallback { font-family: ui-monospace, Consolas, monospace; font-size: 0.92em; }

/* ---- graph cards: a document from the course above the question ---- */
.card-img-btn { position: relative; display: block; width: 100%; padding: 0; border: none; cursor: zoom-in;
  background: #fff; border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.card-img { display: block; width: 100%; height: auto; max-height: 42vh; object-fit: contain; background: #fff; }
.zoom-hint { position: absolute; right: 8px; bottom: 8px; font-size: 11px; font-weight: 600; color: #fff;
  background: rgba(0, 0, 0, 0.65); padding: 3px 9px; border-radius: 99px; }
.img-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, 0.94); overflow: auto;
  -webkit-overflow-scrolling: touch; padding: 52px 10px 20px; box-sizing: border-box; }
.img-overlay img { display: block; width: 100%; height: auto; background: #fff; border-radius: 8px; cursor: zoom-in; }
.img-overlay.zoomed img { width: auto; min-width: 220%; max-width: none; cursor: zoom-out; }
.img-overlay-hint { margin-top: 12px; text-align: center; font-size: 12px; color: rgba(255, 255, 255, 0.7); }
.img-overlay.zoomed .img-overlay-hint { position: fixed; left: 0; right: 0; bottom: 14px; margin: 0; pointer-events: none;
  text-shadow: 0 1px 4px #000; }
.img-overlay-close { position: fixed; top: 10px; right: 10px; z-index: 1001; border: none; border-radius: 99px;
  padding: 8px 14px; font-weight: 700; font-size: 13px; background: #fff; color: #111; cursor: pointer; }

/* ================= BIG SCREEN (bio-pc) =================
   Overrides the phone layout above: sidebar on the left, grids instead of
   single columns, document beside the question in a revision. */
#app { max-width: 1520px; flex-direction: row; }
.view-container { padding: 40px 48px 48px; }
#app.focus-mode .side-nav { display: none; }
#app.focus-mode .view-container { padding: 24px 40px 30px; }

kbd {
  font-family: ui-monospace, Consolas, monospace; font-size: 0.74em; font-weight: 600;
  padding: 2px 6px; margin-left: 6px; border-radius: 6px; vertical-align: 1px;
  border: 1px solid rgba(255,255,255,0.28); background: rgba(255,255,255,0.08); color: inherit;
}

/* ---- sidebar ---- */
.side-nav {
  flex: 0 0 268px; display: flex; flex-direction: column; gap: 4px;
  padding: 30px 18px 22px; overflow-y: auto;
  border-right: 1px solid var(--border);
  background: rgba(11, 7, 16, 0.4);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.side-brand {
  font-family: var(--font-display); font-size: 32px; font-weight: 700; font-style: italic; padding: 0 6px;
  background: linear-gradient(135deg, #fff 0%, #fbcfe8 40%, var(--accent-2) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.side-brand .prime { color: var(--accent); -webkit-text-fill-color: var(--accent); }
.side-tagline { font-size: 12px; color: var(--text-muted); margin: 2px 6px 18px; }
.side-nav .nav-btn {
  flex: none; width: 100%; flex-direction: row; justify-content: flex-start; gap: 12px;
  padding: 11px 14px; border-radius: 13px;
}
.side-nav .nav-label { font-size: 14px; font-weight: 600; }
.side-nav .nav-icon { font-size: 18px; }
.side-nav .nav-btn:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.side-nav .nav-btn.active { color: var(--accent-2); background: linear-gradient(135deg, rgba(244,114,182,0.22), rgba(45,212,191,0.1)); }
.side-section {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted); opacity: 0.85; margin: 22px 6px 8px;
}
.side-course {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: 1px solid transparent; border-radius: 12px; padding: 9px 10px;
  color: var(--text-muted); font-family: var(--font-body); font-size: 13px; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.side-course:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.side-course.active { color: var(--text); background: rgba(244,114,182,0.1); border-color: rgba(244,114,182,0.4); }
.side-num {
  flex: 0 0 24px; height: 24px; border-radius: 8px; display: grid; place-items: center;
  font-family: var(--font-display); font-size: 13px; font-weight: 700; font-style: italic;
  color: #2a0a1a; background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.side-label { flex: 1; min-width: 0; line-height: 1.25; }
.side-count { font-size: 11px; font-variant-numeric: tabular-nums; }
.side-keys { margin-top: auto; padding: 18px 6px 0; display: flex; flex-direction: column; gap: 7px; font-size: 12px; color: var(--text-muted); }
.side-keys .side-section { margin: 0 0 2px; }
.side-keys kbd { margin: 0 3px 0 0; }

/* ---- home, course, progress: grids ---- */
.title-math { font-size: 52px; }
.view-subtitle { font-size: 14px; }
.course-heading { font-size: 38px; }
.course-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 18px; }
.course-card:hover { border-color: rgba(244,114,182,0.55); transform: translateY(-2px); }
.packet-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.quick-start-card { max-width: 760px; cursor: pointer; }
.error-summary { max-width: 760px; }
.stat-packet-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.global-stat-grid { max-width: 960px; }
.btn-reset { max-width: 360px; }
.btn-packet-all:hover, .quick-start-btn:hover, .btn-primary:hover { filter: brightness(1.08); }
.sub-chip:hover, .btn-packet-review:hover, .session-exit:hover { border-color: var(--border-soft); color: var(--text); }
.btn-packet-errors:hover, .btn-packet-partial:hover, .tier-chip:hover { filter: brightness(1.2); }

/* ---- revision: document left, question/answer right ---- */
.session-header, .progress-bar-track { max-width: 1440px; margin-left: auto; margin-right: auto; }
.session-progress-label { font-size: 13px; }
.session-stage { display: grid; gap: 28px; margin: 0 auto; }
.session-stage.no-img { max-width: 920px; }
.session-stage.has-img { grid-template-columns: minmax(0, 1.6fr) minmax(380px, 1fr); max-width: 1440px; align-items: start; }
.doc-pane { position: sticky; top: 0; }
.doc-pane .card-img-btn { margin: 0; border-radius: 16px; }
.doc-pane .card-img { max-height: calc(100vh - 150px); }
.doc-pane .zoom-hint { font-size: 12.5px; padding: 5px 11px; right: 12px; bottom: 12px; }
.flash-card { min-height: 0; padding: 40px 40px 32px; }
.session-stage.no-img .flash-card { min-height: 300px; justify-content: center; }
.session-stage.has-img .flash-card { padding: 30px 30px 26px; }
.q-text { font-size: 28px; }
.has-img .q-text { font-size: 22px; }
.a-text { font-size: 18.5px; line-height: 1.66; }
.has-img .a-text { font-size: 16.5px; }
.btn-reveal {
  width: 100%; padding: 16px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--border-soft); background: rgba(255,255,255,0.06); color: var(--text);
  font-family: var(--font-body); font-size: 15px; font-weight: 700;
  transition: background 0.15s ease;
}
.btn-reveal:hover { background: rgba(255,255,255,0.11); }
.assess-btn { font-size: 15.5px; padding: 17px 8px; }
.assess-wrong:hover { background: rgba(255,107,129,0.27); }
.assess-correct:hover { background: rgba(74,222,128,0.27); }
.summary-card { max-width: 560px; margin: 40px auto 0; }

/* ---- full-window document ---- */
.img-overlay { padding: 64px 30px 50px; cursor: zoom-out; }
.img-overlay-inner { min-height: 100%; display: flex; align-items: center; justify-content: center; }
.img-overlay img { width: auto; max-width: none; height: auto; margin: 0; }
.img-overlay.zoomed .img-overlay-inner { display: block; min-height: 0; }
.img-overlay.zoomed img { min-width: 0; }
.img-overlay-hint { position: fixed; left: 0; right: 0; bottom: 16px; margin: 0; pointer-events: none; font-size: 13px; text-shadow: 0 1px 4px #000; }
.img-overlay-close { top: 16px; right: 22px; font-size: 14px; padding: 9px 16px; }
.img-overlay-close kbd { border-color: rgba(0,0,0,0.25); background: rgba(0,0,0,0.06); }

/* ---- narrow window: sidebar becomes a top bar, panes stack ---- */
@media (max-width: 900px) {
  #app { flex-direction: column; }
  .side-nav { flex: none; flex-direction: row; align-items: center; gap: 6px; padding: 10px 14px; border-right: none; border-bottom: 1px solid var(--border); overflow: visible; }
  .side-tagline, .side-nav > .side-section, .side-course, .side-keys { display: none; }
  .side-brand { font-size: 22px; margin-right: auto; }
  .side-nav .nav-btn { width: auto; }
  .view-container, #app.focus-mode .view-container { padding: 22px 16px 30px; }
  .session-stage.has-img { grid-template-columns: 1fr; }
  .doc-pane { position: static; }
  .q-text, .has-img .q-text { font-size: 21px; }
  .flash-card { padding: 30px 20px 24px; }
}
/* the background derrick + dashed well line would cut the wide page in two */
.graph-bg > g:nth-of-type(2) { display: none; }

/* ---- think timer: 30 s, then the card turns over by itself ---- */
.think-row { width: 100%; display: flex; align-items: center; gap: 12px; margin-top: auto; padding-top: 24px; }
.think-bar { flex: 1; height: 5px; border-radius: 99px; background: rgba(255,255,255,0.08); overflow: hidden; }
.think-bar-fill {
  height: 100%; width: 100%; border-radius: inherit; transform-origin: left center;
  animation-name: thinkDrain; animation-timing-function: linear; animation-fill-mode: both;
}
@keyframes thinkDrain {
  0% { transform: scaleX(1); background: var(--accent-2); }
  60% { background: var(--accent); }
  100% { transform: scaleX(0); background: var(--error); }
}
.think-secs { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--accent); min-width: 24px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---- answers: short lines, lists, cause → consequence chains, explained words ---- */
.a-text .a-p { margin: 0 0 8px; }
.a-text .a-list { margin: 2px 0 10px; padding-left: 22px; }
.a-text .a-list li { margin: 4px 0; }
.a-text .a-bullet li::marker { color: var(--accent); }
.a-text .a-chain, .a-text .a-steps { list-style: none; padding-left: 0; }
.a-text .a-chain li { position: relative; padding-left: 24px; }
.a-text .a-chain li::before { content: "→"; position: absolute; left: 2px; color: var(--accent-2); font-weight: 700; }
.a-text .a-def {
  margin: 12px 0 4px; padding: 8px 12px; border-radius: 10px; font-size: 0.92em;
  background: color-mix(in srgb, var(--accent-2) 9%, transparent); border-left: 3px solid var(--accent-2);
}
.a-text .a-def strong { color: var(--accent-2); }
.a-text > :last-child { margin-bottom: 0; }

/* ---- what to skim in the dossier before a packet ---- */
.packet-read { font-size: 12px; line-height: 1.45; color: var(--text-muted); margin: -2px 0 10px; }
