:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --surface-accent: #eef2ff;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #dbeafe;
  --indigo: #4f46e5;
  --emerald: #059669;
  --emerald-light: #d1fae5;
  --amber: #d97706;
  --amber-light: #fef3c7;
  --rose: #e11d48;
  --rose-light: #ffe4e6;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang HK", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-math: "Cambria Math", "Times New Roman", Georgia, serif;
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 15px;
  overflow-x: hidden;
}

/* Header */
.top-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: #fff;
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(30, 58, 138, 0.22);
}

.header-inner {
  max-width: 1360px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

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

.brand-badge {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: 4px 9px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.brand-title h1 {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
}

.brand-subtitle {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.85);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lang-segmented {
  display: inline-flex;
  background: rgba(15, 23, 42, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.lang-switch-btn {
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  border: none;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lang-switch-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.lang-switch-btn.active {
  background: #ffffff;
  color: #1e3a8a;
}

.ctrl-btn {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

.ctrl-btn.active {
  background: #ffffff;
  color: #1e3a8a;
  border-color: #ffffff;
}

/* Subject Switcher Bar */
.subject-bar-wrap {
  background: #172554;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.subject-bar {
  max-width: 1360px;
  margin: 0 auto;
  padding: 7px 24px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.subject-bar::-webkit-scrollbar {
  display: none;
}

.subject-pill {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.88);
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.subject-pill:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.subject-pill.active {
  background: #ffffff;
  color: #1e3a8a;
  border-color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

/* Main Layout */
.app-layout {
  max-width: 1360px;
  margin: 20px auto;
  padding: 0 20px 40px;
  display: grid;
  grid-template-columns: 285px 1fr;
  gap: 22px;
  align-items: start;
}

/* Sidebar */
.sidebar {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  position: sticky;
  top: 80px;
}

.sidebar-section-title {
  padding: 13px 16px 9px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}

.topic-list {
  list-style: none;
}

.topic-item {
  border-bottom: 1px solid var(--border);
}

.topic-item:last-child {
  border-bottom: none;
}

.topic-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 12px 15px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  transition: background 0.15s;
}

.topic-btn:hover {
  background: var(--surface-alt);
}

.topic-btn.active {
  background: var(--surface-accent);
  border-left: 4px solid var(--primary);
  padding-left: 11px;
}

.topic-num {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--border);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.topic-btn.active .topic-num {
  background: var(--primary);
  color: #fff;
}

.topic-info {
  flex: 1;
  min-width: 0;
}

.topic-name-zh {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  display: block;
}

.topic-name-en {
  font-size: 11.5px;
  color: var(--text-muted);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topic-progress-pill {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--surface-alt);
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-weight: 600;
  flex-shrink: 0;
}

.topic-progress-pill.done {
  background: var(--emerald-light);
  color: var(--emerald);
  border-color: #a7f3d0;
}

.stats-box {
  padding: 13px 16px;
  background: var(--surface-alt);
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.stats-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  color: var(--text-secondary);
}

.stats-row:last-child {
  margin-bottom: 0;
}

.stats-row strong {
  color: var(--text);
}

/* Main Content Area */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

/* Mode Tabs (Desktop) */
.desktop-mode-tabs {
  display: flex;
  gap: 10px;
  background: var(--surface);
  padding: 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.desktop-mode-tabs .mode-tab {
  flex: 1;
  min-width: 140px;
  padding: 10px 14px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.desktop-mode-tabs .mode-tab:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.desktop-mode-tabs .mode-tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.mode-tab-sub {
  display: block;
  font-size: 11px;
  font-weight: 400;
  opacity: 0.85;
  margin-top: 2px;
}

/* Mobile Bottom Navigation (Hidden on Desktop) */
.mobile-bottom-nav {
  display: none;
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.card-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Principle intuition blocks */
.intuition-banner {
  background: linear-gradient(135deg, #eff6ff 0%, #eef2ff 100%);
  border: 1px solid #bfdbfe;
  border-left: 5px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 20px;
}

.intuition-label {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 5px;
  margin-bottom: 7px;
}

.intuition-text {
  font-size: 15px;
  color: #1e293b;
  line-height: 1.7;
}

/* Interactive Visualizer Container */
.visualizer-box {
  background: #f8fafc;
  border: 2px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 18px;
  margin: 18px 0;
}

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

.viz-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--indigo);
  line-height: 1.4;
}

.viz-badge {
  background: #e0e7ff;
  color: var(--indigo);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
}

.viz-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  align-items: center;
}

.viz-CanvasWrap {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
  min-height: 260px;
  overflow: hidden;
}

.viz-CanvasWrap svg {
  max-width: 100%;
  height: auto;
  display: block;
}

.viz-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.slider-group {
  background: #fff;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.slider-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.slider-val {
  color: var(--primary);
  font-family: var(--font-math);
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
}

input[type="range"] {
  width: 100%;
  height: 26px;
  accent-color: var(--primary);
  cursor: pointer;
}

.viz-readout {
  background: #fff;
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--primary);
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  line-height: 1.65;
}

/* Principle Concept Cards */
.concept-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 14px;
}

.concept-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  background: var(--surface);
  transition: border-color 0.15s;
}

.concept-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.concept-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.concept-en {
  font-size: 12px;
  color: var(--indigo);
  background: #eef2ff;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.formula-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 10px 0;
  font-family: var(--font-math);
  font-size: 16px;
  color: #0f172a;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.65;
}

.why-box {
  background: #f0fdf4;
  border-left: 4px solid var(--emerald);
  padding: 12px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-top: 10px;
  font-size: 14px;
  color: #064e3b;
}

.why-box strong {
  color: #047857;
}

.trap-box {
  background: #fffbeb;
  border-left: 4px solid var(--amber);
  padding: 10px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-top: 10px;
  font-size: 13.5px;
  color: #78350f;
}

/* Vocabulary Table */
.vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.vocab-item {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.vocab-zh {
  font-weight: 700;
  color: var(--text);
  font-size: 14px;
}

.vocab-en {
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
}

.vocab-note {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 3px;
}

/* Practice & Drill UI */
.filter-group {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 6px 12px;
  border-radius: 99px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.filter-btn.active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}

.question-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 16px;
  background: var(--surface);
  transition: box-shadow 0.15s;
}

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

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

.badge {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
}

.badge-p1 {
  background: #dbeafe;
  color: #1e40af;
}

.badge-p2 {
  background: #ede9fe;
  color: #5b21b6;
}

.badge-diff {
  background: var(--surface-alt);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.q-stem {
  font-size: 15.5px;
  line-height: 1.72;
  color: var(--text);
  margin-bottom: 14px;
}

.q-stem-en {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
}

/* MC Options */
.mc-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.mc-opt-btn {
  text-align: left;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  font-size: 15px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
}

.mc-opt-btn:hover {
  border-color: var(--primary);
  background: #f8fafc;
}

.mc-opt-btn.selected-correct {
  border-color: var(--emerald);
  background: var(--emerald-light);
  color: #064e3b;
  font-weight: 600;
}

.mc-opt-btn.selected-wrong {
  border-color: var(--rose);
  background: var(--rose-light);
  color: #881337;
}

.mc-letter {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-alt);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

/* Self-check input for Paper 1 */
.p1-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.p1-input {
  padding: 10px 13px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 16px; /* 16px prevents iOS WeChat auto-zoom on focus */
  min-width: 200px;
  flex: 1;
  outline: none;
}

.p1-input:focus {
  border-color: var(--primary);
}

/* Progressive Hints & Solution Actions */
.q-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.btn {
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

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

.btn-outline {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text-secondary);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #f8fafc;
}

.btn-amber {
  background: var(--amber-light);
  color: #92400e;
  border-color: #fde68a;
}

/* Reveal Panels */
.reveal-panel {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.72;
  display: none;
}

.reveal-panel.show {
  display: block;
}

.panel-hint {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #78350f;
}

.panel-solution {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-left: 4px solid var(--emerald);
}

.step-line {
  padding: 6px 0;
  border-bottom: 1px dashed #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.step-line:last-child {
  border-bottom: none;
}

.mark-tag {
  font-family: monospace;
  font-weight: 700;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #dcfce7;
  color: #166534;
  flex-shrink: 0;
}

.math-expr {
  font-family: var(--font-math);
  font-weight: 600;
  color: #0f172a;
}

.feedback-banner {
  margin-top: 10px;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13.5px;
  display: none;
}

.feedback-banner.correct {
  display: block;
  background: var(--emerald-light);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.feedback-banner.wrong {
  display: block;
  background: var(--rose-light);
  color: #9f1239;
  border: 1px solid #fecdd3;
}

/* Infinite Generator Card */
.generator-header-box {
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  border: 1px solid #c7d2fe;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

/* Scratchpad Canvas */
.scratchpad-wrap {
  margin-top: 12px;
  background: #fffef7;
  border: 1.5px dashed #94a3b8;
  border-radius: var(--radius-sm);
  padding: 10px;
  display: none;
}

.scratchpad-wrap.show {
  display: block;
}

.scratchpad-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.scratchpad-canvas {
  width: 100%;
  height: 220px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 6px;
  touch-action: none;
  cursor: crosshair;
  display: block;
}

/* ==================== 手机端 / 微信端深度适配 (<= 820px) ==================== */
@media (max-width: 820px) {
  .desktop-only,
  .brand-subtitle,
  .sidebar-section-title,
  .stats-box,
  .desktop-mode-tabs,
  .topic-name-en {
    display: none !important;
  }

  .top-header {
    position: static;
    padding: 10px 12px;
  }

  .subject-bar {
    padding: 6px 10px;
    gap: 6px;
  }

  .subject-pill {
    padding: 5px 11px;
    font-size: 12.5px;
  }

  .header-inner {
    gap: 8px;
  }

  .brand-title {
    gap: 7px;
  }

  .brand-badge {
    padding: 2px 6px;
    font-size: 11px;
  }

  .brand-title h1 {
    font-size: 15px;
    font-weight: 700;
  }

  .header-controls {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }

  .lang-switch-btn {
    padding: 5px 10px;
    font-size: 12.5px;
  }

  .ctrl-btn {
    padding: 5px 10px;
    font-size: 12px;
  }

  /* 章节横向胶囊吸顶栏：只占 46px 高度，不挡视线 */
  .app-layout {
    display: block;
    margin: 0;
    padding: 0 0 calc(72px + env(safe-area-inset-bottom));
  }

  .sidebar {
    position: sticky !important;
    top: 0;
    z-index: 95;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
  }

  .topic-list {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 6px 10px;
    gap: 7px;
  }

  .topic-list::-webkit-scrollbar {
    display: none;
  }

  .topic-item {
    border: none;
    flex: 0 0 auto;
  }

  .topic-btn {
    padding: 6px 11px;
    border-radius: 99px;
    border: 1px solid var(--border-strong);
    background: var(--surface-alt);
    align-items: center;
    gap: 6px;
  }

  .topic-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    border-left: 1px solid var(--primary);
    padding-left: 11px;
  }

  .topic-num {
    width: 19px;
    height: 19px;
    font-size: 11px;
    border-radius: 50%;
    margin-top: 0;
    background: rgba(15, 23, 42, 0.08);
  }

  .topic-btn.active .topic-num {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
  }

  .topic-name-zh {
    font-size: 13px;
    white-space: nowrap;
  }

  .topic-btn.active .topic-name-zh {
    color: #fff;
  }

  .topic-progress-pill {
    font-size: 10.5px;
    padding: 1px 6px;
  }

  .topic-btn.active .topic-progress-pill {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    border-color: transparent;
  }

  /* 主内容区紧凑边距 */
  .main-content {
    padding: 10px 10px 16px;
  }

  .card {
    padding: 14px 12px;
    border-radius: var(--radius-md);
  }

  .card-header {
    margin-bottom: 12px;
    padding-bottom: 10px;
  }

  .card-title {
    font-size: 16.5px;
  }

  #btn-go-practice {
    width: 100%;
    text-align: center;
    padding: 10px;
  }

  .intuition-banner {
    padding: 12px 14px;
    margin-bottom: 14px;
  }

  .intuition-text {
    font-size: 14px;
  }

  /* 手机端互动实验室：图像在上方，滑块在下方，拖动时手指不挡图！ */
  .visualizer-box {
    padding: 12px;
    margin: 14px 0;
  }

  .viz-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .viz-CanvasWrap {
    order: 1;
    width: 100%;
    min-height: 210px;
    padding: 6px;
  }

  .viz-controls {
    order: 2;
    width: 100%;
    gap: 8px;
  }

  .slider-group {
    padding: 8px 11px;
  }

  .concept-card {
    padding: 14px 12px;
  }

  .concept-title {
    font-size: 15px;
  }

  .formula-box {
    font-size: 14.5px;
    padding: 10px 12px;
  }

  .vocab-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  /* 手机端刷题卡片与选项优化 */
  .question-card {
    padding: 14px 12px;
    margin-bottom: 12px;
  }

  .q-stem {
    font-size: 15px;
  }

  .mc-options {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .p1-input-row label {
    width: 100%;
    margin-bottom: 2px;
  }

  .p1-input {
    min-width: 0;
  }

  .q-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .q-actions .btn-show-sol {
    grid-column: 1 / -1;
  }

  .step-line {
    flex-direction: column;
    gap: 4px;
  }

  .generator-header-box {
    padding: 14px;
  }

  #btn-generate-new {
    width: 100%;
  }

  /* 手机端底部固定导航栏 (App 级大拇指体验) */
  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-strong);
    padding: 5px 4px calc(5px + env(safe-area-inset-bottom));
    z-index: 120;
    box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.08);
  }

  .mobile-bottom-nav .mode-tab {
    border: none;
    background: transparent;
    padding: 5px 2px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
  }

  .mobile-bottom-nav .mode-tab.active {
    color: var(--primary);
    background: #eff6ff;
  }

  .m-nav-icon {
    font-size: 17px;
    line-height: 1.1;
  }

  .m-nav-label {
    font-size: 11.5px;
    line-height: 1.1;
    white-space: nowrap;
  }
}

/* Print Stylesheet */
@media print {
  body {
    background: #fff;
    font-size: 13pt;
  }
  .top-header,
  .sidebar,
  .mode-tabs,
  .mobile-bottom-nav,
  .q-actions,
  .visualizer-box,
  .no-print {
    display: none !important;
  }
  .app-layout {
    display: block;
    margin: 0;
    padding: 0;
    max-width: 100%;
  }
  .card,
  .question-card {
    box-shadow: none;
    border: 1px solid #999;
    page-break-inside: avoid;
    margin-bottom: 16px;
  }
  .print-only-header {
    display: block !important;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #000;
  }
}

.print-only-header {
  display: none;
}
