/* ==========================================================================
   CSS Design System for Network Engineer Theoretical Question Bank Website
   Focused on Typography, Reading Comfort, Fluid Themes & Layout Polish
   ========================================================================== */

/* --- CSS Variables & Theming --- */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.08), 0 2px 6px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 10px -2px rgba(0, 0, 0, 0.05);
}

/* ☀️ 1. Light Theme (Day / Crisp Modern) */
body.theme-light {
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-secondary: #f1f5f9;
  --bg-surface-hover: #e2e8f0;
  --bg-accent-light: #eff6ff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #dbeafe;
  --primary-text: #1e40af;

  --success: #10b981;
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;
  --success-text: #065f46;

  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --danger-text: #991b1b;

  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;
  --warning-text: #92400e;

  --matrix-dot-unanswered: #e2e8f0;
}

/* 📜 2. Sepia Theme (Eye-Care Warm Paper / 长时间舒适阅读模式) */
body.theme-sepia {
  --bg-app: #fbf8f2;
  --bg-surface: #f4ede2;
  --bg-surface-secondary: #ebe2d3;
  --bg-surface-hover: #dfd4c2;
  --bg-accent-light: #f5ede0;
  --text-primary: #2c2519;
  --text-secondary: #5c5140;
  --text-muted: #8c7f6b;
  --border-subtle: #e4d8c5;
  --border-strong: #d2c3ac;

  --primary: #8b5cf6;
  --primary-hover: #7c3aed;
  --primary-light: #ede9fe;
  --primary-text: #5b21b6;

  --success: #059669;
  --success-bg: #e6f6ee;
  --success-border: #a4e4c7;
  --success-text: #064e3b;

  --danger: #dc2626;
  --danger-bg: #fbeae8;
  --danger-border: #f7beba;
  --danger-text: #881337;

  --warning: #d97706;
  --warning-bg: #fdf5e6;
  --warning-border: #f6d89b;
  --warning-text: #78350f;

  --matrix-dot-unanswered: #e2d7c5;
}

/* 🌙 3. Dark Theme (Night / OLED Clean) */
body.theme-dark {
  --bg-app: #0b0f19;
  --bg-surface: #151c2c;
  --bg-surface-secondary: #1e293b;
  --bg-surface-hover: #2b384e;
  --bg-accent-light: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-subtle: #243046;
  --border-strong: #334155;

  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-light: #1d3557;
  --primary-text: #93c5fd;

  --success: #10b981;
  --success-bg: #064e3b;
  --success-border: #047857;
  --success-text: #a7f3d0;

  --danger: #f43f5e;
  --danger-bg: #881337;
  --danger-border: #be123c;
  --danger-text: #fecdd3;

  --warning: #f59e0b;
  --warning-bg: #78350f;
  --warning-border: #b45309;
  --warning-text: #fde68a;

  --matrix-dot-unanswered: #243046;
}

/* --- Font Size Tiers (Typography Hierarchy) --- */
body.font-size-sm {
  --base-size: 15px;
  --stem-size: 1.125rem;
  --opt-size: 0.95rem;
  --exp-size: 0.95rem;
  --line-height-stem: 1.7;
}

body.font-size-md {
  --base-size: 16.5px;
  --stem-size: 1.25rem;
  --opt-size: 1.05rem;
  --exp-size: 1.02rem;
  --line-height-stem: 1.75;
}

body.font-size-lg {
  --base-size: 18.5px;
  --stem-size: 1.4rem;
  --opt-size: 1.15rem;
  --exp-size: 1.12rem;
  --line-height-stem: 1.8;
}

body.font-size-xl {
  --base-size: 21px;
  --stem-size: 1.55rem;
  --opt-size: 1.25rem;
  --exp-size: 1.2rem;
  --line-height-stem: 1.85;
}

/* --- Global Reset & Basics --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font-sans);
  font-size: var(--base-size);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- App Layout Grid --- */
.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* --- Top Navigation Bar --- */
.top-navbar {
  height: 62px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  z-index: 30;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-badge {
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

/* Center Search Box */
.nav-center {
  flex: 1;
  max-width: 520px;
  margin: 0 1.5rem;
}

.search-box {
  display: flex;
  align-items: center;
  background-color: var(--bg-surface-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  gap: 8px;
  color: var(--text-secondary);
  transition: var(--transition-fast);
}

.search-box:focus-within {
  border-color: var(--primary);
  background-color: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.search-box input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.clear-search-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
}

/* Nav Right Tools */
.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.font-scaler-group, .theme-switcher-group {
  display: flex;
  align-items: center;
  background-color: var(--bg-surface-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 3px 4px;
  gap: 2px;
}

.font-btn, .theme-btn {
  background: transparent;
  border: 1px solid transparent;
  outline: none;
  padding: 4px 9px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.font-btn:hover, .theme-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-surface-hover);
}

.font-btn.active, .theme-btn.active {
  background-color: var(--bg-surface);
  color: var(--primary);
  border-color: var(--border-subtle);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.font-btn:focus-visible, .theme-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.primary-pill-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-full);
  padding: 7px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.primary-pill-btn:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.icon-btn:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-primary);
}

/* --- Main Body Layout --- */
.main-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* --- Left Sidebar --- */
.sidebar {
  width: 320px;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  flex-shrink: 0;
  height: 100%;
  overflow-y: auto;
  transition: transform var(--transition-normal);
  z-index: 20;
}

.sidebar.collapsed {
  transform: translateX(-100%);
  margin-right: -320px;
}

.sidebar-inner {
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Mode Tabs */
.mode-tabs {
  display: flex;
  background-color: var(--bg-surface-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 4px;
  gap: 4px;
}

.mode-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  transition: var(--transition-fast);
}

.mode-tab:hover {
  color: var(--text-primary);
}

.mode-tab.active {
  background-color: var(--bg-surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.mode-icon {
  font-size: 1.1rem;
}

/* Quick Filter Pills */
.quick-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-pill {
  background-color: var(--bg-surface-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.filter-pill:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-primary);
}

.filter-pill.active {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.filter-pill.alert-pill {
  border-color: var(--warning);
  color: var(--warning-text);
  background-color: var(--warning-bg);
}

.filter-pill.alert-pill.active {
  background-color: var(--warning);
  color: #ffffff;
}

/* Progress Card */
.progress-card {
  background-color: var(--bg-surface-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.progress-title-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.progress-pct {
  color: var(--primary);
}

.progress-bar-bg {
  height: 8px;
  background-color: var(--border-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #10b981);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.progress-stats-grid {
  display: flex;
  justify-content: space-around;
  text-align: center;
  padding-top: 6px;
  border-top: 1px dashed var(--border-subtle);
}

.stat-num {
  font-size: 1.15rem;
  font-weight: 700;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.text-emerald { color: var(--success); }
.text-rose { color: var(--danger); }
.text-blue { color: var(--primary); }

/* Chapter Hierarchy Tree */
.chapter-tree-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tree-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.text-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.75rem;
  cursor: pointer;
  font-weight: 600;
}

.chapter-tree {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tree-node {
  border-radius: var(--radius-md);
  overflow: hidden;
}

.tree-node-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background-color: transparent;
  border: none;
  width: 100%;
  text-align: left;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
}

.tree-node-title:hover {
  background-color: var(--bg-surface-secondary);
  color: var(--text-primary);
}

.tree-node-title.active {
  background-color: var(--bg-accent-light);
  color: var(--primary);
  font-weight: 700;
}

.tree-badge {
  font-size: 0.72rem;
  background-color: var(--bg-surface-secondary);
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

/* Keyboard Tips */
.keyboard-tips-box {
  background-color: var(--bg-surface-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.tips-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.tips-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  line-height: 1.4;
}

kbd {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
  color: var(--text-primary);
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 4px;
}

/* --- Center Content Viewport --- */
.content-viewport {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-app);
}

/* Context Breadcrumbs & Actions Header */
.context-bar {
  padding: 0.65rem 1.75rem;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.85rem;
  min-height: 52px;
}

.context-breadcrumbs {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.crumb-l1, .crumb-l2 {
  color: var(--text-secondary);
}

.crumb-point {
  color: var(--primary);
  font-weight: 600;
  background-color: var(--primary-light);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.context-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

/* Order Segmented Control (顺序 / 随机 / 换一批) */
.order-toggle-group {
  display: inline-flex;
  align-items: center;
  background-color: var(--bg-surface-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 3px 4px;
  gap: 2px;
}

.order-btn {
  background: transparent;
  border: 1px solid transparent;
  outline: none;
  border-radius: var(--radius-full);
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.order-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-surface-hover);
}

.order-btn.active {
  background-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

.order-btn-icon {
  background: transparent;
  border: 1px solid var(--border-subtle);
  outline: none;
  border-radius: var(--radius-full);
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.order-btn-icon:hover {
  background-color: var(--bg-surface-hover);
  color: var(--primary);
}

/* Switches Group - Perfectly Horizontal Pill */
.switches-group {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 4px 14px;
  background-color: var(--bg-surface-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
}

.switches-divider {
  width: 1px;
  height: 14px;
  background-color: var(--border-strong);
}

.switch-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  user-select: none;
  white-space: nowrap;
  transition: color var(--transition-fast);
}

.switch-control:hover {
  color: var(--text-primary);
}

.switch-control input {
  display: none;
}

.slider {
  width: 32px;
  height: 18px;
  background-color: var(--border-strong);
  border-radius: var(--radius-full);
  position: relative;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.slider::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 2px;
  top: 2px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: var(--transition-fast);
}

.switch-control input:checked + .slider {
  background-color: var(--primary);
}

.switch-control input:checked + .slider::before {
  transform: translateX(14px);
}

/* Reset Practice Button */
.btn-reset-practice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-surface-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 5px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--danger-text, #ef4444);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-reset-practice:hover {
  background-color: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger);
  transform: translateY(-1px);
}

.reset-link-btn {
  background: transparent;
  border: none;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--danger-text, #ef4444);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
  margin-left: auto;
  margin-right: 6px;
}

.reset-link-btn:hover {
  background-color: var(--danger-bg);
  text-decoration: underline;
}

/* App Toast Notification */
.app-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background-color: #0f172a;
  color: #ffffff;
  padding: 10px 22px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.25);
  z-index: 1000;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.app-toast.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(16px);
  pointer-events: none;
}

/* View Panels */
.view-panel {
  display: none;
  flex: 1;
  padding: 2rem 1.5rem 4rem;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}

.view-panel.active {
  display: flex;
  flex-direction: column;
}

/* Practice View Dual-Pane Split Layout (左右分栏双面板架构) */
#view-practice {
  max-width: 1440px;
  width: 100%;
  padding: 1.25rem 1.5rem 3.5rem;
}

.practice-split-container {
  display: grid;
  grid-template-columns: minmax(360px, 1.1fr) minmax(360px, 1fr);
  gap: 1.75rem;
  align-items: start;
  width: 100%;
}

.practice-split-container.explain-collapsed {
  grid-template-columns: minmax(360px, 820px);
  justify-content: center;
}

.practice-split-container.explain-collapsed .practice-right-pane {
  display: none;
}

.practice-left-pane {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

.practice-right-pane {
  min-width: 0;
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
}

@media (max-width: 992px) {
  .practice-split-container {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .practice-right-pane {
    position: static;
    max-height: none;
    overflow-y: visible;
  }
}

/* ==========================================================================
   Question Card & Typography (Primary Focus: Typography & High Legibility)
   ========================================================================== */
.question-container {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2.2rem 2.4rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

/* Question Header Meta Badges */
.q-meta-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  border-bottom: 1px dashed var(--border-subtle);
  padding-bottom: 1rem;
}

.q-badge-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.q-id-pill {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  background-color: var(--bg-surface-secondary);
  color: var(--text-primary);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.q-type-pill {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.q-type-single {
  background-color: var(--primary-light);
  color: var(--primary-text);
}

.q-type-judge {
  background-color: #fef3c7;
  color: #92400e;
}

.q-diff-pill {
  font-size: 0.78rem;
  color: var(--warning);
  font-weight: 600;
}

.q-audited-pill {
  background-color: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning-text);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Question Stem Typography */
.q-stem {
  font-size: var(--stem-size);
  font-weight: 650;
  line-height: var(--line-height-stem);
  color: var(--text-primary);
  letter-spacing: 0.2px;
  user-select: text;
}

/* Options Container */
.q-options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.opt-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px;
  background-color: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.opt-card:hover {
  border-color: var(--primary);
  background-color: var(--bg-surface-secondary);
  transform: translateY(-1px);
}

/* Option Letter Badge */
.opt-key-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-secondary);
  background-color: var(--bg-surface);
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.opt-text {
  font-size: var(--opt-size);
  line-height: 1.6;
  color: var(--text-primary);
  padding-top: 3px;
  flex: 1;
}

/* Option States */
.opt-card.selected {
  border-color: var(--primary);
  background-color: var(--bg-accent-light);
}

.opt-card.selected .opt-key-circle {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.opt-card.correct {
  border-color: var(--success) !important;
  background-color: var(--success-bg) !important;
}

.opt-card.correct .opt-key-circle {
  background-color: var(--success) !important;
  border-color: var(--success) !important;
  color: #ffffff !important;
}

.opt-card.wrong {
  border-color: var(--danger) !important;
  background-color: var(--danger-bg) !important;
}

.opt-card.wrong .opt-key-circle {
  background-color: var(--danger) !important;
  border-color: var(--danger) !important;
  color: #ffffff !important;
}

/* Option Result Marker */
.opt-status-icon {
  margin-left: auto;
  font-weight: 700;
  font-size: 1.1rem;
  padding-top: 3px;
}

.opt-card.correct .opt-status-icon {
  color: var(--success);
}

.opt-card.wrong .opt-status-icon {
  color: var(--danger);
}

/* Option Locked and Feedback Animations (选择后锁定不可更改) */
.opt-card.answered-locked {
  cursor: default !important;
}

.opt-card.answered-locked:hover {
  transform: none !important;
}

.opt-card.answered-locked.selected.correct {
  box-shadow: 0 0 0 2px var(--success);
  animation: pulseCorrect 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.opt-card.answered-locked.selected.wrong {
  box-shadow: 0 0 0 2px var(--danger);
  animation: shakeWrong 0.35s ease;
}

.opt-card.answered-locked:not(.selected):not(.correct) {
  opacity: 0.55;
  cursor: not-allowed !important;
}

@keyframes pulseCorrect {
  0% { transform: scale(1); }
  50% { transform: scale(1.025); }
  100% { transform: scale(1); }
}

@keyframes shakeWrong {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* ==========================================================================
   Explanation Container & Right Side Pane (Deep Analysis & Proven Details)
   ========================================================================== */
.explanation-container {
  background-color: var(--bg-surface-secondary);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.75rem;
  font-size: var(--exp-size);
  line-height: 1.75;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 0.5rem;
  animation: fadeIn 0.25s ease;
}

/* Right Side Dedicated Explanation Panel */
.side-explanation {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-top: 4px solid var(--primary);
  border-left: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.85rem;
  margin-top: 0;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-height: 280px;
}

.side-explanation.placeholder-state {
  background-color: var(--bg-surface);
  border-top: 4px solid var(--border-strong);
  justify-content: center;
  align-items: center;
}

.exp-placeholder-card {
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.85rem;
}

.exp-placeholder-card .placeholder-icon {
  font-size: 2.8rem;
  line-height: 1;
}

.exp-placeholder-card h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.exp-placeholder-card p {
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 440px;
  color: var(--text-secondary);
}

.exp-placeholder-card .placeholder-shortcuts {
  margin-top: 0.5rem;
  padding: 0.85rem 1.25rem;
  background-color: var(--bg-surface-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-align: left;
  font-size: 0.85rem;
  color: var(--text-secondary);
  width: 100%;
  max-width: 440px;
}

.exp-placeholder-card .placeholder-shortcuts .shortcut-title {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.exp-placeholder-card .placeholder-shortcuts ul {
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.exp-header-banner {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.exp-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.exp-title-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--primary);
}

.exp-category-crumb {
  font-size: 0.82rem;
  color: var(--text-muted);
}

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

.exp-section h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.exp-section p {
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.exp-section ul {
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.exp-section li {
  color: var(--text-secondary);
}

/* Answer Callout Badge */
.verified-answer-callout {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success-text);
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 1.05rem;
  font-weight: 700;
}

/* Audited Proof Warning Callout */
.audited-proof-callout {
  background-color: var(--warning-bg);
  border: 1.5px solid var(--warning-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  color: var(--warning-text);
}

.audited-proof-callout .callout-title {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 0.95rem;
}

/* --- Question Bottom Navigation Bar --- */
.question-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.5rem;
  padding: 0 0.5rem;
  gap: 12px;
}

.nav-arrow-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 10px 22px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
}

.nav-arrow-btn:hover {
  background-color: var(--bg-surface-hover);
  transform: translateY(-1px);
}

.nav-arrow-btn.primary {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.nav-arrow-btn.primary:hover {
  background-color: var(--primary-hover);
}

.nav-middle-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.action-btn:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-primary);
}

.action-btn.active {
  color: var(--primary);
  border-color: var(--primary);
  background-color: var(--bg-accent-light);
}

.action-btn.starred {
  color: var(--warning);
  border-color: var(--warning);
  background-color: var(--warning-bg);
}

.action-btn.starred .star-icon {
  fill: var(--warning);
}

/* ==========================================================================
   View 2: Cramming / List Stream Mode (背题速览)
   ========================================================================== */
.cram-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.cram-summary {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.cram-summary span {
  color: var(--primary);
  font-weight: 700;
}

.cram-pagination, .cram-footer-pagination {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cram-footer-pagination {
  margin-top: 2rem;
  justify-content: center;
}

.page-btn {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-primary);
}

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

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

.page-select {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  font-size: 0.85rem;
  color: var(--text-primary);
  outline: none;
}

.cram-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.cram-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ==========================================================================
   View 3: Mock Exam Mode (全真模拟考试)
   ========================================================================== */
.exam-intro-box {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 3rem 2.5rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  max-width: 760px;
  margin: 2rem auto;
}

.exam-badge {
  display: inline-block;
  background-color: var(--primary-light);
  color: var(--primary-text);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  margin-bottom: 1rem;
}

.exam-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
}

.exam-meta-pills {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 1.5rem;
}

.exam-meta-pills span {
  background-color: var(--bg-surface-secondary);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
}

.exam-desc {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 2.5rem;
  text-align: left;
}

.start-exam-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-full);
  padding: 12px 36px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: var(--transition-fast);
}

.start-exam-btn:hover {
  background-color: var(--primary-hover);
  transform: scale(1.02);
}

/* Exam Active Sticky Bar */
.exam-sticky-bar {
  position: sticky;
  top: 0;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
  z-index: 10;
}

.exam-timer-widget {
  display: flex;
  align-items: center;
  gap: 8px;
}

.timer-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.timer-clock {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
}

.timer-clock.warning {
  color: var(--danger);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.submit-exam-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--success);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-full);
  padding: 8px 20px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
}

.submit-exam-btn:hover {
  background-color: #059669;
}

.exam-flow {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

/* Exam Result Box */
.exam-result-box {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Right Drawer: Question Answer Matrix (答题卡 1-1200)
   ========================================================================== */
.matrix-drawer {
  width: 330px;
  background-color: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100%;
  flex-shrink: 0;
  transition: transform var(--transition-normal);
  z-index: 25;
}

.matrix-drawer.collapsed {
  transform: translateX(100%);
  margin-left: -330px;
}

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

.matrix-title {
  font-size: 0.95rem;
  font-weight: 700;
}

.matrix-counter {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.matrix-legend {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 8px 12px;
  border-bottom: 1px dashed var(--border-subtle);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot.unanswered { background-color: var(--matrix-dot-unanswered); }
.dot.correct { background-color: var(--success); }
.dot.wrong { background-color: var(--danger); }
.dot.starred { background-color: var(--warning); }

.matrix-filter-row {
  display: flex;
  padding: 8px 12px;
  gap: 4px;
  background-color: var(--bg-surface-secondary);
}

.m-filter {
  flex: 1;
  border: none;
  background: transparent;
  padding: 4px 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.m-filter.active {
  background-color: var(--bg-surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.matrix-grid {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  align-content: start;
}

.m-item {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface-secondary);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: var(--transition-fast);
}

.m-item:hover {
  transform: scale(1.08);
  border-color: var(--primary);
  color: var(--primary);
  z-index: 2;
}

.m-item.active {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.m-item.correct {
  background-color: var(--success);
  border-color: var(--success);
  color: #ffffff;
}

.m-item.wrong {
  background-color: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
}

.m-item.starred::after {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--warning);
}

.matrix-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: center;
}

.danger-link-btn {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 0.78rem;
  cursor: pointer;
  text-decoration: underline;
}

/* Utilities */
.hidden {
  display: none !important;
}

/* ==========================================================================
   Header Real-Time Stats Badge (已刷题目 & 正确率实时看板)
   ========================================================================== */
.header-stats-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-surface-secondary);
  border: 1px solid var(--border-subtle);
  padding: 4px 14px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  user-select: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
}

.badge-stat-item {
  display: flex;
  align-items: baseline;
  gap: 3px;
}

.badge-stat-item strong {
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 0.88rem;
}

.badge-stat-divider {
  color: var(--border-strong);
  font-weight: 300;
}

/* ==========================================================================
   Order Toggle Group (正常排序 vs 随机排序)
   ========================================================================== */
.order-toggle-group {
  display: flex;
  align-items: center;
  background-color: var(--bg-surface-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 2px;
  gap: 2px;
}

.order-btn {
  background: transparent;
  border: none;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.order-btn:hover {
  color: var(--text-primary);
}

.order-btn.active {
  background-color: var(--bg-surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
}

.order-btn-icon {
  background: transparent;
  border: none;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  color: var(--primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 2px;
  font-weight: 600;
}

.order-btn-icon:hover {
  background-color: var(--primary-light);
}

/* ==========================================================================
   Question Stem Typography & Formatting (Long question reading comfort)
   ========================================================================== */
.stem-blank {
  color: var(--primary);
  font-weight: 700;
  padding: 0 4px;
  letter-spacing: 2px;
  border-bottom: 2px solid var(--primary-light);
  display: inline-block;
  line-height: 1.2;
}

.stem-code {
  background-color: var(--bg-surface-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--primary);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.9em;
  font-weight: 600;
  word-break: break-all;
}

/* Mobile Drawer Overlay Backdrop */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 19;
  transition: opacity var(--transition-fast);
}

/* Exam Review Paper View */
.exam-review-card {
  margin-bottom: 1.5rem;
}
.exam-review-card .opt-card {
  cursor: default !important;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1024px) {
  .sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    box-shadow: var(--shadow-lg);
  }
  .matrix-drawer {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    box-shadow: var(--shadow-lg);
  }
  .view-panel {
    padding: 1.5rem 1rem 3rem;
  }
  .question-container {
    padding: 1.5rem 1.25rem;
  }
}

@media (max-width: 768px) {
  .header-stats-badge {
    display: none;
  }
}

@media (max-width: 640px) {
  .brand-title {
    display: none;
  }
  .nav-center {
    margin: 0 0.5rem;
  }
  .font-scaler-group {
    display: none;
  }
  .question-nav-bar {
    flex-wrap: wrap;
  }
  .nav-arrow-btn {
    flex: 1;
    justify-content: center;
  }
  .order-toggle-group {
    font-size: 0.72rem;
  }
}

