:root {
  --bg: #F8F6F0;
  --surface: #FFFFFF;
  --surface-soft: #F3F6FA;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --text: #1E293B;
  --text-muted: #64748B;
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --primary-soft: #EFF6FF;
  --green: #059669;
  --green-soft: #ECFDF5;
  --rose: #E11D48;
  --rose-soft: #FFF1F2;
  --amber: #D97706;
  --amber-soft: #FFFBEB;
  --indigo: #4F46E5;
  --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--bg);
  background-image: radial-gradient(#E5E0D5 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* ==================== 顶部导航 ==================== */
.top-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.brand-badge {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, #2563EB, #4F46E5);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  flex-shrink: 0;
}

.brand-text h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.25;
}

.brand-text p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

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

.nav-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 15px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.18s ease;
}

.nav-btn:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.nav-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: #BFDBFE;
}

.nav-badge {
  background: var(--rose);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 99px;
  line-height: 1.4;
}

/* ==================== 主容器与视图 ==================== */
.app-container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

.view-section {
  display: none;
  animation: fadeUp 0.25s ease;
}

.view-section.active {
  display: block;
}

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

/* ==================== 按钮与表单基础 ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: inherit;
  text-decoration: none;
}

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

.btn-lg {
  padding: 13px 22px;
  font-size: 15px;
  border-radius: 14px;
}

.btn-sm {
  padding: 7px 13px;
  font-size: 13px;
  border-radius: 10px;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, #2563EB, #1D4ED8);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.34);
}

.btn-amber {
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: #fff;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.25);
}

.btn-amber:hover:not(:disabled) {
  transform: translateY(-1px);
}

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

.btn-green:hover:not(:disabled) {
  background: #047857;
}

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

.btn-outline:hover:not(:disabled) {
  background: var(--primary-soft);
  border-color: var(--primary);
}

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

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

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}

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

.form-select,
.form-input {
  border: 1.5px solid var(--border-strong);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  font-family: inherit;
  outline: none;
  transition: border-color 0.18s;
}

.form-select:focus,
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* ==================== 首页统计卡片 ==================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}

.stat-card.clickable {
  cursor: pointer;
  transition: transform 0.18s, border-color 0.18s;
}

.stat-card.clickable:hover {
  transform: translateY(-2px);
  border-color: #FDA4AF;
}

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.blue { background: #EFF6FF; }
.stat-icon.green { background: #ECFDF5; }
.stat-icon.amber { background: #FFFBEB; }
.stat-icon.rose { background: #FFF1F2; }

.stat-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}

.stat-value {
  font-size: 21px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ==================== 首页 Hero 卡片 ==================== */
.hero-card {
  background: linear-gradient(135deg, #FFFFFF 0%, #F0F7FF 100%);
  border: 1px solid #DBEAFE;
  border-radius: var(--radius-lg);
  padding: 28px 30px;
  display: grid;
  grid-template-columns: 1.45fr 0.95fr;
  gap: 28px;
  align-items: center;
  box-shadow: var(--shadow-md);
  margin-bottom: 22px;
}

.hero-tag {
  display: inline-block;
  background: #DBEAFE;
  color: #1D4ED8;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 99px;
  margin-bottom: 10px;
}

.hero-content h2 {
  margin: 0 0 10px;
  font-size: 24px;
  line-height: 1.35;
  color: #0F172A;
}

.hero-content p {
  margin: 0 0 20px;
  font-size: 14px;
  color: #475569;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.paper-preview {
  position: relative;
  background: #FFFFFF;
  border: 2px solid #E2E8F0;
  border-radius: 18px;
  padding: 20px 22px;
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.08);
}

.paper-stamp {
  position: absolute;
  top: -12px;
  right: 16px;
  background: #FFF1F2;
  color: #E11D48;
  border: 2px solid #E11D48;
  font-weight: 900;
  font-size: 14px;
  padding: 3px 10px;
  border-radius: 8px;
  transform: rotate(6deg);
}

.paper-title {
  font-weight: 800;
  font-size: 16px;
  color: #1E293B;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border-strong);
  margin-bottom: 10px;
}

.paper-meta-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.paper-meta-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.paper-meta-list span {
  color: var(--text-muted);
}

/* ==================== 面板卡片与自定义组卷 ==================== */
.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.panel-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

.panel-sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.pool-counter {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 99px;
  border: 1px solid #BFDBFE;
}

.pool-counter.warn {
  background: var(--amber-soft);
  color: var(--amber);
  border-color: #FDE68A;
}

.config-block {
  margin-bottom: 18px;
}

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

.config-label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.config-label-row .config-label {
  margin-bottom: 0;
}

.mini-actions {
  display: flex;
  gap: 6px;
}

.unit-chips {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.unit-chip {
  border: 1.5px solid var(--border);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: all 0.16s ease;
  user-select: none;
}

.unit-chip:hover {
  border-color: #93C5FD;
  background: #F8FAFC;
}

.unit-chip.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.unit-chip-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.unit-chip-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(15, 23, 42, 0.06);
  padding: 2px 7px;
  border-radius: 99px;
  white-space: nowrap;
}

.unit-chip.selected .unit-chip-count {
  background: #DBEAFE;
  color: #1D4ED8;
}

.config-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.16s;
}

.radio-pill.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: #1E40AF;
  font-weight: 600;
}

.select-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.config-footer {
  margin-top: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

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

/* ==================== 考场界面 ==================== */
.exam-topbar {
  position: sticky;
  top: 71px;
  z-index: 40;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

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

.exam-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.exam-progress-text {
  font-size: 12px;
  color: var(--text-muted);
}

.exam-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.timer-pill {
  background: #F1F5F9;
  color: #0F172A;
  font-weight: 700;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
}

.timer-pill.danger {
  background: var(--rose-soft);
  color: var(--rose);
  animation: pulse 1.2s infinite;
}

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

.mode-switch {
  display: inline-flex;
  background: #F1F5F9;
  padding: 3px;
  border-radius: 10px;
}

.mode-btn {
  border: none;
  background: transparent;
  padding: 5px 11px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.mode-btn.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}

.progress-track {
  height: 6px;
  background: #E2E8F0;
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 18px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563EB, #10B981);
  border-radius: 99px;
  transition: width 0.25s ease;
}

.exam-layout {
  display: grid;
  grid-template-columns: 1fr 270px;
  gap: 20px;
  align-items: start;
}

.question-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

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

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

.q-num-badge {
  background: #1E293B;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  padding: 3px 10px;
  border-radius: 8px;
}

.q-tag {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 8px;
  background: #F1F5F9;
  color: #334155;
}

.q-tag.type-choice { background: #EFF6FF; color: #1D4ED8; }
.q-tag.type-judge { background: #F5F3FF; color: #6D28D9; }
.q-tag.type-fill { background: #ECFDF5; color: #047857; }

.q-score-tag {
  font-size: 12px;
  font-weight: 700;
  color: var(--amber);
  background: var(--amber-soft);
  padding: 3px 9px;
  border-radius: 8px;
}

.flag-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.flag-btn.flagged {
  background: var(--amber-soft);
  color: var(--amber);
  border-color: #FCD34D;
}

.q-stem {
  font-size: 17px;
  font-weight: 600;
  color: #0F172A;
  line-height: 1.75;
  margin-bottom: 16px;
}

/* 数学规范分数排版 */
.math-frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  margin: 0 3px;
  line-height: 1.05;
  font-size: 0.86em;
  font-weight: 700;
}

.math-frac .num {
  padding: 0 3px 1px;
  border-bottom: 1.6px solid currentColor;
}

.math-frac .den {
  padding: 1px 3px 0;
}

.q-svg-wrap {
  display: flex;
  justify-content: center;
  background: #FAFBFD;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 18px;
}

.q-svg {
  max-width: 360px;
  width: 100%;
  height: auto;
  display: block;
}

/* 选项列表 */
.options-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.options-list.single-col {
  grid-template-columns: 1fr;
}

.option-btn {
  border: 1.8px solid var(--border);
  background: #fff;
  border-radius: 14px;
  padding: 13px 16px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  color: var(--text);
  transition: all 0.16s ease;
  font-family: inherit;
}

.option-btn:hover {
  border-color: #93C5FD;
  background: #F8FAFC;
}

.option-btn.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.option-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #F1F5F9;
  color: #475569;
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

/* 填空题输入框 */
.fill-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.fill-input {
  width: 240px;
  max-width: 100%;
  border: 2px solid var(--border-strong);
  border-radius: 12px;
  padding: 12px 15px;
  font-size: 17px;
  font-weight: 700;
  color: #0F172A;
  outline: none;
  font-family: inherit;
}

.fill-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
}

.fill-unit {
  font-size: 15px;
  font-weight: 700;
  color: #475569;
}

.fill-tip {
  width: 100%;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* 逐题底部翻页 */
.single-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 18px;
  box-shadow: var(--shadow-sm);
}

.single-page-indicator {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
}

/* 答题卡 */
.answer-sheet-card {
  position: sticky;
  top: 156px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

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

.sheet-header h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
}

.sheet-legend-mini {
  font-size: 12px;
  color: var(--text-muted);
}

.sheet-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.sheet-num {
  position: relative;
  height: 36px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: #fff;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.sheet-num:hover {
  border-color: var(--primary);
}

.sheet-num.answered {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.sheet-num.current {
  box-shadow: 0 0 0 2.5px rgba(37, 99, 235, 0.3);
  font-weight: 900;
}

.sheet-num.flagged::after {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
}

.sheet-legend {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 3px;
  vertical-align: middle;
}

.dot-empty { border: 1.5px solid var(--border-strong); background: #fff; }
.dot-done { background: var(--primary); }
.dot-flag { background: var(--amber); }

/* ==================== 阅卷报告 ==================== */
.result-hero {
  background: linear-gradient(135deg, #FFFFFF 0%, #F8FAFC 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
  display: flex;
  align-items: center;
  gap: 28px;
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.score-stamp-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.score-ring {
  width: 138px;
  height: 138px;
  border-radius: 50%;
  border: 8px solid #10B981;
  background: #ECFDF5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-ring.mid {
  border-color: #F59E0B;
  background: #FFFBEB;
}

.score-ring.low {
  border-color: #E11D48;
  background: #FFF1F2;
}

.score-num {
  font-size: 44px;
  font-weight: 900;
  line-height: 1;
  color: #0F172A;
  font-variant-numeric: tabular-nums;
}

.score-max {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 4px;
}

.score-grade-tag {
  background: #059669;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  padding: 4px 14px;
  border-radius: 99px;
}

.result-summary-body {
  flex: 1;
  min-width: 260px;
}

.result-meta-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.badge-soft {
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 8px;
}

.result-time-str {
  font-size: 12px;
  color: var(--text-muted);
}

.result-summary-body h2 {
  margin: 0 0 14px;
  font-size: 22px;
}

.result-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.kpi-item {
  background: #F8FAFC;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}

.kpi-item span {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}

.kpi-item strong {
  font-size: 17px;
  font-weight: 800;
}

.text-green { color: var(--green) !important; }
.text-rose { color: var(--rose) !important; }
.text-amber { color: var(--amber) !important; }

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

/* 单元掌握度 */
.unit-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.unit-bar-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: #FAFBFD;
}

.unit-bar-top {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 7px;
}

.unit-bar-track {
  height: 8px;
  background: #E2E8F0;
  border-radius: 99px;
  overflow: hidden;
}

.unit-bar-fill {
  height: 100%;
  border-radius: 99px;
}

/* 筛选标签页 */
.filter-tabs {
  display: inline-flex;
  background: #F1F5F9;
  padding: 4px;
  border-radius: 11px;
  gap: 3px;
}

.filter-tab {
  border: none;
  background: transparent;
  padding: 6px 13px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.filter-tab.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}

/* 批改明细卡片 */
.review-list,
.mistakes-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.review-card {
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  background: #fff;
}

.review-card.is-correct {
  border-left: 5px solid var(--green);
}

.review-card.is-wrong {
  border-left: 5px solid var(--rose);
  background: #FFFCFD;
}

.answer-compare {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin: 12px 0;
  padding: 10px 14px;
  background: #F8FAFC;
  border-radius: 10px;
  font-size: 14px;
}

.ans-pill {
  font-weight: 700;
}

.ans-pill.wrong { color: var(--rose); }
.ans-pill.right { color: var(--green); }

/* 名师讲解盒 */
.explain-box {
  margin-top: 12px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 14px;
}

.explain-row {
  margin-bottom: 8px;
  white-space: pre-line;
}

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

.explain-label {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  margin-right: 6px;
  vertical-align: middle;
}

.explain-label.kp { background: #DBEAFE; color: #1D4ED8; }
.explain-label.step { background: #DCFCE7; color: #15803D; }
.explain-label.tip { background: #FEF3C7; color: #B45309; }

/* ==================== 错题本 ==================== */
.mistake-banner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.mistake-banner h2 {
  margin: 0;
  font-size: 21px;
}

.mistake-top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.file-import-label {
  margin: 0;
}

.mistake-mini-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.m-stat {
  background: #F8FAFC;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.m-stat span { font-size: 13px; color: var(--text-muted); }
.m-stat strong { font-size: 19px; font-weight: 800; }
.m-stat.rose strong { color: var(--rose); }
.m-stat.green strong { color: var(--green); }
.m-stat.amber strong { color: var(--amber); }

.mistake-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mistake-toolbar .form-input {
  flex: 1;
  min-width: 190px;
}

.mistake-card {
  background: #fff;
  border: 1.5px solid var(--border);
  border-left: 5px solid var(--rose);
  border-radius: 16px;
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}

.mistake-card.mastered {
  border-left-color: var(--green);
  opacity: 0.94;
}

.mistake-history-box {
  background: #FFF1F2;
  border: 1px solid #FECDD3;
  border-radius: 10px;
  padding: 10px 14px;
  margin: 12px 0;
  font-size: 13px;
}

.mistake-history-title {
  font-weight: 700;
  color: #BE123C;
  margin-bottom: 6px;
}

.mistake-history-list {
  margin: 0;
  padding-left: 18px;
  color: #881337;
}

.mistake-history-list li {
  margin-bottom: 3px;
}

.redo-box {
  margin: 14px 0;
  padding: 14px 16px;
  background: #EFF6FF;
  border: 1.5px dashed #93C5FD;
  border-radius: 12px;
}

.redo-feedback {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 700;
}

.note-box {
  margin-top: 12px;
}

.note-box label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.note-textarea {
  width: 100%;
  min-height: 58px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  background: #FFFDF7;
}

.note-textarea:focus {
  border-color: var(--amber);
}

.mistake-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* ==================== 历史记录与折线图 ==================== */
.chart-container {
  width: 100%;
  min-height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-item {
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: #fff;
  transition: border-color 0.16s;
}

.history-item:hover {
  border-color: #93C5FD;
}

.history-score-pill {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 22px;
  line-height: 1;
  background: var(--green-soft);
  color: var(--green);
  flex-shrink: 0;
}

.history-score-pill.mid { background: var(--amber-soft); color: var(--amber); }
.history-score-pill.low { background: var(--rose-soft); color: var(--rose); }
.history-score-pill small { font-size: 11px; font-weight: 600; margin-top: 3px; }

.history-info {
  flex: 1;
  min-width: 200px;
}

.history-info h4 {
  margin: 0 0 4px;
  font-size: 15px;
}

.history-meta {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

/* ==================== 空状态、弹窗与 Toast ==================== */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  background: #fff;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 46px;
  margin-bottom: 10px;
}

.empty-state h3 {
  margin: 0 0 6px;
  color: var(--text);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-box {
  background: #fff;
  border-radius: 18px;
  padding: 24px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}

.modal-title {
  margin: 0 0 10px;
  font-size: 18px;
}

.modal-message {
  margin: 0 0 20px;
  font-size: 14px;
  color: #475569;
  white-space: pre-line;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #1E293B;
  color: #fff;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25);
  animation: fadeUp 0.2s ease;
}

.toast.success { background: #059669; }
.toast.warn { background: #D97706; }

/* ==================== 响应式布局 ==================== */
@media (max-width: 960px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-card { grid-template-columns: 1fr; }
  .unit-chips { grid-template-columns: repeat(2, 1fr); }
  .config-grid-3 { grid-template-columns: 1fr; }
  .exam-layout { grid-template-columns: 1fr; }
  .answer-sheet-card { position: static; }
  .result-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .unit-breakdown-grid { grid-template-columns: 1fr; }
  .mistake-mini-stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .options-list { grid-template-columns: 1fr; }
  .header-inner { padding: 10px 14px; }
  .app-container { padding: 16px 12px 48px; }
  .exam-topbar { top: 0; position: static; }
}

/* ==================== 打印试卷/错题讲义样式 ==================== */
@media print {
  body {
    background: #fff !important;
  }
  .no-print {
    display: none !important;
  }
  .app-container {
    max-width: 100%;
    padding: 0;
  }
  .panel-card,
  .review-card,
  .mistake-card,
  .result-hero {
    box-shadow: none !important;
    break-inside: avoid;
    border-color: #CBD5E1;
  }
}
