:root {
  --paper: #f6f4ef;
  --card: #ffffff;
  --ink: #1d2126;
  --muted: #707885;
  --faint: #9aa1ab;
  --line: #e5e1d7;
  --accent: #2f6f5e;
  --accent-bg: #eaf1ed;
  --bad: #b3402f;
  --bad-bg: #fbeeea;
  --dim: #8a7f66;
  --dim-bg: #f3efe4;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.7 "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
#app { max-width: 700px; margin: 0 auto; padding: 26px 18px 90px; }

/* ---------- 通用 ---------- */
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.35; }
h1 { font-family: "Songti SC", "SimSun", Georgia, serif; font-size: 27px; letter-spacing: .5px; }
h2 { font-size: 15px; color: var(--muted); font-weight: 600; letter-spacing: .4px; }
p { margin: 0; }
.sub { color: var(--muted); font-size: 13.5px; margin-top: 6px; }
.hd { margin-bottom: 26px; }
.hd h1 { margin-bottom: 2px; }
.mono { font-variant-numeric: tabular-nums; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 14px;
}
.panel.is-locked { opacity: .42; pointer-events: none; }
.panel > h2 { margin-bottom: 14px; }
.panel .hint { color: var(--faint); font-size: 12.5px; margin-top: 12px; line-height: 1.6; }

/* ---------- 年级 ---------- */
.grades { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grade {
  appearance: none; border: 1px solid var(--line); background: #fbfaf6;
  border-radius: 11px; padding: 14px 8px 12px; cursor: pointer;
  font: inherit; color: var(--ink); text-align: center; transition: .15s;
}
.grade small { display: block; color: var(--faint); font-size: 11.5px; margin-top: 3px; }
.grade b { font-size: 17px; font-weight: 600; }
.grade:hover { border-color: #cfc9b9; }
.grade.on { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.grade.on small { color: #5d8a7c; }

/* ---------- 单元 ---------- */
.term-label {
  font-size: 12px; color: var(--faint); margin: 16px 0 8px; letter-spacing: .6px;
}
.term-label:first-child { margin-top: 0; }
.units { display: flex; flex-direction: column; gap: 7px; }
.unit {
  appearance: none; width: 100%; text-align: left; cursor: pointer; font: inherit;
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 11px 13px; display: flex; align-items: baseline; gap: 8px; color: var(--ink);
  transition: .12s;
}
.unit:hover { border-color: #cfc9b9; background: #fdfcf9; }
.unit .no { color: var(--faint); font-size: 12.5px; min-width: 44px; }
.unit .nm { flex: 1; font-size: 15px; }
.unit .ct { color: var(--faint); font-size: 12px; }
.unit .exb { margin-left: 8px; }

/* 考试重要度徽章 */
.exb { display: inline-block; vertical-align: middle; font-size: 11.5px; line-height: 1;
  padding: 3px 6px; border-radius: 5px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent; }
.exb-hi { background: #fdeceb; color: #c0392b; border-color: #f3c2bd; }
.exb-mid { background: #fff6e6; color: #b9770e; border-color: #f0d9a8; }
.exb-lo { background: #eef1f4; color: #6b7785; border-color: #dde3ea; }
.unit.on { border-color: var(--accent); background: var(--accent-bg); }
.unit.on .nm { color: var(--accent); font-weight: 600; }

/* ---------- 搜索 / 知识点 ---------- */
input[type="text"], input[type="search"] {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 13px; font: inherit; color: var(--ink); background: #fff;
}
input[type="text"]:focus, input[type="search"]:focus { outline: 2px solid var(--accent-bg); border-color: var(--accent); }
.hits { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow: auto; }
.hit {
  appearance: none; text-align: left; font: inherit; cursor: pointer; color: var(--ink);
  border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 9px 12px; font-size: 14px;
}
.hit small { color: var(--faint); font-size: 11.5px; margin-left: 6px; }
.hit.on { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }

/* ---------- 题量 ---------- */
.chips { display: flex; gap: 8px; }
.chip {
  appearance: none; font: inherit; cursor: pointer; border: 1px solid var(--line);
  background: #fff; color: var(--ink); border-radius: 999px; padding: 7px 16px; font-size: 14px;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- 主按钮 ---------- */
.primary {
  appearance: none; font: inherit; cursor: pointer; width: 100%;
  background: var(--accent); color: #fff; border: 0; border-radius: 12px;
  padding: 15px; font-size: 16px; font-weight: 600; letter-spacing: .5px;
  transition: .15s;
}
.primary:hover { background: #275c4d; }
.primary:disabled { background: #cfd4d1; cursor: not-allowed; }
.ghost {
  appearance: none; font: inherit; cursor: pointer; background: transparent;
  border: 1px solid var(--line); color: var(--muted); border-radius: 10px;
  padding: 11px 18px; font-size: 14px;
}
.ghost:hover { border-color: #cfc9b9; color: var(--ink); }
.row { display: flex; gap: 10px; }
.row .primary { flex: 1; }

/* ---------- 答题 ---------- */
.qbar { margin-bottom: 18px; }
.bar { height: 3px; background: #e7e3d8; border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); transition: width .3s ease; }
.qmeta {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12.5px; color: var(--faint); margin-top: 9px;
}
.qmeta .tag {
  background: var(--dim-bg); color: var(--dim); border-radius: 5px;
  padding: 2px 8px; font-size: 11.5px;
}

.qcard {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 24px 20px; margin-bottom: 14px;
}
.stem { font-size: 18px; line-height: 1.85; letter-spacing: .2px; }
.stem .blank { color: var(--accent); font-weight: 600; }

.opts { display: flex; flex-direction: column; gap: 9px; margin-top: 20px; }
.opt {
  appearance: none; font: inherit; cursor: pointer; color: var(--ink); text-align: left;
  display: flex; align-items: flex-start; gap: 11px;
  border: 1px solid var(--line); background: #fff; border-radius: 11px;
  padding: 13px 14px; font-size: 16px; line-height: 1.6; transition: .12s;
}
.opt:hover { border-color: #cfc9b9; background: #fdfcf9; }
.opt b {
  flex: 0 0 22px; height: 22px; border-radius: 50%; background: #f2efe7;
  color: var(--muted); font-size: 12.5px; font-weight: 600; text-align: center;
  line-height: 22px; margin-top: 1px;
}
.opt.right { border-color: var(--accent); background: var(--accent-bg); }
.opt.right b { background: var(--accent); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.opt.wrong b { background: var(--bad); color: #fff; }
.opt[disabled] { cursor: default; }
.opt[disabled]:hover { background: inherit; border-color: inherit; }

.answer { display: flex; gap: 9px; margin-top: 20px; }
.answer input { flex: 1 1 0; min-width: 0; width: auto; font-size: 17px; padding: 13px; }
.answer .primary { flex: 0 0 auto; width: auto; padding: 0 26px; }

/* 快捷符号键：手机数字键盘打不出 / 和 又 */
.keys { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.keys .kb {
  font-family: inherit; font-size: 16px; font-weight: 700; line-height: 1;
  min-width: 46px; height: 40px; padding: 0 12px;
  color: #2f6f5e; background: #eef3f0; border: 1px solid #d8e2dc;
  border-radius: 10px; cursor: pointer; transition: .12s;
}
.keys .kb:hover { background: #e3ece7; }
.keys .kb:active { background: #d5e3dc; transform: scale(.97); }
.keys .kbtip { font-size: 12.5px; color: #8a8070; line-height: 1.5; }
.keys .kbtip b { color: #4a5a52; font-weight: 700; }
.nw { white-space: nowrap; }
/* 竖式分数：分子在上、分母在下，中间一条分数线 */
.frac { display: inline-flex; flex-direction: column; vertical-align: 0.22em;
  text-align: center; font-size: 0.84em; line-height: 1.02; margin: 0 0.12em; }
.frac > i { display: block; font-style: normal; padding: 0 0.18em; }
.frac > i.h { border-top: 1px solid currentColor; }
.frac.hole > i:first-child { padding: 0 0.02em; }

/* ---------- 判定 ---------- */
.verdict-bar {
  border-radius: 12px; padding: 14px 16px; margin-bottom: 14px;
  display: flex; align-items: flex-start; gap: 10px; font-size: 15px;
}
.verdict-bar.ok { background: var(--accent-bg); color: #24564a; }
.verdict-bar.no { background: var(--bad-bg); color: #8d3223; }
.verdict-bar .mark { font-weight: 700; font-size: 16px; }
.sol {
  background: #fbfaf6; border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; font-size: 14.5px; color: #4a5158; line-height: 1.8;
}
.sol b { color: var(--muted); font-size: 12px; display: block; margin-bottom: 4px; font-weight: 600; letter-spacing: .5px; }

/* ---------- 报告 ---------- */
.big { font-size: 21px; font-weight: 600; line-height: 1.5; letter-spacing: .3px; }
.big em { font-style: normal; color: var(--bad); }
.big.ok em { color: var(--accent); }
.lede { color: #4a5158; font-size: 14.5px; margin-top: 10px; line-height: 1.8; }

.chain { margin-top: 4px; }
.node {
  border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; background: #fff;
}
.node .nm { font-size: 15.5px; font-weight: 600; }
.node .meta { font-size: 12px; color: var(--faint); margin-top: 2px; }
.node.bad { border-color: #e2b8b0; background: var(--bad-bg); }
.node.bad .nm { color: var(--bad); }
.node.bad .meta { color: #a8665b; }
.link {
  display: flex; gap: 10px; align-items: flex-start; padding: 9px 0 9px 14px;
  border-left: 2px dashed #d8d2c4; margin-left: 14px;
}
.link .arw { color: var(--faint); font-size: 13px; padding-top: 1px; }
.link .why { font-size: 13px; color: var(--muted); line-height: 1.7; }

.item { display: flex; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); }
.item:first-of-type { border-top: 0; }
.item .idx {
  flex: 0 0 22px; height: 22px; border-radius: 50%; background: var(--bad-bg); color: var(--bad);
  font-size: 12px; font-weight: 600; text-align: center; line-height: 22px; margin-top: 2px;
}
.item .body { flex: 1; min-width: 0; }
.item .nm { font-weight: 600; font-size: 15.5px; }
.item .ds { font-size: 13.5px; color: var(--muted); margin-top: 3px; line-height: 1.7; }
.item .why { font-size: 13px; color: #6b6250; margin-top: 7px; padding-left: 11px; border-left: 2px solid #e6dfcd; line-height: 1.7; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tagx {
  font-size: 12.5px; background: var(--accent-bg); color: #35705f;
  border-radius: 6px; padding: 3px 9px;
}
.tagx.dim { background: var(--dim-bg); color: var(--dim); }

.steps { margin: 0; padding-left: 0; list-style: none; counter-reset: s; }
.steps li {
  counter-increment: s; position: relative; padding-left: 30px; margin-bottom: 14px;
  font-size: 14.5px; line-height: 1.75; color: #3d444b;
}
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 1px;
  width: 20px; height: 20px; border-radius: 50%; background: var(--accent-bg);
  color: var(--accent); font-size: 11.5px; font-weight: 700; text-align: center; line-height: 20px;
}
.steps li b { color: var(--ink); }

.ws {
  display: flex; align-items: center; gap: 12px; text-decoration: none;
  border: 1px solid var(--accent); background: var(--accent-bg); border-radius: 11px;
  padding: 13px 15px; color: var(--accent); margin-top: 12px;
}
.ws:hover { background: #e0ece6; }
.ws .t { flex: 1; font-size: 14.5px; font-weight: 600; }
.ws .a { font-size: 12.5px; opacity: .8; }

.rv { border-top: 1px solid var(--line); padding: 14px 0 4px; }
.rv:first-of-type { border-top: 0; padding-top: 2px; }
.rh { display: flex; gap: 9px; font-size: 15px; line-height: 1.75; }
.rn {
  flex: 0 0 20px; height: 20px; border-radius: 50%; background: var(--bad-bg); color: var(--bad);
  font-size: 11.5px; font-weight: 600; text-align: center; line-height: 20px; margin-top: 3px;
}
.ra { font-size: 13.5px; color: var(--accent); margin: 7px 0 4px 29px; font-variant-numeric: tabular-nums; }
.rs { font-size: 13px; color: var(--muted); line-height: 1.75; margin-left: 29px; }

details { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
details summary {
  cursor: pointer; font-size: 13.5px; color: var(--muted); list-style: none;
}
details summary::-webkit-details-marker { display: none; }
details summary::before { content: "▸ "; color: var(--faint); }
details[open] summary::before { content: "▾ "; }
.tbl { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13.5px; }
.tbl td { padding: 7px 0; border-top: 1px solid #f0ece3; vertical-align: top; }
.tbl td:first-child { color: var(--faint); width: 34px; }
.tbl .r { color: var(--accent); }
.tbl .w { color: var(--bad); }

.foot { margin-top: 26px; }
.empty { color: var(--faint); font-size: 14px; }

/* 去掉移动端点击的 300ms 延迟，按钮更大更好点 */
button, .opt, .unit, .grade, .chip, .hit, .navbtn, .ws-o { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

/* ---------- 顶部导航 ---------- */
.topnav {
  display: flex; align-items: center; gap: 8px;
  margin: -26px -18px 18px; padding: 11px 18px;
  background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.topnav .navbtn {
  appearance: none; font: inherit; cursor: pointer; border: 1px solid var(--line);
  background: #fff; color: var(--muted); border-radius: 999px;
  padding: 6px 16px; font-size: 13.5px; transition: .12s;
}
.topnav .navbtn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.topnav .navtitle { margin-left: auto; font-size: 12.5px; color: var(--faint); }

/* ---------- 练习卷（排版 + 打印） ---------- */
.ws-wrap {
  max-width: 180mm; margin: 18px auto; background: #fff;
  padding: 10mm 12mm; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.ws-head h1 {
  font-family: "Songti SC", "SimSun", Georgia, serif;
  font-size: 20px; text-align: center; margin: 0 0 4px; letter-spacing: 1px;
}
.ws-meta {
  display: flex; justify-content: space-between; align-items: flex-end;
  border-bottom: 1.5px solid #111; padding-bottom: 6px; margin-bottom: 16px;
  font-size: 12.5px; color: #333; font-family: "Songti SC", "SimSun", serif;
}
.ws-qs { list-style: none; padding: 0; margin: 0; }
.ws-qs > li { margin-bottom: 13px; break-inside: avoid; }
.ws-stem {
  font-family: "Songti SC", "SimSun", serif; font-size: 15px; line-height: 1.95;
  text-align: justify; letter-spacing: .2px;
}
.ws-num { font-weight: 700; margin-right: 6px; }
.ws-opts { display: flex; flex-wrap: wrap; gap: 5px 24px; margin: 5px 0 0 26px; }
.ws-o {
  font-family: "Songti SC", "SimSun", serif; font-size: 14px; line-height: 1.9;
  white-space: nowrap;
}
.ws-work { height: 32px; margin: 6px 0 0 26px; border-bottom: 1px dashed #bbb; }
.ws-answers { page-break-before: always; margin-top: 8px; }
.ws-answers h2 {
  font-family: "Songti SC", "SimSun", serif; font-size: 16px;
  margin: 0 0 12px; font-weight: 700;
}
.ws-as { list-style: none; padding: 0; margin: 0; }
.ws-as > li { margin-bottom: 9px; break-inside: avoid; font-size: 13px; line-height: 1.7; }
.ws-a { font-family: "Songti SC", "SimSun", serif; }
.ws-anum { font-weight: 700; margin-right: 5px; }
.ws-lv { color: #999; font-size: 11px; margin-left: 7px; }
.ws-sol { color: #555; margin-left: 18px; }

@media (max-width: 380px) {
  h1 { font-size: 23px; }
  .stem { font-size: 17px; }
  #app { padding: 20px 14px 80px; }
}

@media print {
  body { background: #fff; }
  #app { max-width: none; padding: 0 !important; }
  .no-print, .topnav { display: none !important; }
  .qcard, .node, .rv, .item, .ws-qs > li, .ws-as > li { break-inside: avoid; }
  .panel { break-inside: auto; }
  a[href]::after { content: ""; }
  /* 练习卷：去掉屏幕上的纸边阴影，直接铺满 A4 打印区 */
  .ws-wrap { max-width: none; margin: 0; border: 0; border-radius: 0; box-shadow: none; padding: 0; }
  .ws-answers { page-break-before: always; }
  @page { size: A4; margin: 14mm 13mm; }
}
