/* ═══════════════════════════════════════════════════════════════════════
   app.css  —  Book of Healing
   Fantasy study interface for the PA Study Hub wagon clinic ecosystem.
   Palette + type system mirror Mission Control for visual suite coherence.
   Candlelit grimoire meets RPG inventory — cozy, warm, purposeful.
═══════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ══ TOKENS ════════════════════════════════════════════════════════════════
   Exact ladder as Mission Control — the two apps share one visual language
═══════════════════════════════════════════════════════════════════════════ */
:root {
  /* Surfaces */
  --bg:        #0e0c08;
  --surface:   #181410;
  --surface2:  #201c16;
  --surface3:  #2a241c;
  --border:    #342e24;
  --border2:   #46403a;

  /* Text */
  --text:      #ede5d6;
  --text2:     #9a9082;
  --text3:     #635d55;

  /* Brand — amber / candlelight */
  --amber:      #c8913a;
  --amber-lt:   #e4aa58;
  --amber-dim:  rgba(200,145,58,0.13);
  --amber-glow: rgba(200,145,58,0.06);

  /* Feedback */
  --green:     #72b88a;
  --green-dim: rgba(114,184,138,0.10);
  --red:       #c07070;
  --red-dim:   rgba(192,112,112,0.10);
  --orange:    #c87840;

  /* Shape */
  --radius:    10px;
  --radius-sm: 6px;
  --radius-lg: 14px;

  /* Typography */
  --font-ui:   'Syne', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Layout */
  --top-bar-h: 52px;
  --wagon-h:   31vh;
}

/* ══ RESET ═════════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
  color-scheme: dark;
}

/* Grain overlay — parchment depth, matches Mission Control */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.88' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.038'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: 0.65;
}

/* Bottom fade disabled — educational content takes priority over wagon bleed-through. */
body::after {
  content: none;
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.hidden { display: none !important; }

/* ══ TOP BAR ═══════════════════════════════════════════════════════════════ */
.top-bar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--top-bar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  background: rgba(14,12,8,0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 50;
}
.top-bar-left, .top-bar-right { display: flex; align-items: center; gap: 16px; }

.top-bar-title {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--amber-lt);
  display: flex; align-items: center; gap: 6px;
}
.top-bar-title::before {
  content: '✦';
  font-size: 0.52rem;
  color: var(--amber);
  opacity: 0.7;
  line-height: 1;
}

.top-bar-user {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text3);
  letter-spacing: 0.05em;
}

.top-stat {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text2);
  letter-spacing: 0.01em;
  display: flex; align-items: center; gap: 4px;
}
.top-stat span {
  color: var(--amber-lt);
  font-weight: 600;
}

/* stat icon glyphs */
.stat-gold::before { content: '⬡'; font-size: 0.55rem; color: var(--amber); opacity: 0.75; }
.stat-mana::before { content: '◈'; font-size: 0.55rem; color: #7a9cc0; opacity: 0.75; }

/* ══ GLOBAL ELEMENTS ═══════════════════════════════════════════════════════ */
button {
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  transition: background 0.14s, border-color 0.14s, color 0.14s,
              box-shadow 0.14s, transform 0.12s, opacity 0.14s;
  letter-spacing: 0.03em;
}
button:disabled { opacity: 0.35; cursor: not-allowed; }

/* Gold primary action */
.primary-btn {
  background: linear-gradient(180deg, #d6a84e 0%, #a47030 100%);
  color: #170e00;
  border: 1px solid #856228;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: 0 2px 8px rgba(200,145,58,0.22);
}
.primary-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #e0b85a 0%, #b08040 100%);
  box-shadow: 0 4px 18px rgba(200,145,58,0.32);
  transform: translateY(-1px);
}
.primary-btn:active:not(:disabled) { transform: translateY(0); box-shadow: 0 2px 8px rgba(200,145,58,0.22); }

/* Ghost secondary */
.ghost-btn {
  background: var(--surface2);
  color: var(--text2);
  border: 1px solid var(--border);
  font-weight: 600;
}
.ghost-btn:hover { background: var(--surface3); color: var(--text); border-color: var(--border2); }

.angel-revive-btn {
  padding: 7px 12px;
  font-size: 0.68rem;
  color: var(--amber-lt);
  border-color: rgba(200,145,58,0.4);
  background: rgba(200,145,58,0.08);
  white-space: nowrap;
  position: fixed;
  z-index: 28;
}
.angel-revive-btn:hover:not(:disabled) {
  background: rgba(200,145,58,0.14);
  color: var(--amber-lt);
  border-color: rgba(200,145,58,0.55);
}
.angel-revive-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Form inputs */
input {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  outline: none;
  width: 100%;
  transition: border-color 0.14s, box-shadow 0.14s;
}
input:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-dim);
}
input::placeholder { color: var(--text3); }

label {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  color: var(--text3);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 5px;
}

/* ══ LAYOUT ════════════════════════════════════════════════════════════════ */
.main-content {
  min-height: 100vh;
  padding-bottom: calc(var(--wagon-h) + 44px);
  position: relative;
  z-index: 1;
}

.page-shell {
  max-width: 1000px;
  margin: 0 auto;
  padding: calc(var(--top-bar-h) + 28px) 20px 0;
}

.muted { color: var(--text2); font-size: 0.82rem; }
.error-text {
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.71rem;
  min-height: 18px;
  margin-top: 6px;
  letter-spacing: 0.01em;
}

/* ══ LOGIN ═════════════════════════════════════════════════════════════════ */
.view-login {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}

.login-panel {
  width: min(400px, 100%);
  padding: 36px 32px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 28px 70px rgba(0,0,0,0.55),
              inset 0 0 0 1px rgba(200,145,58,0.07);
  position: relative;
  overflow: hidden;
  animation: panelIn 0.3s ease both;
}
/* Top amber ribbon */
.login-panel::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--amber) 50%, transparent 100%);
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.login-panel h1 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--amber-lt);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 6px;
  line-height: 1.1;
}

/* Subtitle rule under heading */
.login-panel h1 + .muted {
  display: block;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.07em;
  color: var(--text3);
  margin-bottom: 0;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.login-form { display: grid; gap: 16px; margin-top: 24px; }
.login-form label { display: grid; gap: 5px; }
.login-form .primary-btn { width: 100%; padding: 12px; font-size: 0.84rem; margin-top: 6px; }

/* ══ DASHBOARD ═════════════════════════════════════════════════════════════ */

/* Priority / top action card */
.priority-card {
  display: flex; justify-content: space-between; align-items: center;
  gap: 18px; padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 28px;
  position: relative; overflow: hidden;
  box-shadow: 0 6px 22px rgba(0,0,0,0.24);
}
/* Amber top shimmer line */
.priority-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(200,145,58,0.55), transparent);
}
/* Warm corner glow */
.priority-card::after {
  content: '';
  position: absolute; top: -50px; right: -50px;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200,145,58,0.07) 0%, transparent 70%);
  pointer-events: none;
}

.priority-card h2 {
  font-size: 0.70rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--amber-lt);
  margin-bottom: 5px;
}
.priority-card .muted {
  font-family: var(--font-mono);
  font-size: 0.69rem;
  color: var(--text3);
}

/* Lecture groups */
.lecture-groups { display: grid; gap: 26px; }
.lecture-group  { display: grid; gap: 10px; }

.lecture-group h3 {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 0 0 8px 12px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
/* Amber left accent bar */
.lecture-group h3::before {
  content: '';
  position: absolute; left: 0; top: 1px;
  width: 3px; height: 11px;
  background: var(--amber);
  border-radius: 2px;
}

.lecture-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}

.lecture-card {
  text-align: left; padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: grid; gap: 6px;
  transition: background 0.14s, border-color 0.14s, transform 0.14s, box-shadow 0.14s;
}
.lecture-card:hover {
  background: var(--surface2);
  border-color: var(--border2);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.24);
}
.lecture-card-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.lecture-card-meta {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--font-mono); font-size: 0.65rem; color: var(--text3);
}
.lecture-pill {
  display: inline-flex; padding: 2px 8px;
  border-radius: 999px;
  background: var(--amber-dim);
  color: var(--amber);
  border: 1px solid rgba(200,145,58,0.22);
  font-family: var(--font-mono); font-size: 0.60rem; letter-spacing: 0.03em;
}

/* ══ SESSION ═══════════════════════════════════════════════════════════════ */
.session-shell {
  max-width: 1180px;
  padding-top: calc(var(--top-bar-h) + 12px);
}

.session-header {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 8px;
}
.session-header-copy { display: flex; flex-direction: column; gap: 2px; }
.session-title {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--text);
  line-height: 1.2;
}

/* Amber progress meter */
.progress-bar {
  width: 100%; height: 4px;
  background: var(--surface2);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 10px;
}
.progress-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--amber), var(--amber-lt));
  border-radius: 999px;
  transition: width 0.42s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(200,145,58,0.45);
}

.session-grid {
  display: grid;
  /* Single column by default: question card is centered */
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: start;
  transition: grid-template-columns 0.24s ease;
}

/* Once an answer is revealed, the sidecar slides in on the right */
.session-grid.panel-open {
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.95fr);
}

/* Keep the question card max-width so it looks good when centered */
.session-grid:not(.panel-open) .question-card {
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

/* Sidecar is invisible until panel-open */
.session-sidecar {
  overflow: hidden;
}
.session-grid:not(.panel-open) .session-sidecar {
  display: none;
}

/* ══ QUESTION CARD ══════════════════════════════════════════════════════════
   The hero element — every study session lives here.
   Modelled after Mission Control's exam-mode card quality.
═══════════════════════════════════════════════════════════════════════════ */
.question-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: 0 10px 32px rgba(0,0,0,0.30);
  position: relative; overflow: hidden;
  animation: cardIn 0.22s ease both;
}
/* Amber shimmer top edge */
.question-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(200,145,58,0.5), transparent);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.question-tag {
  font-family: var(--font-mono);
  font-size: 0.61rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--text3);
  min-height: 14px;
  margin-bottom: 6px;
}

.question-stem {
  font-family: var(--font-ui);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}

/* ── Option buttons ── */
.question-options { display: grid; gap: 6px; }

.option-btn {
  text-align: left;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--text2);
  font-family: var(--font-ui);
  font-size: 0.79rem;
  font-weight: 500;
  line-height: 1.35;
  transition: background 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s;
  display: grid; gap: 4px;
}
.option-btn:hover:not(:disabled) {
  background: var(--surface3);
  border-color: var(--border2);
  color: var(--text);
}

/* Selected — amber outline, warm bg */
.option-btn.is-selected {
  background: var(--amber-glow);
  border-color: rgba(200,145,58,0.58);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(200,145,58,0.14);
}

/* Correct — green reveal */
.option-btn.is-correct {
  background: rgba(114,184,138,0.08);
  border-color: rgba(114,184,138,0.52);
  color: var(--green);
  box-shadow: 0 0 14px rgba(114,184,138,0.10);
}

/* Wrong — red reveal */
.option-btn.is-wrong {
  background: rgba(192,112,112,0.08);
  border-color: rgba(192,112,112,0.48);
  color: var(--red);
}

/* Disable pointer events after reveal but keep visual */
.option-btn:disabled { cursor: default; opacity: 1; }

/* Per-option feedback sub-text */
.option-feedback {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--text3);
  line-height: 1.5;
}
.option-btn.is-correct .option-feedback { color: rgba(114,184,138,0.65); }
.option-btn.is-wrong   .option-feedback { color: rgba(192,112,112,0.60); }

/* ── Bottom panels (confirm → confidence → feedback) ── */
.question-actions,
.confidence-panel,
.answer-feedback { margin-top: 10px; }

.session-sidecar .answer-feedback {
  margin-top: 0;
}

.question-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.question-hint,
.sidecar-label {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.05em;
  color: var(--text3);
}

.sidecar-label {
  margin-bottom: 8px;
  text-transform: uppercase;
}

.sidecar-label span {
  opacity: 0.7;
  text-transform: none;
  letter-spacing: 0;
}

.session-sidecar {
  display: grid;
  gap: 8px;
  position: sticky;
  top: calc(var(--top-bar-h) + 12px);
  align-self: start;
  min-width: 0;
}

.compact-btn {
  width: auto;
  padding: 7px 10px;
  font-size: 0.68rem;
}

.keycap-inline,
kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 4px;
  border: 1px solid var(--border2);
  background: rgba(255,255,255,0.04);
  color: var(--text2);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  line-height: 1;
}

.option-hotkey {
  display: inline-flex;
  width: 16px;
  margin-right: 6px;
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
}

/* Confidence label */
.confidence-panel .muted {
  font-family: var(--font-mono);
  font-size: 0.60rem;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 10px;
  display: block;
}

.confidence-buttons { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }

.confidence-btn {
  min-width: 0;
  padding: 6px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid;
}

/* Color-coded ritual judgment — Again / Hard / Good / Easy */
.confidence-btn[data-confidence="again"] {
  background: rgba(192,112,112,0.09); color: var(--red);
  border-color: rgba(192,112,112,0.35);
}
.confidence-btn[data-confidence="again"]:hover { background: rgba(192,112,112,0.18); border-color: rgba(192,112,112,0.50); }

.confidence-btn[data-confidence="hard"] {
  background: rgba(200,120,64,0.09); color: var(--orange);
  border-color: rgba(200,120,64,0.30);
}
.confidence-btn[data-confidence="hard"]:hover { background: rgba(200,120,64,0.18); }

.confidence-btn[data-confidence="good"] {
  background: rgba(200,145,58,0.09); color: var(--amber-lt);
  border-color: rgba(200,145,58,0.35);
}
.confidence-btn[data-confidence="good"]:hover { background: rgba(200,145,58,0.18); }

.confidence-btn[data-confidence="easy"] {
  background: rgba(114,184,138,0.09); color: var(--green);
  border-color: rgba(114,184,138,0.35);
}
.confidence-btn[data-confidence="easy"]:hover { background: rgba(114,184,138,0.18); }

/* ── Answer feedback reveal ── */
#answer-feedback:not(.hidden) {
  animation: feedbackIn 0.24s ease both;
}

.session-sidecar #answer-feedback:not(.hidden) {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.24);
}
@keyframes feedbackIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.answer-result {
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.answer-result.correct { color: var(--green); }
.answer-result.wrong   { color: var(--red); }

/* Rationale block — amber left border, healer's annotation style */
.answer-details {
  margin-top: 8px;
}

.feedback-block {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--amber);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 10px 12px;
  margin-bottom: 6px;
  font-size: 0.73rem;
  line-height: 1.45;
  color: var(--text2);
}

.explanation-section + .explanation-section {
  margin-top: 8px;
}

.explanation-heading {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 4px;
}

.explanation-correct { color: var(--green); }
.explanation-wrong { color: var(--red); }

/* Classic Trap block — orange variant */
#answer-trap.feedback-block {
  border-left-color: var(--orange);
  background: rgba(200,120,64,0.04);
}
#answer-trap.feedback-block::before {
  content: '⚠  Classic Trap';
  display: block;
  font-family: var(--font-mono);
  font-size: 0.59rem;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 8px;
  opacity: 0.85;
}

.next-btn { margin-top: 6px; }

/* ══ RESULTS ════════════════════════════════════════════════════════════════ */
.results-card {
  max-width: 500px;
  margin: 0 auto;
  padding: 36px 34px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0,0,0,0.46),
              inset 0 0 0 1px rgba(200,145,58,0.06);
  text-align: center;
  position: relative; overflow: hidden;
  animation: panelIn 0.3s ease both;
}
.results-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--amber) 50%, transparent 100%);
}

.results-card h2 {
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 18px;
}
.results-score {
  font-size: 3rem;
  font-weight: 800;
  color: var(--amber-lt);
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 6px;
}
.results-card .muted {
  font-family: var(--font-mono);
  font-size: 0.70rem;
  color: var(--text3);
  line-height: 2.3;
  letter-spacing: 0.02em;
  display: block;
}
.results-card #results-gold   { color: var(--amber); }
.results-card #results-mana   { color: #7a9cc0; }
.results-card #results-concepts { color: var(--green); }
.results-card .primary-btn { margin-top: 28px; width: 100%; padding: 12px; font-size: 0.84rem; }

/* ══ WAGON VIEWPORT ══════════════════════════════════════════════════════════
   The living companion scene — fixed bottom strip, z beneath main content.
═══════════════════════════════════════════════════════════════════════════ */
.wagon-viewport {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: var(--wagon-h);
  z-index: 0;
  overflow: visible;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 18px 12px;
}

#wagon-scene-host {
  width: min(593px, calc(100vw - 36px));
  aspect-ratio: 593 / 187;
  height: auto;
  flex: 0 0 auto;
}

#wagon-scene-host,
#wagon-scene-host .widget-wrapper,
#wagon-scene-host .widget-container { height: 100%; }

#wagon-scene-host {
  position: relative;
}

#wagon-scene-host::before {
  content: none;
}

#wagon-scene-host .widget-wrapper {
  position: relative;
  z-index: 4;
  max-width: none;
  overflow: hidden;
}

#wagon-scene-host .widget-wrapper::before {
  content: none;
}

#wagon-scene-host .widget-container {
  position: relative;
  z-index: 1;
  overflow: hidden;
  border-radius: 10px 10px 0 0;
  box-shadow:
    inset 0 0 0 1px rgba(200, 150, 70, 0.18),
    0 0 0 1px rgba(30, 15, 5, 0.8);
}

#wagon-scene-host #wagon-scene {
  overflow: visible;
}

#wagon-scene-host .widget-footer {
  display: flex;
  position: relative;
  z-index: 8;
  background: rgba(8, 5, 18, 0.95);
  border: 1px solid rgba(180, 130, 50, 0.16);
  border-top: none;
  border-radius: 0 0 10px 10px;
  padding: 7px 14px;
  min-height: 0;
  box-shadow: none;
}

#wagon-scene-host .tome-trigger {
  opacity: 0;
  pointer-events: none;
}

.app-guide-trigger {
  position: fixed;
  z-index: 60;
  bottom: auto;
  right: auto;
  gap: 2px;
  padding: 4px 5px 4px;
  border-radius: 4px;
  font-size: 6px;
}

.app-guide-trigger svg {
  width: 18px;
  height: 22px;
}

.app-guide-trigger .tome-label {
  font-size: 5px;
  line-height: 1.05;
  letter-spacing: 0.05em;
}

/* ══ RESPONSIVE ═════════════════════════════════════════════════════════════ */
@media (max-width: 960px) {
  .session-grid {
    grid-template-columns: 1fr;
  }

  .session-sidecar {
    position: static;
  }

  .session-sidecar #answer-feedback:not(.hidden) {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
  }

  .confidence-buttons { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .priority-card    { flex-direction: column; align-items: flex-start; }
  .top-bar          { padding: 0 14px; }
  .top-bar-right    { gap: 10px; }
  .top-stat         { font-size: 0.64rem; }
  .angel-revive-btn { padding: 6px 10px; font-size: 0.62rem; }
  .page-shell       { padding-left: 14px; padding-right: 14px; }
  .question-card    { padding: 16px; }
  .question-stem    { font-size: 0.92rem; }
  .session-title    { font-size: 1rem; }
  .results-score    { font-size: 2.5rem; }
  .confidence-btn   { min-width: 0; }
  .results-card     { padding: 28px 20px; }
  .wagon-viewport   { padding: 0 8px 8px; }
  #wagon-scene-host { width: calc(100vw - 16px); }
}


/* ══ EXAM COUNTDOWN BANNER ══════════════════════════════════════════════════ */
.exam-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(0,0,0,0.30);
}
.exam-banner::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--amber), transparent);
}
.exam-banner::after {
  content: '';
  position: absolute; top: -60px; left: -60px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200,145,58,0.06) 0%, transparent 70%);
  pointer-events: none;
}

.exam-banner-left {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.exam-days {
  font-size: 3.8rem;
  font-weight: 800;
  line-height: 1;
  color: var(--amber-lt);
  font-family: var(--font-mono);
  letter-spacing: -0.03em;
  transition: color 0.3s;
}

.exam-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text3);
}

.exam-set-btn {
  background: transparent;
  color: var(--text3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 6px 14px;
  transition: all 0.14s;
}
.exam-set-btn:hover {
  border-color: var(--amber);
  color: var(--amber);
}

.exam-date-form {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  margin-bottom: 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}
.exam-date-label {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text3);
  margin: 0;
}
.exam-date-input {
  width: auto;
  flex: 0 0 auto;
  font-size: 0.78rem;
  padding: 7px 10px;
  color-scheme: dark;
}
.exam-date-form .primary-btn,
.exam-date-form .ghost-btn { padding: 7px 14px; font-size: 0.76rem; }


/* ══ QUICK ROW (last lecture + SRS) ════════════════════════════════════════ */
.quick-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.quick-card {
  padding: 18px 20px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.20);
}

.quick-card-label {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 8px;
}

.quick-lecture-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 4px;
}

.quick-lecture-id {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--amber);
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}

.quick-lecture .primary-btn { font-size: 0.78rem; padding: 8px 18px; }
.quick-resume .primary-btn { font-size: 0.78rem; padding: 8px 18px; }

.quick-srs-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.today-queue {
  margin-bottom: 22px;
  padding-top: 16px;
}

.today-queue-list {
  display: grid;
  gap: 8px;
}

.today-queue-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: left;
  color: var(--text);
}

.today-queue-row:hover {
  background: var(--surface3);
  border-color: var(--border2);
}

.today-queue-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.today-queue-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.today-queue-sub {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text3);
  letter-spacing: 0.04em;
}

.today-queue-action {
  flex-shrink: 0;
  font-size: 0.70rem;
  font-weight: 700;
  color: var(--amber-lt);
  letter-spacing: 0.04em;
}

/* Amber shimmer on lecture card */
.quick-lecture::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(200,145,58,0.4), transparent);
}


/* ══ COURSE SECTIONS (CM / CS / PA) ════════════════════════════════════════ */
.lecture-groups {
  display: grid;
  gap: 18px;
}

.course-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.course-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

.course-header-btn {
  width: 100%;
  border: none;
  border-radius: 0;
  text-align: left;
  cursor: pointer;
}

.course-header-btn:hover {
  background: var(--surface3);
}

.course-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.course-chevron {
  font-size: 0.62rem;
  color: var(--amber);
  flex-shrink: 0;
  width: 10px;
}

.course-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber-lt);
}

.course-code {
  font-family: var(--font-mono);
  font-size: 0.60rem;
  font-weight: 600;
  color: var(--text3);
  letter-spacing: 0.10em;
  background: var(--surface3);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.course-body {
  display: block;
}


/* ══ SYSTEM GROUPS (CARDIO, PULM, etc.) ════════════════════════════════════ */
.system-group {
  border-bottom: 1px solid var(--border);
}
.system-group:last-child { border-bottom: none; }

.system-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: transparent;
  border: none;
  border-radius: 0;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
  font-weight: 600;
  color: var(--text2);
}
.system-header:hover {
  background: var(--surface2);
  color: var(--text);
}

/* Exam-focus: yellow left-border highlight on the system group */
.system-group--exam-focus {
  border-left: 2px solid var(--amber, #c89142);
}
.system-header--exam-focus {
  color: var(--text);
}
.system-header--exam-focus .system-name {
  color: var(--amber-lt, #e4aa58);
}

/* Exam-focus star toggle — span[role=button] inside a system-header button */
.exam-focus-toggle {
  display: inline-flex;
  align-items: center;
  padding: 0 4px;
  font-size: 0.72rem;
  color: var(--border2, #46403a);
  cursor: pointer;
  line-height: 1;
  opacity: 0.55;
  transition: color 0.15s, opacity 0.15s;
  flex-shrink: 0;
  user-select: none;
}
.exam-focus-toggle:hover {
  color: var(--amber, #c89142);
  opacity: 1;
}
.exam-focus-toggle.active {
  color: var(--amber, #c89142);
  opacity: 1;
}

.system-chevron {
  font-size: 0.6rem;
  color: var(--amber);
  flex-shrink: 0;
  width: 10px;
}

.system-name {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  flex: 1;
}

.system-meta {
  font-family: var(--font-mono);
  font-size: 0.60rem;
  color: var(--text3);
  margin-left: auto;
}


/* ══ LECTURE ROWS ═══════════════════════════════════════════════════════════ */
.lecture-list {
  /* Shown/hidden via JS */
}

.lecture-placeholder {
  padding: 10px 18px 10px 32px;
  border-top: 1px solid rgba(52,46,36,0.55);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  color: var(--text3);
  letter-spacing: 0.03em;
}

.lecture-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 18px 10px 32px;
  background: transparent;
  border: none;
  border-radius: 0;
  border-top: 1px solid rgba(52,46,36,0.55);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  font-family: var(--font-ui);
}
.lecture-row:hover {
  background: var(--surface2);
}
.lecture-row:first-child { border-top: 1px solid var(--border); }

/* Completed state — green glow */
.lecture-row--done {
  background: rgba(114,184,138,0.04);
  border-top-color: rgba(114,184,138,0.12);
}
.lecture-row--done:hover {
  background: rgba(114,184,138,0.08);
}

.lecture-row-id {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: var(--amber);
  letter-spacing: 0.06em;
  flex-shrink: 0;
  min-width: 130px;
}

.lecture-row-title {
  font-size: 0.80rem;
  font-weight: 600;
  color: var(--text2);
  line-height: 1.3;
  flex: 1;
  transition: color 0.12s;
}
.lecture-row:hover .lecture-row-title { color: var(--text); }
.lecture-row--done .lecture-row-title { color: var(--text2); }

.lecture-row-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.lecture-q-count {
  font-family: var(--font-mono);
  font-size: 0.60rem;
  color: var(--text3);
  letter-spacing: 0.04em;
}

.lecture-srs-dot {
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(100,140,200,0.12);
  color: #7090c8;
  border: 1px solid rgba(100,140,200,0.25);
}

/* Clickable SRS pill on lecture rows — span[role=button] inside a lecture-row button */
.lecture-srs-btn {
  display: inline-flex;
  align-items: center;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 3px;
  background: rgba(100,140,200,0.12);
  color: #7090c8;
  border: 1px solid rgba(100,140,200,0.25);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  flex-shrink: 0;
  user-select: none;
}
.lecture-srs-btn:hover {
  background: rgba(100,140,200,0.25);
  border-color: rgba(100,140,200,0.55);
  color: #90b0e8;
}

.lecture-score {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  min-width: 34px;
  text-align: right;
}
.score-new  { color: var(--text3); }
.score-low  { color: var(--red); }
.score-mid  { color: var(--amber); }
.score-high { color: var(--green); }

.lecture-check {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--green);
  opacity: 0.85;
  flex-shrink: 0;
}


/* ══ RESPONSIVE ═════════════════════════════════════════════════════════════ */
@media (max-width: 700px) {
  .quick-row { grid-template-columns: 1fr; }
  .exam-days { font-size: 2.8rem; }
  .exam-banner { padding: 16px 18px; }
  .lecture-row-id { min-width: 90px; font-size: 0.54rem; }
  .lecture-row-title { font-size: 0.75rem; }
  .lecture-row { padding-left: 20px; }
  .today-queue-row {
    align-items: flex-start;
    flex-direction: column;
  }
}


/* ══ ROUNDS BANNER (replaces quick-row) ════════════════════════════════════ */
.rounds-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 3px 12px rgba(0,0,0,0.22);
  flex-wrap: wrap;
}

.rounds-banner-top {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.rounds-banner-label {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text3);
}

.rounds-banner-summary {
  font-size: 0.75rem;
  color: var(--text2);
}

.rounds-banner-actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Level buttons in the rounds banner ─────────────────────────── */
.rounds-level-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: filter 0.15s, box-shadow 0.15s, opacity 0.15s, transform 0.1s;
  min-width: 82px;
  font-family: var(--font-ui);
  line-height: 1;
  position: relative;
}
.rounds-level-btn:disabled { opacity: 0.36; cursor: default; }
.rounds-level-btn:not(:disabled):hover { filter: brightness(1.15); transform: translateY(-1px); }
.rounds-level-btn:not(:disabled):active { transform: translateY(0); }

/* Level tag — pill badge */
.rounds-level-tag {
  display: inline-block;
  font-size: 0.50rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.10);
  white-space: nowrap;
}
.rounds-level-name {
  font-size: 0.80rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.rounds-level-mc {
  font-size: 0.57rem;
  opacity: 0.50;
  font-family: var(--font-mono);
}

/* Lvl 1 — teal */
.rounds-level-btn--l1 {
  background: linear-gradient(160deg, rgba(80,180,210,0.18) 0%, rgba(60,150,185,0.10) 100%);
  color: #72d0e8;
  border-color: rgba(80,180,210,0.38);
  box-shadow: inset 0 1px 0 rgba(80,200,220,0.14);
}
.rounds-level-btn--l1 .rounds-level-tag { background: rgba(80,180,210,0.20); border-color: rgba(80,180,210,0.35); }
.rounds-level-btn--l1:not(:disabled):hover { box-shadow: 0 4px 16px rgba(80,180,210,0.22), inset 0 1px 0 rgba(80,200,220,0.18); }

/* Lvl 2 — amber dashed (MC only) */
.rounds-level-btn--l2 {
  background: rgba(200,155,60,0.06);
  color: rgba(200,155,60,0.50);
  border: 1px dashed rgba(200,155,60,0.22);
}
.rounds-level-btn--l2 .rounds-level-tag { background: rgba(200,155,60,0.10); border-color: rgba(200,155,60,0.20); }

/* Lvl 3 — gold */
.rounds-level-btn--l3 {
  background: linear-gradient(160deg, rgba(210,155,55,0.22) 0%, rgba(240,185,85,0.14) 100%);
  color: #eab860;
  border-color: rgba(210,155,55,0.46);
  box-shadow: inset 0 1px 0 rgba(240,190,90,0.16);
}
.rounds-level-btn--l3 .rounds-level-tag { background: rgba(210,155,55,0.22); border-color: rgba(210,155,55,0.40); }
.rounds-level-btn--l3:not(:disabled):hover { box-shadow: 0 4px 16px rgba(210,155,55,0.28), inset 0 1px 0 rgba(240,190,90,0.20); }

@media (max-width: 600px) {
  .rounds-banner { flex-direction: column; align-items: flex-start; }
  .rounds-banner-actions { width: 100%; }
}


/* ══ CLINIC REGISTER ════════════════════════════════════════════════════════ */
.clinic-register {
  display: grid;
  gap: 12px;
}

/* System block — one per body system (CARDIO, PULM, …) */
.clinic-system-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.clinic-system-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

.clinic-system-name {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text3);
  flex: 1;
}

/* Exam-focus highlight on a system block */
.clinic-system-block--exam-focus .clinic-system-header {
  border-left: 2px solid var(--amber);
}
.clinic-system-block--exam-focus .clinic-system-name {
  color: var(--amber-lt);
}

.clinic-system-meta {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: var(--text3);
  letter-spacing: 0.04em;
}

/* ── Individual clinic-day row ────────────────────────────────────────────── */
.clinic-day {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid rgba(52,46,36,0.5);
  background: transparent;
  transition: background 0.11s;
  width: 100%;
  text-align: left;
  cursor: default;
}
.clinic-day:first-child { border-top: none; }
.clinic-day--clickable { cursor: pointer; }
.clinic-day--clickable:hover { background: var(--surface2); }

/* Lecture number / ID chip */
.clinic-day-id {
  font-family: var(--font-mono);
  font-size: 0.60rem;
  font-weight: 600;
  color: var(--amber);
  letter-spacing: 0.06em;
  flex-shrink: 0;
  min-width: 52px;
}

/* Lecture title */
.clinic-day-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text2);
  flex: 1;
  min-width: 0;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.11s;
}
.clinic-day--clickable:hover .clinic-day-title { color: var(--text); }

/* ── Tier gem animations ──────────────────────────────────────────────────── */
@keyframes gem-pulse {
  0%, 100% { box-shadow: 0 0 5px var(--pip-glow, rgba(200,145,58,0.20)); }
  50%       { box-shadow: 0 0 12px var(--pip-glow, rgba(200,145,58,0.45)),
                          0 0 20px var(--pip-glow, rgba(200,145,58,0.15)); }
}
@keyframes gem-shimmer {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.75; }
}

/* Level pips row */
.clinic-pips {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

/* Base pip — all tiers share this foundation */
.clinic-pip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.60rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid transparent;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
  transition: box-shadow 0.2s, background 0.2s;
  font-family: var(--font-mono);
}

/* Gem symbol inside pip (first character) rendered slightly larger */
.clinic-pip-gem {
  font-size: 0.72rem;
  line-height: 1;
  flex-shrink: 0;
}

/* ── L1 PREP tier (cyan/teal crystal) ────────────────────────────────────── */

/* Locked — no deck yet. Dashed border, barely visible. */
.pip-l1-none {
  background: transparent;
  color: rgba(93,184,216,0.28);
  border: 1px dashed rgba(93,184,216,0.18);
}

/* Due — SRS cards outstanding. Amber urgency glow, pulses. */
.pip-l1-due {
  --pip-glow: rgba(200,145,58,0.35);
  background: rgba(200,145,58,0.13);
  color: #e4aa58;
  border-color: rgba(200,145,58,0.48);
  box-shadow: 0 0 7px rgba(200,145,58,0.22);
  animation: gem-pulse 2.2s ease-in-out infinite;
}

/* Done — all clear. Teal glow, satisfied. */
.pip-l1-done {
  --pip-glow: rgba(80,170,200,0.20);
  background: rgba(80,170,200,0.14);
  color: #6ccae0;
  border-color: rgba(80,170,200,0.40);
  box-shadow: 0 0 6px rgba(80,170,200,0.14);
}

/* ── L2 BRIDGE tier (amber crystal — always dim, shows tier exists) ──────── */
.pip-l2-none {
  background: transparent;
  color: rgba(200,155,60,0.30);
  border: 1px dashed rgba(200,155,60,0.16);
}

/* ── L3 EXAM tier (the boss fight) ───────────────────────────────────────── */

/* Locked — never attempted. Dashed crimson, like a sealed door. */
.pip-l3-none {
  background: transparent;
  color: rgba(200,90,90,0.35);
  border: 1px dashed rgba(200,90,90,0.22);
}

/* Partial — attempted but under threshold. Amber scar. Shows score. */
.pip-l3-partial {
  --pip-glow: rgba(210,130,60,0.25);
  background: rgba(210,130,60,0.13);
  color: #e09050;
  border-color: rgba(210,130,60,0.42);
  box-shadow: 0 0 5px rgba(210,130,60,0.16);
}

/* Done — mastered ≥80%. Green triumph glow. */
.pip-l3-done {
  --pip-glow: rgba(114,184,138,0.22);
  background: rgba(114,184,138,0.15);
  color: #7ecf96;
  border-color: rgba(114,184,138,0.42);
  box-shadow: 0 0 7px rgba(114,184,138,0.18);
}

/* ── Row urgency left-border accent ─────────────────────────────────────── */
/* Applied via data-action attribute on the row element */
.clinic-day[data-action="prep"] {
  border-left: 3px solid rgba(200,145,58,0.55);
  padding-left: 13px;
}
.clinic-day[data-action="exam"] {
  border-left: 3px solid rgba(93,184,216,0.45);
  padding-left: 13px;
}
.clinic-day[data-action="retry"] {
  border-left: 3px solid rgba(210,110,60,0.50);
  padding-left: 13px;
}
.clinic-day[data-action="done"] {
  border-left: 3px solid rgba(114,184,138,0.25);
  padding-left: 13px;
}

/* ── Clinic action buttons ─────────────────────────────────────────────────── */
@keyframes exam-shimmer {
  0%   { left: -70%; }
  45%  { left: 115%; }
  100% { left: 115%; }
}

.clinic-action-btn {
  flex-shrink: 0;
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 5px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: filter 0.13s, box-shadow 0.13s;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.clinic-action-btn:hover { filter: brightness(1.18); }

/* Prep: teal — "Begin Prep" */
.clinic-action-prep {
  background: rgba(80,170,200,0.14);
  color: #6ccae0;
  border-color: rgba(80,170,200,0.36);
}
.clinic-action-prep:hover {
  box-shadow: 0 0 10px rgba(80,170,200,0.20);
}

/* Exam: amber gradient — "Run Exam" — the boss fight button */
.clinic-action-exam {
  background: linear-gradient(135deg, #c8913a 0%, #e4aa58 60%, #c8913a 100%);
  color: #1a0e00;
  border-color: rgba(200,145,58,0.70);
  box-shadow: 0 2px 10px rgba(200,145,58,0.28);
  font-size: 0.70rem;
  letter-spacing: 0.05em;
}
.clinic-action-exam::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -70%;
  width: 45%;
  height: 200%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.22), transparent);
  transform: skewX(-18deg);
  animation: exam-shimmer 3.5s ease-in-out infinite;
  pointer-events: none;
}
.clinic-action-exam:hover {
  box-shadow: 0 3px 16px rgba(200,145,58,0.45);
}

/* Retry: amber ghost — "Retry" */
.clinic-action-retry {
  background: rgba(210,130,60,0.12);
  color: #e09050;
  border-color: rgba(210,130,60,0.35);
}
.clinic-action-retry:hover {
  box-shadow: 0 0 8px rgba(210,130,60,0.18);
}

/* Done: muted green — "Review" */
.clinic-action-done {
  background: rgba(114,184,138,0.09);
  color: #72b88a;
  border-color: rgba(114,184,138,0.24);
  opacity: 0.82;
}
.clinic-action-done:hover {
  opacity: 1;
  box-shadow: 0 0 7px rgba(114,184,138,0.14);
}

/* ── Per-lecture level action buttons (Lvl 1 / Lvl 2 / Lvl 3) ───────────── */
.clinic-level-btns {
  display: flex;
  align-items: stretch;
  gap: 6px;
  flex-shrink: 0;
}

.lvl-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: filter 0.13s, box-shadow 0.15s, opacity 0.13s, transform 0.10s;
  min-width: 66px;
  font-family: var(--font-ui);
  line-height: 1;
  position: relative;
}
.lvl-btn:disabled { opacity: 0.28; cursor: default; pointer-events: none; }
.lvl-btn:not(:disabled):hover { filter: brightness(1.16); transform: translateY(-1px); }
.lvl-btn:not(:disabled):active { transform: translateY(0); }

/* Level badge pill */
.lvl-badge {
  display: inline-block;
  font-size: 0.46rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.09);
  white-space: nowrap;
}
.lvl-name {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.lvl-detail {
  font-size: 0.58rem;
  font-family: var(--font-mono);
  opacity: 0.70;
  white-space: nowrap;
}

/* Lvl 1 — teal */
.lvl-btn--l1 {
  background: linear-gradient(155deg, rgba(80,175,205,0.16) 0%, rgba(60,150,185,0.08) 100%);
  color: #6ccae0;
  border-color: rgba(80,175,205,0.32);
  box-shadow: inset 0 1px 0 rgba(80,200,220,0.12);
}
.lvl-btn--l1 .lvl-badge { background: rgba(80,175,205,0.18); border-color: rgba(80,175,205,0.32); }
.lvl-btn--l1:not(:disabled):hover { box-shadow: 0 3px 12px rgba(80,175,205,0.22), inset 0 1px 0 rgba(80,200,220,0.16); }

/* Lvl 2 — amber dashed (dim-only, MC only) */
.lvl-btn--l2 {
  background: transparent;
  color: rgba(200,155,60,0.48);
  border: 1px dashed rgba(200,155,60,0.20);
}
.lvl-btn--l2 .lvl-badge { background: rgba(200,155,60,0.08); border-color: rgba(200,155,60,0.18); }

/* Lvl 3 — gold */
.lvl-btn--l3 {
  background: linear-gradient(155deg, rgba(205,150,52,0.18) 0%, rgba(235,180,80,0.10) 100%);
  color: #e4aa58;
  border-color: rgba(205,150,52,0.40);
  box-shadow: inset 0 1px 0 rgba(235,185,85,0.14);
}
.lvl-btn--l3 .lvl-badge { background: rgba(205,150,52,0.20); border-color: rgba(205,150,52,0.36); }
.lvl-btn--l3:not(:disabled):hover { box-shadow: 0 3px 12px rgba(205,150,52,0.24), inset 0 1px 0 rgba(235,185,85,0.18); }

/* State overrides */
.lvl-btn--due  { animation: gem-pulse 2.2s ease-in-out infinite; }
.lvl-btn--done { opacity: 0.52; }
.lvl-btn--done:not(:disabled):hover { opacity: 1; filter: brightness(1.14); }
.lvl-btn--active { } /* default bright */
.lvl-btn--retry { color: #e08858; border-color: rgba(224,136,88,0.44); background: rgba(224,136,88,0.10); }
.lvl-btn--retry .lvl-badge { background: rgba(224,136,88,0.14); border-color: rgba(224,136,88,0.32); }
.lvl-btn--dim   { opacity: 0.25; }

/* ── System header as button (for collapse in full register) ─────────────── */
.clinic-system-header--btn {
  width: 100%;
  border: none;
  border-radius: 0;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-ui);
  background: var(--surface2);
}
.clinic-system-header--btn:hover {
  background: var(--surface3);
}

/* ── Full register toggle (collapsed "All Lectures" bar) ─────────────────── */
.clinic-register-full {
  margin-top: 4px;
}

.clinic-register-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text3);
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.clinic-register-toggle:hover {
  background: var(--surface2);
  color: var(--text2);
  border-color: var(--border2);
}

.clinic-reg-chevron {
  font-size: 0.60rem;
  color: var(--amber);
  flex-shrink: 0;
}

.clinic-register-body {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

/* Nested system blocks inside the full register */
.clinic-system-block--nested {
  border-radius: var(--radius-sm);
}

/* Course+block context label in action queue rows */
.clinic-day-block {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.52rem;
  color: var(--text3);
  letter-spacing: 0.04em;
  font-weight: 400;
  margin-top: 1px;
}

/* ── Clinic register responsive ─────────────────────────────────────────── */
@media (max-width: 700px) {
  .clinic-day { gap: 8px; padding: 9px 12px; }
  .clinic-day-id { min-width: 40px; font-size: 0.56rem; }
  .clinic-day-title { font-size: 0.76rem; }
  .clinic-pips { gap: 3px; }
  .clinic-pip { font-size: 0.52rem; padding: 2px 5px; }
  .clinic-action-btn { font-size: 0.64rem; padding: 4px 10px; }
}

/* ══ B2 — SRS Grade Bar (Anki-style session summary) ═══════════════════
   Four-band horizontal bar: Again/Hard/Good/Easy, below session done panel.
═══════════════════════════════════════════════════════════════════════ */

/* Container bar */
.srs-grade-bar {
  display: flex;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 10px;
  background: var(--surface3);
  min-height: 10px;
}

/* Each coloured segment */
.srs-grade-seg {
  height: 100%;
  transition: flex 0.45s cubic-bezier(.4,0,.2,1);
  min-width: 0;
}
.srs-grade-seg--again { background: #c94040; }
.srs-grade-seg--hard  { background: #c87820; }
.srs-grade-seg--good  { background: #5a9e72; }
.srs-grade-seg--easy  { background: #2e3a30; border-right: 1px solid rgba(90,158,114,0.3); }

/* Legend row below bar */
.srs-grade-counts {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}
.srs-grade-count {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text2);
}
.srs-grade-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.srs-grade-dot--again { background: #c94040; }
.srs-grade-dot--hard  { background: #c87820; }
.srs-grade-dot--good  { background: #5a9e72; }
.srs-grade-dot--easy  { background: #4a5a4e; border: 1px solid #5a9e72; }
.srs-grade-num { color: var(--text); font-weight: 600; }

/* Summary sentence */
.srs-grade-summary {
  font-size: 0.84rem;
  color: var(--text2);
  margin-bottom: 16px;
  line-height: 1.5;
}
.srs-grade-summary .green-highlight { color: var(--green); font-weight: 700; }
.srs-grade-summary .dim-note { color: var(--text3); font-size: 0.78rem; }

/* ── B5 — Same-day bonus toast ────────────────────────────────────────── */
.sameday-toast {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(114,184,138,0.12), rgba(180,140,60,0.10));
  border: 1px solid rgba(114,184,138,0.35);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--green);
  margin-bottom: 14px;
  animation: toast-in 0.35s ease;
}
.sameday-toast.visible { display: flex; }
.sameday-toast .toast-icon { font-size: 1.1rem; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
