/* ============================================================
   大考刷题 — 设计系统 v3
   宣纸 · 墨 · 靛 · 朱砂  /  衬线数字 / 分类图形
   ============================================================ */

@font-face {
  font-family: 'PFDisplay';
  src: url('serif.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --kb: 0px;
  --fs: 1;

  --r: 18px;
  --r-sm: 12px;
  --r-xs: 9px;

  --ease: cubic-bezier(.22, .61, .36, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  --pad: 18px;
  --serif: 'PFDisplay', Georgia, 'Times New Roman', serif;
}

html[data-theme="light"] {
  --bg: #F4F0E7;
  --bg-2: #FBF8F1;
  --card: #FFFCF6;
  --card-2: #F8F4EA;
  --ink: #1A1611;
  --ink2: #463F35;
  --muted: #7C7466;
  --faint: #A89F8F;
  --line: #E3DACA;
  --line2: #EFE8DA;
  --accent: #2B4A6F;
  --accent-soft: #E7EDF4;
  --on-accent: #FBF8F1;
  --green: #2E6B52;
  --green-bg: #E9F2EC;
  --amber: #B0791F;
  --amber-bg: #FAF2E1;
  --rose: #A83A2B;
  --rose-bar: #C4705F;
  --rose-bg: #F8E9E4;
  --ok: #2E6B52;
  --bad: #A83A2B;
  --shadow: 0 1px 2px rgba(26, 22, 17, .045);
  --shadow-md: 0 6px 20px -14px rgba(26, 22, 17, .35);
  --inset-top: inset 0 1px 0 rgba(255, 255, 255, .75);
}

html[data-theme="dark"] {
  --bg: #0C0B09;
  --bg-2: #12110E;
  --card: #17150F;
  --card-2: #1D1A14;
  --ink: #F4EFE4;
  --ink2: #CFC7B8;
  --muted: #8B8375;
  --faint: #5F584C;
  --line: #29251F;
  --line2: #211E18;
  --accent: #93ADD0;
  --accent-soft: #19232F;
  --on-accent: #0C0B09;
  --green: #57A781;
  --green-bg: #11201A;
  --amber: #CE9F51;
  --amber-bg: #211B0E;
  --rose: #CF7965;
  --rose-bar: #A66052;
  --rose-bg: #241411;
  --ok: #57A781;
  --bad: #CF7965;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-md: 0 8px 24px -16px rgba(0, 0, 0, .9);
  --inset-top: inset 0 1px 0 rgba(255, 255, 255, .04);
}

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

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "MiSans VF", "MiSans", -apple-system, "PingFang SC", "HarmonyOS Sans SC", "Noto Sans CJK SC", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
svg { display: block; }
b { font-weight: 600; }

.num {
  font-family: var(--serif);
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: -.01em;
}

#app {
  position: fixed;
  top: 0; left: 0; right: 0;
  bottom: var(--kb);
  overflow: hidden;
  transition: bottom .16s var(--ease);
}

/* ---------------- 屏幕 ---------------- */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  background: var(--bg);
  background-image: linear-gradient(180deg, var(--bg-2) 0, var(--bg) 200px);
}
.screen::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}
html[data-theme="dark"] .screen::before { display: none; }
.screen.is-active {
  display: flex;
  z-index: 3;
  animation: screenIn .22s var(--ease-out);
}
.screen.is-cover { z-index: 6; }
@keyframes screenIn {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: none; }
}

.scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  padding: calc(var(--sat) + 8px) var(--pad) 0;
}
.pad-bottom { height: calc(96px + var(--sab)); }

/* ---------------- 顶栏 ---------------- */
.head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0 20px;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 500;
  margin-bottom: 7px;
}
.head h1 {
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -.035em;
  line-height: 1.2;
}
.head p {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  color: var(--ink2);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), var(--inset-top);
  flex-shrink: 0;
  transition: transform .15s var(--ease), background .15s;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:active { transform: scale(.94); }
.icon-btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }

/* ---------------- 总览卡 ---------------- */
.board {
  position: relative;
  overflow: hidden;
  padding: 18px 18px 15px;
  border-radius: var(--r);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), var(--inset-top);
}
.board-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.board-k {
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 500;
}
.board-total { font-size: 11.5px; color: var(--muted); }
.board-row { display: flex; align-items: flex-end; justify-content: space-between; }
.board-num {
  font-family: var(--serif);
  font-size: 56px;
  font-weight: 400;
  line-height: .92;
  letter-spacing: -.03em;
  color: var(--ink);
}
.board-num i { font-style: normal; font-size: 21px; color: var(--muted); margin-left: 4px; }
.board-right { text-align: right; padding-bottom: 4px; }
.board-right b {
  display: block;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 400;
  line-height: 1.1;
}
.board-right span { font-size: 10.5px; color: var(--muted); }

.board-kv {
  display: flex;
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid var(--line2);
}
.board-kv > div { flex: 1; }
.board-kv > div + div { padding-left: 14px; border-left: 1px solid var(--line2); }
.board-kv b {
  display: block;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.15;
}
.board-kv span { font-size: 10.5px; color: var(--muted); }

/* ---------------- 进度条 ---------------- */
.bar {
  height: 6px;
  border-radius: 999px;
  background: var(--line2);
  overflow: hidden;
  display: flex;
  gap: 2px;
}
.bar-lg { height: 8px; margin-top: 15px; }
.seg { display: block; height: 100%; border-radius: 3px; flex: 0 0 auto; }
.seg.g { background: var(--green); }
.seg.y { background: var(--amber); }
.seg.r { background: var(--rose-bar); }
.bar-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--ink);
  transition: width .45s var(--ease-out);
}

/* ---------------- 快捷操作 ---------------- */
.quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.quick #btn-review:disabled { display: none; }
#home-star-count { color: var(--muted); font-variant-numeric: tabular-nums; }
#sk-index { width: auto; flex: 0 0 auto; }
#sr-practice:disabled { opacity: .3; }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  height: 48px;
  border-radius: var(--r-sm);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .01em;
  transition: transform .15s var(--ease), opacity .15s, background .15s;
}
.btn:active { transform: scale(.985); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--ink); color: var(--bg-2); }
.btn-primary:disabled { opacity: .3; }
.btn-outline {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), var(--inset-top);
  font-weight: 500;
}
.btn-outline:active { background: var(--card-2); }
.btn-ghost { background: transparent; color: var(--ink2); font-weight: 500; }
.btn-soft { background: var(--card-2); color: var(--ink); border: 1px solid var(--line); }
.btn-danger { background: var(--rose); color: #fff; }
.btn-sm {
  height: 34px;
  font-size: 12.5px;
  border-radius: var(--r-xs);
  padding: 0 13px;
  width: auto;
  font-weight: 500;
}

.hint-line {
  margin-top: 12px;
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
  letter-spacing: .01em;
}
.hint-line b { color: var(--ink); font-family: var(--serif); font-size: 13.5px; font-weight: 400; }

/* ---------------- 分区标题 ---------------- */
.sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 28px 0 12px;
}
.sec-head h2 { font-size: 15px; font-weight: 600; letter-spacing: -.015em; }
.sec-head span { font-size: 11px; color: var(--faint); }

/* ---------------- 分类 ---------------- */
.cat-list { display: flex; flex-direction: column; gap: 8px; }
.cat-card {
  display: flex;
  min-width: 0;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), var(--inset-top);
}
.cat {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 15px 0 0 15px;
  text-align: left;
  transition: background .15s;
}
.cat:hover, .cat:active, .cat-practice:not(:disabled):hover { background: var(--card-2); }
.cat-skim-link { margin-left: auto; color: var(--ink); white-space: nowrap; font-weight: 600; }
.cat-practice {
  flex: 0 0 auto;
  min-width: 42px;
  padding-inline: 7px;
  border-inline-start: 1px solid var(--line);
  border-start-end-radius: 15px;
  border-end-end-radius: 15px;
  color: var(--ink2);
  font-size: 12px;
  white-space: nowrap;
}
.cat-practice:disabled { opacity: .4; cursor: default; }
#sk-category { margin-bottom: 5px; color: var(--ink); font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
#sk-category:not([hidden]) { display: block; }
.cat-glyph {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.cat-glyph svg { width: 19px; height: 19px; }
.cat-body { flex: 1; min-width: 0; }
.cat-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}
.cat-name {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -.012em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-num { font-size: 11px; color: var(--faint); flex-shrink: 0; }
.cat-num b { font-family: var(--serif); font-size: 14px; font-weight: 400; color: var(--ink); }
.cat-bot {
  display: flex;
  gap: 11px;
  margin-top: 8px;
  font-size: 10.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.cat-bot em { font-style: normal; color: var(--muted); }
.dot { display: inline-block; width: 5px; height: 5px; border-radius: 2px; margin-right: 4px; vertical-align: 1px; }
.dot.g { background: var(--green); }
.dot.y { background: var(--amber); }
.dot.r { background: var(--rose); }

/* ---------------- 统计 ---------------- */
.kpi-row { display: flex; gap: 8px; }
.kpi {
  flex: 1;
  padding: 14px 13px 12px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), var(--inset-top);
}
.kpi-num {
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -.01em;
}
.kpi-num i {
  font-style: normal;
  font-size: 11px;
  color: var(--faint);
  margin-left: 3px;
  font-family: "MiSans", system-ui, sans-serif;
  letter-spacing: .01em;
}
.kpi-label { margin-top: 4px; font-size: 10.5px; color: var(--muted); }

.chart {
  padding: 16px 14px 10px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), var(--inset-top);
}
.bars { display: flex; align-items: flex-end; gap: 4px; height: 84px; }
.bar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.bar-col i {
  display: block;
  width: 100%;
  border-radius: 2px;
  background: var(--line);
  min-height: 2px;
  transition: height .5s var(--ease-out), background .3s;
}
.bar-col.has i { background: var(--ink); opacity: .22; }
.bar-col.is-today i { background: var(--ink); opacity: .85; }
.bars-x {
  display: flex;
  gap: 4px;
  margin-top: 7px;
  font-size: 8.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.bars-x span { flex: 1; text-align: center; white-space: nowrap; }

.list {
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), var(--inset-top);
  overflow: hidden;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line2);
  text-align: left;
}
.row:last-child { border-bottom: 0; }
.row-main { flex: 1; min-width: 0; }
.row-t { font-size: 14px; font-weight: 500; }
.row-d { margin-top: 2px; font-size: 10.5px; color: var(--muted); line-height: 1.5; }
.row-btn:active { background: var(--card-2); }
.row-val { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chev { width: 15px; height: 15px; color: var(--faint); flex-shrink: 0; }

.group { margin-bottom: 20px; }
.group-label {
  font-size: 10px;
  letter-spacing: .16em;
  color: var(--faint);
  margin: 0 0 8px 3px;
  text-transform: uppercase;
  font-weight: 500;
}

.stepper {
  display: flex;
  align-items: center;
  background: var(--card-2);
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  overflow: hidden;
}
.stepper button { width: 30px; height: 28px; font-size: 15px; color: var(--ink2); display: grid; place-items: center; }
.stepper button:active { background: var(--line2); }
.stepper span { min-width: 32px; text-align: center; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }

.switch {
  width: 42px;
  height: 25px;
  border-radius: 999px;
  background: var(--line2);
  border: 1px solid var(--line);
  position: relative;
  transition: background .18s var(--ease), border-color .18s;
  flex-shrink: 0;
}
.switch i {
  position: absolute;
  top: 2px; left: 2px;
  width: 19px; height: 19px;
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .22);
  transition: transform .2s var(--ease-out), background .18s;
}
.switch.on { background: var(--ink); border-color: var(--ink); }
.switch.on i { transform: translateX(17px); background: var(--bg-2); }

.segmented {
  display: flex;
  background: var(--card-2);
  border-radius: var(--r-xs);
  padding: 2px;
  border: 1px solid var(--line);
  gap: 2px;
}
.segmented button {
  padding: 5px 9px;
  border-radius: 7px;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.segmented button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

.foot-note {
  margin: 22px 2px 0;
  font-size: 10.5px;
  line-height: 1.9;
  color: var(--faint);
  text-align: center;
}

/* ---------------- TabBar ---------------- */
#tabbar {
  position: fixed;
  left: 0; right: 0;
  bottom: var(--kb);
  z-index: 5;
  display: flex;
  padding: 7px 10px calc(6px + var(--sab));
  background: var(--bg);
  border-top: 1px solid var(--line2);
  transition: transform .22s var(--ease), opacity .18s;
}
#tabbar.hide { transform: translateY(110%); opacity: 0; pointer-events: none; }
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 0 2px;
  color: var(--faint);
  transition: color .15s;
}
.tab svg { width: 21px; height: 21px; }
.tab span { font-size: 9.5px; font-weight: 500; letter-spacing: .04em; }
.tab.is-active { color: var(--ink); }
.tab:active { transform: scale(.94); }

/* ============================================================
   答题
   ============================================================ */
.ses-top {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: calc(var(--sat) + 9px) var(--pad) 3px;
}
.ses-top .icon-btn { width: 34px; height: 34px; border-radius: 10px; }
.ses-prog { flex: 1; }
.ses-prog .bar { height: 4px; background: var(--line2); }
.ses-count {
  font-size: 11.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  min-width: 44px;
  text-align: right;
  letter-spacing: .02em;
}
.ses-count b { color: var(--ink); font-family: var(--serif); font-size: 14px; font-weight: 400; }

.ses-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  padding: 20px var(--pad) 18px;
}

.q-card { animation: cardIn .26s var(--ease-out) both; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: none; }
}
.q-card.leaving { animation: cardOut .22s var(--ease) both; }
@keyframes cardOut { to { opacity: 0; transform: translateX(-18px); } }

.q-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.chip {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  padding: 3px 8px;
  border-radius: 5px;
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--ink2);
}
.chip.ok { background: var(--green-bg); color: var(--green); border-color: transparent; }
.chip.bad { background: var(--rose-bg); color: var(--rose); border-color: transparent; }
.q-idx { font-size: 10.5px; color: var(--faint); font-variant-numeric: tabular-nums; }

.q-stem {
  font-size: calc(18px * var(--fs));
  line-height: 1.78;
  font-weight: 500;
  letter-spacing: .004em;
  margin-bottom: 24px;
  word-break: break-word;
  white-space: pre-wrap;
}
.blank-input {
  display: inline-block;
  width: 64px;
  padding: 0 3px 1px;
  margin: 0 2px;
  background: transparent;
  border: 0;
  border-bottom: 1.5px solid var(--line);
  border-radius: 0;
  color: var(--ink);
  font-weight: 600;
  font-size: inherit;
  line-height: inherit;
  text-align: center;
  outline: none;
  -webkit-user-select: text;
  user-select: text;
  transition: border-color .15s, background .15s;
}
.blank-input::placeholder { color: var(--faint); font-weight: 400; }
.blank-input:focus { border-bottom-color: var(--ink); background: var(--card-2); }
.blank-input.ok { color: var(--green); border-bottom-color: var(--green); background: var(--green-bg); border-radius: 4px 4px 0 0; }
.blank-input.bad { color: var(--rose); border-bottom-color: var(--rose); background: var(--rose-bg); border-radius: 4px 4px 0 0; }

.opts { display: flex; flex-direction: column; gap: 9px; }
.opt {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  width: 100%;
  padding: 14px;
  border-radius: var(--r-sm);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), var(--inset-top);
  text-align: left;
  font-size: calc(14.5px * var(--fs));
  line-height: 1.62;
  color: var(--ink);
  transition: transform .12s var(--ease), border-color .15s, background .15s, opacity .15s;
}
.opt:active { transform: scale(.99); }
.opt-badge {
  width: 23px; height: 23px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--line);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
  margin-top: 1px;
  transition: background .15s, color .15s, border-color .15s;
}
.opt-text { flex: 1; min-width: 0; word-break: break-word; white-space: pre-wrap; }
.opt-mark { width: 16px; height: 16px; flex-shrink: 0; margin-top: 4px; opacity: 0; }
.opt-key { flex-shrink: 0; }

.opt.sel { border-color: var(--ink); background: var(--card-2); }
.opt.sel .opt-badge { background: var(--ink); border-color: var(--ink); color: var(--bg-2); }
.opt.ok { border-color: color-mix(in srgb, var(--green) 40%, var(--line)); background: var(--green-bg); }
.opt.ok .opt-badge { background: var(--green); border-color: var(--green); color: #fff; }
.opt.ok .opt-mark { opacity: 1; color: var(--green); }
.opt.bad { border-color: color-mix(in srgb, var(--rose) 40%, var(--line)); background: var(--rose-bg); }
.opt.bad .opt-badge { background: var(--rose); border-color: var(--rose); color: #fff; }
.opt.bad .opt-mark { opacity: 1; color: var(--rose); }
.opt.dim { opacity: .5; }
.opt.shake { animation: shake .32s var(--ease); }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(3px); }
  75% { transform: translateX(-1px); }
}

.judge-row { display: flex; gap: 10px; }
.judge-btn {
  flex: 1;
  height: 76px;
  border-radius: var(--r-sm);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), var(--inset-top);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14.5px;
  font-weight: 600;
  transition: transform .12s var(--ease), border-color .15s, background .15s;
}
.judge-btn svg { width: 21px; height: 21px; color: var(--muted); }
.judge-btn:active { transform: scale(.98); }
.judge-btn.sel { border-color: var(--ink); background: var(--card-2); }
.judge-btn.ok {
  border-color: color-mix(in srgb, var(--green) 55%, var(--line));
  background: color-mix(in srgb, var(--green) 9%, var(--card));
}
.judge-btn.ok svg { color: var(--green); }
.judge-btn.bad {
  border-color: color-mix(in srgb, var(--rose) 55%, var(--line));
  background: var(--card);
  color: var(--muted);
}
.judge-btn.bad svg { color: var(--rose); }
.judge-btn.dim { opacity: .45; }

.order-hint { font-size: 11px; color: var(--muted); margin: -12px 0 12px; }
.order-list { display: flex; flex-direction: column; gap: 9px; }
.order-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px;
  border-radius: var(--r-sm);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), var(--inset-top);
  text-align: left;
  font-size: calc(14.5px * var(--fs));
  line-height: 1.6;
  transition: transform .12s var(--ease), border-color .15s, background .15s;
  width: 100%;
}
.order-item:active { transform: scale(.99); }
.order-item.picked { border-color: var(--ink); background: var(--card-2); }
.order-item.picked .opt-badge { background: var(--ink); border-color: var(--ink); color: var(--bg-2); }
.order-item.ok { border-color: var(--green); background: var(--green-bg); }
.order-item.ok .opt-badge { background: var(--green); border-color: var(--green); color: #fff; }
.order-item.bad { border-color: var(--rose); background: var(--rose-bg); }
.order-item.bad .opt-badge { background: var(--rose); border-color: var(--rose); color: #fff; }

/* ---------------- 底部操作 ---------------- */
.ses-foot {
  padding: 11px var(--pad) calc(13px + var(--sab));
  background: var(--bg);
  border-top: 1px solid transparent;
  transition: border-color .15s;
}
.ses-foot.bordered { border-top-color: var(--line2); }
#screen-wrong .ses-foot { border-top-color: var(--line2); }
#wb-list { padding-bottom: 14px; }
.foot-row { display: flex; align-items: center; gap: 8px; }
.foot-hint { flex: 1; font-size: 11px; color: var(--muted); text-align: right; }
.slay-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink2);
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow), var(--inset-top);
  flex-shrink: 0;
  transition: transform .12s var(--ease);
}
.slay-btn svg { width: 14px; height: 14px; }
.slay-btn:active { transform: scale(.96); }
.selectall-btn {
  height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  border: 1px solid var(--line);
  background: var(--card-2);
  flex-shrink: 0;
  transition: transform .12s var(--ease);
}
.selectall-btn:active { transform: scale(.96); }

.submit-btn {
  height: 42px;
  padding: 0 20px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg-2);
  font-size: 13.5px;
  font-weight: 600;
  flex-shrink: 0;
  transition: transform .12s var(--ease), opacity .15s;
}
.submit-btn:active { transform: scale(.97); }
.submit-btn:disabled { background: var(--line2); color: var(--faint); }

.result { display: flex; align-items: center; gap: 10px; animation: resIn .22s var(--ease-out) both; }
@keyframes resIn { from { opacity: 0; transform: translateY(5px); } }
.result-icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.result-icon svg { width: 14px; height: 14px; }
.result.ok .result-icon { background: var(--green); color: #fff; }
.result.bad .result-icon { background: var(--rose); color: #fff; }
.result-main { flex: 1; min-width: 0; }
.result-t { font-size: 13.5px; font-weight: 600; }
.result.ok .result-t { color: var(--green); }
.result.bad .result-t { color: var(--rose); }
.result-d { font-size: 11px; color: var(--muted); margin-top: 1px; line-height: 1.5; word-break: break-word; }
.result-d b { color: var(--ink2); font-weight: 600; }
.next-btn {
  height: 42px;
  padding: 0 20px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg-2);
  font-size: 13.5px;
  font-weight: 600;
  flex-shrink: 0;
  transition: transform .12s var(--ease);
}
.next-btn:active { transform: scale(.97); }

/* ---------------- 已斩 / 错题 ---------------- */
.ms-item {
  padding: 13px 14px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), var(--inset-top);
  margin-bottom: 8px;
}
.ms-stem {
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ms-foot { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.ms-cat { font-size: 10.5px; color: var(--faint); flex: 1; }
.ms-cat em { font-style: normal; color: var(--rose); }
.ms-restore {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink2);
  padding: 4px 11px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--card-2);
}
.ms-restore:active { opacity: .7; }
.empty-state { padding: 60px 20px; text-align: center; color: var(--muted); font-size: 12.5px; line-height: 1.9; }
.empty-state svg { width: 32px; height: 32px; margin: 0 auto 12px; opacity: .3; }

.sheet-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(var(--sat) + 10px) var(--pad) 10px;
}
.sheet-head h2 { font-size: 16px; font-weight: 600; flex: 1; letter-spacing: -.015em; }
.sheet-count { font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }

/* ---------------- 结算 ---------------- */
.done-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(var(--sat) + 20px) 22px calc(26px + var(--sab));
}
.done-score { display: flex; align-items: baseline; gap: 6px; }
.done-score span {
  font-family: var(--serif);
  font-size: 72px;
  font-weight: 400;
  letter-spacing: -.03em;
  line-height: 1;
}
.done-score i { font-style: normal; font-size: 14px; color: var(--muted); }
.done-title { margin-top: 16px; font-size: 20px; font-weight: 600; letter-spacing: -.025em; }
.done-sub { margin-top: 7px; font-size: 12px; color: var(--muted); line-height: 1.7; }
.done-stats { display: flex; gap: 28px; margin-top: 24px; }
.done-stats div b { display: block; font-family: var(--serif); font-size: 19px; font-weight: 400; line-height: 1.2; }
.done-stats div span { font-size: 10px; color: var(--faint); }
.done-actions { margin-top: 34px; display: flex; flex-direction: column; gap: 8px; }

/* ---------------- 模考 ---------------- */
.exam-score-hero { display: flex; align-items: baseline; gap: 8px; padding: 18px 0 4px; }
.exam-score-hero span {
  font-family: var(--serif);
  font-size: 62px;
  font-weight: 400;
  letter-spacing: -.03em;
  line-height: 1;
}
.exam-score-hero i { font-style: normal; font-size: 13px; color: var(--muted); }
.exam-grid { display: flex; flex-direction: column; gap: 18px; }
.field-k { font-size: 10px; color: var(--faint); letter-spacing: .14em; margin-bottom: 9px; text-transform: uppercase; font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn {
  padding: 7px 11px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 12px;
  color: var(--ink2);
  transition: background .15s, border-color .15s, color .15s;
}
.chip-btn.on { border-color: var(--ink); background: var(--ink); color: var(--bg-2); font-weight: 500; }
.chip-btn:active { transform: scale(.97); }
.exam-nav { display: flex; gap: 8px; }
.exam-nav .btn { flex: 1; }

.wrong-item {
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow), var(--inset-top);
  margin-bottom: 8px;
}
.wrong-q { font-size: 12.5px; line-height: 1.62; color: var(--ink); }
.wrong-a { margin-top: 9px; font-size: 11.5px; line-height: 1.55; color: var(--muted); }
.wa-k { display: block; font-size: 9px; color: var(--faint); letter-spacing: .1em; margin-bottom: 1px; }
.wrong-a b { color: var(--green); font-weight: 500; }
.wrong-mine { margin-top: 7px; font-size: 11.5px; line-height: 1.55; color: var(--rose); }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--kb));
  transform: translate(-50%, 10px);
  padding: 9px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg-2);
  font-size: 12px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .22s var(--ease-out);
  z-index: 40;
  white-space: nowrap;
  max-width: 88vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- 弹层 ---------------- */
.mask {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(12, 11, 9, .48);
  display: flex;
  align-items: flex-end;
  opacity: 0;
  transition: opacity .2s;
}
.mask.show { opacity: 1; }
.sheet {
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  background: var(--bg-2);
  border-radius: 20px 20px 0 0;
  padding: 20px var(--pad) calc(18px + var(--sab));
  transform: translateY(100%);
  transition: transform .28s var(--ease-out);
  border-top: 1px solid var(--line);
}
.mask.show .sheet { transform: none; }
.sheet h3 { font-size: 17px; font-weight: 600; margin-bottom: 5px; letter-spacing: -.02em; }
.sheet .sub { font-size: 11.5px; color: var(--muted); margin-bottom: 18px; line-height: 1.65; }
.sheet-actions { display: flex; gap: 8px; margin-top: 20px; }
.sheet-actions .btn { height: 46px; font-size: 14.5px; }
.sheet-grip { width: 32px; height: 4px; border-radius: 999px; background: var(--line); margin: -8px auto 14px; }

/* ============================================================
   速记与解析
   ============================================================ */
.note-panel {
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--card-2);
  overflow: hidden;
  animation: resIn .3s var(--ease-out) both;
}
.note-sec { padding: 12px 14px 13px; }
.note-sec + .note-sec { border-top: 1px solid var(--line2); }
.note-k {
  font-size: 9.5px;
  letter-spacing: .18em;
  font-weight: 600;
  color: var(--faint);
  margin-bottom: 5px;
}
.note-sec.tip .note-k { color: var(--amber); }
.note-t {
  font-size: 13px;
  line-height: 1.75;
  color: var(--ink2);
  white-space: pre-wrap;
}
.note-sec.tip .note-t { color: var(--ink); font-weight: 500; }
.note-link {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 11px 14px;
  border-top: 1px solid var(--line2);
  font-size: 11.5px;
  color: var(--accent);
  text-align: left;
}
.note-link svg { width: 13px; height: 13px; margin-left: auto; flex-shrink: 0; }
.note-link:active { background: var(--card); }

/* 速记手册 */
.card-item {
  display: block;
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), var(--inset-top);
  margin-bottom: 8px;
  text-align: left;
}
.card-item:active { background: var(--card-2); }
.card-item-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}
.card-item h3 { font-size: 14px; font-weight: 600; letter-spacing: -.01em; }
.card-tag {
  font-size: 9.5px;
  padding: 2.5px 7px;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
  font-weight: 500;
}
.card-preview {
  font-size: 12px;
  line-height: 1.65;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta { margin-top: 9px; font-size: 10.5px; color: var(--faint); }

.card-body {
  font-size: 13.5px;
  line-height: 1.85;
  color: var(--ink2);
  white-space: pre-wrap;
}
.rel-list { display: flex; flex-direction: column; gap: 8px; }
.rel {
  padding: 11px 12px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--line);
}
.rel-q { font-size: 12px; line-height: 1.6; color: var(--ink); }
.rel-a { margin-top: 5px; font-size: 11.5px; line-height: 1.55; color: var(--green); }
.rel-no { font-size: 9.5px; color: var(--faint); margin-right: 5px; }

/* ============================================================
   单手布局 + 评分按钮
   ============================================================ */
.ses-body { display: flex; flex-direction: column; }
.q-card {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  min-height: 100%;
  justify-content: safe center;
  padding-top: 13vh;
}
.q-meta, .q-stem { flex: 0 0 auto; }
.opts, .judge-row, .order-hint, .order-list { flex: 0 0 auto; }
.q-card.t-blank .q-stem { margin-bottom: 0; }

.order-hint { margin: 0 0 12px; flex: 0 0 auto; }

.reveal-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  border: 1px solid var(--line);
  background: transparent;
  flex-shrink: 0;
  transition: transform .12s var(--ease);
}
.reveal-btn svg { width: 14px; height: 14px; }
.reveal-btn:active { transform: scale(.96); background: var(--card-2); }

.grade-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 0 10px;
  animation: resIn .24s var(--ease-out) both;
}
.grade-btn {
  height: 34px;
  padding: 0 13px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink2);
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
  flex-shrink: 0;
  transition: transform .12s var(--ease), background .15s;
}
.grade-btn:active { transform: scale(.96); background: var(--card-2); }
#g-slay { color: var(--green); border-color: color-mix(in srgb, var(--green) 35%, var(--line)); }
.grade-hint { font-size: 10.5px; color: var(--faint); margin-left: auto; }

.result-note {
  font-size: 10.5px;
  color: var(--accent);
  margin-top: 3px;
  letter-spacing: .01em;
}
.result.mid .result-icon { background: var(--muted); color: #fff; }
.result.mid .result-t { color: var(--fg2); }

.date-input {
  border: 0;
  background: transparent;
  font-size: 12.5px;
  color: var(--ink2);
  text-align: right;
  font-family: inherit;
  max-width: 140px;
}
.date-input::-webkit-calendar-picker-indicator { opacity: .45; }

/* ============================================================
   星级 + 撤回
   ============================================================ */
.stars { display: flex; gap: 1px; margin-left: auto; flex-shrink: 0; }
.star {
  width: 26px; height: 26px;
  font-size: 14px;
  line-height: 1;
  display: grid;
  place-items: center;
  color: color-mix(in srgb, var(--faint) 60%, transparent);
  transition: color .15s, transform .12s var(--ease);
  padding: 0;
}
.star.on { color: var(--amber); }
.star:active { transform: scale(.82); }
.stars.sm { margin-left: 0; gap: 0; }
.stars.sm .star { width: 13px; height: 13px; font-size: 10px; pointer-events: none; }

.toast { white-space: normal; text-align: left; }
.toast-msg { flex: 1; min-width: 0; }
.toast-action {
  flex-shrink: 0;
  padding: 5px 11px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--bg-2);
  background: color-mix(in srgb, var(--bg-2) 15%, transparent);
}
.toast-action:active { background: color-mix(in srgb, var(--bg-2) 28%, transparent); }

.ms-stars { display: flex; gap: 0; margin-right: 2px; }
#screen-starred .ses-foot { border-top-color: var(--line2); }
.q-meta { flex-wrap: wrap; }

/* ============================================================
   答题卡 / 速览
   ============================================================ */
.sc-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
}
.sc-cell {
  height: 42px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--ink2);
  display: grid;
  place-items: center;
  transition: transform .12s var(--ease), background .15s;
}
.sc-cell:active { transform: scale(.94); }
.sc-cell.ok { background: var(--green-bg); border-color: color-mix(in srgb, var(--green) 38%, var(--line)); color: var(--green); }
.sc-cell.hard { background: var(--amber-bg); border-color: color-mix(in srgb, var(--amber) 38%, var(--line)); color: var(--amber); }
.sc-cell.bad { background: var(--rose-bg); border-color: color-mix(in srgb, var(--rose) 38%, var(--line)); color: var(--rose); }
.sc-cell.reveal { background: var(--rose-bg); border-style: dashed; border-color: color-mix(in srgb, var(--rose) 38%, var(--line)); color: var(--rose); }
.sc-cell.slain { background: var(--card-2); color: var(--faint); text-decoration: line-through; }
.sc-cell.done { background: var(--card-2); border-color: var(--border-strong, var(--line)); color: var(--muted); }
.sc-cell.cur { border-color: var(--ink); border-width: 1.5px; font-weight: 700; color: var(--ink); }

.sc-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
  font-size: 10.5px;
  color: var(--muted);
}
.sc-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 3px;
  margin-right: 4px;
  border: 1px solid var(--line);
  vertical-align: 0.5px;
}
.sc-dot.ok { background: var(--green); border-color: transparent; }
.sc-dot.hard { background: var(--amber); border-color: transparent; }
.sc-dot.bad { background: var(--rose); border-color: transparent; }
.sc-dot.slain { background: var(--faint); border-color: transparent; }

/* 速览 */
#screen-skim .q-card { justify-content: flex-start; padding-top: 0; }
.opt.static, .order-item.static { pointer-events: none; }
.opt.static.dim { opacity: .52; }
.blank-filled {
  color: var(--green);
  font-weight: 600;
  border-bottom: 1.5px solid var(--green);
  padding: 0 4px;
  margin: 0 2px;
}
#screen-skim .note-panel { margin-bottom: 8px; }

/* ============================================================
   搜索 / 筛选
   ============================================================ */
.search-input {
  flex: 1;
  height: 38px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 10px;
  padding: 0 12px;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  -webkit-user-select: text;
  user-select: text;
}
.search-input::placeholder { color: var(--faint); font-size: 13px; }
.search-input:focus { border-color: var(--ink); }
.search-input::-webkit-search-cancel-button { -webkit-appearance: none; }

.se-item {
  display: block;
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), var(--inset-top);
  margin-bottom: 8px;
  text-align: left;
}
.se-item:active { background: var(--card-2); }
.se-stem {
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.se-stem mark {
  background: color-mix(in srgb, var(--amber) 28%, transparent);
  color: var(--ink);
  padding: 0 1px;
  border-radius: 2px;
}
.se-meta {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  color: var(--faint);
}
.se-ans {
  margin-top: 6px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--green);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.se-empty { padding: 56px 20px; text-align: center; color: var(--muted); font-size: 12.5px; line-height: 1.9; }

/* 错题本筛选：单行横向滚动 */
#wb-filter {
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin: 0 calc(-1 * var(--pad)) 12px;
  padding: 0 var(--pad) 2px;
}
#wb-filter::-webkit-scrollbar { display: none; }
#wb-filter .chip-btn { flex: 0 0 auto; }

/* ============================================================
   桌面端（网页版）：居中手机框
   ============================================================ */
@media (min-width: 600px) {
  body { background: #E7E1D3; }
  html[data-theme="dark"] body { background: #08080A; }
  #app {
    left: 50%;
    right: auto;
    top: 22px;
    bottom: 22px;
    width: 440px;
    transform: translateX(-50%);
    border-radius: 22px;
    overflow: hidden;
    border: 1px solid var(--line);
    box-shadow: 0 40px 100px -50px rgba(26, 22, 17, .55), 0 2px 8px rgba(26, 22, 17, .08);
  }
  #tabbar {
    left: 50%;
    right: auto;
    bottom: 22px;
    width: 440px;
    transform: translateX(-50%);
    border-radius: 0 0 22px 22px;
  }
  #tabbar.hide { transform: translateX(-50%) translateY(110%); opacity: 0; }
  .mask { justify-content: center; }
  .mask .sheet { max-width: 440px; margin: 0 auto; }
  .toast { max-width: 400px; }
}

.head-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ============================================================
   撤销芯片 / 统计英雄卡
   ============================================================ */
.undo-chip {
  position: fixed;
  top: calc(var(--sat) + 56px);
  right: 14px;
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 13px 7px 11px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg-2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  box-shadow: 0 10px 26px -14px rgba(20, 16, 12, .8);
  opacity: 0;
  transform: translateY(-10px) scale(.94);
  pointer-events: none;
  transition: opacity .16s, transform .22s var(--ease-out);
}
.undo-chip svg { width: 13px; height: 13px; }
.undo-chip.show { opacity: 1; transform: none; pointer-events: auto; }
.undo-chip:active { transform: scale(.94); }

/* 英雄曲线卡 */
.hero-chart {
  margin-top: 10px;
  position: relative;
  overflow: hidden;
  padding: 18px 18px 12px;
  border-radius: var(--r);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), var(--inset-top);
}
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; }
.hero-k {
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 500;
  margin-bottom: 8px;
}
.hero-num {
  font-family: var(--serif);
  font-size: 40px;
  line-height: 1;
  letter-spacing: -.02em;
}
.hero-num i { font-style: normal; font-size: 13px; color: var(--muted); margin-left: 4px; }
.hero-side { display: flex; gap: 18px; padding-top: 4px; }
.hero-side div { text-align: right; }
.hero-side b {
  display: block;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.15;
}
.hero-side span { font-size: 9.5px; color: var(--muted); }

.hero-plot {
  margin: 10px -4px 0;
  height: 96px;
  color: var(--ink);
}
.hero-plot svg { width: 100%; height: 96px; display: block; }
.hero-x {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
  font-size: 9.5px;
  color: var(--faint);
  letter-spacing: .02em;
}

/* 复习节奏网格 */
.pile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.pile {
  padding: 13px 14px 12px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), var(--inset-top);
}
.pile b {
  display: block;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -.01em;
}
.pile span { display: block; margin-top: 4px; font-size: 10.5px; color: var(--muted); }
.pile.warn b { color: var(--rose); }

/* ============================================================
   可折叠解析 / 左右滑动
   ============================================================ */
.note-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 12px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink2);
  text-align: left;
  letter-spacing: .01em;
}
.note-toggle:active { background: var(--card); }
.note-chev {
  margin-left: auto;
  width: 15px; height: 15px;
  color: var(--faint);
  transition: transform .22s var(--ease);
}
.note-panel.open .note-chev { transform: rotate(180deg); }
.note-body { display: none; }
.note-panel.open .note-body { display: block; }
.note-panel.open .note-toggle { border-bottom: 1px solid var(--line2); }

.ver {
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
  opacity: .8;
}

/* ============================================================
   记忆钩子 / 易混辨析 / 同源跳转
   ============================================================ */
.note-sec.hook .note-k { color: var(--green); }
.note-sec.hook .note-t { color: var(--ink); font-weight: 500; }
.note-sec.contrast { background: color-mix(in srgb, var(--amber) 6%, transparent); }
.note-sec.contrast .note-k { color: var(--amber); }

.note-rel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 11px 14px;
  border-top: 1px solid var(--line2);
}
.note-rel-k {
  font-size: 9.5px;
  letter-spacing: .12em;
  color: var(--faint);
  margin-right: 2px;
}
.rel-chip {
  padding: 4px 9px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  transition: transform .12s var(--ease), background .15s;
}
.rel-chip:active { transform: scale(.94); background: var(--card-2); }

.qs-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.qs-stem {
  font-size: 15px;
  line-height: 1.7;
  font-weight: 600;
  letter-spacing: -.01em;
  margin-bottom: 12px;
}
.qs-ans {
  font-size: 13px;
  line-height: 1.6;
  color: var(--green);
  padding: 10px 12px;
  background: var(--green-bg);
  border-radius: 10px;
}

.card-contrast {
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--ink2);
  white-space: pre-wrap;
}
.card-contrast b { color: var(--ink); font-weight: 600; }

/* 答完题后顶部对齐，方便从题干往下读 */
.q-card.has-note { justify-content: flex-start; padding-top: 22px; }

.q-content { display: contents; }
.desktop-only { display: none; }

/* 桌面网页：保留阅读行宽，利用右栏并排展示解析。 */
@media (min-width: 780px) and (hover: hover) and (pointer: fine) {
  html.web-layout { --desktop-width: 1120px; --pad: clamp(24px, 3vw, 38px); }
  .web-layout body { background: var(--bg); }
  .web-layout #app {
    inset: 0 0 var(--kb);
    width: auto;
    transform: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .web-layout #tabbar {
    inset: 0 0 auto;
    width: auto;
    justify-content: center;
    gap: 8px;
    padding: 10px var(--pad);
    transform: none;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: var(--bg-2);
  }
  .web-layout #tabbar.hide { transform: translateY(-110%); visibility: hidden; }
  .web-layout .tab {
    flex: 0 0 auto;
    flex-direction: row;
    gap: 8px;
    min-height: 40px;
    padding: 0 18px;
    color: var(--muted);
    border-radius: 9px;
  }
  .web-layout .tab svg { width: 18px; height: 18px; }
  .web-layout .tab span { font-size: 14px; }
  .web-layout .tab.is-active { background: var(--card-2); color: var(--ink); }
  .web-layout #screen-home, .web-layout #screen-stats, .web-layout #screen-me { top: 61px; }
  .web-layout .scroll {
    width: 100%;
    max-width: var(--desktop-width);
    margin-inline: auto;
    padding-top: 26px;
    min-height: 0;
  }
  .web-layout .pad-bottom { height: 40px; }
  .web-layout .head { padding: 0 0 20px; align-items: center; }
  .web-layout .head h1 { font-size: 29px; }
  .web-layout .head .eyebrow { color: var(--muted); font-size: 12px; }
  .web-layout .home-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
    grid-template-areas: ". heading" "overview categories";
    gap: 8px clamp(20px, 3vw, 36px);
    align-items: start;
  }
  .web-layout .home-overview { grid-area: overview; }
  .web-layout .home-categories { display: contents; }
  .web-layout .home-categories .sec-head { grid-area: heading; margin: 0; }
  .web-layout #cat-grid { grid-area: categories; }
  .web-layout .board { padding: 20px; }
  .web-layout .board-num { font-size: 48px; }
  .web-layout .board-k, .web-layout .board-kv span, .web-layout .hint-line { font-size: 12px; }
  .web-layout .quick .btn { min-width: 0; white-space: nowrap; }
  .web-layout .cat-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 10px;
  }
  .web-layout .cat-card { border-radius: 12px; }
  .web-layout .cat { padding: 10px 12px; gap: 9px; min-height: 64px; align-items: center; border-radius: 11px 0 0 11px; }
  .web-layout .cat-practice { border-start-end-radius: 11px; border-end-end-radius: 11px; }
  .web-layout .cat-glyph { width: 30px; height: 30px; border-radius: 8px; }
  .web-layout .cat-glyph svg { width: 16px; height: 16px; }
  .web-layout .cat-top { margin-bottom: 5px; }
  .web-layout .cat-bot { margin-top: 4px; gap: 7px; flex-wrap: wrap; }
  .web-layout .cat-name { white-space: normal; overflow-wrap: anywhere; font-size: 14px; line-height: 1.35; }
  .web-layout .hero-plot, .web-layout .hero-plot svg { height: 145px; }
  .web-layout .pile-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .web-layout #screen-me .scroll {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 24px;
    align-content: start;
    align-items: start;
  }
  .web-layout #screen-me .head,
  .web-layout #screen-me .foot-note,
  .web-layout #screen-me .pad-bottom { grid-column: 1 / -1; }
  .web-layout #screen-me .head { padding-bottom: 0; }
  .web-layout #screen-me .group { margin: 0; min-width: 0; }

  .web-layout .ses-top, .web-layout .ses-foot, .web-layout .sheet-head {
    width: 100%;
    flex: 0 0 auto;
    padding-inline: max(var(--pad), calc((100% - var(--desktop-width)) / 2 + var(--pad)));
  }
  .web-layout .ses-top, .web-layout .sheet-head { min-height: 56px; padding-block: 8px; border-bottom: 1px solid var(--line); }
  .web-layout .ses-top { gap: 10px; }
  .web-layout .ses-top .icon-btn { width: 36px; height: 36px; }
  .web-layout #ses-sheet { display: flex; gap: 7px; width: auto; padding-inline: 10px; border: 1px solid var(--line); }
  .web-layout #ses-sheet .desktop-only { display: inline; font-size: 13px; white-space: nowrap; }
  .web-layout #ses-prev:not([hidden]), .web-layout #ses-keys { display: inline-flex; width: auto; height: 36px; padding-inline: 11px; font-size: 13px; white-space: nowrap; }
  .web-layout .session-font { display: flex; align-items: center; flex: none; border: 1px solid var(--line); border-radius: 9px; }
  .web-layout .session-font button { width: 33px; height: 34px; color: var(--ink); font-size: 16px; }
  .web-layout .session-font span { min-width: 32px; text-align: center; color: var(--muted); font-size: 11px; }
  .web-layout .ses-count, .web-layout .ses-count b { font-size: 13px; }
  .web-layout .ses-foot { padding-block: 10px; background: var(--bg-2); border-top-color: var(--line); }
  .web-layout .ses-body { min-height: 0; flex: 1 1 auto; padding-block: 20px 14px; scrollbar-gutter: stable both-edges; }
  .web-layout #screen-session .ses-foot,
  .web-layout #screen-skim .ses-foot { background: transparent; }
  .web-layout .q-card,
  .web-layout .q-card.has-note {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
    align-items: start;
    align-content: start;
    gap: clamp(16px, 2.4vw, 30px);
    width: min(100%, calc(var(--desktop-width) - 2 * var(--pad)));
    min-height: 0;
    margin-inline: auto;
    padding: 0;
  }
  .web-layout .q-card:not(:has(.note-panel, .note-placeholder)) { grid-template-columns: minmax(0, 1fr); max-width: 760px; }
  .web-layout .q-content {
    display: block;
    min-width: 0;
    padding: clamp(16px, 1.8vw, 22px);
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--bg-2);
  }
  .web-layout .q-stem { font-size: calc(17px * var(--fs)); line-height: 1.7; margin-bottom: 16px; }
  .web-layout .q-idx, .web-layout .chip { font-size: 11px; }
  .web-layout .q-meta { flex-wrap: wrap; margin-bottom: 12px; }
  .web-layout .opts, .web-layout .order-list { gap: 6px; }
  .web-layout .opt, .web-layout .order-item { min-height: 40px; padding: 8px 10px; align-items: center; }
  .web-layout .opt, .web-layout .judge-btn, .web-layout .order-item { font-size: calc(14px * var(--fs)); }
  .web-layout .judge-btn { flex-direction: row; height: 44px; gap: 8px; padding-inline: 8px; }
  .web-layout .star { width: 30px; height: 30px; font-size: 16px; }
  .web-layout .q-card .star:hover, .web-layout .session-font button:hover { background: var(--card-2); }
  .web-layout .cat:hover, .web-layout .opt:not(.ok, .bad, .sel, .dim):hover { border-color: var(--muted); }
  .web-layout .note-panel, .web-layout .note-placeholder { margin: 0; min-width: 0; overflow-wrap: anywhere; }
  .web-layout .note-placeholder {
    display: block;
    padding: 20px;
    border: 1px dashed var(--line);
    border-radius: 13px;
    background: var(--bg-2);
  }
  .web-layout .has-note .note-placeholder { display: none; }
  .web-layout .note-placeholder h2 { margin-bottom: 6px; font-size: 15px; }
  .web-layout .note-placeholder p, .web-layout .note-link { font-size: 13px; color: var(--muted); }
  .web-layout .note-link { color: var(--accent); }
  .web-layout .note-toggle { min-height: 42px; font-size: 14px; }
  .web-layout .note-t { font-size: calc(13px * var(--fs)); }
  .web-layout .note-k, .web-layout .note-rel-k { font-size: 11px; color: var(--muted); }
  .web-layout .result-t { font-size: 14px; }
  .web-layout .result-d, .web-layout .result-note, .web-layout .grade-hint { font-size: 12px; color: var(--muted); }
  .web-layout [data-keyhint]::after, .web-layout .key-guide kbd {
    display: inline-grid;
    place-items: center;
    min-width: 18px;
    min-height: 17px;
    padding: 0 4px;
    border: 1px solid currentColor;
    border-radius: 4px;
    font: 11px/1.2 system-ui, sans-serif;
  }
  .web-layout [data-keyhint]::after {
    content: attr(data-keyhint);
    margin-inline-start: 6px;
    opacity: .75;
    vertical-align: 1px;
  }
  .web-layout .judge-btn::after, .web-layout .reveal-btn::after, .web-layout .slay-btn::after { margin-inline-start: 1px; }
  .web-layout .opt-key { margin-left: 4px; color: var(--faint); }
  .web-layout .opt-key::after { opacity: .85; }
  .web-layout .key-guide { margin: 12px 0; }
  .web-layout .key-guide div { display: grid; grid-template-columns: 148px 1fr; gap: 12px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line2); }
  .web-layout .key-guide dt, .web-layout .key-guide dd { margin: 0; font-size: 13px; line-height: 1.5; }
  .web-layout .key-guide dd { color: var(--muted); }
  .web-layout .next-btn { min-width: 110px; }
  .web-layout .undo-chip { top: 68px; right: max(14px, calc((100% - var(--desktop-width)) / 2 + 12px)); }
  .web-layout .mask { align-items: center; padding: 24px; }
  .web-layout .mask .sheet {
    width: min(100%, 660px);
    max-width: none;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    transform: translateY(8px);
  }
  .web-layout .mask.show .sheet { transform: none; }
  .web-layout .sheet-grip { display: none; }
  .web-layout .sheet h3 { font-size: 20px; }
  .web-layout .sheet .sub { font-size: 14px; }
  .web-layout .sc-grid { grid-template-columns: repeat(10, minmax(0, 1fr)); }
  .web-layout .sc-cell { min-height: 38px; }
  .web-layout .done-wrap { width: min(100%, 660px); margin-inline: auto; overflow-y: auto; }
  .web-layout #cd-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .web-layout #cd-list .card-item { margin-bottom: 0; }
  .web-layout #cd-list .empty-state { grid-column: 1 / -1; }
  .web-layout #wb-filter { flex-wrap: wrap; margin-inline: 0; padding-inline: 0; }
  .web-layout button:focus-visible, .web-layout input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
}

@media (min-width: 780px) and (max-width: 959px) and (hover: hover) and (pointer: fine) {
  .web-layout .home-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
  .web-layout .quick .btn { gap: 5px; padding-inline: 8px; font-size: 13px; }
  .web-layout .quick .btn svg { display: none; }
}
