/* ==========================================================================
   CentOS 7 在线刷题与智能改卷系统 — 现代极客/运维风格响应式样式表
   100% 本地系统字体栈，零 Google Fonts、零海外 CDN，深度适配手机端 Bottom Sheet 与防溢出布局
   ========================================================================== */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Code", "JetBrains Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  /* 浅色主题（默认） */
  --bg-page: #f3f6fa;
  --bg-surface: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-muted: #eef2f6;
  --bg-code: #f1f5f9;
  --bg-header: rgba(255, 255, 255, 0.92);

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-code: #0f766e;

  --border-color: #e2e8f0;
  --border-strong: #cbd5e1;

  --brand: #0d9488;
  --brand-hover: #0f766e;
  --brand-soft: #ccfbf1;
  --brand-soft-bg: #f0fdfa;
  --brand-text: #115e59;

  --accent-blue: #2563eb;
  --accent-blue-bg: #eff6ff;

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

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

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

  --ai: #7c3aed;
  --ai-bg: #f5f3ff;
  --ai-border: #ddd6fe;
  --ai-text: #5b21b6;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.14);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

[data-theme="dark"] {
  --bg-page: #0b1120;
  --bg-surface: #111827;
  --bg-subtle: #172033;
  --bg-muted: #1e293b;
  --bg-code: #090e1a;
  --bg-header: rgba(17, 24, 39, 0.92);

  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-code: #34d399;

  --border-color: #1f2937;
  --border-strong: #334155;

  --brand: #14b8a6;
  --brand-hover: #2dd4bf;
  --brand-soft: rgba(20, 184, 166, 0.22);
  --brand-soft-bg: rgba(20, 184, 166, 0.1);
  --brand-text: #5eead4;

  --accent-blue: #3b82f6;
  --accent-blue-bg: rgba(59, 130, 246, 0.14);

  --ok: #10b981;
  --ok-bg: rgba(16, 185, 129, 0.13);
  --ok-border: rgba(16, 185, 129, 0.35);
  --ok-text: #6ee7b7;

  --warn: #f59e0b;
  --warn-bg: rgba(245, 158, 11, 0.14);
  --warn-border: rgba(245, 158, 11, 0.35);
  --warn-text: #fcd34d;

  --err: #ef4444;
  --err-bg: rgba(239, 68, 68, 0.14);
  --err-border: rgba(239, 68, 68, 0.35);
  --err-text: #fca5a5;

  --ai: #8b5cf6;
  --ai-bg: rgba(139, 92, 246, 0.14);
  --ai-border: rgba(139, 92, 246, 0.35);
  --ai-text: #c4b5fd;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 14px 36px rgba(0, 0, 0, 0.55);
}

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

html, body {
  width: 100%;
  max-width: 100vw;
  min-height: 100%;
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  touch-action: manipulation;
}

/* ==================== 顶部导航栏 ==================== */
.top-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
}

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

.brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  min-width: 0;
}

.terminal-prompt {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  background: #0f172a;
  color: #34d399;
  border: 1px solid #334155;
  letter-spacing: -0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}

[data-theme="dark"] .terminal-prompt {
  background: #020617;
  border-color: #1e293b;
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-header-quick,
.mobile-only-btn,
.tab-text-short {
  display: none;
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-muted);
  padding: 4px;
  border-radius: var(--radius-md);
}

.nav-tab {
  padding: 6px 13px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.16s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
}

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

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

.badge-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-text);
  line-height: 1.4;
}

.badge-pill.danger {
  background: var(--err-bg);
  color: var(--err-text);
  border: 1px solid var(--err-border);
}

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

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.icon-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft-bg);
}

/* ==================== 主体容器与通用按钮 ==================== */
.main-container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 22px 20px 64px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 15px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.16s ease;
  white-space: nowrap;
  text-align: center;
}

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

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

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
  border-color: var(--brand);
  color: var(--brand);
}

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

.btn-ai:hover {
  opacity: 0.92;
}

.btn-danger {
  background: var(--err-bg);
  color: var(--err-text);
  border: 1px solid var(--err-border);
}

.btn-danger:hover {
  background: var(--err);
  color: #ffffff;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12.5px;
}

/* ==================== 大厅横幅与试卷卡片 ==================== */
.hero-banner {
  background: linear-gradient(135deg, #0f172a 0%, #134e4a 100%);
  color: #f8fafc;
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-md);
}

.hero-left {
  flex: 1 1 320px;
  min-width: 0;
}

.hero-left h1 {
  font-size: 21px;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.35;
}

.hero-left p {
  color: #cbd5e1;
  font-size: 13.5px;
  max-width: 680px;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(105px, 1fr));
  gap: 12px;
}

.hero-stat-box {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  min-width: 0;
}

.hero-stat-box .num {
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 700;
  color: #5eead4;
  white-space: nowrap;
}

.hero-stat-box .lbl {
  font-size: 12px;
  color: #cbd5e1;
}

.exam-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  gap: 20px;
}

.exam-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.exam-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand);
}

.exam-stage-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-text);
  background: var(--brand-soft-bg);
  border: 1px solid var(--brand-soft);
  padding: 3px 9px;
  border-radius: 999px;
  max-width: 100%;
}

.exam-card h2 {
  font-size: 18px;
  font-weight: 700;
  margin-top: 8px;
  line-height: 1.35;
}

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

.exam-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.metric-cell {
  min-width: 0;
}

.metric-cell .v {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-cell .k {
  font-size: 11.5px;
  color: var(--text-muted);
}

.volume-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.vol-chip {
  font-size: 12px;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  color: var(--text-secondary);
}

.progress-strip {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-bar-track {
  height: 7px;
  background: var(--bg-muted);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.exam-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

/* ==================== Linux 命令与路径代码胶囊 ==================== */
code.linux-code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-code);
  color: var(--text-code);
  border: 1px solid var(--border-color);
  padding: 1px 6px;
  border-radius: 5px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

mark.kw-hit {
  background: var(--ok-bg);
  color: var(--ok-text);
  border-bottom: 2px solid var(--ok);
  padding: 0 3px;
  border-radius: 3px;
  font-weight: 600;
}

/* ==================== 做题与改卷工作台工具栏 ==================== */
.workspace-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 20px;
  align-items: start;
}

.workspace-layout.desktop-sheet-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

.workspace-layout.desktop-sheet-collapsed .answer-sheet-card {
  display: none;
}

.workspace-toolbar {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}

.ws-toolbar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.ws-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.ws-title-text {
  font-size: 15px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-toolbar-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px dashed var(--border-color);
}

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

.timer-badge {
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  background: var(--brand-soft-bg);
  color: var(--brand-text);
  border: 1px solid var(--brand-soft);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.timer-badge.urgent {
  background: var(--err-bg);
  color: var(--err-text);
  border-color: var(--err-border);
}

/* ==================== 题目卡片与选项输入 ==================== */
.question-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  scroll-margin-top: 112px;
  min-width: 0;
}

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

.q-meta-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

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

.q-num-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12.5px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: #0f172a;
  color: #5eead4;
  white-space: nowrap;
}

.q-type-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--accent-blue-bg);
  color: var(--accent-blue);
  white-space: nowrap;
}

.q-score-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.q-book-tag {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-muted);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  max-width: 100%;
  overflow-wrap: anywhere;
}

.star-btn {
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.star-btn.starred {
  background: var(--warn-bg);
  color: var(--warn-text);
  border-color: var(--warn-border);
}

.q-stem {
  font-size: 15.5px;
  line-height: 1.72;
  color: var(--text-primary);
  margin-bottom: 18px;
  white-space: pre-line;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.stem-note-box {
  font-size: 13px;
  padding: 9px 12px;
  margin-bottom: 14px;
  border-radius: var(--radius-sm);
  background: var(--warn-bg);
  color: var(--warn-text);
  border: 1px solid var(--warn-border);
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  background: var(--bg-subtle);
  text-align: left;
  transition: all 0.14s ease;
  width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
}

.option-item:hover {
  border-color: var(--brand);
  background: var(--brand-soft-bg);
}

.option-item.selected {
  border-color: var(--brand);
  background: var(--brand-soft-bg);
}

.option-item.correct-opt {
  border-color: var(--ok);
  background: var(--ok-bg);
}

.option-item.wrong-opt {
  border-color: var(--err);
  background: var(--err-bg);
}

.opt-key {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  background: var(--bg-surface);
}

.option-item.selected .opt-key {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.option-item.correct-opt .opt-key {
  background: var(--ok);
  border-color: var(--ok);
  color: #ffffff;
}

.option-item.wrong-opt .opt-key {
  background: var(--err);
  border-color: var(--err);
  color: #ffffff;
}

.judge-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 220px));
  gap: 12px;
}

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

.blank-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.blank-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 78px;
}

.blank-input {
  flex: 1 1 200px;
  min-width: 0;
  max-width: 480px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-strong);
  background: var(--bg-subtle);
  font-family: var(--font-mono);
  font-size: 14px;
  transition: border-color 0.15s ease;
}

.blank-input:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--bg-surface);
}

.subjective-textarea {
  width: 100%;
  min-height: 132px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-strong);
  background: var(--bg-subtle);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.65;
  resize: vertical;
}

.subjective-textarea:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--bg-surface);
}

.focus-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* ==================== 桌面端侧边答题卡 & 移动端 Bottom Sheet 抽屉 ==================== */
.sheet-backdrop {
  display: none;
}

.sheet-drag-handle,
.sheet-mobile-close-btn {
  display: none;
}

.answer-sheet-card {
  position: sticky;
  top: 72px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  max-height: calc(100vh - 92px);
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
}

.sheet-sticky-head {
  background: var(--bg-surface);
}

.sheet-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
  margin: 10px 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 4px;
  vertical-align: -1px;
}

.sheet-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin: 10px 0 6px;
}

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

.sheet-cell {
  position: relative;
  height: 32px;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
}

.sheet-cell:hover {
  border-color: var(--brand);
}

.sheet-cell.current {
  outline: 2px solid var(--accent-blue);
  outline-offset: 1px;
}

.sheet-cell.answered {
  background: var(--brand-soft);
  color: var(--brand-text);
  border-color: var(--brand);
}

.sheet-cell.res-full {
  background: var(--ok-bg);
  color: var(--ok-text);
  border-color: var(--ok-border);
}

.sheet-cell.res-partial {
  background: var(--warn-bg);
  color: var(--warn-text);
  border-color: var(--warn-border);
}

.sheet-cell.res-zero {
  background: var(--err-bg);
  color: var(--err-text);
  border-color: var(--err-border);
}

.sheet-cell.res-pending {
  background: var(--ai-bg);
  color: var(--ai-text);
  border-color: var(--ai-border);
}

.sheet-star-dot {
  position: absolute;
  top: 1px;
  right: 2px;
  font-size: 8px;
  color: #eab308;
  line-height: 1;
}

/* 移动端底部固定快捷拇指栏（桌面端隐藏） */
.mobile-bottom-dock {
  display: none;
}

/* ==================== 解析对比、打分器与统计图表 ==================== */
.analysis-box {
  margin-top: 16px;
  padding: 15px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--brand);
  overflow-wrap: anywhere;
}

.compare-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 12px;
  margin-top: 12px;
}

.compare-pane {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  min-width: 0;
  overflow-wrap: anywhere;
}

.compare-pane h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

.rubric-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 12px;
}

.rubric-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  font-size: 13.5px;
  cursor: pointer;
  min-width: 0;
  overflow-wrap: anywhere;
}

.rubric-item.hit {
  background: var(--ok-bg);
  border-color: var(--ok-border);
}

.score-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.score-pill {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.score-pill.active-full {
  background: var(--ok);
  border-color: var(--ok);
  color: #ffffff;
}

.score-pill.active-partial {
  background: var(--warn);
  border-color: var(--warn);
  color: #ffffff;
}

.score-pill.active-zero {
  background: var(--err);
  border-color: var(--err);
  color: #ffffff;
}

.ai-feedback-card {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--ai-bg);
  border: 1px solid var(--ai-border);
  color: var(--text-primary);
  font-size: 13.5px;
  overflow-wrap: anywhere;
}

.report-summary-grid {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}

.charts-two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.stat-bars-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.stat-bar-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.stat-bar-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}

.stat-bar-label {
  font-weight: 600;
  color: var(--text-primary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-bar-val {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.stat-bar-track {
  height: 10px;
  border-radius: 999px;
  background: var(--bg-muted);
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.25s ease;
}

.surface-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.pitfalls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 16px;
}

.pitfall-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  border-top: 3px solid var(--brand);
  min-width: 0;
  overflow-wrap: anywhere;
}

.pitfall-card.mastered {
  opacity: 0.76;
  border-top-color: var(--ok);
}

.filter-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.input-control, .select-control {
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle);
  font-size: 13.5px;
  max-width: 100%;
  min-width: 0;
}

.input-control:focus, .select-control:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--bg-surface);
}

/* ==================== 模态框与 Toast ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 20px 22px;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.toast-stack {
  position: fixed;
  bottom: 78px;
  right: 16px;
  left: 16px;
  z-index: 150;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.toast-msg {
  background: #0f172a;
  color: #f8fafc;
  padding: 10px 15px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid #14b8a6;
  pointer-events: auto;
  max-width: 100%;
}

/* ==================== 移动端与平板响应式布局 (<= 960px) ==================== */
@media (max-width: 960px) {
  /* 1. 顶部导航栏：两层整洁网格，折叠次要工具按钮，绝不错乱换行 */
  .header-inner {
    padding: 8px 12px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .mobile-header-quick {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .mobile-only-btn {
    display: inline-flex;
    padding: 5px 9px;
    font-size: 12px;
  }

  .desktop-theme-btn {
    display: none;
  }

  .header-actions {
    display: none;
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding-top: 4px;
  }

  .header-actions.mobile-open {
    display: grid;
  }

  .header-actions .icon-btn {
    width: 100%;
    padding: 7px 6px;
    font-size: 12px;
  }

  .nav-tabs {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    width: 100%;
  }

  .nav-tab {
    padding: 6px 4px;
    font-size: 12.5px;
    gap: 4px;
  }

  /* 2. 工作台单列布局 + 底部留白防遮挡 */
  .main-container.has-mobile-dock {
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
  }

  .workspace-layout,
  .workspace-layout.desktop-sheet-collapsed {
    grid-template-columns: minmax(0, 1fr);
  }

  /* 覆盖桌面端 collapsed 隐藏，交由移动端 Bottom Sheet 状态接管 */
  .workspace-layout.desktop-sheet-collapsed .answer-sheet-card {
    display: block;
  }

  /* 3. 移动端 Bottom Sheet 遮罩抽屉（默认收起在视口下方，绝不遮挡题目！） */
  .sheet-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 85;
    background: rgba(15, 23, 42, 0.52);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, visibility 0.22s ease;
  }

  .sheet-backdrop.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .answer-sheet-card {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 95;
    max-height: 76vh;
    border-radius: 18px 18px 0 0;
    padding: 0 16px calc(20px + env(safe-area-inset-bottom));
    box-shadow: 0 -10px 32px rgba(0, 0, 0, 0.25);
    transform: translateY(105%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.25s ease;
  }

  .workspace-layout.mobile-sheet-open .answer-sheet-card {
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
  }

  .sheet-sticky-head {
    position: sticky;
    top: 0;
    z-index: 3;
    padding-top: 10px;
    padding-bottom: 2px;
    background: var(--bg-surface);
  }

  .sheet-drag-handle {
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: var(--border-strong);
    margin: 0 auto 10px;
  }

  .sheet-mobile-close-btn {
    display: inline-flex;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-subtle);
    color: var(--text-secondary);
    font-weight: 600;
  }

  .sheet-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 7px;
  }

  .sheet-cell {
    height: 36px;
    font-size: 12px;
  }

  /* 4. 移动端底部拇指操作栏 */
  .mobile-bottom-dock {
    display: grid;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 75;
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-color);
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    gap: 8px;
    box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.06);
  }

  .mobile-bottom-dock .btn {
    padding: 9px 8px;
    font-size: 13px;
    min-width: 0;
  }

  .focus-nav-bar {
    display: none;
  }

  .report-summary-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ==================== 小屏手机精细排版优化 (<= 640px) ==================== */
@media (max-width: 640px) {
  .main-container {
    padding: 12px 12px 64px;
  }

  .terminal-prompt {
    font-size: 11px;
    padding: 3px 6px;
  }

  .brand-title {
    font-size: 14px;
  }

  .tab-text-full {
    display: none;
  }

  .tab-text-short {
    display: inline;
  }

  .badge-pill {
    font-size: 10px;
    padding: 0 5px;
  }

  .hero-banner {
    padding: 18px 16px;
    gap: 14px;
  }

  .hero-left h1 {
    font-size: 17.5px;
  }

  .hero-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }

  .exam-card {
    padding: 16px;
  }

  .exam-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .exam-actions-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .exam-actions-grid .btn {
    padding: 9px 8px;
    font-size: 13px;
  }

  /* 做题工具栏小屏整齐排版 */
  .workspace-toolbar {
    padding: 10px 12px;
    gap: 8px;
  }

  .ws-toolbar-top {
    gap: 8px;
  }

  .ws-title-group {
    flex: 1 1 100%;
    order: 2;
  }

  .ws-title-text {
    font-size: 13.5px;
    white-space: normal;
    line-height: 1.4;
  }

  .ws-toolbar-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .ws-toolbar-controls .input-control {
    width: 100% !important;
  }

  .ws-btn-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
    width: 100%;
    gap: 6px;
  }

  .ws-btn-group .btn {
    padding: 7px 6px;
    font-size: 12.5px;
    min-width: 0;
  }

  .question-card {
    padding: 15px 14px;
    scroll-margin-top: 108px;
  }

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

  .judge-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .blank-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
  }

  .blank-input {
    width: 100%;
    max-width: 100%;
    flex: none;
    background: var(--bg-surface);
  }

  .filter-bar {
    padding: 12px;
    gap: 6px;
  }

  .filter-bar .select-control,
  .filter-bar .input-control {
    flex: 1 1 calc(50% - 6px);
  }

  .surface-card {
    padding: 15px;
  }

  .modal-panel {
    padding: 16px;
    max-height: 90vh;
  }

  .toast-stack {
    align-items: stretch;
    bottom: 74px;
  }
}
