:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --green: #16a34a;
  --green-soft: #ecfdf5;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.12);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

body.lock {
  overflow: hidden;
}

button {
  font-family: inherit;
}

[hidden] {
  display: none !important;
}

/* ---------- 通用按钮 ---------- */
.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.25);
  outline-offset: 2px;
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #2563eb, #1e40af);
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.32);
}

.btn-soft {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-color: #dbeafe;
}

.btn-soft:hover {
  background: #dbeafe;
}

.btn-ghost {
  background: #fff;
  color: #334155;
  border-color: var(--line);
}

.btn-ghost:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.btn-danger-ghost {
  background: #fff;
  color: var(--red);
  border-color: #fecaca;
}

.btn-danger-ghost:hover {
  background: var(--red-soft);
}

.btn-xl {
  padding: 14px 30px;
  font-size: 16px;
  border-radius: 12px;
}

.count-badge {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary-dark);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.btn-primary .count-badge {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

/* ---------- 屏幕切换 ---------- */
.screen {
  display: none;
}

.screen.active {
  display: block;
}

/* ---------- 开始页 ---------- */
.start-screen {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(900px 500px at 12% 8%, rgba(59, 130, 246, 0.16), transparent 60%),
    radial-gradient(800px 520px at 88% 88%, rgba(14, 165, 233, 0.14), transparent 60%),
    linear-gradient(150deg, #f8fbff 0%, #eef4fd 55%, #f7fafc 100%);
  padding: 56px clamp(20px, 5vw, 72px) 92px;
  display: none;
  flex-direction: column;
  justify-content: center;
}

.start-screen.active {
  display: flex;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(10px);
  pointer-events: none;
}

.orb-1 {
  width: 340px;
  height: 340px;
  top: -120px;
  right: -80px;
  background: radial-gradient(circle at 35% 35%, rgba(96, 165, 250, 0.35), rgba(59, 130, 246, 0.04) 68%);
}

.orb-2 {
  width: 260px;
  height: 260px;
  bottom: -100px;
  left: -70px;
  background: radial-gradient(circle at 60% 40%, rgba(45, 212, 191, 0.24), rgba(45, 212, 191, 0.02) 70%);
}

.orb-3 {
  width: 180px;
  height: 180px;
  top: 46%;
  left: 46%;
  background: radial-gradient(circle at 50% 50%, rgba(147, 197, 253, 0.22), transparent 70%);
}

.start-layout {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: clamp(32px, 6vw, 84px);
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #1e40af;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(191, 219, 254, 0.9);
  padding: 7px 14px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
}

.eyebrow-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14);
}

.start-hero h1 {
  font-size: clamp(38px, 5.1vw, 58px);
  line-height: 1.14;
  letter-spacing: -0.02em;
  margin: 24px 0 20px;
  font-weight: 800;
  color: #0b1b3a;
}

.start-hero h1 em {
  font-style: normal;
  background: linear-gradient(120deg, #2563eb 0%, #0ea5e9 70%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lead {
  max-width: 600px;
  font-size: 16px;
  line-height: 1.85;
  color: #475569;
  margin: 0 0 30px;
}

.rule-grid {
  display: inline-grid;
  grid-template-columns: repeat(3, auto);
  gap: 0;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
  margin-bottom: 32px;
}

.rule {
  padding: 15px 26px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: relative;
}

.rule + .rule::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18%;
  height: 64%;
  width: 1px;
  background: #e2e8f0;
}

.rule strong {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #0f172a;
}

.rule span {
  font-size: 12.5px;
  color: var(--muted);
}

.start-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 28px;
}

.tips {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  color: #64748b;
  font-size: 13px;
}

.tips li {
  position: relative;
  padding-left: 20px;
}

.tips li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: #93c5fd;
  transform: rotate(45deg);
}

.bank-panel {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 22px;
  padding: 30px 28px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(14px);
}

.bank-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.bank-head h2 {
  font-size: 16px;
  margin: 0;
  letter-spacing: 0.02em;
}

.live-dot {
  font-size: 12px;
  color: #15803d;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  padding: 4px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.live-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
}

.bank-total {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding-bottom: 20px;
  border-bottom: 1px dashed #e2e8f0;
}

.bank-total strong {
  font-size: 48px;
  line-height: 1;
  letter-spacing: -0.03em;
  color: #1d4ed8;
}

.bank-total span {
  color: var(--muted);
  font-size: 13px;
}

.bank-bars {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px 0;
}

.bank-row {
  display: grid;
  grid-template-columns: 54px 1fr 38px;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: #475569;
}

.bank-row b {
  text-align: right;
  font-size: 13px;
  color: #1e293b;
}

.track {
  height: 7px;
  background: #eef2f7;
  border-radius: 999px;
  overflow: hidden;
}

.track i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #60a5fa, #2563eb);
  transition: width 0.8s ease;
}

.track i.amber {
  background: linear-gradient(90deg, #fbbf24, #d97706);
}

.track i.green {
  background: linear-gradient(90deg, #4ade80, #16a34a);
}

.bank-note {
  background: #f8fafc;
  border: 1px solid #eef2f7;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.7;
  color: #64748b;
}

.start-footer {
  position: absolute;
  bottom: 26px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.2em;
  color: #94a3b8;
}

/* ---------- 考试页 ---------- */
.exam-screen.active {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

.topbar {
  flex-shrink: 0;
  height: 78px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 clamp(16px, 2.4vw, 30px);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
  z-index: 5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.26);
}

.brand-logo svg {
  width: 24px;
  height: 24px;
}

.brand-text {
  min-width: 0;
}

.brand-text h1 {
  font-size: 16px;
  margin: 0 0 3px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-text p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timer {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #eef2f7;
  color: #0f172a;
  transition: all 0.25s ease;
  flex-shrink: 0;
}

.timer svg {
  width: 21px;
  height: 21px;
  color: #64748b;
}

.timer-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.timer-text span {
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.timer-text strong {
  font-size: 19px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  font-weight: 700;
}

.timer.warn {
  background: var(--amber-soft);
  border-color: #fde68a;
  color: #b45309;
}

.timer.warn svg {
  color: #d97706;
}

.timer.danger {
  background: var(--red-soft);
  border-color: #fecaca;
  color: #b91c1c;
  animation: timerPulse 1.6s ease-in-out infinite;
}

.timer.danger svg {
  color: #dc2626;
}

@keyframes timerPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.16); }
  50% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}

.progress-box {
  width: 148px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 6px;
}

.progress-label b {
  color: #334155;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 6px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}

.progress-track i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #60a5fa, #2563eb);
  transition: width 0.3s ease;
}

.top-actions .btn {
  min-width: 88px;
  height: 42px;
}

.exam-body {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  padding: 18px clamp(14px, 2.2vw, 26px);
  display: flex;
  gap: 18px;
  overflow: hidden;
}

.question-scroll {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(226, 232, 240, 0.7);
  scroll-behavior: smooth;
}

.question-list {
  padding: 6px clamp(18px, 2.6vw, 34px) 46px;
}

.question-card {
  padding: 26px 0;
  border-bottom: 1px solid #eef2f7;
  scroll-margin-top: 14px;
}

.question-card:last-child {
  border-bottom: 0;
}

.question-card.flash {
  animation: cardFlash 1.1s ease;
}

@keyframes cardFlash {
  0%, 100% { background: transparent; }
  30% { background: #f0f7ff; }
}

.q-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 13px;
  flex-wrap: wrap;
}

.q-number {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

.q-type {
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 6px;
  letter-spacing: 0.02em;
}

.q-type.single {
  color: #1d4ed8;
  background: #eff6ff;
}

.q-type.multi {
  color: #b45309;
  background: #fffbeb;
}

.q-type.judge {
  color: #15803d;
  background: #f0fdf4;
}

.q-score {
  font-size: 12px;
  color: #94a3b8;
}

.q-verdict {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 999px;
}

.q-verdict.ok {
  color: #15803d;
  background: var(--green-soft);
}

.q-verdict.bad {
  color: #b91c1c;
  background: var(--red-soft);
}

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

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

.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  background: #fff;
  border: 1px solid #e5eaf1;
  border-radius: 10px;
  font-size: 14.5px;
  line-height: 1.6;
  color: #334155;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.option:hover {
  border-color: #bfdbfe;
  background: #f8fbff;
}

.option:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.2);
  outline-offset: 1px;
}

.opt-key {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 7px;
  border: 1px solid #dbe2ec;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 700;
  color: #64748b;
  margin-top: 1px;
  transition: all 0.16s ease;
}

.opt-text {
  flex: 1;
}

.option.selected {
  border-color: #3b82f6;
  background: #f0f7ff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.08);
}

.option.selected .opt-key {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.option.correct {
  border-color: #86efac;
  background: #f0fdf4;
}

.option.correct .opt-key {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
}

.option.wrong {
  border-color: #fca5a5;
  background: #fef2f2;
}

.option.wrong .opt-key {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

.option.chosen {
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.04);
}

.opt-tag {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  align-self: center;
}

.tag-correct {
  color: #15803d;
  background: #dcfce7;
}

.tag-wrong {
  color: #b91c1c;
  background: #fee2e2;
}

.q-answer-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 22px;
  margin-top: 16px;
  font-size: 13px;
  color: #475569;
}

.q-answer-line b {
  font-weight: 700;
}

.q-answer-line b.good {
  color: #15803d;
}

.q-answer-line b.bad {
  color: #b91c1c;
}

.q-explain {
  margin-top: 14px;
  padding: 13px 16px;
  background: #f8fafc;
  border-left: 3px solid #93c5fd;
  border-radius: 0 10px 10px 0;
  font-size: 13.5px;
  line-height: 1.7;
  color: #475569;
}

.q-explain b {
  color: #1e40af;
  font-size: 12.5px;
  margin-right: 6px;
}

.q-explain p {
  margin: 4px 0 0;
}

/* 答题卡 */
.answer-panel {
  width: 292px;
  flex-shrink: 0;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(226, 232, 240, 0.7);
  display: flex;
  flex-direction: column;
  padding: 18px 18px 14px;
  min-height: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 13px;
  border-bottom: 1px solid #f1f5f9;
  flex-wrap: wrap;
}

.panel-head h2 {
  font-size: 15px;
  margin: 0;
}

.legend {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--muted);
}

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

.dot {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: #e2e8f0;
  display: inline-block;
}

.dot.done {
  background: #2563eb;
}

.dot.ok {
  background: #16a34a;
}

.dot.bad {
  background: #dc2626;
}

.answer-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  align-content: start;
  padding: 15px 2px;
}

.grid-btn {
  height: 37px;
  border-radius: 8px;
  border: 1px solid #e8edf4;
  background: #f8fafc;
  color: #64748b;
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: all 0.15s ease;
}

.grid-btn:hover {
  border-color: #bfdbfe;
  color: #1d4ed8;
  background: #f0f7ff;
}

.grid-btn.done {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.grid-btn.ok {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
}

.grid-btn.bad {
  background: #fee2e2;
  border-color: #fecaca;
  color: #b91c1c;
}

.panel-note {
  border-top: 1px solid #f1f5f9;
  padding-top: 11px;
  font-size: 11.5px;
  color: #94a3b8;
  text-align: center;
}

/* 回顾模式 */
.exam-screen.review-mode .timer,
.exam-screen.review-mode .progress-box {
  display: none;
}

.exam-screen.review-mode .top-actions {
  margin-left: auto;
}

.exam-screen.review-mode .question-list {
  padding-bottom: 60px;
}

/* ---------- 结果页 ---------- */
.result-screen {
  min-height: 100vh;
  background:
    radial-gradient(800px 480px at 50% -10%, rgba(59, 130, 246, 0.15), transparent 65%),
    linear-gradient(160deg, #f8fbff 0%, #eef4fd 100%);
  padding: 48px 20px;
  overflow-y: auto;
}

.result-screen.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-wrap {
  width: 100%;
  max-width: 780px;
  margin: auto;
}

.result-card {
  background: #fff;
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(226, 232, 240, 0.7);
  padding: 44px clamp(24px, 5vw, 54px) 38px;
  text-align: center;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: #1d4ed8;
  background: #eff6ff;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 26px;
}

.result-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3b82f6;
}

.score-ring {
  --pct: 0;
  --ring: #2563eb;
  width: 186px;
  height: 186px;
  border-radius: 50%;
  margin: 0 auto 24px;
  background: conic-gradient(var(--ring) calc(var(--pct) * 1%), #edf2f8 0);
  display: grid;
  place-items: center;
  position: relative;
  transition: background 0.8s ease;
}

.score-ring::before {
  content: "";
  position: absolute;
  inset: 13px;
  background: #fff;
  border-radius: 50%;
  box-shadow: inset 0 2px 10px rgba(15, 23, 42, 0.03);
}

.ring-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  gap: 3px;
}

.ring-inner strong {
  font-size: 60px;
  line-height: 1;
  letter-spacing: -0.04em;
  font-weight: 800;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.ring-inner span {
  font-size: 15px;
  color: var(--muted);
}

.result-card h2 {
  font-size: 24px;
  margin: 0 0 9px;
  letter-spacing: -0.01em;
}

.result-sub {
  margin: 0 auto;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
  max-width: 520px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 30px 0 32px;
}

.stat {
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 12px;
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.stat span {
  font-size: 12px;
  color: var(--muted);
}

.stat strong {
  font-size: 21px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat strong.good {
  color: var(--green);
}

.stat strong.bad {
  color: var(--red);
}

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

.result-actions .btn {
  height: 44px;
}

/* ---------- 错题本 ---------- */
.wrongbook-screen.active {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

.page-topbar {
  flex-shrink: 0;
  height: 78px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 clamp(16px, 3vw, 34px);
  z-index: 3;
}

.page-title {
  flex: 1;
  min-width: 0;
}

.page-title h1 {
  font-size: 19px;
  margin: 0 0 3px;
}

.page-title p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.wrongbook-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px clamp(16px, 3vw, 34px) 48px;
  scroll-behavior: smooth;
}

.wrongbook-list {
  max-width: 920px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.wrong-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid rgba(226, 232, 240, 0.85);
  box-shadow: var(--shadow-sm);
  padding: 22px clamp(18px, 3vw, 28px);
}

.wrong-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 13px;
}

.wrong-index {
  font-size: 12px;
  font-weight: 700;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}

.wrong-meta {
  margin-left: auto;
  font-size: 12px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.wrong-count {
  color: #b91c1c;
  background: #fef2f2;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 600;
}

.wrong-remove {
  border: 0;
  background: transparent;
  color: #94a3b8;
  font-size: 12px;
  cursor: pointer;
  padding: 3px 4px;
  border-radius: 5px;
}

.wrong-remove:hover {
  color: var(--red);
  background: var(--red-soft);
}

.wrong-card .q-stem {
  margin-bottom: 14px;
}

.wrong-card .option {
  cursor: default;
}

.wrong-card .option:hover {
  border-color: #e5eaf1;
  background: #fff;
}

.wrong-card .option.correct:hover {
  border-color: #86efac;
  background: #f0fdf4;
}

.wrong-card .option.wrong:hover {
  border-color: #fca5a5;
  background: #fef2f2;
}

.wrong-answer-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-top: 15px;
  font-size: 13px;
  color: #475569;
}

.wrong-answer-line b.good {
  color: var(--green);
}

.wrong-answer-line b.bad {
  color: var(--red);
}

.empty-state {
  max-width: 560px;
  margin: 10vh auto 0;
  text-align: center;
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 20px;
  padding: 58px 30px;
  box-shadow: var(--shadow-sm);
}

.empty-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  border-radius: 22px;
  background: #f0fdf4;
  color: #16a34a;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-icon svg {
  width: 36px;
  height: 36px;
}

.empty-state h2 {
  margin: 0 0 8px;
  font-size: 19px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: maskIn 0.18s ease;
}

@keyframes maskIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 18px;
  padding: 26px 26px 22px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

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

.modal p {
  margin: 0 0 22px;
  color: #475569;
  font-size: 14px;
  line-height: 1.7;
}

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

.modal-actions .btn {
  min-width: 84px;
}

.btn-danger {
  background: var(--red);
  color: #fff;
  border: 1px solid var(--red);
}

.btn-danger:hover {
  background: #b91c1c;
}

/* ---------- 提示条 ---------- */
.toast-stack {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  pointer-events: none;
  width: min(92vw, 520px);
}

body.lock .toast-stack {
  top: 92px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #0f172a;
  color: #fff;
  border-radius: 10px;
  padding: 11px 18px;
  font-size: 13.5px;
  line-height: 1.5;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.24);
  animation: toastIn 0.24s ease;
  max-width: 100%;
}

.toast::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #60a5fa;
  flex-shrink: 0;
}

.toast.warn::before {
  background: #fbbf24;
}

.toast.danger::before {
  background: #f87171;
}

.toast.success::before {
  background: #4ade80;
}

.toast.out {
  animation: toastOut 0.25s ease forwards;
}

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

@keyframes toastOut {
  to { opacity: 0; transform: translateY(-8px); }
}

/* ---------- 滚动条 ---------- */
.question-scroll::-webkit-scrollbar,
.answer-grid::-webkit-scrollbar,
.wrongbook-scroll::-webkit-scrollbar,
.result-screen::-webkit-scrollbar {
  width: 9px;
}

.question-scroll::-webkit-scrollbar-track,
.answer-grid::-webkit-scrollbar-track,
.wrongbook-scroll::-webkit-scrollbar-track,
.result-screen::-webkit-scrollbar-track {
  background: transparent;
}

.question-scroll::-webkit-scrollbar-thumb,
.answer-grid::-webkit-scrollbar-thumb,
.wrongbook-scroll::-webkit-scrollbar-thumb,
.result-screen::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.question-scroll::-webkit-scrollbar-thumb:hover,
.answer-grid::-webkit-scrollbar-thumb:hover,
.wrongbook-scroll::-webkit-scrollbar-thumb:hover,
.result-screen::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
  background-clip: padding-box;
}

.question-scroll,
.answer-grid,
.wrongbook-scroll,
.result-screen {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .answer-panel {
    width: 252px;
    padding: 15px 14px 12px;
  }

  .answer-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .progress-box {
    width: 120px;
  }
}

@media (max-width: 980px) {
  .start-layout {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .bank-panel {
    max-width: 560px;
  }

  .start-screen {
    padding-top: 44px;
    padding-bottom: 80px;
    justify-content: flex-start;
  }

  .exam-body {
    flex-direction: column;
    gap: 12px;
    padding: 12px;
  }

  .answer-panel {
    width: 100%;
    max-height: 190px;
    padding: 12px 14px;
  }

  .answer-grid {
    grid-template-columns: repeat(10, 1fr);
    padding: 10px 2px;
    gap: 6px;
  }

  .grid-btn {
    height: 32px;
    font-size: 11.5px;
  }

  .panel-note {
    display: none;
  }

  .topbar {
    height: auto;
    min-height: 70px;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
  }

  .timer {
    margin-left: auto;
    padding: 6px 13px;
  }

  .timer-text strong {
    font-size: 17px;
  }

  .top-actions {
    gap: 12px;
  }
}

@media (max-width: 700px) {
  .answer-panel {
    max-height: 150px;
  }

  .answer-grid {
    grid-template-columns: repeat(8, 1fr);
    gap: 5px;
    padding: 9px 2px;
  }

  .grid-btn {
    height: 29px;
  }

  .brand-text h1 {
    font-size: 14px;
  }

  .brand-text p {
    display: none;
  }

  .brand-logo {
    width: 38px;
    height: 38px;
  }

  .timer {
    order: 3;
    margin-left: 0;
    flex: 1;
    justify-content: center;
  }

  .top-actions {
    order: 4;
    flex: 1;
    justify-content: flex-end;
  }

  .progress-box {
    display: none;
  }

  .exam-screen.review-mode .top-actions {
    margin-left: 0;
  }

  .answer-grid {
    grid-template-columns: repeat(8, 1fr);
  }

  .start-hero h1 {
    font-size: 37px;
  }

  .lead {
    font-size: 14.5px;
  }

  .rule-grid {
    width: 100%;
  }

  .rule {
    flex: 1;
    padding: 12px 10px;
    text-align: center;
    align-items: center;
  }

  .rule strong {
    font-size: 22px;
  }

  .start-actions .btn {
    flex: 1;
    min-width: 140px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .result-card {
    padding: 32px 20px 28px;
  }

  .score-ring {
    width: 158px;
    height: 158px;
  }

  .ring-inner strong {
    font-size: 50px;
  }

  .result-actions .btn {
    flex: 1;
    min-width: 130px;
  }

  .page-topbar {
    height: auto;
    padding: 12px 16px;
    flex-wrap: wrap;
  }

  .page-title h1 {
    font-size: 17px;
  }

  .wrongbook-card {
    padding: 18px 16px;
  }

  .option {
    font-size: 14px;
    padding: 10px 12px;
  }

  .opt-tag {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
