:root {
  --bg-primary: #0a0e17;
  --bg-surface: #111726;
  --bg-card: #161e31;
  --bg-card-hover: #1c263d;
  --border-subtle: #222f4c;
  --border-strong: #33446b;

  --text-main: #f0f4fc;
  --text-muted: #8b9bb4;
  --text-dim: #5c6b84;

  --accent-cyan: #0ea5e9;
  --accent-cyan-soft: rgba(14, 165, 233, 0.15);
  --accent-emerald: #10b981;
  --accent-emerald-soft: rgba(16, 185, 129, 0.15);
  --accent-amber: #f59e0b;
  --accent-amber-soft: rgba(245, 158, 11, 0.15);
  --accent-rose: #f43f5e;
  --accent-rose-soft: rgba(244, 63, 94, 0.15);
  --accent-indigo: #6366f1;

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "IBM Plex Mono", Menlo, Consolas, monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
}

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

html {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 15px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  color: var(--text-main);
}

/* App Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 14, 23, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: opacity 0.15s ease;
}

.brand-group:hover {
  opacity: 0.9;
}

.brand-group:focus-visible {
  outline: 2px solid var(--accent-cyan);
}

.brand-badge {
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--text-main);
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.hdr-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.hdr-btn:hover {
  color: var(--text-main);
  background: var(--bg-surface);
  border-color: var(--border-subtle);
}

.hdr-btn.active {
  color: var(--accent-cyan);
  background: var(--accent-cyan-soft);
  border-color: rgba(14, 165, 233, 0.3);
  font-weight: 600;
}

/* Container */
.main-container {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

/* Hero Section */
.hero {
  margin-bottom: 28px;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--accent-cyan-soft);
  border: 1px solid rgba(14, 165, 233, 0.3);
  color: #38bdf8;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}

.hero h1 {
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
  color: #ffffff;
}

.hero-desc {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 760px;
  line-height: 1.6;
}

/* Stats Ribbon */
.stats-ribbon {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin: 20px 0 28px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.stat-card .val {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-cyan);
  line-height: 1.2;
}

.stat-card.emerald .val { color: var(--accent-emerald); }
.stat-card.amber .val { color: var(--accent-amber); }
.stat-card.rose .val { color: var(--accent-rose); }

.stat-card .lbl {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Resume Banner */
.resume-banner {
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.12), rgba(99, 102, 241, 0.12));
  border: 1px solid rgba(14, 165, 233, 0.4);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.resume-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.resume-badge {
  background: var(--accent-cyan);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.resume-actions {
  display: flex;
  gap: 10px;
}

/* Two-column Mode Cards */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.panel-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel-header {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 14px;
}

.panel-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  display: inline-block;
  color: var(--accent-cyan);
}

.panel-title {
  font-size: 19px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.panel-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

/* Form Controls */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.2px;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 12.5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.chip-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-main);
}

.chip-btn.active {
  background: var(--accent-cyan-soft);
  border-color: var(--accent-cyan);
  color: #38bdf8;
  font-weight: 600;
}

.chip-count {
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.75;
}

/* Segmented Control */
.segmented-control {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
  max-width: 100%;
  overflow-x: auto;
}

.seg-btn {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.seg-btn:hover {
  color: var(--text-main);
}

.seg-btn.active {
  background: var(--bg-surface);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.form-select, .form-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  padding: 8px 12px;
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color 0.15s ease;
}

.form-select:focus, .form-input:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}

.checkbox-label input {
  accent-color: var(--accent-cyan);
  width: 16px;
  height: 16px;
}

/* Action Rows */
.panel-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-meta {
  font-size: 13px;
  color: var(--text-muted);
}

.panel-meta b {
  color: var(--text-main);
  font-family: var(--font-mono);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  text-decoration: none;
}

.btn:focus-visible {
  outline: 2px solid var(--accent-cyan);
}

.btn-primary {
  background: var(--accent-cyan);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: #0284c7;
}

.btn-emerald {
  background: var(--accent-emerald);
  color: #ffffff;
}

.btn-emerald:hover:not(:disabled) {
  background: #059669;
}

.btn-secondary {
  background: var(--bg-card);
  border-color: var(--border-subtle);
  color: var(--text-main);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text-main);
  background: var(--bg-surface);
}

.btn-danger {
  background: var(--accent-rose-soft);
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.3);
}

.btn-danger:hover:not(:disabled) {
  background: var(--accent-rose);
  color: #ffffff;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-lg {
  padding: 10px 22px;
  font-size: 15px;
}

/* Secondary Panels (Subject stats, history) */
.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 16px;
}

.box-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.box-title {
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
}

/* Subject Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th {
  text-align: left;
  padding: 8px 10px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 600;
  font-size: 12px;
}

.data-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.progress-bar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-track {
  flex: 1;
  height: 6px;
  background: var(--bg-card);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent-cyan);
  border-radius: var(--radius-full);
}

.progress-fill.emerald { background: var(--accent-emerald); }

/* History List */
.history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.history-main {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-main);
}

.history-sub {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-top: 2px;
}

.history-score {
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 16px;
  color: var(--accent-emerald);
}

/* Quiz Running View */
.quiz-runner {
  max-width: 860px;
  margin: 0 auto;
}

.runner-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  margin-bottom: 12px;
}

.nav-center {
  display: flex;
  align-items: center;
  gap: 12px;
}

.timer-badge {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-cyan);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

.timer-badge.low {
  color: var(--accent-rose);
  border-color: var(--accent-rose);
  animation: pulse-border 1.5s infinite;
}

@keyframes pulse-border {
  0%, 100% { border-color: rgba(244, 63, 94, 0.4); }
  50% { border-color: rgba(244, 63, 94, 1); }
}

.linear-progress {
  width: 100%;
  height: 4px;
  background: var(--bg-surface);
  border-radius: var(--radius-full);
  margin-bottom: 20px;
  overflow: hidden;
}

.linear-progress-bar {
  height: 100%;
  background: var(--accent-cyan);
  transition: width 0.2s ease;
}

/* Question Card */
.q-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
}

.q-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.q-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tag-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.tag-badge.cyan {
  background: var(--accent-cyan-soft);
  color: #38bdf8;
  border-color: rgba(14, 165, 233, 0.3);
}

.tag-badge.amber {
  background: var(--accent-amber-soft);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}

.tag-badge.rose {
  background: var(--accent-rose-soft);
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.3);
}

.tag-badge.emerald {
  background: var(--accent-emerald-soft);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

.q-actions-mini {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-strong);
}

.icon-btn.active {
  background: var(--accent-amber-soft);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.4);
}

.icon-btn.flagged {
  background: var(--accent-rose-soft);
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.4);
}

/* Question Stem */
.q-stem {
  font-size: 16.5px;
  font-weight: 500;
  line-height: 1.65;
  color: var(--text-main);
  margin-bottom: 20px;
  white-space: pre-wrap;
  word-break: break-word;
}

.q-image-container {
  margin: 16px 0 20px;
  text-align: center;
}

.q-image {
  max-width: 100%;
  max-height: 480px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: #000;
}

/* Options */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.option-btn {
  width: 100%;
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.5;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: all 0.15s ease;
}

.option-btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

.option-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 1px;
}

.option-text {
  flex: 1;
}

.option-status {
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  margin-left: 8px;
}

/* Option States in Practice */
.option-btn.selected {
  border-color: var(--accent-cyan);
  background: var(--accent-cyan-soft);
}

.option-btn.selected .option-letter {
  background: var(--accent-cyan);
  color: #fff;
  border-color: var(--accent-cyan);
}

.option-btn.correct {
  border-color: var(--accent-emerald) !important;
  background: var(--accent-emerald-soft) !important;
}

.option-btn.correct .option-letter {
  background: var(--accent-emerald);
  color: #fff;
  border-color: var(--accent-emerald);
}

.option-btn.correct .option-status {
  color: var(--accent-emerald);
}

.option-btn.incorrect {
  border-color: var(--accent-rose) !important;
  background: var(--accent-rose-soft) !important;
}

.option-btn.incorrect .option-letter {
  background: var(--accent-rose);
  color: #fff;
  border-color: var(--accent-rose);
}

.option-btn.incorrect .option-status {
  color: var(--accent-rose);
}

/* Explanation Box */
.explanation-box {
  background: #0d131f;
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--accent-cyan);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-top: 20px;
}

.explanation-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 10px;
}

.explanation-body {
  font-size: 14px;
  color: #cbd5e1;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.explanation-source {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12.5px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.source-link {
  color: var(--accent-cyan);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.source-link:hover {
  color: #38bdf8;
}

/* Bottom Bar */
.runner-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.runner-shortcuts {
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  gap: 10px;
  align-items: center;
}

.kbd {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* Sheet Drawer / Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.sheet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 8px;
}

.sheet-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
}

.sheet-cell:hover {
  border-color: var(--accent-cyan);
  color: var(--text-main);
}

.sheet-cell.current {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px var(--accent-cyan-soft);
}

.sheet-cell.answered {
  background: var(--accent-cyan-soft);
  color: #38bdf8;
  font-weight: 700;
}

.sheet-cell.flagged::after {
  content: "•";
  position: absolute;
  top: 1px;
  right: 3px;
  color: var(--accent-rose);
  font-size: 16px;
  line-height: 1;
}

.sheet-cell.result-correct {
  background: var(--accent-emerald-soft);
  color: var(--accent-emerald);
  border-color: rgba(16, 185, 129, 0.4);
}

.sheet-cell.result-wrong {
  background: var(--accent-rose-soft);
  color: var(--accent-rose);
  border-color: rgba(244, 63, 94, 0.4);
}

/* Exam Review Page */
.review-score-hero {
  text-align: center;
  padding: 32px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}

.review-score-num {
  font-family: var(--font-mono);
  font-size: 56px;
  font-weight: 800;
  color: var(--accent-emerald);
  line-height: 1.1;
}

.review-score-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Resource List */
.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.resource-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.resource-card:hover {
  border-color: var(--border-strong);
}

.resource-title {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}

.resource-cat {
  font-size: 11px;
  color: var(--accent-cyan);
  font-weight: 600;
  text-transform: uppercase;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #ffffff;
  border: 1px solid var(--border-strong);
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  pointer-events: none;
}

/* Utility */
.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
}

.empty-state h3 {
  font-size: 17px;
  color: var(--text-main);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  margin-bottom: 16px;
}

.app-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
  padding: 24px 16px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-dim);
}

.footer-sub {
  margin-top: 4px;
  font-size: 11.5px;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .header-actions {
    width: 100%;
  }
  .runner-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .runner-shortcuts {
    display: none;
  }
}

.bank-note { display:block; margin-top:10px; color:var(--text-muted); font-size:13px; line-height:1.7; }
.sheet-cell { color:inherit; font:inherit; cursor:pointer; }
button:focus-visible, a:focus-visible { outline:3px solid #38bdf8; outline-offset:3px; }

.provenance {margin-top:16px;font-size:13px;line-height:1.8;color:var(--text-muted)}
.provenance summary{cursor:pointer;color:var(--accent-cyan)}
.provenance ul{padding-left:20px}.provenance a{color:#67d2f5}
@media (prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important;animation:none!important}}

/* Keep the runner controls legible on narrow phones. */
@media (max-width: 600px) {
  .runner-nav { flex-wrap: wrap; gap: 10px; }
  .runner-nav > .btn, .runner-nav .timer-badge { flex-shrink: 0; white-space: nowrap; }
  .runner-nav .nav-center { flex: 1; min-width: 0; gap: 8px; }
  .runner-nav > div:last-child { flex-basis: 100%; text-align: right; }
}
.answer-basis { font-size: 12px; color: var(--text-muted); margin: 16px 0 8px; }
.provenance { color: var(--text-muted); margin-top: 12px; font-size: 13px; }
.provenance summary { cursor: pointer; }
.provenance li { margin-bottom: 10px; overflow-wrap: anywhere; }

/* Persistent separation of exam questions and teacher-led lecture study. */
.study-sections {width:100%;max-width:1100px;margin:24px auto 0;padding:0 16px;display:grid;grid-template-columns:1fr 1fr;gap:12px;}
.study-sections a {display:flex;flex-direction:column;gap:5px;text-decoration:none;padding:16px 20px;border:1px solid var(--border-subtle);border-radius:12px;color:var(--text-muted);background:var(--bg-card);}
.study-sections strong {font-size:20px;color:var(--text-main);}
.study-sections span {font-size:13px;}
.study-sections a[aria-current] {border-color:var(--accent-cyan);background:var(--accent-cyan-soft);}
.study-sections a[aria-current] strong {color:var(--accent-cyan);}
.study-sections a:focus-visible {outline:2px solid var(--accent-cyan);outline-offset:3px;}
.mode-grid.lecture-practice-layout {grid-template-columns:minmax(0,1fr);}
.lecture-practice-layout .panel-card {min-width:0;}
[hidden] {display:none !important;}
@media(max-width:600px){.study-sections{margin-top:16px;gap:8px}.study-sections a{padding:12px}.study-sections strong{font-size:18px}.study-sections span{font-size:12px}}

.study-resources {width:100%;max-width:1100px;margin:8px auto 0;padding:0 16px;text-align:right;}
.study-resources a {color:var(--text-muted);font-size:13px;text-decoration:underline;text-underline-offset:3px;}
