/* 艾宾浩斯背诵闯关 · 视觉系统
   纸张 + 墨色，浅色主题 */

:root {
  --paper: #f5f3ee;
  --surface: #fffdfa;
  --ink: #1d1b18;
  --ink-soft: #4d4842;
  --muted: #8b857a;
  --line: #e6e1d6;
  --line-strong: #d5cec0;
  --accent: #b23b2a;
  --ok: #2f7a5f;
  --ok-bg: #e9f3ee;
  --bad: #b23b2a;
  --bad-bg: #fbecea;
  --gold: #a9781f;
  --radius: 16px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --serif: Georgia, "Songti SC", "SimSun", "Noto Serif SC", serif;
  --shadow: 0 1px 0 rgba(0, 0, 0, .02), 0 10px 30px -22px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; color: inherit; }
h1, h2, h3, h4 { letter-spacing: -.01em; }
::selection { background: #efe3c8; }

/* ---------------- 顶栏 ---------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(245, 243, 238, .88);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 780px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: .04em;
  white-space: nowrap;
}

.brand span {
  color: var(--muted);
  font-weight: 400;
  margin-left: 3px;
}

.nav {
  margin-left: auto;
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  /* 不加这条，flex 子项默认按内容撑宽，窄屏上整个 body 会被导航顶宽（页面整体右侧被切） */
  min-width: 0;
}

.nav::-webkit-scrollbar { display: none; }

.nav a {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13.5px;
  color: var(--muted);
  white-space: nowrap;
  transition: .16s;
}

.nav a:hover { color: var(--ink); background: rgba(0, 0, 0, .04); }
.nav a.active { color: #fff; background: var(--ink); }

.nav-all { opacity: .75; }

/* ---------------- 布局 ---------------- */

.wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 26px 20px 96px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: .04em;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  background: #efe9dc;
  color: #7a6a45;
  letter-spacing: .02em;
}

.chip.warm { background: #f6e7e0; color: #a3492f; }
.chip.plain { background: #eeece6; color: var(--muted); }

.hero {
  margin-bottom: 22px;
}

.hero h1 {
  font-size: 34px;
  line-height: 1.25;
  margin: 8px 0 20px;
  font-weight: 650;
  letter-spacing: -.02em;
}

.hero-sub {
  color: var(--muted);
  font-size: 13px;
  margin: 12px 0 0;
}

/* ---------------- 数字卡 ---------------- */

.numbers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

/* 错题本多一栏「已毕业」：宽屏四列，窄屏两行 */
#wrongNumbers { grid-template-columns: repeat(4, 1fr); }

.num {
  padding: 13px 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.num b {
  display: block;
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1.25;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.num span { font-size: 12px; color: var(--muted); }
.num.zero b { color: #aba496; }

/* ---------------- 按钮 ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 18px;
  font-size: 14.5px;
  font-weight: 500;
  transition: .16s ease;
  background: transparent;
}

.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #000; }
.btn-ghost { border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: rgba(0, 0, 0, .035); }
.btn-quiet { color: var(--muted); padding: 8px 12px; }
.btn-quiet:hover { color: var(--ink); background: rgba(0, 0, 0, .04); }
.btn-danger { color: var(--bad); border-color: rgba(178, 59, 42, .3); }
.btn-danger:hover { background: var(--bad-bg); }
.btn-lg { padding: 15px 24px; font-size: 16px; border-radius: 14px; width: 100%; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: translateY(1px); }

/* ---------------- 面板 ---------------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.panel + .panel { margin-top: 14px; }

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

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

.panel-head a, .panel-head span.more {
  font-size: 12.5px;
  color: var(--muted);
}

.panel-head a:hover { color: var(--ink); }

/* ---------------- 掌握度 ---------------- */

.meter {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #eee9df;
}

.meter i { display: block; height: 100%; transition: width .4s ease; }

.legend {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.legend div { font-size: 12px; color: var(--muted); }
.legend b {
  display: block;
  font-family: var(--serif);
  font-size: 17px;
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.legend .dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  margin-right: 5px;
  vertical-align: 1px;
}

/* ---------------- 未来 7 天 ---------------- */

.bars {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  height: 86px;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  height: 100%;
}

.bar-col .bar {
  width: 100%;
  border-radius: 5px 5px 3px 3px;
  background: #ded7c8;
  min-height: 3px;
  transition: height .3s;
}

.bar-col.today .bar { background: var(--ink); }
.bar-col .cap { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-col .cnt { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------------- 答题 ---------------- */

.quiz-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.level-strip { display: flex; gap: 6px; flex-wrap: wrap; }

.level-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 4px 9px;
  font-size: 12px;
  color: var(--muted);
  background: var(--surface);
  font-variant-numeric: tabular-nums;
}

.level-chip.active { border-color: var(--ink); color: var(--ink); font-weight: 600; }
.level-chip.passed { color: var(--ok); border-color: rgba(47, 122, 95, .35); background: var(--ok-bg); }
.level-chip.locked { opacity: .42; }
.level-chip.retry { color: var(--gold); border-color: rgba(169, 120, 31, .3); background: #fbf4e6; }

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}

.progress {
  height: 4px;
  background: #e8e3d9;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--ink);
  transition: width .35s ease;
}

.qcard {
  position: relative;
  border-radius: 18px;
  /* 阴影挂在窗口上：它不被 overflow 裁，翻页时也不会跟着卡片跑 */
  box-shadow: 0 1px 2px rgba(29, 27, 24, .04), 0 14px 30px -22px rgba(29, 27, 24, .35);
  touch-action: pan-y;
}

/* 卡片是一叠实体：左 / 当前 / 右三张并排躺在一条轨道上。
   拖动时轨道直接跟着手指走，停在半路就是两张卡片各露一半；
   松手才决定留在这一张还是翻过去 —— 位移即状态，不是播完就没的动画。 */
.qviewport {
  position: relative;
  overflow: hidden;
  transition: height .26s cubic-bezier(.22, .61, .36, 1);
}

.qtrack {
  --qgap: 14px;
  display: flex;
  align-items: flex-start;
  gap: var(--qgap);
  width: 100%;
  transform: translate3d(calc(-100% - var(--qgap)), 0, 0);
  will-change: transform;
}

.qpanel {
  flex: 0 0 100%;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 26px 24px 22px;
  transition: background .22s ease;
}

/* 回看已答题时这张卡片略偏纸色，和「正在作答」区分开 */
.qpanel.reviewing { background: #fbf9f3; }

/* 两侧的卡片只负责被看见，不接手势也不进朗读顺序 */
.qpanel[aria-hidden="true"] { pointer-events: none; }
.qpanel[aria-hidden="true"] .opts .opt { animation: none; }

.qcard.dragging { cursor: grabbing; }
.qcard.touching,
.qcard.touching *,
.qcard.dragging,
.qcard.dragging * {
  user-select: none;
  -webkit-user-select: none;
}

/* 输入框里还是交给系统：选字、拖光标都正常 */
.qcard input { touch-action: auto; }

.qmeta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
  font-variant-numeric: tabular-nums;
}

.badge {
  padding: 2px 8px;
  border-radius: 6px;
  background: #f1ece0;
  color: #6f6450;
  font-size: 11.5px;
  letter-spacing: .03em;
  white-space: nowrap;   /* 窄屏上「填空题」不能被拆成两行 */
  flex: none;
}

.badge.fill { background: #e9eef4; color: #455f78; }

.timer {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .04em;
}

.qstem {
  font-size: 21px;
  line-height: 1.8;
  font-weight: 500;
  margin: 0 0 22px;
  letter-spacing: .005em;
  word-break: break-word;
}

.blank {
  display: inline-block;
  min-width: 62px;
  border-bottom: 2px solid var(--ink);
  margin: 0 5px;
  height: 1.05em;
  vertical-align: -3px;
}

.opts { display: grid; gap: 9px; }

/* 选项错峰入场：一题里的选项像被「摆」出来，而不是同时闪现 */
.opts .opt {
  animation: optIn .3s cubic-bezier(.22, .61, .36, 1) both;
  animation-delay: calc(var(--i, 0) * 42ms);
}

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

.opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 15px;
  font-size: 15.5px;
  line-height: 1.5;
  transition: .14s ease;
}

.opt:hover:not(:disabled) { border-color: var(--line-strong); background: #fcfaf6; }
.opt .key {
  width: 23px;
  height: 23px;
  flex: 0 0 23px;
  border-radius: 7px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.opt.sel {
  border-color: var(--ink);
  background: #f7f4ec;
  box-shadow: inset 0 0 0 1px var(--ink);
}
.opt.sel .key { background: var(--ink); color: #fff; border-color: var(--ink); }
.opt.correct { border-color: var(--ok); background: var(--ok-bg); }
.opt.correct .key { background: var(--ok); color: #fff; border-color: var(--ok); }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.opt.wrong .key { background: var(--bad); color: #fff; border-color: var(--bad); }
.opt.dim { opacity: .52; }
.opt:disabled { cursor: default; }

.answer-input {
  width: 100%;
  font-family: inherit;
  font-size: 19px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  letter-spacing: .02em;
}

.answer-input::placeholder { color: #c3bcae; }

/* ---------------- 同句式分组 ---------------- */

/* 「____的，从重处罚」这类一串同句式的题：摊开整组，帮人认出问的是哪一条 */
.series {
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbf9f4;
}

/* 会泄漏答案的组：只显示「共 N 条 · 本题第 k 条」，不展开 */
.series-count {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--ink-soft);
}

.series > summary {
  list-style: none;
  cursor: pointer;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 8px;
}

.series > summary::-webkit-details-marker { display: none; }

.series > summary::after {
  content: "展开";
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.series[open] > summary::after { content: "收起"; }
.series[open] > summary { border-bottom: 1px dashed var(--line); }

.series-tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 99px;
  background: #efe9dc;
  color: var(--ink-soft);
  font-size: 11.5px;
  letter-spacing: .04em;
}

.series-list {
  margin: 0;
  padding: 10px 14px 12px 32px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--ink-soft);
}

.series-list li { margin: 3px 0; }
.series-list li.self { color: var(--ink); font-weight: 500; }
.series-list li.self .blank { min-width: 42px; height: .95em; vertical-align: -2px; }
.answer-input:focus {
  outline: none;
  border-color: #b2977a;
  box-shadow: 0 0 0 3px rgba(178, 151, 122, .14);
}
.answer-input:disabled { background: #f7f5f0; color: var(--ink-soft); }

.hint-line {
  margin: 10px 2px 0;
  font-size: 12.5px;
  color: var(--muted);
}

.feedback {
  margin-top: 18px;
  border-radius: 13px;
  padding: 14px 16px;
  font-size: 14px;
  border: 1px solid transparent;
  animation: rise .18s ease-out;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* 刚判完分：答对轻轻弹一下，答错微微一抖 */
.feedback.pop { animation: popIn .34s cubic-bezier(.22, .61, .36, 1); }
.feedback.shake { animation: shakeIn .42s ease-out; }

@keyframes popIn {
  0% { opacity: 0; transform: translateY(8px) scale(.988); }
  60% { opacity: 1; transform: translateY(0) scale(1.004); }
  100% { opacity: 1; transform: none; }
}

@keyframes shakeIn {
  0% { opacity: 0; transform: translateX(0); }
  18% { opacity: 1; transform: translateX(-5px); }
  38% { transform: translateX(4px); }
  58% { transform: translateX(-3px); }
  78% { transform: translateX(2px); }
  100% { opacity: 1; transform: none; }
}

.feedback.ok { background: var(--ok-bg); border-color: rgba(47, 122, 95, .22); }
.feedback.bad { background: var(--bad-bg); border-color: rgba(178, 59, 42, .2); }
.feedback h4 { margin: 0 0 6px; font-size: 13.5px; font-weight: 600; }
.feedback.ok h4 { color: var(--ok); }
.feedback.bad h4 { color: var(--bad); }
.feedback .ans { font-weight: 600; }
.feedback p { margin: 6px 0 0; color: var(--ink-soft); line-height: 1.75; font-size: 13.5px; }
.feedback .tip { color: var(--muted); font-size: 12.5px; margin-top: 8px; }

.qa-actions { display: flex; gap: 10px; margin-top: 20px; }
.qa-actions .btn-primary { flex: 1; }

/* 题目语境：顺序打乱后，靠这一行知道「这题在说什么」 */
.qcontext {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin: -6px 0 14px;
  padding: 8px 11px;
  border-radius: 10px;
  background: #f7f4ec;
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.5;
}

.qcontext .ctx-label {
  flex: 0 0 auto;
  font-size: 10.5px;
  letter-spacing: .06em;
  color: var(--muted);
  background: #efe9db;
  border-radius: 4px;
  padding: 1px 5px;
}

.qcontext .ctx-path { font-weight: 500; }
.qcontext .ctx-summary { color: var(--muted); }
.qcontext .ctx-summary::before { content: '· '; }

/* 前提：单独一行，比语境重一档，避免被当成装饰忽略 */
.qcontext .ctx-scene {
  flex: 1 0 100%;
  margin-top: 2px;
  padding-top: 6px;
  border-top: 1px dashed #e4dcc9;
  color: var(--ink-soft);
  line-height: 1.55;
}
.qcontext .ctx-scene b {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 5px;
  border-radius: 4px;
  background: #ebe3d0;
  color: #6f6450;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .06em;
}

/* 两级提示 */
.hint-line {
  margin: 10px 2px 0;
  font-size: 12.5px;
  color: var(--ink-soft);
}

.hint-line .hint-tag {
  display: inline-block;
  margin-right: 7px;
  padding: 0 5px;
  border-radius: 4px;
  background: #efe9db;
  color: #7a6a4d;
  font-size: 10.5px;
  letter-spacing: .04em;
}

.hint-line.quiet { color: var(--muted); font-size: 11.5px; }

/* 底部圆点：回看这一场答过的题 */
.dots {
  display: flex;
  gap: 6px;
  justify-content: flex-start;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  margin: 18px auto 0;
  padding: 8px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.dots::-webkit-scrollbar { display: none; }
.dots[hidden] { display: none; }

.dots .dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #fff;
  transition: .16s ease;
}

.dots .dot.ok { background: var(--ok); border-color: var(--ok); }
.dots .dot.bad { background: var(--bad); border-color: var(--bad); }
.dots .dot.cur { width: 22px; border-radius: 999px; }
.dots .dot.now { background: var(--ink); border-color: var(--ink); width: 22px; }
.dots .dot:hover { transform: scale(1.18); }

/* 刚答完的圆点弹一下，给「这题记下了」一个反馈 */
.dots .dot.pop { animation: dotPop .34s cubic-bezier(.2, .9, .3, 1); }

@keyframes dotPop {
  0% { transform: scale(.5); }
  55% { transform: scale(1.5); }
  100% { transform: scale(1); }
}

.dots-tip {
  margin: 2px 0 0;
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* 系统开了「减少动态效果」就老老实实不晃 */
@media (prefers-reduced-motion: reduce) {
  .opts .opt,
  .feedback,
  .feedback.pop,
  .feedback.shake,
  .dots .dot.pop {
    animation: none !important;
  }
  .center-card { animation: none !important; }
  .qcard,
  .qviewport,
  .dots .dot,
  .progress i {
    transition: none !important;
  }
  .dots .dot:hover { transform: none; }
}

/* ---------------- 结算 / 关卡失败 ---------------- */

.center-card {
  text-align: center;
  padding: 34px 24px;
  animation: panelIn .34s cubic-bezier(.22, .61, .36, 1);
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(10px) scale(.994); }
  to { opacity: 1; transform: none; }
}

.big-mark {
  width: 54px;
  height: 54px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 24px;
  background: var(--ok-bg);
  color: var(--ok);
}

.big-mark.bad { background: var(--bad-bg); color: var(--bad); }

.center-card h2 { margin: 0 0 8px; font-size: 21px; font-weight: 600; }
.center-card p { color: var(--muted); margin: 0 0 22px; font-size: 13.5px; }

.result-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 22px 0 24px;
}

.result-grid div {
  background: #faf8f3;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 6px;
}

.result-grid b {
  display: block;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.result-grid span { font-size: 11.5px; color: var(--muted); }

/* ---------------- 卡片库 ---------------- */

.deck {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.deck-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 17px 20px;
  cursor: pointer;
  user-select: none;
}

.deck-head:hover { background: #fcfaf6; }

.level-no {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 14px;
  background: #f1ece0;
  color: #8b857a;
  font-variant-numeric: tabular-nums;
}

.deck.learning .level-no { background: var(--ink); color: #fff; }
.deck.mastered .level-no { background: var(--ok-bg); color: var(--ok); }

.status {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 5px;
  margin-left: 7px;
  vertical-align: 2px;
  font-weight: 500;
  letter-spacing: .02em;
}

.status.pending { background: #f1ece0; color: #8b857a; }
.status.learning { background: #fbf4e6; color: #8a6a20; }
.status.mastered { background: var(--ok-bg); color: var(--ok); }
.status.graduated { background: #eef1ea; color: #6d7b62; }

.deck-title { flex: 1; min-width: 0; }
.deck-title h3 { margin: 0; font-size: 16px; font-weight: 600; }
.deck-title p {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deck-stat {
  text-align: right;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.deck-stat b {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.chev {
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  transition: transform .18s ease;
}

.deck-head.open .chev { transform: rotate(90deg); }

.deck-body { border-top: 1px solid var(--line); padding: 4px 20px 18px; }
.deck-body[hidden] { display: none; }

.note { padding: 14px 0; border-bottom: 1px dashed var(--line); }
.note:last-child { border-bottom: none; }
.note-path { font-size: 11.5px; color: var(--muted); letter-spacing: .02em; }
.note h4 { margin: 3px 0 8px; font-size: 15px; font-weight: 600; }
.note ul { margin: 0; padding-left: 17px; }
.note li { font-size: 13.5px; color: var(--ink-soft); margin-bottom: 4px; line-height: 1.7; }
.note-meta { font-size: 11.5px; color: var(--muted); margin-top: 8px; }

.search {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.search input {
  flex: 1;
  font-family: inherit;
  font-size: 14px;
  padding: 10px 14px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.search input:focus { outline: none; border-color: var(--ink); }

/* ---------------- 统计 ---------------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 15px;
}

.kpi b {
  display: block;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

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

.chart { display: flex; gap: 6px; align-items: flex-end; height: 128px; }

.chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  height: 100%;
}

.chart-col .stack {
  width: 100%;
  position: relative;
  border-radius: 4px 4px 2px 2px;
  background: #e4dfd3;
  overflow: hidden;
  min-height: 3px;
}

.chart-col .stack i {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: #9dbcaa;
  display: block;
}

.chart-col.today .stack { background: #cfc7b6; }
.chart-col.today .stack i { background: var(--ok); }
.chart-col .cap { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.mastery-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
  font-size: 13px;
}

.mastery-row .lab { width: 34px; color: var(--muted); font-size: 12.5px; }
.mastery-row .track { flex: 1; height: 8px; background: #f0ece2; border-radius: 999px; overflow: hidden; }
.mastery-row .track i { display: block; height: 100%; border-radius: 999px; }
.mastery-row .val { width: 40px; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; }

.wrong-item {
  display: flex;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13.5px;
}
.wrong-item:last-child { border-bottom: none; }
.wrong-item .n {
  flex: 0 0 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--bad-bg);
  color: var(--bad);
  font-size: 11.5px;
  display: grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
}
.wrong-item p { margin: 0; color: var(--ink-soft); line-height: 1.6; }
.wrong-item small { color: var(--muted); }

/* ---------------- 表单 ---------------- */

.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }

.field input, .field textarea, .field select {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.field input[type="checkbox"] {
  width: 15px;
  height: 15px;
  padding: 0;
  margin: 0;
  accent-color: var(--ink);
  cursor: pointer;
}

.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(29, 27, 24, .06);
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--ink-soft);
  cursor: pointer;
}

textarea.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.7;
  min-height: 260px;
  resize: vertical;
  background: #fbfaf6;
}

.help {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.75;
}

.help code {
  background: #f0ece2;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11.5px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}

details.schema { margin-top: 14px; }
details.schema summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-soft);
  padding: 6px 0;
}
details.schema summary:hover { color: var(--ink); }

/* ---------------- 导入预览 ---------------- */

.preview-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 14px 0 18px;
}

.stat-pill {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 5px 11px;
  font-size: 12.5px;
  color: var(--ink-soft);
  background: #fbfaf6;
}

.stat-pill b { font-family: var(--serif); font-size: 15px; }

.preview-card { border-top: 1px dashed var(--line); padding: 13px 0; }
.preview-card:first-of-type { border-top: none; }
.preview-card h4 { margin: 0 0 6px; font-size: 14px; }
.preview-card .qline {
  font-size: 13px;
  color: var(--ink-soft);
  padding: 3px 0;
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.preview-card .qline .t {
  flex: 0 0 auto;
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #f0ece2;
  color: #6f6450;
}
.preview-card .qline .t.fill { background: #e9eef4; color: #455f78; }
.preview-card .qline .a { color: var(--muted); font-size: 12px; }
.preview-card .qline .a b { color: var(--ok); font-weight: 600; }

.warn-list {
  margin: 10px 0 0;
  padding: 10px 14px;
  background: #fbf4e6;
  border: 1px solid rgba(169, 120, 31, .2);
  border-radius: 10px;
  font-size: 12.5px;
  color: #8a6a20;
}

/* ---------------- 杂项 ---------------- */

.empty { text-align: center; color: var(--muted); padding: 46px 20px; font-size: 14px; }
.empty .btn { margin-top: 16px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 12px);
  background: rgba(29, 27, 24, .94);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transition: .22s ease;
  z-index: 100;
  max-width: 88vw;
  text-align: center;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

.footer-links {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-top: 26px;
  font-size: 12.5px;
  color: var(--muted);
}

.footer-links a:hover { color: var(--ink); }

.section-title {
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: .06em;
  margin: 26px 2px 10px;
}

#previewArea { scroll-margin-top: 74px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------------- 响应式 ---------------- */

@media (max-width: 620px) {
  .wrap { padding: 20px 16px 88px; }
  .hero h1 { font-size: 27px; }
  .qstem { font-size: 18.5px; line-height: 1.85; }
  .blank { min-width: 46px; margin: 0 4px; }
  .qcard { padding: 22px 18px 18px; border-radius: 16px; }
  .numbers { gap: 8px; }
  .num { padding: 11px 12px; }
  .num b { font-size: 22px; }
  .kpi-grid, .result-grid { grid-template-columns: repeat(2, 1fr); }
  .legend { grid-template-columns: repeat(2, 1fr); }
  .field-row { grid-template-columns: 1fr; }
  .brand span { display: none; }
  .deck-stat.mastery { display: none; }
  .topbar-inner { padding: 10px 16px; gap: 8px; }
  .nav a { padding: 6px 10px; }
  /* 口诀换行后开头那个「·」会像多出来的个小点，窄屏直接去掉 */
  .qcontext .ctx-summary { flex: 1 0 100%; margin-top: 2px; }
  .qcontext .ctx-summary::before { content: ''; }
}

/* ---------------- 专题首页 ---------------- */

.landing-head { margin: 4px 0 22px; }

.landing-head h1 {
  font-size: 31px;
  line-height: 1.3;
  margin: 10px 0 12px;
  font-weight: 650;
  letter-spacing: -.02em;
}

.landing-sub {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.8;
  margin: 0;
  max-width: 32em;
}

.landing-foot {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  margin: 26px 0 0;
}

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

.subject {
  display: block;
  padding: 17px 18px 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: .18s ease;
}

.subject:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, .02), 0 16px 34px -24px rgba(0, 0, 0, .5);
}

.subject-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 13px;
  align-items: start;
}

.subject-no {
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.2;
  color: #c6bfb0;
  font-variant-numeric: tabular-nums;
  padding-top: 1px;
}

.subject-title h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -.01em;
}

.subject-hint {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: .02em;
  background: #f1ece0;
  color: #8b857a;
  vertical-align: 2px;
}

.subject-title p {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
}

.subject-go {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  padding-top: 5px;
}

.subject:hover .subject-go { color: var(--ink); }

.subject-bar {
  margin: 14px 0 9px;
  height: 4px;
  border-radius: 999px;
  background: #ece7db;
  overflow: hidden;
}

.subject-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--ink);
  transition: width .4s ease;
}

.subject.t-accent .subject-bar i { background: var(--accent); }
.subject.t-gold .subject-bar i { background: var(--gold); }
.subject.t-ink .subject-bar i { background: var(--ink); }

.subject-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.subject-meta .hot { color: var(--accent); }

.subject-cta {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px dashed var(--line);
  font-size: 12.5px;
  color: var(--ink-soft);
}



/* ---------------- 关卡分组 / 分组标题卡片 ---------------- */

.group-head {
  font-size: 12px;
  letter-spacing: .1em;
  color: var(--muted);
  font-weight: 600;
  margin: 22px 0 9px;
}

.group-head:first-child { margin-top: 2px; }

.note-group {
  padding: 12px 0 6px;
  border-bottom: 1px dashed var(--line);
}

.note-group h4 {
  margin: 0;
  font-size: 12.5px;
  letter-spacing: .08em;
  color: var(--muted);
  font-weight: 600;
  text-transform: none;
}

@media (max-width: 620px) {
  .landing-head h1 { font-size: 26px; }
  .subject { padding: 15px 15px 12px; }
  .subject-title h2 { font-size: 16.5px; }
  .subject-hint { display: none; }
}

/* ---------------- 错题本 ---------------- */

.hero-extra { margin-top: 10px; }
.hero-extra .chip { font-size: 12.5px; padding: 4px 11px; }

/* ---------------- 高级选项：挑关卡 ---------------- */

.focus-entry { margin-top: 12px; }

.link-btn {
  border: none;
  background: none;
  padding: 2px 0;
  color: var(--muted);
  font-family: inherit;
  font-size: 12.5px;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-btn:hover { color: var(--ink); }

.link-btn:disabled {
  color: var(--line-strong);
  text-decoration: none;
  cursor: default;
}

/* 全选 / 反选 / 清空：紧贴列表上方的一排操作 */
.focus-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 14px;
  margin-top: 10px;
}

.focus-tools .help {
  margin: 0 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.focus-panel {
  margin-top: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  text-align: left;
  box-shadow: var(--shadow);
}

.focus-head h3 { margin: 0 0 4px; font-size: 14px; }
.focus-head .help { margin: 0 0 10px; }

.focus-search {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  padding: 7px 11px;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  outline: none;
}

.focus-search:focus { border-color: var(--line-strong); }

.focus-list {
  margin-top: 8px;
  max-height: 320px;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.focus-list > .help { padding: 10px 2px; margin: 0; }

.focus-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.focus-item:last-child { border-bottom: none; }
.focus-item:hover { background: rgba(0, 0, 0, .02); }

.focus-item input {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  accent-color: var(--ink);
}

.focus-no {
  flex: 0 0 auto;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.focus-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.4;
}

.focus-main b {
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.focus-main span { font-size: 11.5px; color: var(--muted); }

.focus-tag {
  flex: 0 0 auto;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #eeece6;
  color: var(--muted);
  white-space: nowrap;
}

.focus-item.st-learning .focus-tag { background: var(--ok-bg); color: var(--ok); }
.focus-item.st-mastered .focus-tag { background: #f3eddf; color: var(--gold); }
.focus-item.on { background: rgba(178, 59, 42, .04); }
.focus-item.on .focus-main b { font-weight: 600; }

.focus-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 10px;
}

.focus-foot .help { flex: 1 1 auto; margin: 0; }
.focus-foot .btn { padding: 8px 14px; font-size: 13.5px; }

.wrong-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.wrong-actions .btn-lg { flex: 0 1 auto; }
.wrong-actions .help { margin: 0; }

.seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: #f1ece0;
}

.seg-btn {
  border: none;
  background: transparent;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12.5px;
  color: var(--muted);
  transition: .15s;
}

.seg-btn.active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.06); }

.level-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
}

.level-filter .level-chip { cursor: pointer; }
.level-filter .level-chip.active { border-color: var(--ink); color: var(--ink); font-weight: 600; }

/* 清单工具条：搜索框 + 左边关卡筛选、右边「排序 + 一键展开答案」 */
.wrong-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}

.wrong-search:focus-within {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(178, 59, 42, .08);
}

.wrong-search-icon { flex: 0 0 auto; color: var(--muted); }

.wrong-search input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  outline: none;
  background: none;
  padding: 0;
  font-size: 13.5px;
  color: var(--ink);
}

.wrong-search input::placeholder { color: var(--muted); }

/* 用自绘的清空按钮，各家浏览器的原生 ✕ 位置/样式不一致 */
.wrong-search input::-webkit-search-cancel-button,
.wrong-search input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }

.wrong-search-clear {
  flex: 0 0 auto;
  border: none;
  background: none;
  padding: 0 2px;
  font-size: 13px;
  line-height: 1;
  color: var(--muted);
}

.wrong-search-clear:hover { color: var(--ink); }

/* 命中的关键词 */
.wrong-card mark {
  background: #f7e6b0;
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}

.wrong-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin: 0 0 14px;
}

.wrong-bar .level-filter { flex: 1 1 auto; margin: 0; }

.wrong-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin-left: auto;
}

/* 屏幕再窄就把开关挤到下一行，靠右对齐，不至于顶出面板 */
.wrong-tools .switch { margin-left: auto; }

/* 排序：比上面的范围切换更轻，白底细边，不抢主次 */
.seg-sm {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 2px;
}

.seg-sm .seg-btn { padding: 3px 10px; font-size: 12px; }
.seg-sm .seg-btn.active { background: #f3eddf; box-shadow: none; }

/* 一键展开答案：拨动开关 */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: none;
  background: none;
  padding: 0;
  font-size: 12.5px;
  color: var(--muted);
  transition: color .15s;
}

.switch-text { white-space: nowrap; }

.switch-track {
  position: relative;
  flex: 0 0 auto;
  width: 34px;
  height: 19px;
  border-radius: 999px;
  background: #e2dccd;
  transition: background .18s;
}

.switch-dot {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .18);
  transition: transform .18s;
}

.switch:hover .switch-track { background: #d8d1c0; }

.switch.on { color: var(--ink); }
.switch.on .switch-track { background: var(--accent); }
.switch.on .switch-dot { transform: translateX(15px); }
.switch.on:hover .switch-track { background: #9c3325; }

.switch:focus-visible {
  outline: 2px solid rgba(178, 59, 42, .35);
  outline-offset: 3px;
  border-radius: 999px;
}

.wrong-card {
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 14px 16px;
  margin-bottom: 10px;
  background: #fff;
}

.wrong-card.resolved { opacity: .72; }
/* 已毕业：错过的题又回到了巩固档，留个印子就够了 */
.wrong-card.graduated { opacity: .55; }
.wrong-card.graduated .wrong-count { color: var(--muted); }

.wrong-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 7px;
  font-variant-numeric: tabular-nums;
}

.wrong-ctx { color: var(--ink-soft); }
.wrong-meta .status { margin-left: 0; }
.wrong-count { color: var(--bad); }
.wrong-weight { margin-left: auto; }
/* 反复错到负分：直接标成「欠账」，一眼挑出来 */
.wrong-weight.negative { color: var(--bad); font-weight: 600; }

.wrong-stem {
  margin: 0 0 8px;
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink);
}

.wrong-answer {
  margin: 0 0 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f7f4ec;
  font-size: 13.5px;
}

.wrong-answer p { margin: 6px 0 0; }

.wrong-toggle {
  border: none;
  background: none;
  padding: 0;
  font-size: 12.5px;
  color: var(--accent);
}

.wrong-toggle:hover { text-decoration: underline; }

@media (max-width: 620px) {
  .hero-extra { margin-top: 10px; }
.hero-extra .chip { font-size: 12.5px; padding: 4px 11px; }

.wrong-actions { flex-direction: column; align-items: stretch; }
  .wrong-actions .btn-lg { width: 100%; }
  .wrong-weight { margin-left: 0; }

  /* 错题本：四栏数字改两行，四个范围切换按钮允许换行 */
  #wrongNumbers { grid-template-columns: repeat(2, 1fr); }
  .panel-head { flex-wrap: wrap; row-gap: 8px; }
  .seg { flex-wrap: wrap; border-radius: 14px; }
  .seg-btn { padding: 4px 10px; }

  /* 工具条：关卡筛选占一行，排序 + 展开开关另占一行（左右分开） */
  .wrong-tools { width: 100%; margin-left: 0; justify-content: space-between; }
  .seg-sm { border-radius: 999px; }
  /* iOS 上输入框字号小于 16px 会自动放大页面，搜索框按 16px 走 */
  .wrong-search input { font-size: 16px; }
}
