/* ==========================================================================
   统计学原理 · 可视化课堂
   设计系统  ——  学术出版社质感：暖纸底 + 墨色字 + 蜂蜜金主色
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  color-scheme: light;

  /* 纸面与墨色 */
  --paper: #fbf8f3;
  --paper-2: #f4efe6;
  --panel: #ffffff;
  --panel-2: #fdfbf7;
  --ink: #17130f;
  --ink-2: #4a423a;
  --ink-3: #857a6d;
  --ink-4: #b3a897;
  --line: #e7dfd2;
  --line-2: #d8cdbb;

  /* 主色与强调色 */
  --honey: #c9801f;
  --honey-soft: #f5e3c6;
  --honey-ink: #8a5510;
  --teal: #2b7a72;
  --teal-soft: #d8ece9;
  --plum: #8a4c85;
  --plum-soft: #eedff0;
  --brick: #bf4a32;
  --brick-soft: #f7ddd5;
  --slate: #4c6b96;
  --slate-soft: #dde6f3;
  --good: #2f7a4e;

  /* 图形色（JS 从这些变量取色，改这里即可换全站配色） */
  --c1: #c9801f;
  --c2: #2b7a72;
  --c3: #8a4c85;
  --c4: #bf4a32;
  --c5: #4c6b96;
  --c6: #7d8a3f;

  --shadow-s: 0 1px 2px rgba(40, 28, 12, .05), 0 2px 8px rgba(40, 28, 12, .04);
  --shadow-m: 0 2px 4px rgba(40, 28, 12, .05), 0 10px 30px -8px rgba(40, 28, 12, .14);
  --shadow-l: 0 30px 70px -30px rgba(40, 28, 12, .3);

  --radius-s: 8px;
  --radius: 14px;
  --radius-l: 22px;

  --serif: "Noto Serif SC", "Source Han Serif SC", "Source Han Serif CN", "Songti SC", "STSong", "SimSun", Georgia, serif;
  --sans: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Consolas, "Courier New", monospace;

  --maxw: 1160px;
  --header-h: 62px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #14120f;
  --paper-2: #1a1713;
  --panel: #201d18;
  --panel-2: #26221c;
  --ink: #f3eee4;
  --ink-2: #cdc4b6;
  --ink-3: #9a9081;
  --ink-4: #6d6558;
  --line: #322c25;
  --line-2: #423a30;

  --honey: #e3a442;
  --honey-soft: #3a2c16;
  --honey-ink: #f0bd6d;
  --teal: #5bb3a8;
  --teal-soft: #16302d;
  --plum: #bd8bb8;
  --plum-soft: #2e2130;
  --brick: #e0785f;
  --brick-soft: #35211b;
  --slate: #86a3cf;
  --slate-soft: #1d2635;
  --good: #63b482;

  --c1: #e3a442;
  --c2: #5bb3a8;
  --c3: #bd8bb8;
  --c4: #e0785f;
  --c5: #86a3cf;
  --c6: #b6c46a;

  --shadow-s: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-m: 0 2px 6px rgba(0, 0, 0, .4), 0 14px 36px -12px rgba(0, 0, 0, .6);
  --shadow-l: 0 30px 70px -30px rgba(0, 0, 0, .8);
}

/* ---------- 2. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 18px); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
/* 纸面微纹理 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .5;
  background-image:
    radial-gradient(circle at 12% 8%, rgba(201, 128, 31, .055), transparent 42%),
    radial-gradient(circle at 88% 4%, rgba(43, 122, 114, .05), transparent 38%),
    radial-gradient(circle at 50% 100%, rgba(138, 76, 133, .04), transparent 55%);
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 650; letter-spacing: .01em; line-height: 1.25; margin: 0; }
p { margin: 0; }
ul, ol { margin: 0; padding-left: 1.15em; }
::selection { background: var(--honey-soft); color: var(--honey-ink); }

/* ---------- 3. Layout ---------- */
.wrap { width: min(100% - 44px, var(--maxw)); margin-inline: auto; position: relative; z-index: 1; }
.wrap-narrow { width: min(100% - 44px, 860px); margin-inline: auto; }
section { position: relative; z-index: 1; }

/* 顶部读进度 */
.progress-bar {
  position: fixed; left: 0; top: 0; height: 2px; width: 0%;
  background: linear-gradient(90deg, var(--honey), var(--teal));
  z-index: 90; transition: width .12s linear;
}

/* ---------- 4. Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 80;
  height: var(--header-h);
  display: flex; align-items: center;
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background .3s;
}
.site-header.is-stuck { border-bottom-color: var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 20px; width: min(100% - 44px, 1240px); }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 16px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 9px; flex: none;
  background: linear-gradient(145deg, var(--honey), #e8b45f);
  display: grid; place-items: center;
  color: #fff; font-family: var(--mono); font-size: 13px; font-weight: 700;
  box-shadow: 0 2px 10px -2px rgba(201, 128, 31, .7);
}
.brand small { display: block; font-family: var(--sans); font-size: 11px; font-weight: 400; color: var(--ink-3); letter-spacing: .08em; margin-top: -2px; }
.nav-chapters { display: flex; align-items: center; gap: 2px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav-chapters::-webkit-scrollbar { display: none; }
.nav-chapters a {
  padding: 6px 10px; border-radius: 999px; font-size: 13.5px; color: var(--ink-3);
  white-space: nowrap; transition: background .18s, color .18s;
}
.nav-chapters a:hover { color: var(--ink); background: var(--paper-2); }
.nav-chapters a.active { color: var(--honey-ink); background: var(--honey-soft); font-weight: 600; }
.icon-btn {
  width: 34px; height: 34px; flex: none; border-radius: 50%;
  border: 1px solid var(--line); background: var(--panel);
  display: grid; place-items: center; cursor: pointer;
  color: var(--ink-2); transition: transform .18s, border-color .18s, color .18s;
}
.icon-btn:hover { transform: translateY(-1px); border-color: var(--line-2); color: var(--ink); }
.icon-btn svg { width: 17px; height: 17px; }
:root[data-theme="dark"] .sun-icon { display: block; }
:root[data-theme="dark"] .moon-icon { display: none; }
.sun-icon { display: none; }
.moon-icon { display: block; }

/* ---------- 5. Hero ---------- */
.hero { padding: 76px 0 58px; }
.hero-grid { display: grid; grid-template-columns: 1.06fr .94fr; gap: 56px; align-items: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--honey-ink); background: var(--honey-soft);
  padding: 5px 12px; border-radius: 999px;
}
.eyebrow .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--honey); }
.hero h1 {
  font-size: clamp(34px, 4.6vw, 60px);
  line-height: 1.16;
  margin: 20px 0 0;
  letter-spacing: -.01em;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(100deg, var(--honey), var(--brick) 62%, var(--plum));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-lead { margin-top: 20px; font-size: 17px; color: var(--ink-2); max-width: 40em; }
.hero-lead strong { color: var(--ink); font-weight: 650; }
.hero-meta { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--ink-2);
  background: var(--panel); border: 1px solid var(--line);
  padding: 7px 13px; border-radius: 999px; box-shadow: var(--shadow-s);
}
.chip b { font-family: var(--mono); font-size: 13px; color: var(--honey-ink); }
.hero-cta { margin-top: 34px; display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 12px 22px; border-radius: 999px; cursor: pointer;
  font-size: 14.5px; font-weight: 600; border: 1px solid transparent;
  transition: transform .18s cubic-bezier(.2,.8,.3,1), box-shadow .18s, background .18s, color .18s;
}
.btn-primary { background: var(--ink); color: var(--paper); box-shadow: var(--shadow-m); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-l); }
.btn-ghost { background: var(--panel); color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { transform: translateY(-2px); border-color: var(--ink-4); }
.btn svg { width: 15px; height: 15px; }

.hero-stage {
  position: relative; border-radius: var(--radius-l);
  background: var(--panel); border: 1px solid var(--line);
  box-shadow: var(--shadow-m); overflow: hidden;
  aspect-ratio: 4 / 3.35;
}
.hero-stage canvas { width: 100%; height: 100%; }
.hero-stage-label {
  position: absolute; left: 16px; bottom: 14px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .1em;
  color: var(--ink-3); text-transform: uppercase;
}

/* ---------- 6. Section heading ---------- */
.sec { padding: 26px 0 70px; }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding-bottom: 22px; border-bottom: 1px solid var(--line); margin-bottom: 34px; }
.sec-head h2 { font-size: clamp(23px, 2.6vw, 30px); }
.sec-head p { color: var(--ink-3); font-size: 14px; margin-top: 6px; }
.sec-kicker { font-family: var(--mono); font-size: 11.5px; letter-spacing: .16em; color: var(--honey-ink); text-transform: uppercase; }
.sec-head .right { font-size: 13px; color: var(--ink-3); white-space: nowrap; }

/* ---------- 7. Chapter cards ---------- */
.chapter-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.chapter-card {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  padding: 20px 20px 18px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line);
  box-shadow: var(--shadow-s);
  transition: transform .22s cubic-bezier(.2,.8,.3,1), box-shadow .22s, border-color .22s;
  overflow: hidden;
}
.chapter-card::after {
  content: ""; position: absolute; left: 0; top: 0; height: 3px; width: 100%;
  background: var(--c, var(--honey)); opacity: .85;
  transform: scaleX(0); transform-origin: left;
  transition: transform .3s cubic-bezier(.2,.8,.3,1);
}
.chapter-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-m); border-color: var(--line-2); }
.chapter-card:hover::after { transform: scaleX(1); }
.chapter-card .num {
  font-family: var(--mono); font-size: 12px; letter-spacing: .1em;
  color: var(--c, var(--honey)); font-weight: 700;
}
.chapter-card h3 { font-size: 19px; }
.chapter-card p { font-size: 13.5px; color: var(--ink-3); line-height: 1.65; min-height: 3.2em; }
.chapter-card .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 8px; }
.tag { font-size: 11.5px; color: var(--ink-2); background: var(--paper-2); padding: 3px 9px; border-radius: 6px; }
.chapter-card .go { position: absolute; right: 18px; top: 18px; color: var(--ink-4); transition: transform .2s, color .2s; }
.chapter-card:hover .go { transform: translateX(3px); color: var(--c, var(--honey)); }
.chapter-card .go svg { width: 16px; height: 16px; }

/* ---------- 8. Demo block ---------- */
.demo {
  margin-bottom: 22px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line);
  box-shadow: var(--shadow-s); overflow: hidden;
  scroll-margin-top: calc(var(--header-h) + 20px);
}
.demo-head { padding: 22px 24px 0; display: flex; gap: 14px; align-items: flex-start; }
.demo-num {
  flex: none; width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center; margin-top: 2px;
  font-family: var(--mono); font-size: 12.5px; font-weight: 700;
  color: var(--accent, var(--honey)); background: var(--accent-soft, var(--honey-soft));
}
.demo-head h3 { font-size: 20px; }
.demo-head .sub { font-size: 13.5px; color: var(--ink-3); margin-top: 4px; }
.demo-body { display: grid; grid-template-columns: minmax(0, 1fr) 258px; gap: 22px; padding: 20px 24px 0; }
.demo-stage {
  border-radius: var(--radius-s);
  background: var(--panel-2);
  border: 1px solid var(--line);
  padding: 8px; min-width: 0;
}
.demo-stage canvas { width: 100%; border-radius: 6px; }
.plot-h { height: 336px; }
.plot-h-sm { height: 260px; }
.demo-side { display: flex; flex-direction: column; gap: 14px; }
.demo-note {
  margin: 18px 24px 22px; padding: 14px 16px;
  background: var(--paper-2); border-radius: 10px;
  border-left: 3px solid var(--accent, var(--honey));
  font-size: 13.5px; color: var(--ink-2); line-height: 1.7;
}
.demo-note b { color: var(--ink); }
.demo-note .k { font-family: var(--mono); color: var(--honey-ink); }

/* ---------- 9. Controls ---------- */
.ctrl { display: block; }
.ctrl + .ctrl { margin-top: 12px; }
.ctrl-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 5px; }
.ctrl label { font-size: 12.5px; color: var(--ink-3); }
.ctrl .val { font-family: var(--mono); font-size: 12.5px; color: var(--ink); font-weight: 600; }
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 20px; background: transparent; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent, var(--honey)) var(--fill, 50%), var(--line) var(--fill, 50%));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 15px; height: 15px; margin-top: -5.5px;
  border-radius: 50%; background: var(--panel);
  border: 2px solid var(--accent, var(--honey));
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  transition: transform .12s;
}
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.18); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 99px; background: var(--line); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 99px; background: var(--accent, var(--honey)); }
input[type="range"]::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%; background: var(--panel);
  border: 2px solid var(--accent, var(--honey));
}
input[type="range"]:focus-visible { outline: 2px solid var(--accent, var(--honey)); outline-offset: 3px; border-radius: 4px; }

.seg { display: flex; gap: 4px; background: var(--paper-2); padding: 3px; border-radius: 9px; }
.seg button {
  flex: 1; padding: 6px 8px; border: 0; background: transparent; border-radius: 7px;
  font-size: 12.5px; color: var(--ink-3); cursor: pointer; transition: background .16s, color .16s;
  white-space: nowrap;
}
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--panel); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-s); }
.btn-row { display: flex; gap: 8px; }
.btn-sm {
  flex: 1; padding: 8px 10px; border-radius: 9px; cursor: pointer; font-size: 12.5px; font-weight: 600;
  background: var(--paper-2); border: 1px solid var(--line); color: var(--ink-2);
  transition: background .16s, color .16s, border-color .16s, transform .16s;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-sm:hover { background: var(--panel-2); border-color: var(--line-2); color: var(--ink); }
.btn-sm.solid { background: var(--accent, var(--honey)); border-color: var(--accent, var(--honey)); color: #fff; }
.btn-sm.solid:hover { filter: brightness(1.06); transform: translateY(-1px); }
:root[data-theme="dark"] .btn-sm.solid { color: #14120f; }

/* 读数面板 */
.readout { display: grid; gap: 1px; background: var(--line); border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.readout .row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  background: var(--panel); padding: 8px 11px;
}
.readout .row span { font-size: 12px; color: var(--ink-3); }
.readout .row b { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--ink); }
.readout .row b.hl { color: var(--accent, var(--honey)); }
.readout .row b.warn { color: var(--brick); }

/* 图例 */
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-3); margin-top: 8px; }
.legend i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

/* ---------- 10. Chapter page head ---------- */
.ch-head { padding: 52px 0 34px; }
.ch-head .crumb { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; color: var(--ink-3); }
.ch-head .crumb a:hover { color: var(--honey-ink); }
.ch-head h1 { font-size: clamp(30px, 4vw, 46px); margin: 14px 0 0; }
.ch-head .en { font-family: var(--mono); font-size: 12.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--honey-ink); margin-top: 10px; }
.ch-head .lead { font-size: 16.5px; color: var(--ink-2); margin-top: 16px; max-width: 46em; }
.ch-rule { height: 1px; background: var(--line); margin-top: 30px; }

/* 章节导览（锚点目录） */
.toc { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.toc a {
  font-size: 13px; color: var(--ink-2); background: var(--panel);
  border: 1px solid var(--line); padding: 7px 13px; border-radius: 999px;
  transition: border-color .16s, color .16s, transform .16s;
}
.toc a:hover { border-color: var(--honey); color: var(--honey-ink); transform: translateY(-1px); }
.toc a span { font-family: var(--mono); font-size: 11px; color: var(--ink-4); margin-right: 5px; }

/* 概念条：关键结论 */
.keyline {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1px;
  background: var(--line); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; margin: 26px 0 40px;
}
.keyline > div { background: var(--panel); padding: 16px 18px; }
.keyline dt { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; color: var(--honey-ink); text-transform: uppercase; }
.keyline dd { margin: 5px 0 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.62; }
.keyline dd b { color: var(--ink); }

/* 公式 */
.formula {
  display: inline-block; font-family: var(--mono); font-size: 13.5px;
  background: var(--honey-soft); color: var(--honey-ink);
  padding: 2px 8px; border-radius: 6px; white-space: nowrap;
}
.formula-block {
  font-family: var(--mono); font-size: 14px; text-align: center;
  color: var(--ink); background: var(--paper-2);
  padding: 14px 16px; border-radius: 10px; margin: 0; overflow-x: auto;
}

/* ---------- 11. Footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 42px 0 56px; background: var(--paper-2); }
.footer-grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 28px; align-items: flex-start; }
.site-footer h4 { font-size: 15px; }
.site-footer p, .site-footer a { font-size: 13px; color: var(--ink-3); }
.site-footer a:hover { color: var(--honey-ink); }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 10px; }
.footer-note { margin-top: 30px; padding-top: 20px; border-top: 1px dashed var(--line-2); font-size: 12px; color: var(--ink-4); display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: space-between; }

/* 上一章 / 下一章 */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 48px 0 10px; }
.pager a {
  display: block; padding: 18px 20px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line);
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.pager a:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: var(--shadow-m); }
.pager .dir { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; color: var(--ink-4); text-transform: uppercase; }
.pager .t { font-family: var(--serif); font-size: 17px; margin-top: 5px; }
.pager .next { text-align: right; }

/* ---------- 12. Reveal ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s cubic-bezier(.2,.8,.3,1), transform .6s cubic-bezier(.2,.8,.3,1); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- 13. Responsive ---------- */
@media (max-width: 1080px) {
  .chapter-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-grid { grid-template-columns: 1fr; gap: 34px; }
  .hero-stage { aspect-ratio: 16 / 11; }
}
@media (max-width: 860px) {
  .demo-body { grid-template-columns: 1fr; }
  .demo-side { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
  .demo-side > * { flex: 1 1 150px; }
  .sec-head { flex-direction: column; align-items: flex-start; gap: 8px; }
}
@media (max-width: 720px) {
  .wrap, .wrap-narrow { width: calc(100% - 30px); }
  .hero { padding: 40px 0 34px; }
  .chapter-grid { grid-template-columns: 1fr; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { text-align: left; }
  .demo-head { padding: 18px 16px 0; }
  .demo-body { padding: 16px 16px 0; }
  .demo-note { margin: 16px 16px 18px; }
  .plot-h { height: 280px; }
  .nav-chapters a { padding: 6px 8px; font-size: 12.5px; }
  .brand small { display: none; }
  .sec { padding-bottom: 46px; }
}
@media print {
  .site-header, .pager, .demo-side, .progress-bar { display: none !important; }
  .demo { break-inside: avoid; }
}

/* ==========================================================================
   v2 —— 理论层 / 自测 / 章节导航 / 任务卡 / 整体精修
   ========================================================================== */

/* ---------- 13.1 排版与细节精修 ---------- */
p, li { text-wrap: pretty; }
h1, h2, h3, .chapter-card h3 { text-wrap: balance; }
h1, h2, h3, h4 { letter-spacing: -.012em; }
body { font-size: 16px; }
a:focus-visible, button:focus-visible, input:focus-visible,
summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--honey);
  outline-offset: 3px;
  border-radius: 6px;
}
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--paper-2); }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; border: 3px solid var(--paper-2); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }

/* 章节大标题的装饰线 */
.ch-head h1 { position: relative; display: inline-block; }
.ch-head h1::after {
  content: ""; position: absolute; left: 0; right: -8px; bottom: 2px; height: 9px;
  background: linear-gradient(90deg, var(--honey-soft), transparent);
  border-radius: 4px; z-index: -1;
}
.ch-head { position: relative; }
.ch-head::after {
  content: "CHAPTER"; position: absolute; right: 0; top: 46px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .35em;
  color: color-mix(in srgb, var(--ink) 9%, transparent);
}
.sec-head h2 { position: relative; }

/* 演示卡：顶部渐隐高光 + 更柔和的立体感 */
.demo {
  box-shadow: var(--shadow-s), inset 0 1px 0 color-mix(in srgb, #fff 55%, transparent);
  transition: border-color .25s, box-shadow .25s;
}
:root[data-theme="dark"] .demo { box-shadow: var(--shadow-s), inset 0 1px 0 rgba(255,255,255,.04); }
.demo:hover { border-color: var(--line-2); box-shadow: var(--shadow-m); }
.demo-head h3 { font-size: 21px; }
.demo-num { box-shadow: 0 1px 0 color-mix(in srgb, var(--accent, var(--honey)) 40%, transparent) inset; }
.demo-stage { background-image: radial-gradient(circle at 30% 0%, color-mix(in srgb, var(--accent, var(--honey)) 5%, transparent), transparent 65%); }

/* 首页卡片更精致 */
.chapter-card { box-shadow: var(--shadow-s), inset 0 1px 0 color-mix(in srgb, #fff 60%, transparent); }
:root[data-theme="dark"] .chapter-card { box-shadow: var(--shadow-s), inset 0 1px 0 rgba(255,255,255,.04); }
.chapter-card h3 { transition: color .2s; }
.chapter-card:hover h3 { color: var(--c, var(--honey-ink)); }

/* ---------- 13.2 徽标 / 标签 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px;
  background: var(--honey-soft); color: var(--honey-ink); white-space: nowrap;
}
.badge.t { background: var(--teal-soft); color: var(--teal); }
.badge.s { background: var(--slate-soft); color: var(--slate); }
.badge.p { background: var(--plum-soft); color: var(--plum); }
.badge.b { background: var(--brick-soft); color: var(--brick); }
.hint-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; color: var(--ink-3);
  border: 1px dashed var(--line-2); border-radius: 999px; padding: 2px 9px;
}
.hint-chip svg { width: 11px; height: 11px; }

/* ---------- 13.3 理论区 ---------- */
.theory { margin: 6px 0 44px; }
.theory-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.theory-head h2 { font-size: clamp(21px, 2.3vw, 26px); }
.theory-head p { flex: 1 1 100%; color: var(--ink-3); font-size: 13.5px; margin-top: -2px; }
.theory-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tcard {
  padding: 18px 20px 16px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line);
  box-shadow: var(--shadow-s);
}
.tcard.wide { grid-column: 1 / -1; }
.tcard-h { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.tno {
  font-family: var(--mono); font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
  color: var(--honey-ink); background: var(--honey-soft);
  padding: 3px 8px; border-radius: 6px;
}
.tcard-h h3 { font-size: 16.5px; }
.tcard-h .for { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--ink-4); white-space: nowrap; }
.tcard > p { font-size: 13.5px; color: var(--ink-2); line-height: 1.78; }
.tcard > p + p { margin-top: 7px; }
.tkv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin-top: 11px; font-size: 12.8px; }
.tkv dt { color: var(--ink-3); white-space: nowrap; padding-top: 1px; }
.tkv dt::before { content: "·"; margin-right: 5px; color: var(--honey); }
.tkv dd { margin: 0; color: var(--ink-2); line-height: 1.65; }
.pit {
  margin-top: 11px; padding: 9px 12px; border-radius: 9px;
  background: var(--brick-soft); color: color-mix(in srgb, var(--brick) 85%, var(--ink));
  font-size: 12.5px; line-height: 1.65;
}
.pit b { color: var(--brick); }
.tip-line {
  margin-top: 11px; padding: 9px 12px; border-radius: 9px;
  background: var(--teal-soft); color: color-mix(in srgb, var(--teal) 85%, var(--ink));
  font-size: 12.5px; line-height: 1.65;
}

/* ---------- 13.4 公式排版 ---------- */
.eq {
  display: flex; align-items: center; gap: 12px;
  margin: 11px 0; padding: 13px 16px;
  background: var(--paper-2); border: 1px solid var(--line);
  border-radius: 10px; overflow-x: auto;
  font-size: 15px; line-height: 1.5;
}
.eq .body { white-space: nowrap; color: var(--ink); }
.eq .tag { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--ink-4); white-space: nowrap; padding-left: 12px; }
.eq i, .math i { font-style: italic; font-family: Georgia, "Cambria Math", "Times New Roman", var(--serif); }
.eq sub, .eq sup, .math sub, .math sup { font-size: .7em; }
.eq .op { padding: 0 .18em; }
.frac {
  display: inline-flex; flex-direction: column; align-items: center;
  vertical-align: -0.55em; margin: 0 .3em; line-height: 1.2;
}
.frac > span:first-child { border-bottom: 1px solid currentColor; padding: 0 .4em .1em; }
.frac > span:last-child { padding: .1em .4em 0; }
.sqrt { display: inline-block; padding: 0 .1em; border-top: 1px solid currentColor; }
.eq-inline {
  font-family: var(--mono); font-size: .92em;
  background: var(--honey-soft); color: var(--honey-ink);
  padding: 1px 6px; border-radius: 5px; white-space: nowrap;
}

/* ---------- 13.5 自测 ---------- */
.quiz-wrap { margin: 34px 0 10px; }
.quiz-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.quiz-head h2 { font-size: clamp(21px, 2.3vw, 26px); }
.quiz-head p { flex: 1 1 100%; font-size: 13.5px; color: var(--ink-3); }
.quiz { display: grid; gap: 12px; }
.q {
  padding: 17px 19px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-s);
}
.q-stem { display: flex; gap: 11px; font-size: 14px; color: var(--ink); line-height: 1.7; margin-bottom: 11px; }
.q-no {
  flex: none; font-family: var(--mono); font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
  color: var(--slate); background: var(--slate-soft);
  padding: 3px 8px; border-radius: 6px; height: fit-content;
}
.q-opts { display: grid; gap: 7px; }
.q-opt {
  display: flex; gap: 9px; align-items: flex-start; width: 100%;
  text-align: left; padding: 10px 13px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--panel-2);
  font-size: 13.3px; color: var(--ink-2); cursor: pointer;
  transition: border-color .16s, background .16s, color .16s, transform .12s;
}
.q-opt:hover:not([disabled]) { border-color: var(--line-2); background: var(--paper-2); transform: translateX(2px); }
.q-opt .k { font-family: var(--mono); font-size: 11.5px; color: var(--ink-4); flex: none; padding-top: 1px; }
.q-opt.correct { border-color: var(--good); background: color-mix(in srgb, var(--good) 11%, var(--panel)); color: var(--ink); }
.q-opt.correct .k { color: var(--good); }
.q-opt.wrong { border-color: var(--brick); background: var(--brick-soft); color: var(--ink); }
.q-opt.wrong .k { color: var(--brick); }
.q-opt[disabled] { cursor: default; opacity: 1; }
.q-exp {
  margin-top: 10px; padding: 10px 13px; border-radius: 0 9px 9px 0;
  border-left: 3px solid var(--teal); background: var(--teal-soft);
  font-size: 12.8px; color: color-mix(in srgb, var(--teal) 80%, var(--ink));
  line-height: 1.7; display: none;
}
.q.done .q-exp { display: block; }
.q-exp b { color: var(--teal); }
.quiz-foot {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 14px; padding: 12px 16px; border-radius: 11px;
  background: var(--paper-2); border: 1px solid var(--line);
  font-size: 13px; color: var(--ink-2);
}
.quiz-foot b { font-family: var(--mono); font-size: 15px; color: var(--honey-ink); }
.quiz-foot .spacer { flex: 1; }

/* ---------- 13.6 任务卡（互动挑战） ---------- */
.task {
  margin-top: 2px; padding: 11px 13px; border-radius: 10px;
  border: 1px dashed var(--line-2); background: var(--paper-2);
  font-size: 12.3px; color: var(--ink-2); line-height: 1.6;
  transition: border-color .25s, background .25s;
}
.task .t-h {
  display: flex; align-items: center; gap: 7px;
  font-weight: 650; color: var(--ink); margin-bottom: 4px; font-size: 12.3px;
}
.task .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-4); flex: none; transition: .25s; }
.task.ok { border-color: var(--good); border-style: solid; background: color-mix(in srgb, var(--good) 9%, var(--panel)); }
.task.ok .dot { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 22%, transparent); }
.task .t-prog { font-family: var(--mono); color: var(--honey-ink); }

/* ---------- 13.7 章节悬浮导航 ---------- */
.rail {
  position: fixed; right: 16px; top: 50%; transform: translateY(-50%);
  z-index: 60; display: none; flex-direction: column; gap: 5px;
}
@media (min-width: 1400px) { .rail { display: flex; } }
.rail a { display: flex; align-items: center; justify-content: flex-end; text-decoration: none; }
.rail .rn {
  width: 27px; height: 27px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  color: var(--ink-3); background: var(--panel); border: 1px solid var(--line);
  transition: all .18s cubic-bezier(.2,.8,.3,1);
}
.rail a:hover .rn { border-color: var(--honey); color: var(--honey-ink); transform: scale(1.06); }
.rail a.on .rn { background: var(--honey); border-color: var(--honey); color: #fff; transform: scale(1.1); }
:root[data-theme="dark"] .rail a.on .rn { color: #14120f; }

/* ---------- 13.8 回到顶部 ---------- */
.backtop {
  position: fixed; right: 18px; bottom: 22px; z-index: 70;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-2);
  display: grid; place-items: center; cursor: pointer;
  box-shadow: var(--shadow-m);
  opacity: 0; pointer-events: none; transform: translateY(8px);
  transition: opacity .25s, transform .25s, border-color .18s, color .18s;
}
.backtop.show { opacity: 1; pointer-events: auto; transform: none; }
.backtop:hover { border-color: var(--honey); color: var(--honey-ink); }
.backtop svg { width: 16px; height: 16px; }

/* ---------- 13.9 演示里的“理论依据”折叠 ---------- */
.demo-theory {
  margin: 0 24px 20px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel-2); overflow: hidden;
}
.demo-theory > summary {
  cursor: pointer; padding: 11px 15px; font-size: 12.8px; color: var(--ink-2);
  display: flex; align-items: center; gap: 8px; list-style: none; user-select: none;
}
.demo-theory > summary::-webkit-details-marker { display: none; }
.demo-theory > summary::before {
  content: "+"; font-family: var(--mono); font-size: 13px; color: var(--honey);
  width: 15px; text-align: center; transition: transform .2s;
}
.demo-theory[open] > summary::before { content: "−"; }
.demo-theory > summary:hover { color: var(--ink); }
.demo-theory .dt-body { padding: 0 15px 14px; font-size: 12.8px; color: var(--ink-2); line-height: 1.75; }
.demo-theory .dt-body .eq { margin: 9px 0; padding: 10px 13px; font-size: 14px; }

/* ---------- 13.10 响应式补充 ---------- */
@media (max-width: 1080px) {
  .theory-grid { grid-template-columns: 1fr; }
  .ch-head::after { display: none; }
}
@media (max-width: 720px) {
  .eq { font-size: 13.5px; padding: 11px 12px; }
  .q { padding: 14px 15px; }
  .q-stem { font-size: 13.5px; }
  .tcard { padding: 15px 16px; }
  .demo-theory { margin: 0 16px 16px; }
  .theory-head h2, .quiz-head h2 { font-size: 20px; }
}
@media print {
  .rail, .backtop, .quiz-wrap { display: none !important; }
  .theory .tcard { break-inside: avoid; }
}

/* ==========================================================================
   v2.1 —— 意见反馈模块
   ========================================================================== */
.fb-hero { padding: 54px 0 30px; }
.fb-hero h1 { font-size: clamp(30px, 3.8vw, 44px); margin-top: 14px; }
.fb-hero .lead { font-size: 16px; color: var(--ink-2); max-width: 44em; margin-top: 14px; }

.fb-layout { display: grid; grid-template-columns: minmax(0, 1fr) 316px; gap: 18px; align-items: start; }
.fb-card {
  padding: 26px 26px 22px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-s);
}
.fb-row { margin-bottom: 20px; }
.fb-row:last-of-type { margin-bottom: 14px; }
.fb-label {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  font-size: 13px; font-weight: 650; color: var(--ink); margin-bottom: 9px;
}
.fb-label em { font-style: normal; font-weight: 400; font-size: 12px; color: var(--ink-3); }
.fb-types { display: flex; flex-wrap: wrap; gap: 7px; }
.fb-type {
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel-2);
  font-size: 12.8px; color: var(--ink-2);
  transition: border-color .16s, background .16s, color .16s, transform .12s;
}
.fb-type:hover { border-color: var(--line-2); transform: translateY(-1px); }
.fb-type.on { background: var(--honey-soft); border-color: var(--honey); color: var(--honey-ink); font-weight: 650; }

.fb-select, .fb-input, .fb-textarea {
  width: 100%; font: inherit; font-size: 13.5px; color: var(--ink);
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 13px;
  transition: border-color .16s, background .16s, box-shadow .16s;
}
.fb-select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.fb-textarea { min-height: 130px; resize: vertical; line-height: 1.72; }
.fb-select:focus, .fb-input:focus, .fb-textarea:focus {
  outline: none; border-color: var(--honey); background: var(--panel);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--honey) 16%, transparent);
}
.fb-count { text-align: right; font-family: var(--mono); font-size: 11.5px; color: var(--ink-4); margin-top: 6px; }
.fb-count.warn { color: var(--brick); }

.fb-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.fb-submit {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 24px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--ink); color: var(--paper); font-size: 14px; font-weight: 650;
  box-shadow: var(--shadow-m);
  transition: transform .16s, box-shadow .16s, opacity .16s;
}
.fb-submit:hover { transform: translateY(-2px); box-shadow: var(--shadow-l); }
.fb-submit[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.fb-submit svg { width: 15px; height: 15px; }
.fb-note { font-size: 12px; color: var(--ink-3); }

.fb-status { margin-top: 14px; font-size: 13px; line-height: 1.7; padding: 11px 14px; border-radius: 10px; display: none; }
.fb-status.show { display: block; }
.fb-status.ok { background: color-mix(in srgb, var(--good) 12%, var(--panel)); color: color-mix(in srgb, var(--good) 85%, var(--ink)); border: 1px solid color-mix(in srgb, var(--good) 40%, transparent); }
.fb-status.err { background: var(--brick-soft); color: var(--brick); border: 1px solid color-mix(in srgb, var(--brick) 34%, transparent); }
.fb-status code { font-family: var(--mono); font-size: 12px; }

.fb-fallback { margin-top: 12px; display: none; }
.fb-fallback.show { display: block; }
.fb-fallback textarea {
  width: 100%; font-family: var(--mono); font-size: 12px; color: var(--ink-2);
  background: var(--paper-2); border: 1px dashed var(--line-2); border-radius: 9px;
  padding: 10px 12px; min-height: 84px; resize: vertical;
}
.fb-fallback .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

.fb-side { display: flex; flex-direction: column; gap: 14px; }
.fb-scard { padding: 18px 20px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-s); }
.fb-scard h3 { font-size: 14.5px; display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.fb-scard h3 .bd { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-family: var(--mono); font-size: 11px; background: var(--honey-soft); color: var(--honey-ink); }
.fb-scard p, .fb-scard li { font-size: 12.8px; color: var(--ink-2); line-height: 1.7; }
.fb-scard ul { padding-left: 1.05em; display: grid; gap: 5px; }
.fb-scard li::marker { color: var(--honey); }
.fb-quote { border-left: 3px solid var(--teal); padding-left: 11px; font-size: 12.5px; color: var(--ink-2); line-height: 1.7; }
.fb-quote + .fb-quote { margin-top: 10px; }
.fb-quote b { color: var(--ink); display: block; font-size: 12px; margin-bottom: 2px; font-weight: 600; }

.fb-hist { margin-top: 18px; }
.fb-hist h3 { font-size: 14px; color: var(--ink-2); display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.fb-hist-list { display: grid; gap: 8px; }
.fb-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 13px; border-radius: 9px;
  background: var(--panel); border: 1px solid var(--line);
  font-size: 12.5px; color: var(--ink-2);
}
.fb-item .t { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--ink-4); white-space: nowrap; }
.fb-item .ok { color: var(--good); font-family: var(--mono); font-size: 11px; }
.fb-item .no { color: var(--brick); font-family: var(--mono); font-size: 11px; }
.fb-empty { font-size: 12.5px; color: var(--ink-4); padding: 4px 2px; }

/* 章节页底部的反馈入口 */
.fb-cta {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin: 26px 0 6px; padding: 20px 24px; border-radius: var(--radius);
  background: linear-gradient(100deg, color-mix(in srgb, var(--honey) 9%, var(--panel)), var(--panel) 62%);
  border: 1px solid var(--line); box-shadow: var(--shadow-s);
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.fb-cta:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: var(--shadow-m); }
.fb-cta .txt { flex: 1 1 260px; }
.fb-cta b { display: block; font-family: var(--serif); font-size: 17px; color: var(--ink); }
.fb-cta span { font-size: 13px; color: var(--ink-3); }
.fb-cta .go {
  font-size: 13.5px; font-weight: 650; color: var(--honey-ink);
  background: var(--honey-soft); padding: 8px 16px; border-radius: 999px; white-space: nowrap;
}

@media (max-width: 900px) {
  .fb-layout { grid-template-columns: 1fr; }
  .fb-side { flex-direction: row; flex-wrap: wrap; }
  .fb-side > * { flex: 1 1 240px; }
}
@media (max-width: 640px) {
  .fb-card { padding: 18px 15px; }
  .fb-hero { padding: 34px 0 20px; }
}

/* 顶栏反馈图标 */
.fb-icon { color: var(--honey-ink); border-color: color-mix(in srgb, var(--honey) 42%, var(--line)); }
.fb-icon:hover { background: var(--honey-soft); border-color: var(--honey); color: var(--honey-ink); }

/* ==========================================================================
   v3 —— 配色方案（多风格） / 练习台 / 排版精修
   ========================================================================== */

/* ---------- 14.1 配色方案：切换 <html data-palette="…"> ---------- */
:root[data-palette="jade"] {
  --honey: #2f7d6b; --honey-soft: #dceee9; --honey-ink: #1d5b4c;
  --c1: #2f7d6b; --c2: #a9761f; --c3: #4e6f9e; --c4: #b4562f; --c5: #7a5b9a; --c6: #6b8f3f;
}
:root[data-palette="indigo"] {
  --honey: #3f5f9e; --honey-soft: #e2e8f6; --honey-ink: #2b4372;
  --c1: #3f5f9e; --c2: #b07c2a; --c3: #7a4f95; --c4: #bf5540; --c5: #2f7d6b; --c6: #7f8a3a;
}
:root[data-palette="rust"] {
  --honey: #b6452c; --honey-soft: #f7e0d8; --honey-ink: #8a301c;
  --c1: #b6452c; --c2: #2b7a72; --c3: #8a4c85; --c4: #a8761c; --c5: #4c6b96; --c6: #7d8a3f;
}
:root[data-palette="graphite"] {
  --honey: #6b6259; --honey-soft: #eae6e0; --honey-ink: #4a433c;
  --c1: #6b6259; --c2: #4e6f6a; --c3: #6f5b78; --c4: #8a5a4a; --c5: #52637a; --c6: #6f7350;
}
:root[data-theme="dark"][data-palette="jade"] {
  --honey: #5bb3a0; --honey-soft: #16302b; --honey-ink: #8ad3c1;
  --c1: #5bb3a0; --c2: #d2a45a; --c3: #86a6d0; --c4: #e08a63; --c5: #b592cf; --c6: #a8c46a;
}
:root[data-theme="dark"][data-palette="indigo"] {
  --honey: #8aa5dc; --honey-soft: #1b2438; --honey-ink: #aec3ea;
  --c1: #8aa5dc; --c2: #d2a45a; --c3: #b592cf; --c4: #e0896f; --c5: #5bb3a0; --c6: #b6c46a;
}
:root[data-theme="dark"][data-palette="rust"] {
  --honey: #e0785f; --honey-soft: #35211b; --honey-ink: #f0a289;
  --c1: #e0785f; --c2: #5bb3a8; --c3: #bd8bb8; --c4: #d2a45a; --c5: #86a3cf; --c6: #b6c46a;
}
:root[data-theme="dark"][data-palette="graphite"] {
  --honey: #b3a89b; --honey-soft: #2b2823; --honey-ink: #d8cec2;
  --c1: #b3a89b; --c2: #86b3ab; --c3: #b39dc0; --c4: #c79b8b; --c5: #98a8c2; --c6: #b0b48a;
}

/* 配色选择器 */
.palette-wrap { position: relative; flex: none; display: flex; }
.palette-pop {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 95;
  width: 186px; padding: 9px; border-radius: 13px;
  background: var(--panel); border: 1px solid var(--line);
  box-shadow: var(--shadow-l); display: none;
}
.palette-pop.open { display: block; animation: popIn .16s cubic-bezier(.2, .8, .3, 1); }
@keyframes popIn { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.pp-title {
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-4); padding: 3px 8px 7px;
}
.pp-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 8px; border: 0; border-radius: 8px; background: transparent;
  font-size: 12.5px; color: var(--ink-2); cursor: pointer; text-align: left;
  transition: background .14s, color .14s;
}
.pp-item:hover { background: var(--paper-2); color: var(--ink); }
.pp-item.on { background: var(--honey-soft); color: var(--honey-ink); font-weight: 650; }
.pp-dot {
  width: 15px; height: 15px; border-radius: 50%; flex: none;
  border: 1px solid rgba(0, 0, 0, .14);
}

/* ---------- 14.2 排版精修 ---------- */
body { letter-spacing: .006em; }
.lead, .hero-lead, .fb-hero .lead, .demo-note, .tcard > p, .ex-note li {
  text-align: justify;
  text-justify: inter-ideograph;
  hyphens: none;
}
.ch-head .lead { font-size: 17px; line-height: 1.92; max-width: 36em; }
.sec-head h2 { font-size: clamp(24px, 2.8vw, 31px); }
.theory-head h2::before, .quiz-head h2::before, .sec-head h2::before {
  content: ""; display: inline-block; width: 3px; height: .82em;
  border-radius: 2px; margin-right: 11px; vertical-align: -.04em;
  background: linear-gradient(180deg, var(--honey), color-mix(in srgb, var(--honey) 18%, transparent));
}
.sec-head p, .theory-head p, .quiz-head p { line-height: 1.7; }
.tcard { padding: 20px 22px 18px; }
.tcard-h h3 { font-size: 17px; }
.tcard > p { font-size: 13.8px; line-height: 1.82; }
.tkv { grid-template-columns: max-content 1fr; gap: 8px 14px; font-size: 13px; }
.tkv dd { line-height: 1.7; }
.demo-note { font-size: 13.8px; line-height: 1.88; padding: 15px 17px; }
.eq { padding: 14px 18px; }
.eq .body { line-height: 1.8; }
.keyline dd { font-size: 14px; line-height: 1.7; }
.num-table, .dtable, .anova-table, .ex-table table, .readout b, .val, .ex-stats b {
  font-variant-numeric: tabular-nums;
}
.footer-note { line-height: 1.9; }

/* ---------- 14.3 练习台 ---------- */
.ex-filter { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 16px; }
.ex-filter button {
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel);
  font-size: 12.8px; color: var(--ink-2);
  transition: border-color .16s, background .16s, color .16s, transform .12s;
}
.ex-filter button:hover { border-color: var(--line-2); transform: translateY(-1px); }
.ex-filter button.on { background: var(--honey-soft); border-color: var(--honey); color: var(--honey-ink); font-weight: 650; }

.ex-card {
  padding: 26px 28px 22px; border-radius: var(--radius-l);
  background: var(--panel); border: 1px solid var(--line);
  box-shadow: var(--shadow-m), inset 0 1px 0 color-mix(in srgb, #fff 55%, transparent);
}
:root[data-theme="dark"] .ex-card { box-shadow: var(--shadow-m), inset 0 1px 0 rgba(255, 255, 255, .04); }
.ex-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.ex-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.ex-num { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--ink-4); letter-spacing: .06em; }

.ex-q { font-size: 15px; line-height: 1.85; color: var(--ink); }
.ex-q b { color: var(--ink); font-weight: 650; }
.ex-q .eq-inline { font-size: .88em; }
.ex-table { overflow-x: auto; margin: 13px 0 3px; }
.ex-table table { border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.ex-table th, .ex-table td { padding: 8px 16px; text-align: center; border-bottom: 1px solid var(--line); }
.ex-table th { font-size: 12px; font-weight: 600; color: var(--ink-3); background: var(--paper-2); }
.ex-table td { color: var(--ink-2); }
.ex-table tr:last-child td { border-bottom: 0; }

.ex-hintbox { margin: 16px 0 0; border: 1px dashed var(--line-2); border-radius: 10px; background: var(--panel-2); }
.ex-hintbox > summary { cursor: pointer; list-style: none; padding: 9px 14px; font-size: 12.5px; color: var(--ink-3); }
.ex-hintbox > summary::-webkit-details-marker { display: none; }
.ex-hintbox > summary::before { content: "💡 "; }
.ex-hintbox[open] > summary { color: var(--ink-2); border-bottom: 1px dashed var(--line-2); }
.ex-hint { padding: 11px 14px; font-size: 13px; color: var(--ink-2); line-height: 1.75; }

.ex-answer { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.ex-alabel { display: block; font-size: 12.5px; font-weight: 650; color: var(--ink); margin-bottom: 9px; }
.ex-arow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ex-arow.secondary { margin-top: 10px; }
.ex-input {
  width: 230px; font-family: var(--mono); font-size: 16px;
  color: var(--ink); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 14px; transition: border-color .16s, box-shadow .16s, background .16s;
}
.ex-input::placeholder { font-size: 12.5px; font-family: var(--sans); color: var(--ink-4); }
.ex-input:focus {
  outline: none; border-color: var(--honey); background: var(--panel);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--honey) 16%, transparent);
}
.ex-input:disabled { opacity: .62; }
.ex-unit { font-size: 13px; color: var(--ink-3); min-width: 2em; }
.ex-btn {
  padding: 11px 22px; border-radius: 999px; cursor: pointer; font-size: 13.5px; font-weight: 650;
  border: 1px solid transparent;
  transition: transform .16s, box-shadow .16s, background .16s, color .16s, border-color .16s;
}
.ex-btn.primary { background: var(--ink); color: var(--paper); box-shadow: var(--shadow-s); }
.ex-btn.primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-m); }
.ex-btn.primary.is-next { background: var(--honey); color: #fff; }
:root[data-theme="dark"] .ex-btn.primary.is-next { color: #14120f; }
.ex-btn.ghost { background: var(--panel-2); color: var(--ink-2); border-color: var(--line); padding: 9px 18px; font-weight: 600; }
.ex-btn.ghost:hover { background: var(--paper-2); border-color: var(--line-2); color: var(--ink); }
.ex-tip { font-size: 12px; color: var(--ink-4); }

.ex-fb { margin-top: 16px; font-size: 13.5px; line-height: 1.75; padding: 12px 15px; border-radius: 10px; display: none; }
.ex-fb.ok, .ex-fb.near, .ex-fb.bad, .ex-fb.warn { display: block; }
.ex-fb.ok { background: color-mix(in srgb, var(--good) 12%, var(--panel)); color: color-mix(in srgb, var(--good) 88%, var(--ink)); border: 1px solid color-mix(in srgb, var(--good) 36%, transparent); }
.ex-fb.near { background: var(--honey-soft); color: var(--honey-ink); border: 1px solid color-mix(in srgb, var(--honey) 38%, transparent); }
.ex-fb.bad { background: var(--brick-soft); color: var(--brick); border: 1px solid color-mix(in srgb, var(--brick) 34%, transparent); }
.ex-fb.warn { background: var(--paper-2); color: var(--ink-2); border: 1px solid var(--line); }
.ex-fb code, .ex-fb kbd { font-family: var(--mono); font-size: .92em; padding: 1px 5px; border-radius: 4px; background: color-mix(in srgb, currentColor 12%, transparent); }
kbd { font-family: var(--mono); font-size: .9em; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line-2); background: var(--paper-2); }

.ex-sol { display: none; margin-top: 14px; padding: 16px 18px; border-radius: 12px; background: var(--paper-2); border: 1px solid var(--line); }
.ex-sol.show { display: block; animation: popIn .2s cubic-bezier(.2, .8, .3, 1); }
.ex-step { display: flex; gap: 12px; padding: 7px 0; font-size: 13px; color: var(--ink-2); line-height: 1.8; }
.ex-step + .ex-step { border-top: 1px dashed var(--line-2); }
.ex-sl {
  flex: none; font-family: var(--mono); font-size: 11.5px; color: var(--honey-ink);
  background: var(--honey-soft); border-radius: 6px; padding: 2px 8px; height: fit-content; margin-top: 2px;
  white-space: nowrap;
}
.ex-step b { color: var(--ink); }

.ex-stats {
  display: flex; flex-wrap: wrap; align-items: center; gap: 1px;
  margin-top: 16px; background: var(--line); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.ex-stats > div { flex: 1 1 92px; background: var(--panel); padding: 13px 16px; text-align: center; }
.ex-stats > div:last-child { flex: 0 0 auto; display: grid; place-items: center; padding: 10px 14px; }
.ex-stats b { display: block; font-family: var(--mono); font-size: 20px; color: var(--ink); line-height: 1.2; }
.ex-stats span { font-size: 11.5px; color: var(--ink-3); }

.ex-notes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 20px; }
.ex-note { padding: 18px 20px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-s); }
.ex-note h3 { font-size: 14.5px; margin-bottom: 8px; color: var(--ink); }
.ex-note ul { display: grid; gap: 5px; padding-left: 1em; }
.ex-note li { font-size: 12.8px; color: var(--ink-2); line-height: 1.72; }
.ex-note li::marker { color: var(--honey); }
.ex-note code { font-family: var(--mono); font-size: .94em; background: var(--paper-2); padding: 1px 5px; border-radius: 4px; }

@media (max-width: 900px) { .ex-notes { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .ex-card { padding: 18px 16px 16px; }
  .ex-input { width: 100%; }
  .ex-arow { gap: 8px; }
  .ex-btn { flex: 1 1 auto; text-align: center; }
  .ex-tip { flex: 1 1 100%; }
  .ex-stats b { font-size: 17px; }
}
@media print { .ex-filter, .ex-stats, .ex-notes { display: none !important; } }

/* ==========================================================================
   v4 —— 讨论区 / 审核台
   ========================================================================== */

/* ---------- 15.1 表单标题 ---------- */
.fb-ttl { font-size: 17px; margin: 0 0 4px; }
.fb-sub { font-size: 12.8px; color: var(--ink-3); line-height: 1.65; margin: 0 0 16px; }
.fb-card > form, .fb-card form { display: block; }

/* ---------- 15.2 讨论区 ---------- */
.dsc-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 12px;
}
.dsc-head h2 { font-size: clamp(20px, 2.2vw, 24px); margin-top: 8px; }
.dsc-head p { font-size: 12.8px; color: var(--ink-3); margin-top: 5px; }
.dsc-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.dsc-filter button {
  padding: 5px 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel);
  font-size: 12px; color: var(--ink-2); transition: all .15s;
}
.dsc-filter button:hover { border-color: var(--line-2); }
.dsc-filter button.on { background: var(--honey-soft); border-color: var(--honey); color: var(--honey-ink); font-weight: 650; }

.dsc-list { display: grid; gap: 12px; }
.dsc-empty {
  padding: 30px 20px; text-align: center; font-size: 13px; color: var(--ink-3);
  background: var(--panel); border: 1px dashed var(--line-2); border-radius: var(--radius);
}
.dsc-skel {
  height: 92px; border-radius: var(--radius); background: var(--panel);
  border: 1px solid var(--line); animation: skel 1.4s ease-in-out infinite;
}
@keyframes skel { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

.thread {
  padding: 16px 18px 12px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line);
  box-shadow: var(--shadow-s);
}
.thread-h { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 9px; }
.thread-av, .reply-av {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 13px; color: var(--honey-ink);
  background: var(--honey-soft);
}
.thread-who { font-size: 13.2px; font-weight: 650; color: var(--ink); }
.thread-badges { display: flex; gap: 5px; flex-wrap: wrap; }
.thread-time { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--ink-4); }
.thread-body { font-size: 13.8px; line-height: 1.8; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; }

.replies { margin: 12px 0 0 12px; padding-left: 13px; border-left: 2px solid var(--line); display: grid; gap: 10px; }
.reply { display: flex; gap: 9px; align-items: flex-start; }
.reply-av { width: 22px; height: 22px; font-size: 11.5px; background: var(--paper-2); color: var(--ink-3); }
.reply.team .reply-av { background: var(--teal-soft); color: var(--teal); }
.reply-main { min-width: 0; }
.reply-h { font-size: 12.2px; color: var(--ink-3); display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.reply-badge {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .06em;
  background: var(--teal-soft); color: var(--teal); padding: 1px 6px; border-radius: 4px;
}
.reply-time { font-family: var(--mono); font-size: 10.5px; color: var(--ink-4); }
.reply-body { font-size: 13.2px; line-height: 1.75; color: var(--ink-2); margin-top: 3px; white-space: pre-wrap; word-break: break-word; }

.thread-foot { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--line); }
.dsc-act {
  border: 0; background: transparent; cursor: pointer; padding: 3px 4px;
  font-size: 12.3px; color: var(--honey-ink); font-weight: 600; border-radius: 6px;
}
.dsc-act:hover { background: var(--honey-soft); }
.dsc-count { font-size: 11.5px; color: var(--ink-4); }

.reply-form { margin-top: 11px; display: grid; gap: 8px; }
.reply-form .fb-input { font-size: 13px; padding: 8px 12px; }
.reply-form .fb-textarea { min-height: 74px; font-size: 13px; }
.reply-form-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.reply-hint { font-size: 11.8px; color: var(--ink-3); }
.reply-hint.ok { color: var(--good); }
.reply-hint.err { color: var(--brick); }

/* ---------- 15.3 审核台 ---------- */
.mod-login {
  max-width: 620px; margin: 0 auto; padding: 26px 26px 20px;
  border-radius: var(--radius); background: var(--panel);
  border: 1px solid var(--line); box-shadow: var(--shadow-m);
}
.mod-login-row { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.mod-login-row .fb-input { flex: 1 1 160px; }

.mod-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 16px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-s);
  margin-bottom: 12px;
}
.mod-counts { display: flex; gap: 1px; background: var(--line); border-radius: 9px; overflow: hidden; }
.mod-counts > div { background: var(--panel); padding: 8px 15px; text-align: center; }
.mod-counts b { display: block; font-family: var(--mono); font-size: 18px; line-height: 1.15; color: var(--ink); }
.mod-counts span { font-size: 10.5px; color: var(--ink-3); }
.mod-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mod-tools .seg button { font-size: 12px; padding: 6px 10px; }

.mod-msg {
  display: none; margin-bottom: 12px; padding: 10px 14px; border-radius: 9px;
  font-size: 13px; line-height: 1.65;
}
.mod-msg.show { display: block; }
.mod-msg.ok { background: color-mix(in srgb, var(--good) 12%, var(--panel)); color: color-mix(in srgb, var(--good) 88%, var(--ink)); border: 1px solid color-mix(in srgb, var(--good) 34%, transparent); }
.mod-msg.err { background: var(--brick-soft); color: var(--brick); border: 1px solid color-mix(in srgb, var(--brick) 32%, transparent); }
.mod-msg:not(.ok):not(.err) { background: var(--honey-soft); color: var(--honey-ink); border: 1px solid color-mix(in srgb, var(--honey) 30%, transparent); }

.mod-list { display: grid; gap: 10px; transition: opacity .15s; }
.mod-list.loading { opacity: .55; }
.mod-empty { padding: 26px; text-align: center; color: var(--ink-3); font-size: 13px; background: var(--panel); border: 1px dashed var(--line-2); border-radius: var(--radius); }

.mod-card {
  padding: 14px 16px 12px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--line-2); box-shadow: var(--shadow-s);
}
.mod-card.wait { border-left-color: var(--honey); }
.mod-card.ok { border-left-color: var(--good); }
.mod-card.no { border-left-color: var(--brick); opacity: .82; }

.mod-card-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.mod-st {
  font-family: var(--mono); font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  padding: 2px 8px; border-radius: 5px;
}
.mod-st.wait { background: var(--honey-soft); color: var(--honey-ink); }
.mod-st.ok { background: color-mix(in srgb, var(--good) 16%, var(--panel)); color: var(--good); }
.mod-st.no { background: var(--brick-soft); color: var(--brick); }
.mod-kind { font-size: 11px; color: var(--ink-4); font-family: var(--mono); }
.mod-who { font-size: 13px; font-weight: 650; color: var(--ink); }
.mod-tag { font-size: 11px; color: var(--ink-3); background: var(--paper-2); padding: 2px 8px; border-radius: 5px; }
.mod-time { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--ink-4); }
.mod-body { font-size: 13.6px; line-height: 1.78; color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.mod-meta { display: flex; gap: 6px 16px; flex-wrap: wrap; margin-top: 8px; font-size: 11.5px; color: var(--ink-4); }
.mod-meta b { color: var(--ink-3); font-family: var(--mono); }
.mod-acts { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--line); }
.btn-sm.danger { color: var(--brick); border-color: color-mix(in srgb, var(--brick) 32%, var(--line)); }
.btn-sm.danger:hover { background: var(--brick-soft); border-color: var(--brick); color: var(--brick); }

.mod-reply { margin-top: 10px; display: grid; gap: 8px; }
.mod-reply .fb-textarea { min-height: 70px; font-size: 13px; }
.mod-reply-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mod-reply-row .mod-note { flex: 1 1 200px; font-size: 12.5px; padding: 8px 11px; }
.mod-more { text-align: center; margin-top: 12px; }

@media (max-width: 640px) {
  .mod-login { padding: 18px 16px; }
  .mod-counts > div { padding: 7px 11px; }
  .mod-counts b { font-size: 15px; }
  .mod-tools { margin-left: 0; width: 100%; }
  .thread { padding: 14px 14px 11px; }
  .thread-time { margin-left: 0; flex: 1 1 100%; }
}

/* ==========================================================================
   v5 —— 顶栏主导航（紧凑 + 章节下拉）与统一工具条
   ========================================================================== */

.site-header .wrap { gap: 14px; }

/* ---------- 主导航 ---------- */
.nav-main {
  display: flex; align-items: center; gap: 2px;
  margin-left: auto; min-width: 0;
}
.nav-main > a,
.nav-dd-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 999px;
  font-size: 13.5px; color: var(--ink-3);
  background: transparent; border: 1px solid transparent;
  font-family: inherit; cursor: pointer; white-space: nowrap;
  transition: background .16s, color .16s, border-color .16s;
}
.nav-main > a:hover, .nav-dd-btn:hover { background: var(--paper-2); color: var(--ink); }
.nav-main > a.active {
  background: var(--honey-soft); color: var(--honey-ink); font-weight: 650;
}
.nav-dd { position: relative; }
/* 填补按钮与下拉面板之间的空隙，避免移动鼠标时意外关闭；
   向下 30px 完全覆盖 10px 视觉间隙，左右各延 36px 兜住斜向移动 */
.nav-dd::after { content: ""; position: absolute; left: -36px; right: -36px; top: 100%; height: 30px; }
.nav-dd-cur { font-weight: 600; }
.nav-dd-cur.is-ch {
  font-family: var(--mono); font-size: 12.5px; letter-spacing: .01em;
}
.nav-dd-caret { width: 11px; height: 11px; opacity: .6; transition: transform .2s; }
.nav-dd-btn[aria-expanded="true"] {
  background: var(--panel); color: var(--ink);
  border-color: var(--line); box-shadow: var(--shadow-s);
}
.nav-dd-btn[aria-expanded="true"] .nav-dd-caret { transform: rotate(180deg); opacity: 1; }

/* ---------- 下拉面板 ---------- */
.nav-dd-panel {
  position: absolute; top: calc(100% + 10px); left: 50%;
  transform: translateX(-50%) translateY(-5px) scale(.99);
  width: min(520px, calc(100vw - 28px));
  padding: 11px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--line);
  box-shadow: var(--shadow-l);
  display: none; z-index: 96;
  opacity: 0; transition: opacity .16s, transform .16s cubic-bezier(.2,.8,.3,1);
}
.nav-dd-panel.open {
  display: block; opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}
.nav-dd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.nav-dd-grid a {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 11px; border-radius: 9px;
  font-size: 13.5px; color: var(--ink-2);
  transition: background .14s, color .14s;
}
.nav-dd-grid a > span {
  flex: none; font-family: var(--mono); font-size: 10.5px; font-weight: 700;
  color: var(--honey-ink); background: var(--honey-soft);
  padding: 2px 6px; border-radius: 5px; letter-spacing: .02em;
}
.nav-dd-grid a:hover { background: var(--paper-2); color: var(--ink); }
.nav-dd-grid a.on {
  background: var(--honey-soft); color: var(--honey-ink); font-weight: 650;
}
.nav-dd-foot {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-top: 9px; padding-top: 9px; border-top: 1px dashed var(--line);
}
.nav-dd-foot a {
  font-size: 12.5px; font-weight: 600; color: var(--honey-ink);
  padding: 6px 10px; border-radius: 8px; transition: background .14s;
}
.nav-dd-foot a:hover { background: var(--honey-soft); }

/* ---------- 工具条（反馈 / 配色 / 主题） ---------- */
.toolbar {
  display: flex; align-items: center; gap: 5px; flex: none;
  margin-left: 6px; padding-left: 9px; border-left: 1px solid var(--line);
}
.toolbar .icon-btn { width: 32px; height: 32px; border-color: transparent; background: transparent; }
.toolbar .icon-btn:hover { background: var(--paper-2); border-color: var(--line); }
.toolbar .fb-icon { color: var(--ink-3); }
.toolbar .fb-icon:hover { color: var(--honey-ink); background: var(--honey-soft); border-color: color-mix(in srgb, var(--honey) 40%, var(--line)); }
.palette-wrap { display: flex; }
.palette-pop { right: -4px; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .nav-main > a, .nav-dd-btn { padding: 7px 10px; font-size: 13px; }
}
@media (max-width: 760px) {
  .site-header .wrap { gap: 8px; }
  .nav-main { margin-left: auto; }
  .nav-main .nav-practice { display: none; }
  .nav-dd-panel { left: auto; right: -46px; transform: translateY(-5px) scale(.99); }
  .nav-dd-panel.open { transform: translateY(0) scale(1); }
  .nav-dd-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .nav-main .nav-home { display: none; }
  .toolbar { margin-left: 2px; padding-left: 6px; gap: 2px; }
  .toolbar .icon-btn { width: 30px; height: 30px; }
  .nav-dd-cur { font-size: 12px; }
}

/* ---------- v5.1 移动端下拉面板改为固定定位，避免跑出视口 ---------- */
@media (max-width: 760px) {
  .nav-dd-panel {
    position: fixed;
    left: 12px; right: 12px; top: calc(var(--header-h) + 4px);
    width: auto; max-height: calc(100vh - var(--header-h) - 20px);
    overflow-y: auto;
    transform: translateY(-6px) scale(.995);
    padding: 10px;
  }
  .nav-dd-panel.open { transform: none; }
  .nav-dd-grid { grid-template-columns: 1fr 1fr; gap: 2px; }
  .nav-dd-grid a { padding: 9px 8px; font-size: 13px; gap: 7px; }
  .nav-dd-grid a > span { font-size: 10px; padding: 2px 5px; }
  .nav-dd-foot { margin-top: 8px; padding-top: 8px; }
}
@media (max-width: 400px) {
  .nav-dd-grid { grid-template-columns: 1fr; }
  .nav-dd-grid a { padding: 10px 10px; }
}

/* ==========================================================================
   v6 —— 完整主题包（不只换主色：纸张底色 / 墨色 / 次要色 / 背景晕染 / Logo 一起换）
   --------------------------------------------------------------------------
   每个主题包都重定义整套 token：
     表面   --paper --paper-2 --panel --panel-2
     文字   --ink --ink-2 --ink-3 --ink-4
     线条   --line --line-2
     主色   --honey --honey-soft --honey-ink  （即各处的“强调色”）
     副色   --teal/--plum/--brick/--slate（+ -soft）与 --good
     图形   --c1…--c6（图表用）
     氛围   --wash-1/2/3（页面背景晕染）、--brand-b（Logo 渐变）
   ========================================================================== */

/* ---------- 默认值（蜂蜜金） ---------- */
:root {
  --brand-b: #e8b45f;
  --wash-1: rgba(201, 128, 31, .055);
  --wash-2: rgba(43, 122, 114, .050);
  --wash-3: rgba(138, 76, 133, .040);
}
:root[data-theme="dark"] {
  --brand-b: #8a6b33;
  --wash-1: rgba(227, 164, 66, .050);
  --wash-2: rgba(91, 179, 168, .045);
  --wash-3: rgba(189, 139, 184, .040);
}

/* ---------- 把写死的颜色接到 token 上 ---------- */
body::before {
  background-image:
    radial-gradient(circle at 12% 8%, var(--wash-1), transparent 42%),
    radial-gradient(circle at 88% 4%, var(--wash-2), transparent 38%),
    radial-gradient(circle at 50% 100%, var(--wash-3), transparent 55%);
}
.brand-mark {
  background: linear-gradient(145deg, var(--honey), var(--brand-b));
  box-shadow: 0 2px 10px -2px color-mix(in srgb, var(--honey) 70%, transparent);
}
.eyebrow .dot { background: var(--honey); }
.hero-stage-badge .live-dot { background: var(--good); }

/* ==========================================================================
   v7 —— 公开学习路径与阅读体验优化
   ========================================================================== */

/* 首页：减少重复信息，让行动入口更清晰 */
.home-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.home-actions .fb-cta { margin: 0; }
.chapter-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
.chapter-card { padding: 22px; }
.chapter-card p { font-size: 14px; }
.highlight-list .hl-card { min-height: 150px; }

/* 章节：先告诉学习者为什么学、怎样学 */
.learning-guide {
  display: grid; grid-template-columns: 1.35fr 1.35fr .8fr; gap: 0;
  margin-top: 22px; padding: 15px 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.learning-guide > div { padding: 0 18px; border-left: 1px solid var(--line); }
.learning-guide > div:first-child { padding-left: 0; border-left: 0; }
.learning-guide > div:last-child { padding-right: 0; }
.learning-guide span {
  display: block; margin-bottom: 4px; font-size: 11px; font-weight: 700;
  letter-spacing: .1em; color: var(--honey-ink);
}
.learning-guide p { font-size: 13px; line-height: 1.65; color: var(--ink-2); }

/* 理论是辅助阅读，演示才是视觉主角 */
.tcard { box-shadow: none; background: color-mix(in srgb, var(--panel) 72%, var(--paper)); }
.tcard > p { font-size: 14.5px; line-height: 1.82; }
.tkv { font-size: 13.5px; gap: 7px 12px; }
.pit, .tip-line { font-size: 13px; line-height: 1.75; }
.demo-head .sub, .demo-note { font-size: 14px; }
.demo-note { line-height: 1.8; }
.ctrl label, .ctrl .val { font-size: 13px; }
.readout .row span { font-size: 12.5px; }
.readout .row b { font-size: 13.5px; }
.legend { font-size: 12.5px; }

/* 练习解析与交互演示形成闭环 */
.ex-review {
  display: flex; align-items: center; justify-content: space-between; gap: 10px 18px;
  flex-wrap: wrap; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line-2);
  font-size: 13px; color: var(--ink-3);
}
.ex-review a { color: var(--honey-ink); font-weight: 650; }
.ex-review a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* 操作区域更宽松，触屏拖动更稳定 */
.btn-sm { min-height: 38px; }
.seg button { min-height: 34px; }
input[type="range"] { height: 26px; }
input[type="range"]::-webkit-slider-thumb { width: 18px; height: 18px; margin-top: -7px; }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; }

@media (max-width: 1080px) {
  .chapter-grid { grid-template-columns: repeat(2, 1fr); }
  .learning-guide { grid-template-columns: 1fr 1fr; gap: 14px 0; }
  .learning-guide > div:nth-child(3) { grid-column: 1 / -1; padding: 12px 0 0; border-left: 0; border-top: 1px dashed var(--line); }
}
@media (max-width: 860px) {
  .demo-side { flex-direction: column; flex-wrap: nowrap; }
  .demo-side > * { flex: none; width: 100%; }
  .home-actions { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .chapter-grid { grid-template-columns: 1fr; }
  .learning-guide { grid-template-columns: 1fr; gap: 12px; padding: 16px 0; }
  .learning-guide > div,
  .learning-guide > div:first-child,
  .learning-guide > div:nth-child(3) { grid-column: auto; padding: 0; border: 0; }
  .learning-guide > div + div { padding-top: 12px; border-top: 1px dashed var(--line); }
  .learning-guide p { font-size: 13.5px; }
  .tcard { padding: 17px 16px; }
  .tcard > p { font-size: 14.5px; }
  .btn-sm { min-height: 42px; }
  .seg button { min-height: 38px; }
  .toolbar .icon-btn { width: 36px; height: 36px; }
  .hero-stage-label { max-width: calc(100% - 32px); line-height: 1.5; letter-spacing: .03em; }
}

/* ==========================================================================
   主题包 1 —— 青瓷（jade）：冷调纸面 + 玉青主色
   ========================================================================== */
:root[data-palette="jade"] {
  --paper: #f5faf7;
  --paper-2: #eaf2ee;
  --panel: #fbfefd;
  --panel-2: #f5fbf8;
  --ink: #0f1a16;
  --ink-2: #334a43;
  --ink-3: #6a857d;
  --ink-4: #a2b8b1;
  --line: #d9e6e0;
  --line-2: #c1d4cd;

  --honey: #1f7a63;
  --honey-soft: #d8efe6;
  --honey-ink: #125a48;
  --teal: #2f7d94; --teal-soft: #d6ebf1;
  --plum: #7b5c98; --plum-soft: #e8e1f3;
  --brick: #b35f38; --brick-soft: #f6dfd3;
  --slate: #46739c; --slate-soft: #dae6f2;
  --good: #2f7a52;

  --c1: #1f7a63; --c2: #b0822a; --c3: #46739c;
  --c4: #b35f38; --c5: #7b5c98; --c6: #7c8c42;

  --brand-b: #45ab8b;
  --wash-1: rgba(31, 122, 99, .060);
  --wash-2: rgba(70, 115, 156, .050);
  --wash-3: rgba(176, 130, 42, .045);
  --shadow-s: 0 1px 2px rgba(12, 40, 32, .05), 0 2px 8px rgba(12, 40, 32, .04);
  --shadow-m: 0 2px 4px rgba(12, 40, 32, .05), 0 10px 30px -8px rgba(12, 40, 32, .13);
  --shadow-l: 0 30px 70px -30px rgba(12, 40, 32, .28);
}
:root[data-theme="dark"][data-palette="jade"] {
  --paper: #0e1613;
  --paper-2: #131f1b;
  --panel: #182722;
  --panel-2: #1d2f29;
  --ink: #eaf4f0;
  --ink-2: #c0d5cf;
  --ink-3: #87a29b;
  --ink-4: #5c7a73;
  --line: #22352f;
  --line-2: #2e4740;

  --honey: #52b89c;
  --honey-soft: #16332b;
  --honey-ink: #8bd8c2;
  --teal: #5fa8bd; --teal-soft: #143037;
  --plum: #b295cc; --plum-soft: #2a2237;
  --brick: #dd9270; --brick-soft: #35241c;
  --slate: #8aabcf; --slate-soft: #1a2532;
  --good: #62b587;

  --c1: #52b89c; --c2: #d3a558; --c3: #8aabcf;
  --c4: #dd9270; --c5: #b295cc; --c6: #a9bf6a;

  --brand-b: #2f7f6a;
  --wash-1: rgba(82, 184, 156, .055);
  --wash-2: rgba(138, 171, 207, .040);
  --wash-3: rgba(211, 165, 88, .035);
}

/* ==========================================================================
   主题包 2 —— 靛蓝（indigo）：瓷蓝纸面 + 靛青主色
   ========================================================================== */
:root[data-palette="indigo"] {
  --paper: #f5f7fc;
  --paper-2: #eaEEf8;
  --panel: #fcfdff;
  --panel-2: #f6f9ff;
  --ink: #11141f;
  --ink-2: #39405a;
  --ink-3: #727c96;
  --ink-4: #a9b1c6;
  --line: #dce1ef;
  --line-2: #c5ccdf;

  --honey: #3a5aa8;
  --honey-soft: #dde5f8;
  --honey-ink: #28417c;
  --teal: #2f7f8c; --teal-soft: #d7ecf0;
  --plum: #82508f; --plum-soft: #ecdeF0;
  --brick: #bd5a45; --brick-soft: #f7ddd7;
  --slate: #4d6fa8; --slate-soft: #dce5f6;
  --good: #2f7a55;

  --c1: #3a5aa8; --c2: #b3822c; --c3: #82508f;
  --c4: #bd5a45; --c5: #2f7f8c; --c6: #74833f;

  --brand-b: #6b8bd2;
  --wash-1: rgba(58, 90, 168, .060);
  --wash-2: rgba(130, 80, 143, .045);
  --wash-3: rgba(47, 127, 140, .045);
  --shadow-s: 0 1px 2px rgba(18, 26, 54, .05), 0 2px 8px rgba(18, 26, 54, .04);
  --shadow-m: 0 2px 4px rgba(18, 26, 54, .05), 0 10px 30px -8px rgba(18, 26, 54, .13);
  --shadow-l: 0 30px 70px -30px rgba(18, 26, 54, .28);
}
:root[data-theme="dark"][data-palette="indigo"] {
  --paper: #0d1019;
  --paper-2: #131826;
  --panel: #171d2c;
  --panel-2: #1c2333;
  --ink: #e9edf8;
  --ink-2: #bbc3dc;
  --ink-3: #818ba8;
  --ink-4: #576279;
  --line: #212a3c;
  --line-2: #2c374c;

  --honey: #8aa6de;
  --honey-soft: #1b2438;
  --honey-ink: #b0c6ee;
  --teal: #5cb0bd; --teal-soft: #143034;
  --plum: #b895cc; --plum-soft: #2a2136;
  --brick: #e08f77; --brick-soft: #35241f;
  --slate: #93b0d8; --slate-soft: #1a2231;
  --good: #63b58b;

  --c1: #8aa6de; --c2: #d3a558; --c3: #b895cc;
  --c4: #e08f77; --c5: #5cb0bd; --c6: #b0c26b;

  --brand-b: #3d5a96;
  --wash-1: rgba(138, 166, 222, .055);
  --wash-2: rgba(184, 149, 204, .040);
  --wash-3: rgba(92, 176, 189, .040);
}

/* ==========================================================================
   主题包 3 —— 朱砂（rust）：暖粉纸面 + 朱红主色
   ========================================================================== */
:root[data-palette="rust"] {
  --paper: #fdf7f4;
  --paper-2: #f7ebe4;
  --panel: #fffdfb;
  --panel-2: #fdf6f2;
  --ink: #1b100b;
  --ink-2: #4c392f;
  --ink-3: #8a6e60;
  --ink-4: #bea699;
  --line: #eddcd2;
  --line-2: #deC3b6;

  --honey: #b8432a;
  --honey-soft: #f9dfd6;
  --honey-ink: #882d19;
  --teal: #2c7a72; --teal-soft: #d7ece9;
  --plum: #8a4c85; --plum-soft: #eedff0;
  --brick: #9a6a1c; --brick-soft: #f4e7cf;
  --slate: #4c6b96; --slate-soft: #dde6f3;
  --good: #2f7a4e;

  --c1: #b8432a; --c2: #2c7a72; --c3: #8a4c85;
  --c4: #9a6a1c; --c5: #4c6b96; --c6: #7d8a3f;

  --brand-b: #e0855f;
  --wash-1: rgba(184, 67, 42, .055);
  --wash-2: rgba(154, 106, 28, .050);
  --wash-3: rgba(44, 122, 114, .040);
  --shadow-s: 0 1px 2px rgba(52, 18, 8, .05), 0 2px 8px rgba(52, 18, 8, .04);
  --shadow-m: 0 2px 4px rgba(52, 18, 8, .05), 0 10px 30px -8px rgba(52, 18, 8, .13);
  --shadow-l: 0 30px 70px -30px rgba(52, 18, 8, .28);
}
:root[data-theme="dark"][data-palette="rust"] {
  --paper: #150f0c;
  --paper-2: #1e1712;
  --panel: #251b16;
  --panel-2: #2b201a;
  --ink: #f7ece6;
  --ink-2: #d3bcb0;
  --ink-3: #a0857a;
  --ink-4: #6e5a51;
  --line: #33241d;
  --line-2: #433026;

  --honey: #e0846a;
  --honey-soft: #35211a;
  --honey-ink: #f2a68e;
  --teal: #5cb3a8; --teal-soft: #16302d;
  --plum: #bd8bb8; --plum-soft: #2e2130;
  --brick: #d3a558; --brick-soft: #352b18;
  --slate: #88a5d0; --slate-soft: #1b2635;
  --good: #64b585;

  --c1: #e0846a; --c2: #5cb3a8; --c3: #bd8bb8;
  --c4: #d3a558; --c5: #88a5d0; --c6: #b4c26a;

  --brand-b: #7f3b25;
  --wash-1: rgba(224, 132, 106, .055);
  --wash-2: rgba(211, 165, 88, .040);
  --wash-3: rgba(92, 179, 168, .035);
}

/* ==========================================================================
   主题包 4 —— 石墨（graphite）：中性石纸 + 暖灰主色（印刷品质感）
   ========================================================================== */
:root[data-palette="graphite"] {
  --paper: #f7f6f4;
  --paper-2: #efece7;
  --panel: #fefdfc;
  --panel-2: #f9f8f5;
  --ink: #15140f;
  --ink-2: #4a463f;
  --ink-3: #7f7a71;
  --ink-4: #b0aba1;
  --line: #e2dfd9;
  --line-2: #cdc8c0;

  --honey: #5f5850;
  --honey-soft: #e7e3dc;
  --honey-ink: #403a33;
  --teal: #4c6f6a; --teal-soft: #dee9e6;
  --plum: #6b5b74; --plum-soft: #e7e2ea;
  --brick: #8a5a48; --brick-soft: #efe1db;
  --slate: #55636f; --slate-soft: #e1e5e9;
  --good: #486b4d;

  --c1: #5f5850; --c2: #4c6f6a; --c3: #6b5b74;
  --c4: #8a5a48; --c5: #55636f; --c6: #6f7350;

  --brand-b: #8d857b;
  --wash-1: rgba(95, 88, 80, .050);
  --wash-2: rgba(76, 111, 106, .040);
  --wash-3: rgba(107, 91, 116, .035);
  --shadow-s: 0 1px 2px rgba(24, 22, 18, .06), 0 2px 8px rgba(24, 22, 18, .05);
  --shadow-m: 0 2px 4px rgba(24, 22, 18, .06), 0 10px 30px -8px rgba(24, 22, 18, .14);
  --shadow-l: 0 30px 70px -30px rgba(24, 22, 18, .30);
}
:root[data-theme="dark"][data-palette="graphite"] {
  --paper: #111110;
  --paper-2: #191917;
  --panel: #1d1c19;
  --panel-2: #23221f;
  --ink: #efede8;
  --ink-2: #c7c1b8;
  --ink-3: #928b81;
  --ink-4: #655f59;
  --line: #2b2825;
  --line-2: #393530;

  --honey: #b5aa9c;
  --honey-soft: #2a2722;
  --honey-ink: #dacfc0;
  --teal: #8cb3ad; --teal-soft: #1c2926;
  --plum: #b19dbb; --plum-soft: #262029;
  --brick: #c79a86; --brick-soft: #2e231d;
  --slate: #9aa8b6; --slate-soft: #1e2429;
  --good: #8db08f;

  --c1: #b5aa9c; --c2: #8cb3ad; --c3: #b19dbb;
  --c4: #c79a86; --c5: #9aa8b6; --c6: #b0b48a;

  --brand-b: #4d4a45;
  --wash-1: rgba(181, 170, 156, .045);
  --wash-2: rgba(140, 179, 173, .035);
  --wash-3: rgba(177, 157, 187, .030);
}

/* ==========================================================================
   v7 —— 首页「最新讨论」外显 / 章节讨论数徽标
   ========================================================================== */
.dsc-latest {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.lt-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 16px 18px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line);
  box-shadow: var(--shadow-s);
  transition: transform .2s cubic-bezier(.2,.8,.3,1), box-shadow .2s, border-color .2s;
  min-width: 0;
}
.lt-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-m); border-color: var(--line-2); }
.lt-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lt-time { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--ink-4); }
.lt-body {
  font-size: 13.4px; line-height: 1.72; color: var(--ink-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.lt-team {
  font-size: 12.5px; line-height: 1.6; color: color-mix(in srgb, var(--teal) 85%, var(--ink));
  background: var(--teal-soft); border-radius: 8px; padding: 7px 10px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.lt-team b {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .06em;
  background: color-mix(in srgb, var(--teal) 18%, transparent);
  padding: 1px 6px; border-radius: 4px; margin-right: 7px;
}
.lt-foot {
  display: flex; align-items: center; gap: 10px;
  font-size: 11.5px; color: var(--ink-4); margin-top: auto; padding-top: 2px;
}
.lt-who { color: var(--ink-3); }
.lt-reply { margin-left: auto; font-family: var(--mono); }

/* 章节 CTA 里的讨论数徽标 */
[data-discuss-chapter].is-live { background: var(--honey-soft); }

/* 讨论区里被锚点定位到的那条 */
.thread.is-target {
  border-color: var(--honey);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--honey) 16%, transparent), var(--shadow-m);
  animation: targetPulse 1.6s ease-out;
}
@keyframes targetPulse {
  0% { background: var(--honey-soft); }
  100% { background: var(--panel); }
}

@media (max-width: 820px) {
  .dsc-latest { grid-template-columns: 1fr; }
}

/* ==========================================================================
   v8 —— 分式排版修正（解决同一行多个分式"不平行"、横线只跟分子同宽）
   --------------------------------------------------------------------------
   旧写法：inline-flex + vertical-align:-0.55em
     → 固定位移，分子带不带上下标时高度不同，两个分式就对不齐；
     → border-bottom 画在分子上，横线只有分子那么宽。
   新写法：inline-grid 三行（分子 / 横线 / 分母）+ vertical-align:middle
     → 所有分式按"中心"对齐，同一行必然平行；
     → 横线用伪元素横跨整列（= 分子与分母中较宽的那个）。
   ========================================================================== */
.frac {
  display: inline-grid;
  grid-template-rows: auto auto auto;
  justify-items: center;
  align-items: center;
  vertical-align: middle;
  margin: 0 .34em;
  line-height: 1.16;
  font-size: .97em;
  color: inherit;
}
.frac > span:first-child {
  grid-row: 1;
  border-bottom: 0;            /* 清掉旧的下边框，改用伪元素横线 */
  padding: 0 .42em .14em;
  line-height: 1.2;
  white-space: nowrap;
}
.frac > span:last-child {
  grid-row: 3;
  padding: .14em .42em 0;
  line-height: 1.2;
  white-space: nowrap;
}
.frac::after {
  content: "";
  grid-row: 2;
  justify-self: stretch;
  align-self: center;
  width: 100%;
  height: 1px;
  background: currentColor;
  opacity: .85;
}

/* 公式块内部：让行高容纳分式上下溢出的部分 */
.eq { align-items: center; }
.eq .body { line-height: 1.5; }
.eq sub, .eq sup { line-height: 0; }

/* 根式：让上横线与内容贴合一点 */
.sqrt { display: inline-block; padding: .02em .14em 0; border-top: 1px solid currentColor; }

/* 移动端字号略缩，避免分式被压得过扁 */
@media (max-width: 640px) {
  .frac { font-size: .94em; margin: 0 .28em; }
  .frac > span:first-child { padding: 0 .34em .12em; }
  .frac > span:last-child { padding: .12em .34em 0; }
}

/* ==========================================================================
   v9 —— 顶栏「讨论与反馈」文字入口（练习台之后）
   ========================================================================== */
.nav-main .nav-feedback {
  color: var(--ink-2);
  font-weight: 600;
  position: relative;
}
.nav-main .nav-feedback::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--honey);
  margin-right: 7px;
  flex: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--honey) 18%, transparent);
}
.nav-main .nav-feedback:hover {
  background: var(--honey-soft);
  color: var(--honey-ink);
}
.nav-main .nav-feedback.active {
  background: var(--honey-soft);
  color: var(--honey-ink);
  font-weight: 650;
}
.nf-short { display: none; }

/* 工具条现在只有配色 + 主题两个按钮 */
.toolbar { gap: 4px; }

@media (max-width: 980px) {
  .nav-main > a, .nav-dd-btn { padding: 7px 10px; font-size: 13px; }
  .nav-main .nav-feedback::before { width: 5px; height: 5px; margin-right: 5px; }
}
@media (max-width: 760px) {
  /* 练习台在窄屏隐藏（下拉面板里仍有入口），把空间让给讨论入口 */
  .nav-main .nf-long { display: none; }
  .nav-main .nf-short { display: inline; }
}

/* v17 typography refinement (global) */
/* v18 typography system */
body { font-size: 16px; line-height: 1.8; }
h1, h2, h3, h4 {
  font-family: var(--sans); font-weight: 700;
  letter-spacing: .02em; line-height: 1.3;
}
.ch-head h1 { letter-spacing: .03em; }
.sec-head h2 { font-size: clamp(21px, 2.3vw, 26px); line-height: 1.32; }
.lec-h h2 { font-size: clamp(19px, 2vw, 23px); }
.sec-head p { font-size: 15.5px; line-height: 1.8; color: var(--ink-2); }
.ch-head .lead { font-size: 17px; line-height: 1.8; }
.method-card { padding: 23px 23px 21px; border-radius: 16px; }
.method-card h3 { font-size: 20px; }
.method-card p { font-size: 13.6px; line-height: 1.75; color: var(--ink-2); }
.method-table td { padding: 12px 14px; }
