/* ============================================================
   《纠缠理论的数学基础》阅读版样式
   设计：克制的学术排版 —— 白纸、细线、单一强调色
   ============================================================ */

:root {
  --ink: #1b1b1f;
  --ink-2: #3d3d45;
  --ink-3: #6b6b76;
  --muted: #8e8e99;
  --line: #e7e6e1;
  --line-2: #f0efeb;
  --bg: #fbfaf7;
  --paper: #ffffff;
  --accent: #1d4e6f;
  --accent-soft: #eef4f8;
  --thm: #2f6b4f;
  --thm-bg: #f4f8f5;
  --proof: #6a6a74;
  --warn: #a8562b;
  --radius: 8px;
  --sidebar-w: 272px;
  --serif: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "SimSun", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16.5px;
  line-height: 1.78;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------------------------------------------------------- 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(251, 250, 247, .88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 28px;
  height: 56px; display: flex; align-items: center; justify-content: space-between;
  font-family: var(--sans);
}
.brand {
  font-size: 15px; font-weight: 600; letter-spacing: .12em;
  color: var(--ink); text-decoration: none;
}
.brand:hover { text-decoration: none; color: var(--accent); }
.topbar nav { display: flex; gap: 4px; }
.topbar nav a {
  font-size: 13.5px; color: var(--ink-3); padding: 6px 12px; border-radius: 999px;
  transition: background .16s, color .16s;
}
.topbar nav a:hover { background: var(--line-2); color: var(--ink); text-decoration: none; }
.topbar nav a.on { color: var(--ink); background: var(--line-2); }

/* ---------------------------------------------------------- 布局 */
.layout {
  max-width: 1180px; margin: 0 auto; padding: 0 28px;
  display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); gap: 48px;
}

/* ---------------------------------------------------------- 侧边栏 */
.sidebar {
  position: sticky; top: 56px; align-self: start;
  max-height: calc(100vh - 56px); overflow-y: auto;
  padding: 30px 0 60px;
  font-family: var(--sans);
  scrollbar-width: thin;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }

.sb-home {
  display: inline-block; margin-bottom: 18px;
  font-size: 12.5px; color: var(--muted); letter-spacing: .04em;
}
.sb-book {
  display: block; margin-bottom: 22px; padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  font-size: 14.5px; font-weight: 600; color: var(--ink); line-height: 1.5;
}
.sb-book:hover { color: var(--accent); text-decoration: none; }

.sb-part { margin-bottom: 16px; }
.sb-part-title {
  font-size: 11px; letter-spacing: .1em; color: var(--muted);
  text-transform: uppercase; margin-bottom: 6px;
}
.sb-ch {
  display: flex; gap: 8px; align-items: baseline;
  padding: 4px 10px 4px 8px; border-radius: 6px;
  font-size: 13.2px; color: var(--ink-2); line-height: 1.55;
  border-left: 2px solid transparent;
}
.sb-ch:hover { background: var(--line-2); text-decoration: none; color: var(--ink); }
.sb-ch.active {
  background: var(--accent-soft); color: var(--accent);
  border-left-color: var(--accent); font-weight: 600;
}
.sb-num {
  flex: 0 0 auto; min-width: 14px; font-size: 11px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.sb-ch.active .sb-num { color: var(--accent); }

.sb-toc { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.sb-toc-title { font-size: 11px; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; margin-bottom: 8px; }
.sb-sec {
  display: flex; gap: 7px; align-items: baseline;
  padding: 3px 8px; border-radius: 5px;
  font-size: 12.8px; color: var(--ink-3); line-height: 1.5;
}
.sb-sec .sb-num { font-size: 10.5px; }
.sb-sec:hover { background: var(--line-2); color: var(--ink); text-decoration: none; }

/* ---------------------------------------------------------- 正文 */
.content { min-width: 0; padding: 34px 0 90px; max-width: 780px; }

.crumb {
  font-family: var(--sans); font-size: 12.5px; color: var(--muted);
  display: flex; gap: 8px; align-items: center; margin-bottom: 18px;
}
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--accent); }
.crumb span { color: #cfcec9; }

.chapter-title {
  font-size: 30px; line-height: 1.35; font-weight: 600; letter-spacing: .01em;
  margin: 0 0 8px; color: var(--ink);
}
.chapter-meta {
  font-family: var(--sans); font-size: 12.5px; color: var(--muted);
  letter-spacing: .04em; margin-bottom: 34px;
  padding-bottom: 18px; border-bottom: 1px solid var(--line);
}

.note { font-size: 16.5px; }
.note p { margin: 0 0 1.05em; }
.note > p:first-of-type { margin-top: 0; }

/* 中文段落首行不缩进，靠段距分隔；但连续正文保持舒适行宽 */
.note p, .note li { text-align: justify; text-justify: inter-ideograph; text-wrap: pretty; }

.section-title {
  font-size: 21px; font-weight: 600; line-height: 1.4;
  margin: 2.4em 0 .9em; padding-top: .2em;
  display: flex; align-items: baseline; gap: 10px;
  scroll-margin-top: 76px;
}
.sec-num {
  font-family: var(--sans); font-size: 12px; font-weight: 600;
  color: var(--accent); background: var(--accent-soft);
  border-radius: 4px; padding: 2px 7px; line-height: 1.6;
  flex: 0 0 auto; transform: translateY(-2px);
}
.subsection-title {
  font-size: 17.5px; font-weight: 600; color: var(--ink-2);
  margin: 1.9em 0 .7em; scroll-margin-top: 76px;
}
.subsubsection-title {
  font-size: 15.5px; font-weight: 600; color: var(--ink-2);
  margin: 1.6em 0 .5em; scroll-margin-top: 76px;
}

/* ---------------------------------------------------------- 定理环境 */
.thm {
  margin: 1.35em 0; padding: 0;
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 3px solid var(--thm);
  overflow: hidden;
  scroll-margin-top: 76px;
}
.thm-head {
  display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap;
  padding: 9px 16px 9px 15px;
  background: var(--thm-bg);
  border-bottom: 1px solid var(--line-2);
  font-family: var(--sans);
}
.thm-name { font-size: 13.5px; font-weight: 700; color: var(--thm); letter-spacing: .04em; }
.thm-num { font-size: 12.5px; font-weight: 600; color: var(--thm); font-variant-numeric: tabular-nums; }
.thm-title { font-size: 13px; color: var(--ink-3); }
.thm-body { padding: 13px 18px 4px; font-size: 16px; }
.thm-body > p:last-child { margin-bottom: .85em; }
.thm-body .thm { margin: 1em 0; }

/* 各类环境配色 */
.thm-definition { border-left-color: #1d4e6f; }
.thm-definition .thm-head { background: var(--accent-soft); }
.thm-definition .thm-name, .thm-definition .thm-num { color: var(--accent); }

.thm-theorem, .thm-proposition, .thm-lemma, .thm-corollary { border-left-color: var(--thm); }
.thm-axiom { border-left-color: #7a5c1e; }
.thm-axiom .thm-head { background: #faf6ec; }
.thm-axiom .thm-name, .thm-axiom .thm-num { color: #7a5c1e; }

.thm-example { border-left-color: #8a5a9a; background: #fdfbfe; }
.thm-example .thm-head { background: #f8f2fb; }
.thm-example .thm-name, .thm-example .thm-num { color: #8a5a9a; }

.thm-remark {
  border-left-color: #b8b7b0; background: #fcfcfa;
}
.thm-remark .thm-head { background: #f7f7f4; }
.thm-remark .thm-name { color: var(--ink-3); }

/* 证明 */
.thm-proof {
  margin: 1.2em 0; padding: 0 0 0 16px;
  border-left: 2px solid #dcdcd6;
  font-size: 15.8px; color: #2c2c33;
}
.thm-proof .thm-head {
  background: none; border: 0; padding: 0 0 4px;
}
.thm-proof .thm-name {
  font-size: 13px; font-weight: 700; color: var(--proof); letter-spacing: .18em;
}
.thm-proof .thm-body { padding: 0; }
.thm-proof .thm-body > p:last-child { margin-bottom: .8em; }

/* ---------------------------------------------------------- 公式 */
.eq {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  align-items: center; column-gap: 12px;
  margin: 1.15em 0; position: relative;
  scroll-margin-top: 80px;
}
.eq-body { min-width: 0; overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
.eq-body .katex-display { margin: .2em 0; }
.eq-num {
  font-family: var(--sans); font-size: 12.5px; color: var(--ink-3);
  font-variant-numeric: tabular-nums; letter-spacing: .02em;
  white-space: nowrap; user-select: none;
}
.eq-group { margin: 1.2em 0; }
.eq-group .eq { margin: .25em 0; }
.eq:target { background: #fffdf0; }

.katex { font-size: 1.03em; }
.katex-display > .katex { font-size: 1.06em; }

/* 行内公式容器 */
.m { white-space: nowrap; }

math-err, .math-err {
  font-family: var(--mono); font-size: 12.5px; color: var(--warn);
  background: #fdf3ec; border: 1px dashed #e5b79a; border-radius: 4px;
  padding: 1px 6px; white-space: pre-wrap; word-break: break-all;
}

/* ---------------------------------------------------------- 列表 */
.list { margin: .7em 0 1.1em; padding-left: 1.55em; }
.list li { margin: .3em 0; }
.list li > p { margin-bottom: .35em; }
ul.bullet { list-style: none; padding-left: 1.3em; }
ul.bullet > li { position: relative; }
ul.bullet > li::before {
  content: ""; position: absolute; left: -1em; top: .72em;
  width: 5px; height: 5px; border-radius: 50%; background: #c3c2ba;
}
ol.list { list-style: none; counter-reset: item; padding-left: 1.9em; }
ol.list > li { position: relative; counter-increment: item; }
ol.list > li::before {
  content: "(" counter(item) ")"; position: absolute; left: -1.9em; top: 0;
  font-family: var(--sans); font-size: .82em; color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.list.depth-0 { padding-left: 1.55em; }
.list.depth-0 > li::before { font-size: .86em; }

/* 讲义版列表：编号由 <span class="li-lab"> 给出（支持 1. / (1) / Method 1） */
ol.enum { list-style: none; counter-reset: none; padding-left: 2.2em; }
ol.enum > li { position: relative; counter-increment: none; }
ol.enum > li::before { content: none; }
.li-lab {
  position: absolute; left: -2.2em; top: 0; min-width: 1.9em;
  font-family: var(--sans); font-size: .86em; line-height: 1.9;
  color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap;
}
ol.enum.depth-1 { padding-left: 2.4em; }
ol.enum.depth-1 > li > .li-lab { left: -2.4em; }
ol.enum.depth-2 { padding-left: 3.4em; }
ol.enum.depth-2 > li > .li-lab { left: -3.4em; }

/* 多栏排版（multicols） */
.multicols {
  column-count: var(--cols, 2); column-gap: 32px; margin: .8em 0 1.1em;
}
.multicols > p:first-child { margin-top: 0; }
@media (max-width: 720px) { .multicols { column-count: 1; } }

/* 插图 */
.fig { margin: 1.4em 0 1.6em; text-align: center; }
.fig-img { display: inline-block; max-width: 100%; height: auto; border-radius: 4px; }
.fig-multi { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; justify-content: center; }
.fig-multi .fig-img { flex: 0 0 auto; }
.fig-cap {
  margin-top: 10px; font-family: var(--sans); font-size: 13px; color: var(--ink-3);
  line-height: 1.65; text-wrap: pretty;
}
.fig-n { font-weight: 600; color: var(--ink-2); margin-right: 6px; }

/* 表格（讲义里只有严镇军习题全解用到一次，用 KaTeX 的 array 渲染） */
.tbl { margin: 1.4em 0 1.6em; }
.tbl .eq-body { overflow-x: auto; overflow-y: hidden; }
.tbl .katex-display { margin: 0; }

/* 填空题的横线（\hbox to 80mm{}） */
.blank {
  display: inline-block; height: 1em; vertical-align: -0.15em;
  border-bottom: 1px solid currentColor; opacity: .75;
}

/* 讲义页顶部：原件链接 + 可选内嵌 PDF */
.src-bar {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  margin: 20px 0 26px; padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.src-tip { font-family: var(--sans); font-size: 12px; color: var(--muted); }
.src-links { display: flex; gap: 20px; }
.src-links a {
  font-size: 13px; color: var(--accent);
  border-bottom: 1px solid transparent; padding-bottom: 1px; text-decoration: none;
}
.src-links a:hover { border-bottom-color: var(--accent); text-decoration: none; }

.pdf-embed { margin: 0 0 26px; }
.pdf-embed > summary {
  cursor: pointer; font-family: var(--sans); font-size: 12.5px; color: var(--ink-3);
  padding: 6px 0; list-style: none;
}
.pdf-embed > summary::-webkit-details-marker { display: none; }
.pdf-embed > summary::before { content: "＋ "; color: var(--muted); }
.pdf-embed[open] > summary::before { content: "－ "; }
.pdf-embed > summary:hover { color: var(--accent); }
.pdf-embed .pdf-wrap { margin-top: 10px; }

/* 讲义里个性化的定理块（解 / 注 / 另解） */
.thm-solution, .thm-note {
  border-left-color: #b9b8b0; background: #fcfcfa;
}
.thm-solution .thm-head, .thm-note .thm-head { background: #f6f6f2; }
.thm-solution .thm-name, .thm-note .thm-name { color: var(--ink-2); }

/* \textcolor{red}{…} 之类 */
.tc-red { color: #b4372e; }
.tc-blue { color: #1d4e6f; }
.tc-green { color: #2f6b4f; }
.tc-orange { color: #a5601c; }
.tc-purple { color: #6b4a8a; }
.tc-gray, .tc-grey { color: var(--ink-3); }
.tc-black { color: var(--ink); }

/* ---------------------------------------------------------- 引用/脚注/文献 */
.ref { border-bottom: 1px solid rgba(29, 78, 111, .28); }
.ref:hover { text-decoration: none; border-bottom-color: var(--accent); }
.ref.dangling {
  color: var(--warn); border-bottom: 1px dashed #d9b49b; cursor: help;
  background: #fdf6f1; padding: 0 3px; border-radius: 3px;
}
.cite { font-family: var(--sans); font-size: .78em; }
.cite a { color: var(--accent); }
sup.fn { font-family: var(--sans); font-size: .72em; line-height: 0; }
sup.fn a {
  padding: 1px 4px; border-radius: 4px; background: var(--line-2); color: var(--ink-3);
}
sup.fn a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }

.footnotes {
  margin-top: 46px; padding-top: 18px; border-top: 1px solid var(--line);
  font-size: 13.6px; color: var(--ink-3); font-family: var(--sans);
}
.footnotes ol { padding-left: 1.6em; margin: 0; }
.footnotes li { margin: .45em 0; line-height: 1.65; }
.footnotes li:target { background: #fffdf0; }

/* ---------------------------------------------------------- 参考文献 */
.bib { margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); }
.bib-title {
  font-family: var(--serif); font-size: 20px; font-weight: 600; letter-spacing: .02em;
  margin: 0 0 18px; display: flex; align-items: baseline; gap: 10px;
}
.bib-en { font-family: var(--sans); font-size: 11px; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; font-weight: 400; }
.bib-list { list-style: none; margin: 0; padding: 0; counter-reset: bib; }
.bib-item {
  display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 8px;
  font-size: 13.6px; line-height: 1.75; color: var(--ink-2);
  padding: 7px 8px; margin: 0 -8px; border-radius: 6px;
  scroll-margin-top: 80px; text-wrap: pretty;
}
.bib-item:target { background: #fffdf0; }
.bib-n { font-family: var(--sans); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bib-body i { font-style: italic; }

.center { text-align: center; margin: 1.1em 0; }

/* ---------------------------------------------------------- 翻页 */
.pager {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  margin-top: 64px; font-family: var(--sans);
}
.pager a {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 16px; background: var(--paper);
  transition: border-color .16s, transform .16s, box-shadow .16s;
  min-width: 0;
}
.pager a:hover {
  text-decoration: none; border-color: #cfcec6;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .04);
}
.pager-label { display: block; font-size: 11px; color: var(--muted); letter-spacing: .08em; margin-bottom: 3px; }
.pager-title {
  display: block; font-size: 14.5px; color: var(--ink); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pager-next { text-align: right; }

.page-foot {
  margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--line);
  font-family: var(--sans); font-size: 12px; color: var(--muted); letter-spacing: .03em;
}

/* ---------------------------------------------------------- 资料大纲页 */
.outline {
  max-width: 880px; margin: 0 auto; padding: 46px 28px 100px;
}
.outline-hero {
  display: grid; grid-template-columns: 1fr 268px; gap: 40px; align-items: center;
  padding-bottom: 34px; border-bottom: 1px solid var(--line); margin-bottom: 14px;
}
.oh-text h1 {
  font-size: 32px; line-height: 1.32; margin: 0 0 8px; font-weight: 600; letter-spacing: .01em;
}
.oh-sub {
  font-family: var(--sans); font-size: 12.5px; letter-spacing: .1em;
  color: var(--muted); text-transform: uppercase; margin: 0 0 16px;
}
.oh-desc { font-size: 15px; line-height: 1.85; color: var(--ink-2); margin: 0 0 18px; max-width: 46em; }
.oh-desc em { font-style: normal; font-family: var(--sans); font-weight: 600; }
.oh-stats { display: flex; gap: 10px; flex-wrap: wrap; font-family: var(--sans); margin-bottom: 22px; }
.oh-stats span {
  font-size: 12px; color: var(--ink-3); background: var(--paper);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 13px;
}
.oh-actions { display: flex; gap: 24px; margin: 0; flex-wrap: wrap; }
.oh-actions a {
  font-family: var(--sans); font-size: 13.5px; font-weight: 500; color: var(--accent);
  display: inline-flex; align-items: center; gap: 6px;
  border-bottom: 1px solid transparent; padding-bottom: 1px;
  text-decoration: none;
}
/* 只在悬停时给一条下划线：全局 a:hover 自带 text-decoration，这里必须压掉，否则会叠成双线 */
.oh-actions a:hover { border-bottom-color: var(--accent); text-decoration: none; }
.oh-cover {
  /* 不锁死比例：16:9 的书封与 4:3 的照片各自按原比例显示 */
  width: 268px; height: auto;
  border-radius: var(--radius); display: block;
  box-shadow: 0 6px 26px rgba(30, 40, 60, .16);
  border: 1px solid rgba(0, 0, 0, .06);
}

/* 封面：可点击放大（Wiki 式灯箱） */
.oh-cover-btn {
  position: relative; width: 268px; padding: 0; margin: 0; border: 0; background: none;
  display: block; cursor: zoom-in; border-radius: var(--radius);
  -webkit-tap-highlight-color: transparent;
}
.oh-cover-btn .oh-cover { width: 100%; }
.oh-cover-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.oh-zoom {
  position: absolute; right: 10px; bottom: 10px;
  font-family: var(--sans); font-size: 11px; letter-spacing: .04em;
  color: #fff; background: rgba(18, 26, 38, .58);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  border-radius: 999px; padding: 4px 11px;
  opacity: 0; transform: translateY(3px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}
.oh-cover-btn:hover .oh-zoom,
.oh-cover-btn:focus-visible .oh-zoom { opacity: 1; transform: translateY(0); }
.oh-cover-btn:hover .oh-cover { box-shadow: 0 10px 34px rgba(30, 40, 60, .24); }

.lightbox {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
  background: rgba(14, 18, 26, .82);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .22s ease;
  overscroll-behavior: contain;
}
.lightbox[hidden] { display: none; }
.lightbox.on { opacity: 1; }
.lb-figure {
  margin: 0; max-width: min(1400px, 96vw); max-height: 92vh;
  display: flex; align-items: center; justify-content: center;
  transform: scale(.965); transition: transform .24s cubic-bezier(.2, .7, .3, 1);
}
.lightbox.on .lb-figure { transform: scale(1); }
.lb-img {
  display: block; max-width: 100%; max-height: 92vh; width: auto; height: auto;
  border-radius: 6px; background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
}
.lb-close {
  position: absolute; top: 22px; right: 22px;
  width: 40px; height: 40px; padding: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(24, 30, 40, .74); color: #fff; border: 1px solid rgba(255, 255, 255, .26);
  cursor: pointer; transition: background .16s ease, transform .16s ease, border-color .16s ease;
}
.lb-close:hover { background: rgba(24, 30, 40, .92); border-color: rgba(255, 255, 255, .5); transform: scale(1.06); }
.lb-close:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.lb-close svg { display: block; }
body.lb-open { overflow: hidden; }

.parts { margin-top: 8px; }
.part { padding: 30px 0 10px; border-bottom: 1px solid var(--line-2); }
.part:last-child { border-bottom: 0; }
.part-pre { padding-top: 22px; }
.part-head {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.part-cn {
  font-family: var(--sans); font-size: 11px; letter-spacing: .12em;
  color: var(--accent); background: var(--accent-soft);
  border-radius: 4px; padding: 3px 8px; text-transform: uppercase;
}
.part-head h2 { font-size: 21px; font-weight: 600; margin: 0; letter-spacing: .01em; }
.part-sub {
  font-family: var(--sans); font-size: 11.5px; color: var(--muted);
  letter-spacing: .08em; text-transform: uppercase;
}

.ch-list { display: flex; flex-direction: column; }
.ch-card {
  padding: 12px 0 13px 14px; border-left: 2px solid var(--line-2);
  transition: border-color .16s, background .16s;
}
.ch-card:hover { border-left-color: var(--accent); background: rgba(29, 78, 111, .022); }
.ch-line { display: flex; align-items: baseline; gap: 12px; text-decoration: none; }
.ch-line:hover { text-decoration: none; }
/* 卡片横条：左半边是进入详情页的链接，右侧依次是「下载PDF」与页数 */
.ch-main {
  display: flex; align-items: baseline; gap: 12px;
  flex: 1 1 auto; min-width: 0; text-decoration: none;
}
.ch-main:hover { text-decoration: none; }
.ch-dl {
  font-family: var(--sans); font-size: 12px; color: var(--accent);
  flex: 0 0 auto; border-bottom: 1px solid transparent; padding-bottom: 1px;
}
.ch-dl:hover { border-bottom-color: var(--accent); text-decoration: none; }
.ch-num {
  font-family: var(--sans); font-size: 12px; font-weight: 600; color: var(--muted);
  min-width: 18px; font-variant-numeric: tabular-nums;
}
.ch-title { font-size: 16.5px; color: var(--ink); font-weight: 600; flex: 1 1 auto; }
.ch-line:hover .ch-title { color: var(--accent); }
.ch-secs {
  font-family: var(--sans); font-size: 11.5px; color: var(--muted);
  flex: 0 0 auto; letter-spacing: .04em;
  /* 固定宽度、右对齐：页码一位数还是两位数都不影响「下载PDF」的横向位置 */
  min-width: 3.4em; text-align: right;
  font-variant-numeric: tabular-nums;
}
.ch-toc {
  display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 7px 0 0 30px;
  font-family: var(--sans);
}
.ch-toc a {
  font-size: 12.6px; color: var(--ink-3); padding: 1px 0;
  border-bottom: 1px solid transparent;
}
.ch-toc a:hover { color: var(--accent); border-bottom-color: rgba(29, 78, 111, .3); text-decoration: none; }

/* ---------------------------------------------------------- 资料集（数学分析 B2） */
.outline-hero-plain { grid-template-columns: minmax(0, 1fr); }
.oh-note {
  font-family: var(--sans); font-size: 12.5px; color: var(--muted);
  margin: 0; letter-spacing: .02em;
}
.part-desc {
  font-size: 14px; line-height: 1.8; color: var(--ink-3);
  margin: -8px 0 16px; max-width: 44em; text-wrap: pretty;
}
.it-en {
  font-family: var(--sans); font-size: 12px; color: var(--muted);
  margin: 5px 0 0 30px; letter-spacing: .04em;
  display: flex; gap: 10px; align-items: baseline;
}
.it-date { font-variant-numeric: tabular-nums; color: var(--ink-3); }

/* PDF 阅读条 */
.pdf-bar {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  margin: 22px 0 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.pdf-tip { font-family: var(--sans); font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.pdf-links { display: flex; gap: 20px; }
.pdf-links a {
  font-family: var(--sans); font-size: 13px; color: var(--accent);
  border-bottom: 1px solid transparent; padding-bottom: 1px;
}
.pdf-links a:hover { border-bottom-color: var(--accent); text-decoration: none; }
.pdf-wrap {
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; background: #f4f3ef;
}
.pdf-frame { display: block; width: 100%; height: 78vh; min-height: 480px; border: 0; }
.pdf-empty {
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 42px 28px; text-align: center; background: var(--paper);
  margin: 26px 0 8px;
}
.pe-title { font-family: var(--serif); font-size: 17px; color: var(--ink-2); margin: 0 0 8px; }
.pe-desc {
  font-size: 13.5px; line-height: 1.8; color: var(--muted);
  margin: 0 auto; max-width: 34em; text-wrap: pretty;
}
.pe-desc code {
  font-family: var(--mono); font-size: .92em; background: var(--line-2);
  border-radius: 4px; padding: 1px 5px;
}

/* ---------------------------------------------------------- 杂项 */
.tex-cmd {
  font-family: var(--mono); font-size: .88em; color: var(--warn);
  background: #fdf6f1; border-radius: 3px; padding: 0 3px;
}
.unknown-env {
  border: 1px dashed #d9b49b; border-radius: 6px; padding: 10px 12px;
  background: #fdf6f1; font-family: var(--sans); font-size: 13px; color: var(--warn);
}
.nobreak { white-space: nowrap; }
.op-symbol, .text, .mathrm, .mathcal, .mathbb, .mathscr, .mathfrak { font-style: normal; }

/* 标题锚点 */
.anchor-link {
  opacity: 0; margin-left: 8px; font-family: var(--sans); font-size: .68em;
  color: var(--muted); text-decoration: none; transition: opacity .16s;
}
.section-title:hover .anchor-link,
.subsection-title:hover .anchor-link,
.anchor-link:focus { opacity: 1; }
.anchor-link:hover { color: var(--accent); text-decoration: none; }

.sb-sec.cur {
  background: var(--accent-soft); color: var(--accent);
  font-weight: 600;
}

.to-top {
  position: fixed; right: 26px; bottom: 26px; z-index: 50;
  padding: 0 14px; height: 34px;
  border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink-3);
  font-size: 12px; letter-spacing: .04em; line-height: 1; cursor: pointer;
  font-family: var(--sans);
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity .2s, transform .2s, border-color .2s, color .2s;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .06);
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { border-color: #cfcec6; color: var(--accent); }

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

/* 行内公式绝不折行。
   早期为了消除横向溢出，曾在窄屏/讲义页把 .m 与 .katex-base 的 white-space 改成
   normal；但 .katex-base 是 width:min-content 的 inline-block，一旦允许折行，
   一个公式会被竖着拆成好几行，行盒高度暴涨，整段文字被顶上去——就是"公式跑到上一行"
   那个错版。现在统一保持 nowrap，超长公式改由所在段落横向滚动（见下面的 .ovf-x）。 */
.m,
.m .katex,
.m .katex-html,
.m .katex-base { white-space: nowrap; }

/* 由 notes.js 在加载后给"内容确实超宽"的段落打上 .ovf-x：
   只有这种段落才成为横向滚动容器，其余段落保持普通流，不影响行距与基线。 */
.note p.ovf-x,
.note li.ovf-x,
.footnotes li.ovf-x,
.thm-body p.ovf-x,
.thm-body li.ovf-x {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: #d8d7d0 transparent;
}
.note p.ovf-x::-webkit-scrollbar,
.note li.ovf-x::-webkit-scrollbar,
.footnotes li.ovf-x::-webkit-scrollbar,
.thm-body p.ovf-x::-webkit-scrollbar,
.thm-body li.ovf-x::-webkit-scrollbar { height: 6px; }
.note p.ovf-x::-webkit-scrollbar-thumb,
.note li.ovf-x::-webkit-scrollbar-thumb,
.footnotes li.ovf-x::-webkit-scrollbar-thumb,
.thm-body p.ovf-x::-webkit-scrollbar-thumb,
.thm-body li.ovf-x::-webkit-scrollbar-thumb {
  background: #dedcd5; border-radius: 3px;
}

@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; gap: 0; padding: 0 22px; }
  .sidebar {
    position: static; max-height: none; overflow: visible;
    padding: 22px 0 6px; border-bottom: 1px solid var(--line);
  }
  .sb-chapters { display: none; }
  .sb-toc { display: none; }
  .sb-book { margin-bottom: 10px; padding-bottom: 10px; border-bottom: 0; }
  .content { padding-top: 24px; max-width: none; }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  .topbar-inner { padding: 0 18px; height: 52px; }
  .layout { padding: 0 18px; }
  .outline { padding: 30px 18px 80px; }
  .outline-hero { grid-template-columns: 1fr; gap: 22px; }
  .oh-cover-btn { width: 100%; max-width: 320px; order: -1; }
  .oh-cover { width: 100%; max-width: 320px; order: -1; }
  .oh-text h1 { font-size: 25px; }
  .chapter-title { font-size: 24px; }
  .section-title { font-size: 19px; }
  .thm-body { padding: 12px 14px 2px; }
  .thm-head { padding: 8px 14px; }
  .pager { grid-template-columns: 1fr; }
  .pager-next { text-align: left; }
  .ch-toc { margin-left: 0; }
  .ch-card { padding-left: 10px; }
}

@media (max-width: 720px) {
  .lightbox { padding: 16px; }
  .lb-close { top: 12px; right: 12px; width: 38px; height: 38px; }
  .lb-img { max-height: 84vh; }
  .lb-figure { max-height: 84vh; }
}
@media print {
  .topbar, .sidebar, .pager, .page-foot, .oh-zoom { display: none; }
  .lightbox { display: none !important; }
  .layout { display: block; padding: 0; }
  .content { max-width: none; padding: 0; }
  body { background: #fff; font-size: 11pt; }
  .thm { break-inside: avoid; }
}
