/* ============================================================
   翰墨书院 · 中级会计每日一练
   ============================================================ */
:root {
  /* 纸墨色系 */
  --paper:        #faf6f0;
  --paper-deep:   #f0e8d8;
  --paper-card:   #fffef9;
  --ink:          #2c2416;
  --ink-soft:     #5c4b3a;
  --ink-light:    #8b7b6b;
  --ink-faint:    #c4b8a8;

  /* 朱砂红 */
  --cinnabar:     #b22222;
  --cinnabar-dim: #d44a4a;
  --cinnabar-bg:  rgba(178, 34, 34, 0.06);
  --cinnabar-bg2: rgba(178, 34, 34, 0.10);

  /* 松烟绿 */
  --pine:         #2d6a2e;
  --pine-bg:      rgba(45, 106, 46, 0.07);
  --pine-border:  rgba(45, 106, 46, 0.25);

  /* 赭石 */
  --ochre:        #b85c1a;
  --ochre-bg:     rgba(184, 92, 26, 0.06);
  --ochre-border: rgba(184, 92, 26, 0.25);

  /* 花青 */
  --indigo:       #3a5a80;
  --indigo-bg:    rgba(58, 90, 128, 0.06);

  /* 琉璃黄 */
  --amber:        #a6802e;
  --amber-bg:     rgba(166, 128, 46, 0.08);

  /* 布局 */
  --radius-sm:    4px;
  --radius:       8px;
  --radius-lg:    16px;
  --shadow-sm:    0 1px 3px rgba(44,36,22,0.06);
  --shadow:       0 2px 12px rgba(44,36,22,0.08);
  --shadow-lg:    0 6px 24px rgba(44,36,22,0.12);
  --transition:   color 0.25s, background-color 0.25s, border-color 0.25s, box-shadow 0.25s, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);

  /* 滚动进度条 */
  --progress-height: 3px;
  --progress-color: #b22222;
  --progress-bg: rgba(196,184,168,0.3);
}

/* ── 深色模式 ──────────────────────────── */
[data-theme="dark"] {
  --paper:        #1a1a2e;
  --paper-deep:   #16213e;
  --paper-card:   #1f2937;
  --ink:          #e2e8f0;
  --ink-soft:     #b0b8c4;
  --ink-light:    #8892a0;
  --ink-faint:    #4a5568;
  --cinnabar:     #e54d4d;
  --cinnabar-dim: #b22222;
  --cinnabar-bg:  rgba(229, 77, 77, 0.10);
  --cinnabar-bg2: rgba(229, 77, 77, 0.18);
  --pine:         #48bb78;
  --pine-bg:      rgba(72, 187, 120, 0.10);
  --pine-border:  rgba(72, 187, 120, 0.25);
  --ochre:        #ed8936;
  --ochre-bg:     rgba(237, 137, 54, 0.10);
  --ochre-border: rgba(237, 137, 54, 0.25);
  --indigo:       #63b3ed;
  --indigo-bg:    rgba(99, 179, 237, 0.10);
  --amber:        #d69e2e;
  --amber-bg:     rgba(214, 158, 46, 0.10);
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.3);
  --shadow:       0 2px 12px rgba(0,0,0,0.35);
  --shadow-lg:    0 6px 24px rgba(0,0,0,0.4);
  --progress-bg:  rgba(74,85,104,0.4);
}
[data-theme="dark"] body {
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(229,77,77,0.06) 0%, transparent 70%),
    radial-gradient(ellipse at 85% 100%, rgba(99,179,237,0.06) 0%, transparent 60%);
}
[data-theme="dark"] html { color-scheme: dark; }

/* ── 首屏 Loading 遮罩 ──────────────────── */
.app-loading {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  transition: opacity 0.4s ease;
}
.app-loading.hide {
  opacity: 0;
  pointer-events: none;
}
.app-loading-img {
  width: 120px;
  height: 120px;
}
[data-theme="dark"] .app-loading { background: #1a1a2e; }

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

body {
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--paper);
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(178,34,34,0.03) 0%, transparent 70%),
    radial-gradient(ellipse at 85% 100%, rgba(58,90,128,0.04) 0%, transparent 60%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.container { max-width: 820px; margin: 0 auto; padding: 32px 20px 80px; }

/* ── 顶栏 ─────────────────────────────── */
.header { text-align: center; padding: 28px 0 24px; position: relative; }
.header::after {
  content: ''; display: block; width: 60px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--cinnabar-dim), transparent);
  margin: 20px auto 0;
}
.header h1 {
  font-family: "Noto Serif SC", "STSong", serif;
  font-size: 28px; font-weight: 700; letter-spacing: 3px;
  color: var(--ink);
}
.header .date {
  color: var(--ink-soft); font-size: 14px; margin-top: 8px; letter-spacing: 1px;
}
.subject-badge {
  display: inline-block;
  background: var(--cinnabar);
  color: #fff;
  padding: 5px 22px;
  border-radius: 3px;
  font-size: 13px; font-weight: 500; letter-spacing: 2px;
  margin-top: 10px;
  box-shadow: 0 2px 8px rgba(178,34,34,0.25);
  font-family: "Noto Serif SC", serif;
}

/* 主题切换按钮 */
.theme-toggle {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  background: var(--paper); border: 1.5px solid var(--ink-faint);
  border-radius: 50%; width: 44px; height: 44px; cursor: pointer;
  font-size: 16px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition); color: var(--ink-soft);
}
.theme-toggle:hover { border-color: var(--cinnabar-dim); color: var(--cinnabar); }
.theme-toggle:focus-visible { outline: 2px solid var(--cinnabar-dim); outline-offset: 2px; }
@media (max-width: 640px) {
  .theme-toggle { width: 44px; height: 44px; font-size: 14px; }
}

/* ── 考试倒计时 ───────────────────────── */
.exam-countdown {
  margin-top: 10px; font-size: 15px; letter-spacing: 2px;
  font-family: "Noto Serif SC", serif; font-weight: 600;
  color: var(--ink);
}
.exam-countdown .cd-num {
  display: inline-block; font-size: 28px; font-weight: 900;
  color: var(--cinnabar); margin: 0 4px;
  font-family: "Noto Serif SC", serif; line-height: 1;
}
.exam-countdown .cd-label {
  font-size: 13px; font-weight: 400; color: var(--ink-light);
  letter-spacing: 1px; margin-left: 6px;
}
.exam-countdown .cd-passed {
  font-size: 13px; color: var(--ink-light); font-weight: 400;
}

/* ── Tab 导航 ─────────────────────────── */
.tabs {
  display: flex; gap: 0; margin-bottom: 28px;
  border-bottom: 1px solid var(--ink-faint);
}
.tab {
  padding: 12px 28px; cursor: pointer; font-size: 15px;
  color: var(--ink-light); border: none; background: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: var(--transition); letter-spacing: 1px;
  font-family: "Noto Serif SC", serif;
  position: relative;
}
.tab:hover { color: var(--ink-soft); }
.tab:focus-visible { outline: 2px solid var(--cinnabar-dim); outline-offset: -2px; border-radius: 0; }
.tab.active {
  color: var(--cinnabar); border-bottom-color: var(--cinnabar);
  font-weight: 600;
}

/* ── 区块 ─────────────────────────────── */
.section { display: none; animation: fadeSlideIn .4s ease; }
.section.active { display: block; }
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── 辅助 ─────────────────────────────── */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}

/* ── 卡片 ─────────────────────────────── */
.card {
  background: var(--paper-card);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(196,184,168,0.35);
  position: relative;
}
.card h2 {
  font-family: "Noto Serif SC", serif;
  font-size: 17px; font-weight: 600;
  margin-bottom: 18px; color: var(--ink);
  display: flex; align-items: center; gap: 8px;
}
.card h2::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--ink-faint), transparent);
  margin-top: 3px;
}

/* ── 题目区 ───────────────────────────── */
.q-item {
  padding: 20px 0;
  border-bottom: 1px solid rgba(196,184,168,0.25);
  transition: background .2s;
}
.q-item:last-child { border-bottom: none; }
.q-stem {
  font-size: 15px; font-weight: 500; margin-bottom: 12px;
  line-height: 1.85; color: var(--ink);
}
.q-id {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--cinnabar-bg);
  color: var(--cinnabar); font-size: 13px; font-weight: 700;
  margin-right: 6px; flex-shrink: 0;
  font-family: "Noto Serif SC", serif;
}
.q-type-badge {
  display: inline-block; font-size: 11px; font-weight: 600;
  color: var(--amber); background: var(--amber-bg);
  padding: 1px 7px; border-radius: 3px; margin-right: 6px;
  vertical-align: middle; letter-spacing: 1px;
  font-family: "Noto Serif SC", serif;
}
.fav-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; cursor: pointer; font-size: 18px;
  color: var(--ink-faint); user-select: none; vertical-align: middle;
  margin-right: 4px; transition: transform .2s, color .2s;
  background: none; border: none; padding: 0; line-height: 1;
}
.fav-btn:hover { transform: scale(1.2); }
.fav-btn:focus-visible { outline: 2px solid var(--cinnabar-dim); outline-offset: 2px; border-radius: 50%; }
.fav-btn.on { color: var(--cinnabar); }
.fav-btn.on:hover { color: var(--cinnabar-dim); }

/* 选项 */
.opts { display: flex; flex-direction: column; gap: 8px; padding-left: 34px; }
.opt {
  padding: 0;
  background: var(--paper);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  border: 1.5px solid transparent;
}
.opt:hover { background: var(--paper-deep); border-color: var(--ink-faint); }
.opt:focus-within { border-color: var(--cinnabar-dim); }
.opt-label {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; cursor: pointer; flex: 1;
  user-select: none; font-size: 14px; color: var(--ink-soft);
}

/* 自定义 radio / checkbox */
.opt .custom-input {
  width: 18px; height: 18px;
  border: 2px solid var(--ink-faint);
  background: var(--paper-card);
  display: inline-block; flex-shrink: 0;
  transition: var(--transition);
  position: relative;
}
.opt input[type="radio"] + .custom-input { border-radius: 50%; }
.opt input[type="checkbox"] + .custom-input { border-radius: var(--radius-sm); }

.opt input[type="radio"],
.opt input[type="checkbox"] {
  position: absolute; opacity: 0; width: 0; height: 0;
}

.opt input[type="radio"]:checked + .custom-input,
.opt input[type="checkbox"]:checked + .custom-input {
  border-color: var(--cinnabar); background: var(--cinnabar-bg);
}
.opt input[type="radio"]:checked + .custom-input::after {
  content: ''; position: absolute; top: 50%; left: 50%;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--cinnabar); transform: translate(-50%, -50%);
}
.opt input[type="checkbox"]:checked + .custom-input::after {
  content: ''; position: absolute; top: 2px; left: 5px;
  width: 5px; height: 9px; border: solid var(--cinnabar);
  border-width: 0 2px 2px 0; transform: rotate(45deg);
}

/* focus-visible for hidden inputs */
.opt input[type="radio"]:focus-visible + .custom-input,
.opt input[type="checkbox"]:focus-visible + .custom-input {
  outline: 2px solid var(--cinnabar-dim);
  outline-offset: 2px;
}

.opt input:checked ~ .opt-text { color: var(--ink); font-weight: 500; }

/* 判断题特殊样式 */
.judge-opts { display: flex; gap: 20px; padding-left: 34px; }
.judge-opts .opt { flex: 1; font-weight: 500; }
.judge-opts .opt-label { justify-content: flex-start; font-weight: 500; }

/* 计算题文本框 */
.calc-area {
  width: calc(100% - 34px); min-height: 170px;
  background: var(--paper);
  border: 1.5px solid var(--ink-faint);
  border-radius: var(--radius-sm); color: var(--ink);
  padding: 14px 16px; font-size: 14px; resize: vertical;
  font-family: "Noto Sans SC", sans-serif; line-height: 1.8;
  transition: border-color .2s;
  margin-left: 34px;
}
.calc-area:focus-visible { outline: 2px solid var(--cinnabar-dim); outline-offset: 2px; border-color: var(--cinnabar-dim); }
.calc-area::placeholder { color: var(--ink-faint); font-size: 13px; }

/* ── 按钮 ─────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 28px; border: none; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 500; cursor: pointer;
  transition: var(--transition); letter-spacing: 1px;
  font-family: "Noto Serif SC", serif;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn-primary {
  background: var(--cinnabar); color: #fff;
  box-shadow: 0 2px 6px rgba(178,34,34,0.25);
}
.btn-primary:hover { box-shadow: 0 4px 12px rgba(178,34,34,0.35); }
.btn-secondary {
  background: var(--paper); color: var(--ink-soft);
  border: 1.5px solid var(--ink-faint);
}
.btn-secondary:hover { border-color: var(--ink-light); }
.btn-submit { width: 100%; margin-top: 20px; padding: 15px; font-size: 16px; }

/* ── 得分展示 ─ 印章风格 ──────────────── */
.result {
  margin: 24px 0 36px;
  padding-bottom: 28px;
  border-bottom: 1px solid rgba(196,184,168,0.3);
  animation: stampReveal .6s cubic-bezier(.34,1.56,.64,1);
}
@keyframes stampReveal {
  from { opacity: 0; transform: scale(0.85) rotate(-3deg); }
  to   { opacity: 1; transform: scale(1) rotate(0deg); }
}
.score-display {
  text-align: center; padding: 28px 24px 24px;
  background: var(--paper-card);
  border-radius: var(--radius-lg); position: relative;
  border: 2px solid var(--cinnabar);
  box-shadow: 0 0 0 4px var(--paper-card), 0 0 0 6px var(--cinnabar);
}
.score-display::before {
  content: '成绩单'; position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  background: var(--cinnabar); color: #fff; padding: 3px 20px;
  font-size: 13px; letter-spacing: 3px; border-radius: 2px;
  font-family: "Noto Serif SC", serif;
  white-space: nowrap;
}
.score-num {
  font-family: "Noto Serif SC", serif;
  font-size: 64px; font-weight: 900; line-height: 1;
  margin: 8px 0 4px; letter-spacing: -2px;
  font-variant-numeric: tabular-nums;
}
.score-label {
  color: var(--ink-light); font-size: 14px; letter-spacing: 2px;
}
.score-detail { margin-top: 10px; font-size: 13px; color: var(--ink-soft); letter-spacing: 1px; }

/* ── 答案反馈 ─────────────────────────── */
.q-result {
  padding: 14px 18px; margin-top: 12px;
  border-radius: var(--radius-sm); font-size: 14px; line-height: 1.8;
  margin-left: 34px;
}
.q-result.correct {
  background: var(--pine-bg); border-left: 3px solid var(--pine);
}
.q-result.wrong {
  background: var(--ochre-bg); border-left: 3px solid var(--ochre);
}
.q-result.calc-result {
  background: var(--amber-bg); border-left: 3px solid var(--amber);
}
.q-result .mark { font-weight: 600; display: block; margin-bottom: 6px; }
.q-result .correct-mark { color: var(--pine); }
.q-result .wrong-mark { color: var(--ochre); }
.q-result .explain {
  color: var(--ink-soft); white-space: pre-wrap; font-size: 13px; line-height: 1.85;
  font-family: "Noto Sans SC", sans-serif;
}

/* 已完成标记 */
.completed-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--pine); color: #fff;
  padding: 3px 14px; border-radius: 3px;
  font-size: 12px; font-weight: 500; letter-spacing: 1px;
  margin-left: 8px;
}
[data-theme="dark"] .completed-badge { color: #1a1a2e; }
.exam-submitted-note {
  text-align: center; margin-top: 16px;
  color: var(--pine); font-size: 15px; font-weight: 500;
  letter-spacing: 1px;
}

/* ── 空状态 ───────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 64px 24px; min-height: 280px;
  text-align: center; color: var(--ink-light);
}
.empty-state .empty-svg { width: 120px; height: 120px; margin-bottom: 20px; flex-shrink: 0; }
.empty-state .empty-main {
  font-size: 18px; font-weight: 600; color: var(--ink);
  margin-bottom: 6px; letter-spacing: 0.5px;
}
.empty-state .empty-sub {
  font-size: 14px; color: var(--ink-light); line-height: 1.6;
  max-width: 240px;
}
.empty-state .empty-btn {
  margin-top: 20px; padding: 8px 28px;
  background: var(--cinnabar); border: none; border-radius: var(--radius-sm);
  color: #fff; font-size: 14px; cursor: pointer;
  transition: opacity .2s, transform .2s;
}
.empty-state .empty-btn:hover { opacity: .9; transform: translateY(-1px); }

/* 空状态 SVG 动画 */
@keyframes empty-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes empty-draw {
  from { stroke-dashoffset: var(--dash); }
  to { stroke-dashoffset: 0; }
}
@keyframes empty-fade-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.empty-state { animation: empty-fade-in .6s ease-out both; }
.empty-state .empty-svg { animation: empty-float 4s ease-in-out infinite; }

/* ── 历史记录 ─────────────────────────── */
.history-layout { display: flex; gap: 24px; }
.history-list { flex: 0 0 230px; }
.history-list .date-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; cursor: pointer; border-radius: var(--radius-sm);
  margin-bottom: 4px; transition: var(--transition);
  border-left: 3px solid transparent;
}
.history-list .date-item:hover { background: var(--paper-deep); }
.history-list .date-item:focus-visible { outline: 2px solid var(--cinnabar-dim); outline-offset: 2px; }
.history-list .date-item.selected {
  background: var(--paper-deep);
  border-left-color: var(--cinnabar);
}
.history-list .date-item .score-mini {
  font-size: 12px; padding: 2px 10px; border-radius: 3px; font-weight: 500;
}
.history-list .date-item .score-mini.high { background: var(--pine); color: #fff; }
.history-list .date-item .score-mini.mid  { background: var(--amber); color: #fff; }
.history-list .date-item .score-mini.low  { background: var(--ochre); color: #fff; }
.history-detail { flex: 1; min-height: 280px; }

/* ── 统计面板 ─────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.stats-grid .empty-state { grid-column: 1 / -1; min-height: 280px; }
.stat-card {
  background: var(--paper-card); border-radius: var(--radius);
  padding: 24px 16px; text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(196,184,168,0.3);
  transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.stat-card .stat-num {
  font-family: "Noto Serif SC", serif;
  font-size: 36px; font-weight: 700; color: var(--cinnabar); line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-card .stat-label { color: var(--ink-light); font-size: 13px; margin-top: 6px; letter-spacing: 1px; }
.stat-subject { font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 10px; }
.stat-sub-row { display: flex; justify-content: space-between; padding: 3px 4px; font-size: 13px; border-bottom: 1px solid var(--ink-faint); border-bottom-color: rgba(196,184,168,0.2); }
.stat-sub-row:last-child { border-bottom: none; }
.stat-sub-label { color: var(--ink-light); }
.stat-sub-val { color: var(--ink); font-weight: 600; }

/* 打卡日历 */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-header { font-size: 12px; color: var(--ink-light); text-align: center; padding: 4px 0; letter-spacing: 1px; }
.cal-day {
  aspect-ratio: 1; border-radius: 3px; display: flex; align-items: center;
  justify-content: center; font-size: 11px; font-weight: 500;
  transition: transform .15s, box-shadow .15s;
}
.cal-day.empty { visibility: hidden; }
.cal-day.miss  { background: var(--paper-card); color: var(--ink-faint); border-radius: 3px; }
.cal-day.done  { background: var(--pine); color: #fff; cursor: pointer; border-radius: 3px; position: relative; }
.cal-day.done:hover { transform: scale(1.15); box-shadow: 0 2px 8px rgba(45,106,46,0.3); z-index: 1; }
.cal-day.done:focus-visible { outline: 2px solid var(--cinnabar-dim); outline-offset: 2px; }
.cal-day.done.selected {
  background: var(--cinnabar); transform: scale(1.1);
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--cinnabar);
  z-index: 2;
}
.cal-day.done.selected:hover { transform: scale(1.15); }

/* 图表 */
.chart-wrap { margin-top: 20px; }
.chart-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.chart-header h2 { border: none; margin: 0; padding: 0; }
.chart-header h2::after { display: none; }
.chart-legend { display: flex; gap: 18px; font-size: 12px; color: var(--ink-soft); }
.legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; }
.chart-container { position: relative; height: 280px; }
.chart-container canvas { width: 100%; height: 100%; }

/* ── 题型正确率条 ────────────────────── */
.type-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.type-row:last-child { margin-bottom: 0; }
.type-label { flex: 0 0 56px; font-size: 13px; color: var(--ink); }
.type-bar-bg { flex: 1; height: 18px; background: var(--paper-deep); border-radius: 9px; overflow: hidden; }
.type-bar-fill { height: 100%; border-radius: 9px; transition: transform .6s ease; transform-origin: left; }
.type-pct { flex: 0 0 40px; text-align: right; font-size: 13px; font-weight: 600; color: var(--ink); }

/* ── AI 评分设置 ──────────────────────── */
.api-key-row {
  display: flex; gap: 8px; align-items: center;
}
.api-key-input {
  flex: 1; padding: 8px 12px;
  background: var(--paper); border: 1.5px solid var(--ink-faint);
  border-radius: var(--radius-sm); color: var(--ink);
  font-size: 13px; font-family: "JetBrains Mono", monospace;
  transition: border-color .2s;
}
.api-key-input:focus { outline: none; border-color: var(--cinnabar-dim); }

/* ── 加载动画 ─────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--paper-deep) 25%, var(--paper-card) 50%, var(--paper-deep) 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Mobile ───────────────────────────── */
@media (max-width: 640px) {
  .container { padding: 16px 12px 60px; }
  .card { padding: 18px 16px; }
  .header h1 { font-size: 22px; letter-spacing: 2px; }
  .tabs { overflow-x: auto; }
  .tab { padding: 10px 16px; font-size: 13px; white-space: nowrap; }
  .opts { padding-left: 0; }
  .judge-opts { padding-left: 0; flex-direction: column; gap: 8px; }
  .calc-area { margin-left: 0; width: 100%; }
  .q-result { margin-left: 0; }
  .score-num { font-size: 48px; }
  .score-display { padding: 24px 16px; }
  .history-layout { flex-direction: column; }
  .history-list { flex: none; display: flex; overflow-x: auto; gap: 6px; padding: 4px 0 8px; }
  .history-list .date-item { flex-shrink: 0; }
  .history-detail { min-height: 200px; }
  .stats-grid { grid-template-columns: 1fr; }
}

/* ── 滚动进度条 ───────────────────────── */
.progress-bar-wrap {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  height: var(--progress-height);
  background: var(--progress-bg);
  pointer-events: none;
}
.progress-bar-fill {
  height: 100%; width: 100%; transform: scaleX(0); transform-origin: left;
  background: var(--progress-color);
  transition: transform 50ms linear;
  will-change: transform;
}
/* 抵消进度条占用的顶部空间 */
body { padding-top: var(--progress-height); }

/* ── 回到顶部 ─────────────────────────── */
.back-to-top {
  position: fixed; bottom: 36px; right: 24px; z-index: 9998;
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--cinnabar); color: #fff; border: none;
  cursor: pointer; font-size: 18px; line-height: 1;
  box-shadow: 0 2px 10px rgba(178,34,34,0.3);
  transition: transform .3s, box-shadow .3s;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  opacity: 1; visibility: visible;
}
.back-to-top:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(178,34,34,0.4); }
.back-to-top:focus-visible { outline: 2px solid var(--cinnabar-dim); outline-offset: 2px; }
.back-to-top:active { transform: translateY(0) scale(0.95); }
.back-to-top svg { width: 18px; height: 18px; fill: currentColor; }
.back-to-top-hint {
  position: fixed; bottom: 86px; right: 24px; z-index: 9998;
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--cinnabar); color: #fff; border: none;
  cursor: pointer; font-size: 20px; font-weight: 700; line-height: 42px;
  text-align: center;
  box-shadow: 0 2px 10px rgba(178,34,34,0.3);
  transition: transform .3s, box-shadow .3s;
  opacity: 1; visibility: visible;
  font-family: "JetBrains Mono", monospace;
}
.back-to-top-hint:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(178,34,34,0.4); }
.back-to-top-hint:focus-visible { outline: 2px solid var(--cinnabar-dim); outline-offset: 2px; }
.back-to-top-hint:active { transform: translateY(0) scale(0.95); }
@media (max-width: 640px) {
  .back-to-top { bottom: 20px; right: 16px; width: 38px; height: 38px; }
  .back-to-top svg { width: 16px; height: 16px; }
  .back-to-top-hint { bottom: 64px; right: 16px; width: 38px; height: 38px; line-height: 38px; font-size: 18px; }
}

/* ── 快捷键提示浮窗 ───────────────────── */
.shortcut-popup {
  position: fixed; bottom: 136px; right: 24px; z-index: 9999;
  background: var(--paper-card); border: 1px solid var(--ink-faint);
  border-radius: var(--radius); padding: 14px 18px;
  box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .25s, transform .25s, visibility .25s;
  min-width: 160px;
}
.shortcut-popup.show { opacity: 1; visibility: visible; transform: translateY(0); }
.shortcut-popup-arrow {
  position: absolute; bottom: -6px; right: 30px;
  width: 12px; height: 12px;
  background: var(--paper-card);
  border-right: 1px solid var(--ink-faint);
  border-bottom: 1px solid var(--ink-faint);
  transform: rotate(45deg);
}
.shortcut-popup-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; color: var(--ink); }
.shortcut-popup-row:last-child { margin-bottom: 0; }
.shortcut-popup-title { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--ink-faint); border-bottom-color: rgba(196,184,168,0.3); }
.popup-icon { display: inline-flex; align-items: center; justify-content: center; width: 20px; font-size: 14px; flex-shrink: 0; }
.shortcut-popup-row kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 24px; padding: 0 6px;
  background: var(--paper); border: 1px solid var(--ink-faint);
  border-radius: 3px; font-family: "JetBrains Mono", monospace;
  font-size: 12px; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
@media (max-width: 640px) {
  .shortcut-popup { right: 16px; bottom: 110px; }
}
@media (max-width: 700px) {
  .date-current { min-width: 70px; font-size: 12px; }
  .date-arrow { font-size: 12px; padding: 10px 8px; min-width: 44px; min-height: 44px; }
}

/* ── 考试工具栏 ───────────────────────── */
.exam-toolbar {
  position: sticky; top: var(--progress-height); z-index: 50;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; margin-bottom: 16px;
  background: var(--paper-card);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(196,184,168,0.3);
  box-shadow: var(--shadow-sm);
  font-size: 13px;
  min-height: 44px;
}
/* 日期导航 */
.date-nav {
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.date-arrow {
  background: none; border: none; cursor: pointer;
  font-size: 12px; color: var(--ink-light); padding: 2px 4px;
  transition: var(--transition); line-height: 1;
}
.date-arrow:hover { color: var(--cinnabar); }
.date-arrow:focus-visible { outline: 2px solid var(--cinnabar-dim); outline-offset: 2px; }
.date-arrow:disabled { opacity: 0.25; cursor: not-allowed; }
.date-arrow:disabled:hover { color: var(--ink-light); }
.date-current {
  font-size: 13px; font-weight: 600; color: var(--ink);
  min-width: 90px; text-align: center;
  font-family: "JetBrains Mono", monospace;
  cursor: pointer; transition: var(--transition);
  padding: 2px 6px; border-radius: var(--radius-sm);
}
.date-current:hover { background: var(--paper-deep); color: var(--cinnabar); }
.date-current:focus-visible { outline: 2px solid var(--cinnabar-dim); outline-offset: 2px; }
.btn-today {
  font-size: 11px; padding: 2px 8px; border-radius: var(--radius-sm);
  background: var(--cinnabar-bg); color: var(--cinnabar);
  border: 1px solid var(--cinnabar-bg2); cursor: pointer;
  font-family: "Noto Sans SC", sans-serif; font-weight: 500;
  transition: var(--transition); white-space: nowrap;
}
.btn-today:hover { background: var(--cinnabar); color: #fff; }
.exam-toolbar .progress-text {
  color: var(--ink-soft); flex: 1; font-size: 13px;
}
.exam-toolbar .toolbar-actions { display: flex; gap: 8px; align-items: center; }
.btn-sheet {
  padding: 5px 14px; font-size: 12px; letter-spacing: 1px;
  background: var(--paper); border: 1.5px solid var(--ink-faint);
  border-radius: var(--radius-sm); cursor: pointer;
  transition: var(--transition);
  font-family: "Noto Sans SC", sans-serif; color: var(--ink-soft);
}
.btn-sheet:hover { border-color: var(--cinnabar-dim); color: var(--cinnabar); }
.btn-sheet:focus-visible { outline: 2px solid var(--cinnabar-dim); outline-offset: 2px; }

/* ── 答题卡面板 ───────────────────────── */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(44,36,22,0.35);
  opacity: 0; visibility: hidden;
  transition: opacity .25s, visibility .25s;
}
.sheet-overlay.open { opacity: 1; visibility: visible; }
.sheet-panel {
  position: fixed; top: 0; right: -340px; z-index: 10001;
  width: 320px; height: 100vh;
  background: var(--paper-card);
  box-shadow: -4px 0 24px rgba(44,36,22,0.15);
  transition: right .3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex; flex-direction: column;
  overscroll-behavior: contain;
}
.sheet-panel.open { right: 0; }
.sheet-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--ink-faint);
}
.sheet-header h3 { font-family: "Noto Serif SC", serif; font-size: 16px; color: var(--ink); }
.sheet-close {
  width: 28px; height: 28px; border: none; background: none;
  cursor: pointer; font-size: 20px; color: var(--ink-light);
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; transition: background .2s;
}
.sheet-close:hover { background: var(--paper-deep); }
.sheet-body { flex: 1; overflow-y: auto; padding: 16px 20px 24px; }
.sheet-section { margin-bottom: 20px; }
.sheet-section-title {
  font-size: 12px; color: var(--ink-light); margin-bottom: 8px;
  letter-spacing: 1px; font-weight: 500;
  display: flex; align-items: center; gap: 6px;
}
.sheet-section-title::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--ink-faint), transparent);
}
.qnum-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.qnum-item {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: var(--transition);
  border: 1.5px solid var(--ink-faint);
  color: var(--ink-soft); background: var(--paper);
}
.qnum-item:hover { border-color: var(--cinnabar-dim); color: var(--cinnabar); }
.qnum-item:focus-visible { outline: 2px solid var(--cinnabar-dim); outline-offset: 2px; }
.qnum-item.answered { background: var(--pine); color: #fff; border-color: var(--pine); position: relative; }
.qnum-item.answered::after {
  content: '\u2713'; position: absolute; top: -2px; right: 2px;
  font-size: 8px; color: rgba(255,255,255,0.6);
}
.qnum-item.current { border-color: var(--cinnabar); box-shadow: 0 0 0 2px var(--cinnabar-bg2); }
.qnum-item.answered.current { background: var(--pine); border-color: var(--cinnabar); box-shadow: 0 0 0 2px var(--cinnabar-bg2); }

/* 答题卡图例 */
.sheet-legend {
  display: flex; align-items: center; gap: 14px;
  font-size: 12px; color: var(--ink-soft); margin-bottom: 16px;
  padding-bottom: 12px; border-bottom: 1px solid var(--ink-faint);
}
.sheet-legend .legend-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 2px;
  margin-right: 3px; vertical-align: middle;
}
.sheet-legend .legend-dot.done { background: var(--pine); }
.sheet-legend .legend-dot.undone { background: var(--paper); border: 1.5px solid var(--ink-faint); }
.sheet-legend .legend-dot.current-dot { background: none; border: 2px solid var(--cinnabar); border-radius: 2px; }
  .exam-toolbar { padding: 6px 10px; gap: 8px; }
  .exam-toolbar .progress-text { font-size: 12px; }
  .btn-sheet { padding: 4px 10px; font-size: 11px; }
  .sheet-panel { width: 280px; right: -300px; }
}

/* ── 错题本 ───────────────────────────── */
.wrong-date-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; cursor: pointer; border-radius: var(--radius-sm);
  transition: var(--transition); border-left: 3px solid transparent;
  margin-bottom: 4px;
}
.wrong-date-item:hover { background: var(--paper-deep); }
.wrong-date-item:focus-visible { outline: 2px solid var(--cinnabar-dim); outline-offset: 2px; }
.wrong-date-item .wrong-date { font-weight: 600; color: var(--ink); min-width: 60px; }
.wrong-date-item .wrong-subject { color: var(--ink-soft); font-size: 13px; flex: 1; }
.wrong-date-item .wrong-count { color: var(--cinnabar); font-size: 13px; font-weight: 600; }
.wrong-date-item .wrong-reviewed { font-size: 12px; color: var(--pine); }

/* 错题本内部的 tab（错题/收藏） */
.wrong-tabs { display: flex; gap: 0; margin-bottom: 16px; border-bottom: 1px solid var(--ink-faint); border-bottom-color: rgba(196,184,168,0.3); }
.wrong-tab { padding: 8px 24px; font-size: 14px; cursor: pointer; border: none; background: none; color: var(--ink-light); font-family: inherit; transition: color .2s, box-shadow .2s; }
.wrong-tab.active { color: var(--cinnabar); box-shadow: inset 0 -2px 0 var(--cinnabar); }
.wrong-tab:hover { color: var(--ink); }

.wrong-answer-row {
  display: flex; gap: 16px; margin: 8px 0 4px 34px; font-size: 13px;
}
.wrong-user-answer { color: var(--ochre); font-weight: 500; }
.wrong-correct-answer { color: var(--pine); font-weight: 500; }