/* ---------- 颜色与字体 ---------- */
:root {
  --bg: #faf9f5;
  --bg-2: #f0eee6;
  --card: #ffffff;
  --fg: #141413;
  --fg-2: #3d3d3a;
  --muted: #73726c;
  --line: #e8e6dc;
  --line-2: #d8d5c9;
  --desk: #e6e4dc;
  --topbar: rgba(250, 249, 245, .9);
  --shadow: 0 1px 2px rgba(20, 20, 19, .05), 0 4px 16px rgba(20, 20, 19, .04);

  --accent: #c6613f;
  --accent-soft: #f6e6dc;
  --on-accent: #ffffff;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", serif;
  --paper-serif: Georgia, "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;
  --fs: 15px;
  --top-h: 56px;
  color-scheme: light;
}
:root[data-size="s"] { --fs: 14px; }
:root[data-size="l"] { --fs: 16.5px; }

:root[data-accent="ink"] { --accent: #3a5a92; --accent-soft: #e3e9f3; }
:root[data-accent="pine"] { --accent: #3b7658; --accent-soft: #e1ede6; }
:root[data-accent="plum"] { --accent: #8b4a7c; --accent-soft: #f1e4ee; }
:root[data-accent="graphite"] { --accent: #3d3d3a; --accent-soft: #e9e7df; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1f1e1d; --bg-2: #262624; --card: #2a2927; --fg: #f5f4ef; --fg-2: #d6d4cc; --muted: #a3a198;
    --line: #393835; --line-2: #4a4844; --desk: #30302d; --topbar: rgba(31, 30, 29, .9);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .2);
    --accent: #e08b6b; --accent-soft: #3d2b23; --on-accent: #1f1e1d; color-scheme: dark;
  }
  :root:not([data-theme="light"])[data-accent="ink"] { --accent: #93b0e3; --accent-soft: #232d3f; }
  :root:not([data-theme="light"])[data-accent="pine"] { --accent: #82c4a3; --accent-soft: #1f332a; }
  :root:not([data-theme="light"])[data-accent="plum"] { --accent: #d49dc8; --accent-soft: #36263a; }
  :root:not([data-theme="light"])[data-accent="graphite"] { --accent: #dedbd2; --accent-soft: #34332f; }
}
:root[data-theme="dark"] {
  --bg: #1f1e1d; --bg-2: #262624; --card: #2a2927; --fg: #f5f4ef; --fg-2: #d6d4cc; --muted: #a3a198;
  --line: #393835; --line-2: #4a4844; --desk: #30302d; --topbar: rgba(31, 30, 29, .9);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .2);
  --accent: #e08b6b; --accent-soft: #3d2b23; --on-accent: #1f1e1d; color-scheme: dark;
}
:root[data-theme="dark"][data-accent="ink"] { --accent: #93b0e3; --accent-soft: #232d3f; }
:root[data-theme="dark"][data-accent="pine"] { --accent: #82c4a3; --accent-soft: #1f332a; }
:root[data-theme="dark"][data-accent="plum"] { --accent: #d49dc8; --accent-soft: #36263a; }
:root[data-theme="dark"][data-accent="graphite"] { --accent: #dedbd2; --accent-soft: #34332f; }

/* ---------- 基础 ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + 16px); }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--sans); font-size: 16px; line-height: 1.7; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; height: auto; }
button { font-family: inherit; }
::selection { background: var(--accent-soft); }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--top-h);
  display: flex; align-items: center; gap: 14px; padding: 0 20px;
  background: var(--topbar); backdrop-filter: saturate(1.5) blur(12px); -webkit-backdrop-filter: saturate(1.5) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--fg); white-space: nowrap; flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-family: var(--serif); font-weight: 700; font-size: 12px; letter-spacing: .02em; }
.brand-t { font-family: var(--serif); font-weight: 600; font-size: 15px; }
.crumb { min-width: 0; flex: 1; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 14px; border-left: 1px solid var(--line); }
.crumb-no { font-variant-numeric: tabular-nums; color: var(--fg); font-weight: 600; margin-right: 8px; }
.tabs { display: flex; gap: 2px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; flex-shrink: 0; }
.tab { padding: 2px 14px; border-radius: 7px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.tab:hover { text-decoration: none; color: var(--fg); }
.tab.on { background: var(--card); color: var(--fg); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.menu-btn { display: none; width: 36px; height: 36px; border: 0; background: none; padding: 10px 8px; cursor: pointer; flex-direction: column; justify-content: space-between; border-radius: 8px; flex-shrink: 0; }
.menu-btn:hover { background: var(--bg-2); }
.menu-btn span { display: block; height: 1.6px; background: var(--fg); border-radius: 1px; }
.progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; pointer-events: none; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .1s linear; }

/* 外观菜单 */
.theme { position: relative; flex-shrink: 0; }
.theme-btn { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--card); color: var(--fg); border-radius: 10px; cursor: pointer; }
.theme-btn:hover { border-color: var(--line-2); }
.theme-pop { position: absolute; right: 0; top: 44px; width: 272px; padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow), 0 12px 40px rgba(0, 0, 0, .12); z-index: 60; }
.tp-h { font-size: 12px; color: var(--muted); margin: 0 0 8px; letter-spacing: .04em; }
.tp-h:not(:first-child) { margin-top: 14px; }
.seg { display: flex; background: var(--bg-2); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { flex: 1; border: 0; background: none; padding: 5px 0; border-radius: 7px; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--card); color: var(--fg); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
.sws { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.sw { border: 1px solid transparent; background: none; border-radius: 10px; padding: 6px 0 4px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); }
.sw i { width: 24px; height: 24px; border-radius: 50%; display: block; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .5); }
.sw.on { border-color: var(--line-2); background: var(--bg-2); color: var(--fg); }
.sw-clay i { background: #c6613f; } .sw-ink i { background: #3a5a92; } .sw-pine i { background: #3b7658; } .sw-plum i { background: #8b4a7c; } .sw-graphite i { background: #3d3d3a; }

/* ---------- 布局 ---------- */
.layout { display: grid; grid-template-columns: 288px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h)); overflow-y: auto;
  border-right: 1px solid var(--line); padding: 18px 12px 48px; font-size: 13px; line-height: 1.5;
  scrollbar-width: thin;
}
.toc a { display: flex; gap: 10px; padding: 5px 10px; border-radius: 8px; color: var(--fg-2); }
.toc a b { font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 1.6em; flex-shrink: 0; font-size: 12.5px; padding-top: 1px; }
.toc a:hover { background: var(--bg-2); text-decoration: none; }
.toc a.on { background: var(--accent-soft); color: var(--fg); font-weight: 600; }
.toc a.on b { color: var(--accent); }
.toc .toc-home { color: var(--muted); margin-bottom: 8px; font-size: 13px; }
.toc details > summary { list-style: none; cursor: pointer; }
.toc details > summary::-webkit-details-marker { display: none; }
.toc .sub { margin: 2px 0 8px 20px; border-left: 1px solid var(--line); padding-left: 6px; }
.toc .sub a { font-size: 12.5px; padding: 5px 8px; }
.scrim { display: none; }
main { min-width: 0; }

.pane { display: none; }
body[data-mode="讲解"] .pane[data-pane="讲解"],
body[data-mode="译文"] .pane[data-pane="译文"],
body[data-mode="原文"] .pane[data-pane="原文"] { display: block; }

/* ---------- 讲解 ---------- */
.lecture-grid { display: grid; grid-template-columns: minmax(0, 1fr) 240px; max-width: 1080px; margin: 0 auto; gap: 40px; padding: 0 32px; }
.lecture-wrap { min-width: 0; max-width: 740px; padding: 44px 0 72px; }
.kicker { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.kicker span { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 1px 9px; border-radius: 6px; }
.lecture-wrap h1 { font-family: var(--serif); font-weight: 600; font-size: 24px; line-height: 1.4; margin: 0 0 16px; letter-spacing: -.005em; text-wrap: balance; }
.head-note { font-size: 13px; color: var(--muted); line-height: 1.7; }
.head-note blockquote { margin: 0; padding: 14px 18px; background: var(--bg-2); border-radius: 12px; }
.head-note blockquote p { margin: 3px 0; }
.head-note a { color: var(--fg-2); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }

.stair { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; flex-shrink: 0; }
.stair i { width: 3px; border-radius: 1px; background: var(--line-2); }
.stair i:nth-child(1) { height: 4px; } .stair i:nth-child(2) { height: 6px; } .stair i:nth-child(3) { height: 8px; } .stair i:nth-child(4) { height: 10px; } .stair i:nth-child(5) { height: 12px; }
.stair i.on { background: var(--accent); }

.levels {
  position: sticky; top: var(--top-h); z-index: 5; display: none; gap: 6px; overflow-x: auto; scrollbar-width: none;
  margin: 22px -32px 4px; padding: 10px 32px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.levels::-webkit-scrollbar { display: none; }
.levels a { flex-shrink: 0; display: flex; align-items: center; gap: 7px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--fg-2); font-size: 13px; background: var(--card); }
.levels a b { font-weight: 600; }
.levels a span { color: var(--muted); max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.levels a:hover { text-decoration: none; border-color: var(--line-2); }
.levels a.on { border-color: var(--accent); background: var(--accent-soft); }

.rail { padding-top: 44px; }
.rail-in { position: sticky; top: calc(var(--top-h) + 28px); font-size: 12.5px; }
.rail-h { font-size: 12px; color: var(--muted); letter-spacing: .04em; margin: 0 0 8px; }
.rail-h:not(:first-child) { margin-top: 24px; }
.steps { display: flex; flex-direction: column; gap: 2px; border-left: 1px solid var(--line); }
.steps a { display: flex; gap: 10px; align-items: flex-start; padding: 6px 10px; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); line-height: 1.45; }
.steps a .stair { margin-top: 3px; }
.steps a b { display: block; color: var(--fg-2); font-weight: 600; font-size: 12.5px; }
.steps a:hover { text-decoration: none; color: var(--fg-2); }
.steps a.on { border-left-color: var(--accent); color: var(--fg-2); }
.steps a.on b { color: var(--accent); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; color: var(--fg-2); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; }
.jumps { display: flex; flex-direction: column; gap: 6px; margin-top: 18px; }
.jumps a { display: block; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--fg-2); background: var(--card); }
.jumps a:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }

.lecture { font-size: var(--fs); line-height: 1.85; color: var(--fg); }
.lecture h2, .lecture h3, .lecture h4 { scroll-margin-top: calc(var(--top-h) + 64px); font-family: var(--serif); text-wrap: balance; }
.lecture h2 { font-size: 1.2em; line-height: 1.45; margin: 2.2em 0 .6em; font-weight: 600; }
.lecture h2.lv { display: flex; flex-direction: column; gap: 10px; padding-top: 1.6em; border-top: 1px solid var(--line-2); }
.lecture > h2.lv:first-child { margin-top: 1.2em; }
.lv-no { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; font-family: var(--sans); font-size: 12px; font-weight: 600; color: var(--accent); letter-spacing: .06em; }
.lecture h3 { font-size: 1.07em; margin: 1.8em 0 .45em; font-weight: 600; line-height: 1.5; }
.lecture h4 { font-size: 1em; margin: 1.6em 0 .4em; font-weight: 600; }
.lecture hr { border: 0; border-top: 1px solid var(--line); margin: 2.2em 0; }
.lecture p { margin: .7em 0; }
.lecture ul, .lecture ol { padding-left: 1.35em; margin: .6em 0; }
.lecture li { margin: .3em 0; }
.lecture li::marker { color: var(--muted); }
.lecture blockquote { margin: 1em 0; padding: .7em 1.1em; border-left: 3px solid var(--accent); background: var(--bg-2); border-radius: 0 10px 10px 0; color: var(--fg-2); }
.lecture blockquote p { margin: .3em 0; }
.lecture strong { font-weight: 650; color: var(--fg); }
.lecture h2 + p > strong:only-child { font-family: var(--serif); font-weight: 600; }
.lecture code { font-size: .88em; background: var(--bg-2); padding: 1px 5px; border-radius: 5px; }
.lecture a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); text-underline-offset: 3px; }

.tw { overflow-x: auto; margin: 1.1em 0; border: 1px solid var(--line); border-radius: 12px; background: var(--card); -webkit-overflow-scrolling: touch; }
.tw table { border-collapse: collapse; width: 100%; font-size: .88em; line-height: 1.6; }
.tw th { background: var(--bg-2); font-weight: 600; text-align: left; color: var(--fg-2); }
.tw th, .tw td { padding: 7px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tw tr:last-child td { border-bottom: 0; }
.tw td { font-variant-numeric: tabular-nums; }
.tw td:first-child { min-width: 5.5em; }
.tw tbody tr:hover td { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }

.lecture details { margin: 1.2em 0; border: 1px solid var(--line); border-radius: 12px; background: var(--card); overflow: hidden; }
.lecture details summary { cursor: pointer; padding: 12px 18px; font-weight: 600; font-size: .92em; color: var(--accent); list-style: none; display: flex; align-items: center; gap: 8px; }
.lecture details summary::-webkit-details-marker { display: none; }
.lecture details summary::before { content: ""; width: 7px; height: 7px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
.lecture details[open] summary::before { transform: rotate(45deg); }
.lecture details[open] summary { border-bottom: 1px solid var(--line); }
.lecture details > :not(summary) { margin-left: 18px; margin-right: 18px; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 56px; }
.pager a { display: block; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; color: var(--fg); background: var(--card); font-size: 13.5px; line-height: 1.5; }
.pager a small { display: block; color: var(--muted); font-size: 12px; margin-bottom: 3px; }
.pager a:hover { text-decoration: none; border-color: var(--accent); }
.pager .next { text-align: right; }

/* ---------- 译文与原文：阅读器 ---------- */
.viewer { display: grid; grid-template-columns: 200px minmax(0, 1fr); background: var(--desk); min-height: calc(100vh - var(--top-h)); }
.prail { position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h)); overflow-y: auto; padding: 18px 10px 40px 14px; border-right: 1px solid color-mix(in srgb, var(--line-2) 70%, transparent); scrollbar-width: thin; }
.prail-h { font-size: 12px; color: var(--muted); letter-spacing: .04em; padding: 0 8px 8px; }
.prail-list a { display: flex; align-items: baseline; gap: 8px; padding: 5px 8px; border-radius: 7px; color: var(--fg-2); font-size: 12.5px; line-height: 1.45; }
.prail-list a b { font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 1.7em; text-align: right; flex-shrink: 0; }
.prail-list a:hover { text-decoration: none; background: color-mix(in srgb, var(--card) 70%, transparent); }
.prail-list a.on { background: var(--card); color: var(--fg); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.prail-list a.on b { color: var(--accent); }
.vmain { min-width: 0; padding: 0 28px 72px; }
.vbar {
  position: sticky; top: var(--top-h); z-index: 6; max-width: 816px; margin: 0 auto 18px; padding: 12px 0;
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px;
  background: var(--desk);
}
.vbar::after { content: ""; position: absolute; left: -28px; right: -28px; bottom: 0; border-bottom: 1px solid color-mix(in srgb, var(--line-2) 70%, transparent); }
.vbar-t { min-width: 0; line-height: 1.35; }
.vbar-t small { display: block; font-size: 11.5px; color: var(--muted); letter-spacing: .03em; }
.vbar-t span { display: block; font-family: var(--serif); font-weight: 600; font-size: 14px; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vbar-nav { display: flex; align-items: center; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 3px; box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }
.vbar-nav button { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 7px; background: none; color: var(--fg-2); cursor: pointer; }
.vbar-nav button:hover:not(:disabled) { background: var(--bg-2); color: var(--fg); }
.vbar-nav button:disabled { opacity: .35; cursor: default; }
.pg-sel { appearance: none; -webkit-appearance: none; border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--fg); font-variant-numeric: tabular-nums; padding: 4px 8px; text-align: center; text-align-last: center; cursor: pointer; max-width: 15em; border-radius: 6px; }
.pg-sel:hover { background: var(--bg-2); }
.vbar-tools { display: flex; justify-content: flex-end; gap: 6px; }
.vt { font: inherit; font-size: 12.5px; color: var(--fg-2); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 5px 11px; cursor: pointer; white-space: nowrap; }
.vt:hover { border-color: var(--line-2); color: var(--fg); }
.vt[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.zoom { display: flex; }
.zoom .vt { border-radius: 0; margin-left: -1px; }
.zoom .vt:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.zoom .vt:last-child { border-radius: 0 8px 8px 0; }
.zoom .z-out, .zoom .z-in { width: 30px; padding: 5px 0; font-size: 15px; line-height: 1; }
.zoom .z-val { min-width: 6.2em; font-variant-numeric: tabular-nums; }
.vpages { max-width: 816px; margin: 0 auto; }
.vmain .pager { max-width: 816px; margin: 32px auto 0; }
.sheet-intro { margin: 0 0 14px; font-size: 12.5px; color: var(--muted); }
.sheet-intro blockquote { margin: 0; padding: 0; }
.sheet-intro p { margin: 0; }
.sheet {
  --sfs: calc(var(--fs) - 1px);
  width: 100%; max-width: 816px; margin: 0 auto 18px; background: #fff; color: #111;
  border: 1px solid #cfcfcf; box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
  font-family: var(--paper-serif); font-size: var(--sfs); line-height: 1.85;
  scroll-margin-top: calc(var(--top-h) + 10px); color-scheme: light;
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 20px 0; font-family: var(--sans); font-size: 12px; color: #8b8a85; }
.see-orig { white-space: nowrap; flex-shrink: 0; font: inherit; font-size: 12px; color: #5d5c57; background: #fff; border: 1px solid #ddd9cf; border-radius: 7px; padding: 3px 11px; cursor: pointer; }
.see-orig:hover { border-color: #b9b5aa; color: #111; }
.see-orig.on { background: #141413; color: #fff; border-color: #141413; }
.sheet-body { padding: 22px 68px 8px; }
.sheet-foot { text-align: center; font-family: Georgia, serif; font-size: 13px; color: #333; padding: 10px 0 20px; min-height: 18px; }
.sheet a { color: #1a4fa0; }
.sheet h2 { font-size: 1.08em; text-align: center; font-weight: 700; margin: 1.6em 0 1em; letter-spacing: .05em; }
.sheet h3 { font-size: 1.03em; font-weight: 700; margin: 1.5em 0 .7em; }
.sheet h4 { font-size: 1em; font-weight: 700; font-style: italic; margin: 1.2em 0 .5em; }
.sheet p { margin: 0 0 .85em; text-align: justify; }
.sheet ul, .sheet ol { padding-left: 1.6em; margin: 0 0 .85em; }
.sheet li { margin: 0 0 .55em; text-align: justify; }
.sheet blockquote { margin: .8em 0; padding: 0 0 0 14px; border-left: 2px solid #bbb; color: #444; font-size: .93em; }
.sheet hr { border: 0; border-top: 1px solid #000; width: 22%; margin: 1.2em 0 .7em; }
.sheet sup { font-size: .7em; }
.sheet .tw { border: 0; border-radius: 0; background: transparent; margin: .7em 0 1.1em; }
.sheet .tw table { font-size: .88em; line-height: 1.5; font-variant-numeric: tabular-nums; }
.sheet .tw th { background: transparent; color: #111; font-weight: 700; border-bottom: 1px solid #000; vertical-align: bottom; padding: 4px 7px; }
.sheet .tw td { border-bottom: 0; padding: 3px 7px; }
.sheet .tw tbody tr:hover td { background: #eef3fb; }
.sheet .tw tbody tr:nth-child(even) td { background: #f4f6f9; }
.sheet .tw tr:last-child td { border-bottom: 1px solid #000; }
.sheet .tw td:not(:first-child), .sheet .tw th:not(:first-child) { white-space: nowrap; }
.sheet .tw td:first-child, .sheet .tw th:first-child { min-width: 10em; }
.sheet img { display: block; margin: 8px auto; border: 1px solid #ddd; }
.sheet .orig { margin: 0; padding: 14px 18px 18px; border-top: 1px dashed #ccc; background: #f1f0ec; max-width: none; }

/* 原文页 */
.orig { margin: 0 auto 22px; scroll-margin-top: calc(var(--top-h) + 70px); }
.orig-box { position: relative; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.orig-sizer { position: relative; margin: 0 auto; }
.orig-inner { position: absolute; top: 0; left: 0; transform-origin: 0 0; width: max-content; font-family: Arial, sans-serif; word-wrap: break-word; }
.orig-inner > div { margin: 0 !important; border-color: #d4d2ca !important; box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 6px 18px rgba(0, 0, 0, .06); }
.orig-cap { display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.orig-cap b { color: var(--fg-2); font-weight: 600; }
.orig-cap a { color: var(--fg-2); border: 1px solid var(--line-2); border-radius: 999px; padding: 1px 10px; background: color-mix(in srgb, var(--card) 70%, transparent); }
.orig-cap a:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.orig-hint { margin: 0 0 14px; font-size: 12.5px; color: var(--muted); text-align: center; }
.sheet .orig { margin: 0; padding: 16px 18px 14px; border-top: 1px dashed #d6d3ca; background: #f3f2ee; }
.sheet .orig-cap { color: #8b8a85; }
.sheet .orig-cap b { color: #3d3d3a; }
.sheet .orig-cap a { display: none; }

/* ---------- 对照：左译文右原文 ---------- */
body[data-mode="对照"] .sidebar { display: none; }
body[data-mode="对照"] .layout { grid-template-columns: minmax(0, 1fr); }
body[data-mode="对照"] main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); height: calc(100vh - var(--top-h)); }
body[data-mode="对照"] .pane[data-pane="译文"], body[data-mode="对照"] .pane[data-pane="原文"] { display: block; overflow-y: auto; height: 100%; position: relative; scrollbar-width: thin; background: var(--desk); }
body[data-mode="对照"] .pane[data-pane="原文"] { border-left: 1px solid var(--line-2); }
body[data-mode="对照"] .viewer { grid-template-columns: minmax(0, 1fr); min-height: 100%; }
body[data-mode="对照"] .prail, body[data-mode="对照"] .vmain .pager, body[data-mode="对照"] .see-orig, body[data-mode="对照"] .sheet .orig, body[data-mode="对照"] .expand-all, body[data-mode="对照"] .orig-cap a { display: none; }
body[data-mode="对照"] .vmain { padding: 0 18px 72px; }
body[data-mode="对照"] .vbar { top: 0; grid-template-columns: minmax(0, 1fr) auto; }
body[data-mode="对照"] .vbar-tools:empty { display: none; }
body[data-mode="对照"] .vbar::after { left: -18px; right: -18px; }
body[data-mode="对照"] .pane[data-pane="原文"] .vbar { grid-template-columns: minmax(0, 1fr) auto auto; }
body[data-mode="对照"] .sheet.cur { box-shadow: 0 0 0 2px var(--accent); }
body[data-mode="对照"] .orig.cur .orig-cap b { color: var(--accent); }

/* 回到顶部 */
.to-top { position: fixed; right: 22px; bottom: 22px; z-index: 25; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--fg); box-shadow: var(--shadow); cursor: pointer; display: grid; place-items: center; opacity: 0; pointer-events: none; transition: opacity .2s; }
.to-top.show { opacity: 1; pointer-events: auto; }
.to-top:hover { border-color: var(--accent); color: var(--accent); }
body[data-mode="对照"] .to-top { display: none; }

/* ---------- 首页 ---------- */
.home { max-width: 1120px; margin: 0 auto; padding: 56px 32px 72px; }
.hero { max-width: 780px; }
.eyebrow { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.hero h1 { font-family: var(--serif); font-weight: 600; font-size: 36px; line-height: 1.3; margin: 0 0 16px; letter-spacing: -.01em; }
.lead { font-size: 15px; line-height: 1.85; color: var(--fg-2); margin: 0 0 22px; max-width: 640px; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 30px; }
.btn { display: inline-flex; align-items: center; padding: 8px 16px; border-radius: 9px; background: var(--fg); color: var(--bg); font-weight: 600; font-size: 13.5px; }
.btn:hover { text-decoration: none; opacity: .88; }
.btn.ghost { background: transparent; color: var(--fg); border: 1px solid var(--line-2); }
.btn.ghost:hover { border-color: var(--fg); opacity: 1; }
.stats { display: flex; gap: 36px; margin: 0; flex-wrap: wrap; }
.stats div { display: flex; flex-direction: column-reverse; }
.stats dt { font-size: 12px; color: var(--muted); }
.stats dd { margin: 0; font-family: var(--serif); font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums; }

.stairs-wrap { margin: 48px 0 0; padding: 22px 24px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; }
.stairs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; align-items: end; }
.stairs li { display: flex; flex-direction: column; gap: 4px; }
.st-bar { height: calc(var(--h) * 16px); border-radius: 8px 8px 3px 3px; background: color-mix(in srgb, var(--accent) calc(var(--h) * 18%), var(--bg-2)); margin-bottom: 8px; }
.stairs b { font-size: 12px; color: var(--accent); letter-spacing: .06em; }
.st-t { font-family: var(--serif); font-weight: 600; font-size: 15px; }
.st-d { font-size: 12.5px; color: var(--muted); line-height: 1.55; }

.howto { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-top: 16px; background: var(--line); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.howto div { background: var(--bg); padding: 14px 18px; display: flex; flex-direction: column; gap: 2px; }
.howto b { font-size: 13px; }
.howto span { font-size: 12.5px; color: var(--muted); line-height: 1.55; }

.group { margin-top: 52px; }
.group-h { display: flex; align-items: baseline; gap: 14px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.group-h h2 { font-family: var(--serif); font-weight: 600; font-size: 19px; margin: 0; }
.group-h p { margin: 0; color: var(--muted); font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.card { display: flex; flex-direction: column; padding: 16px 18px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; color: var(--fg); transition: border-color .15s, transform .15s, box-shadow .15s; }
.card:hover { text-decoration: none; border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-1px); }
.card-top { display: flex; justify-content: space-between; align-items: center; }
.card-no { font-family: var(--serif); font-size: 14px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.parts { font-size: 12px; color: var(--muted); background: var(--bg-2); border-radius: 999px; padding: 1px 9px; }
.card h3 { margin: 6px 0 6px; font-family: var(--serif); font-weight: 600; font-size: 16px; line-height: 1.45; }
.card p { margin: 0 0 12px; font-size: 13px; line-height: 1.7; color: var(--fg-2); flex: 1; }
.card-foot { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 12px; border-top: 1px solid var(--line); }
.foot { margin-top: 60px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; line-height: 1.8; }

/* ---------- 响应式 ---------- */
@media (max-width: 1279px) {
  .lecture-grid { grid-template-columns: minmax(0, 1fr); max-width: 804px; }
  .rail { display: none; }
  .levels { display: flex; }
}
@media (max-width: 1099px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: flex; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; height: 100%; width: min(320px, 86vw); z-index: 50;
    background: var(--bg); transform: translateX(-100%); transition: transform .22s ease; padding-top: 20px;
  }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .25); }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .35); }
}
@media (max-width: 1099px) {
  .viewer { grid-template-columns: minmax(0, 1fr); }
  .prail { display: none; }
}
@media (max-width: 999px) {
  .tab[data-mode="对照"], .wide-only { display: none; }
}
@media (max-width: 760px) {
  :root { --top-h: 100px; --fs: 15px; }
  :root[data-size="s"] { --fs: 14px; }
  :root[data-size="l"] { --fs: 16.5px; }
  .topbar { flex-wrap: wrap; height: auto; min-height: var(--top-h); padding: 8px 16px 10px; gap: 8px 10px; align-content: center; }
  .brand-t { display: none; }
  .crumb { font-size: 12.5px; padding-left: 10px; }
  .tabs { order: 5; width: 100%; }
  .tab { flex: 1; text-align: center; padding: 4px 0; }
  .lecture-grid { padding: 0 16px; }
  .lecture-wrap { padding: 26px 0 56px; }
  .lecture-wrap h1 { font-size: 20px; }
  .levels { margin: 16px -16px 4px; padding: 8px 16px; }
  .lecture h2 { font-size: 1.15em; }
  .tw table { font-size: .82em; }
  .tw th, .tw td { padding: 7px 10px; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { text-align: left; }
  .vmain { padding: 0 8px 48px; }
  .vbar { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 8px 2px; margin-bottom: 12px; }
  .vbar::after { left: -8px; right: -8px; }
  .vbar-t { display: none; }
  .vbar-nav { justify-self: start; }
  .pg-sel { max-width: 11em; }
  .sheet { line-height: 1.8; }
  .sheet-head { padding: 9px 12px 0; }
  .sheet-body { padding: 14px 16px 4px; }
  .sheet .tw td:first-child, .sheet .tw th:first-child { min-width: 8em; }
  .sheet .orig { padding: 10px 8px 12px; }
  .to-top { right: 14px; bottom: 14px; }
  .home { padding: 30px 16px 52px; }
  .hero h1 { font-size: 27px; }
  .lead { font-size: 14.5px; }
  .stats { gap: 22px; }
  .stats dd { font-size: 19px; }
  .stairs-wrap { margin-top: 40px; padding: 18px; }
  .stairs { grid-template-columns: 1fr; gap: 10px; }
  .stairs li { display: grid; grid-template-columns: 52px auto; grid-template-rows: auto auto; column-gap: 12px; align-items: center; }
  .st-bar { grid-row: 1 / 3; height: 10px; width: calc(var(--h) * 10px + 2px); margin: 0; border-radius: 3px; }
  .stairs b { display: none; }
  .howto { grid-template-columns: 1fr 1fr; }
  .group { margin-top: 44px; }
  .group-h { flex-direction: column; gap: 2px; }
  .grid { grid-template-columns: 1fr; }
}
body[data-mode="home"] .topbar { min-height: 56px; height: 56px; flex-wrap: nowrap; }
body[data-mode="home"] .crumb { border-left: 0; }
@media (max-width: 760px) { body[data-mode="home"] .brand-t { display: inline; } }

/* ---------- 阅读记录 ---------- */
.tp-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tp-note { font-size: 12px; color: var(--muted); }
.tp-clear { font: inherit; font-size: 12.5px; border: 1px solid var(--line-2); background: var(--card); color: var(--fg-2); border-radius: 7px; padding: 3px 10px; cursor: pointer; }
.tp-clear:hover { border-color: #b33; color: #b33; }
.toc a.seen::after, .toc a.done::after { content: ""; width: 6px; height: 6px; border-radius: 50%; margin: .55em 0 0 auto; flex-shrink: 0; border: 1.5px solid var(--accent); }
.toc a.done::after { background: var(--accent); }
.card-read { height: 3px; border-radius: 2px; background: var(--bg-2); margin: 0 0 10px; overflow: hidden; visibility: hidden; }
.card-read.has { visibility: visible; }
.card-read i { display: block; height: 100%; width: 0; background: var(--accent); }
#resume:empty { display: none; }
.resume { display: flex; align-items: center; gap: 14px; margin: 0 0 22px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 12px; max-width: 640px; }
.resume-b { min-width: 0; flex: 1; line-height: 1.5; }
.resume-b small { display: block; font-size: 12px; color: var(--muted); }
.resume-b b { display: block; font-family: var(--serif); font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.resume-b span { display: block; font-size: 12.5px; color: var(--fg-2); }
.resume .btn { flex-shrink: 0; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 12px); z-index: 70; display: flex; align-items: center; gap: 12px; padding: 9px 10px 9px 16px; background: var(--fg); color: var(--bg); border-radius: 12px; font-size: 13px; box-shadow: 0 8px 30px rgba(0, 0, 0, .2); opacity: 0; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast button { font: inherit; font-size: 12.5px; border: 0; border-radius: 8px; padding: 4px 10px; background: color-mix(in srgb, var(--bg) 18%, transparent); color: var(--bg); cursor: pointer; white-space: nowrap; }
.toast button:hover { background: color-mix(in srgb, var(--bg) 30%, transparent); }
@media (max-width: 760px) {
  .resume { flex-wrap: wrap; }
  .resume .btn { width: 100%; justify-content: center; }
}
.vpages > .sheet { scroll-margin-top: calc(var(--top-h) + 70px); }
/* 原文页里的图片按 SEC 原样的固定尺寸显示，不受全站图片宽度限制 */
.orig-inner img { max-width: none; }
.prail-list a.seen::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); opacity: .55; margin-left: auto; align-self: center; flex-shrink: 0; }
.prail-list a.on::after { opacity: 1; }
.tw .nw { white-space: nowrap; }
.tw td.nw:first-child, .tw th.nw:first-child { min-width: 0; }
/* 分隔线和层级标题的上边框不要叠成两条 */
.lecture hr:has(+ h2.lv) { display: none; }

/* 右侧层级锚点：没有右栏时代替横排按钮 */
.lv-dock { display: none; }
@media (max-width: 1279px) {
  .levels { display: none; }
  body[data-mode="讲解"] .lv-dock {
    display: flex; flex-direction: column; gap: 6px; position: fixed; z-index: 20;
    right: 8px; top: 50%; transform: translateY(-50%);
    padding: 6px 4px; border-radius: 999px; background: color-mix(in srgb, var(--card) 88%, transparent);
    border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  }
  .lv-dock a { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; font-size: 12px; font-weight: 600; color: var(--muted); text-decoration: none; }
  .lv-dock a:hover { text-decoration: none; color: var(--fg); background: var(--bg-2); }
  .lv-dock a.on { background: var(--accent); color: var(--on-accent); }
  .lecture-grid { padding-right: 52px; }
}
@media (max-width: 760px) {
  .lecture-grid { padding-left: 16px; padding-right: 44px; }
  .lv-dock { right: 5px; }
}
/* 首页浏览计数 */
.live-count { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 22px; padding: 5px 14px 5px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: 13px; color: var(--fg-2); }
.live-count[hidden] { display: none; }
.live-count b { font-family: var(--serif); font-weight: 600; font-size: 14px; color: var(--fg); font-variant-numeric: tabular-nums; }
.live-count i { width: 7px; height: 7px; border-radius: 50%; background: #3fa66b; box-shadow: 0 0 0 0 rgba(63, 166, 107, .5); animation: live 2s infinite; }
@keyframes live { 0% { box-shadow: 0 0 0 0 rgba(63, 166, 107, .45); } 70% { box-shadow: 0 0 0 7px rgba(63, 166, 107, 0); } 100% { box-shadow: 0 0 0 0 rgba(63, 166, 107, 0); } }
@media (prefers-reduced-motion: reduce) { .live-count i { animation: none; } }
/* 首页底部广告（样式沿用 claude.xtabapp.com 的联系方式条） */
.ad { margin-top: 56px; padding: 18px 20px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.ad-text { min-width: 0; }
.ad-tag { display: inline-block; font-size: 11px; color: var(--muted); border: 1px solid var(--line-2); border-radius: 5px; padding: 0 6px; line-height: 1.6; margin-bottom: 4px; }
.ad h2 { margin: 0; font-family: var(--serif); font-size: 16px; font-weight: 600; line-height: 1.5; }
.ad-id { display: block; margin-top: 2px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ad-note { grid-column: 1 / -1; margin: 6px 0 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.contact-buttons { display: flex; align-items: center; gap: 8px; flex: none; }
.contact-copy, .contact-show-qr { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px; border-radius: 10px; font: inherit; font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; }
.contact-copy { border: 1px solid transparent; background: var(--accent-soft); color: var(--accent); }
.contact-show-qr { width: 44px; padding: 0; border: 1px solid var(--line-2); color: var(--fg-2); background: transparent; }
.contact-copy:hover, .contact-show-qr:hover { color: var(--fg); text-decoration: none; }
.contact-qr-dialog { width: min(330px, calc(100% - 40px)); max-height: 90vh; padding: 16px 20px 20px; border: 1px solid var(--line); border-radius: 20px; background: var(--card); color: var(--fg); }
.contact-qr-dialog:not([open]) { display: none; }
.contact-qr-dialog::backdrop { background: rgba(20, 20, 19, .45); }
.contact-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.contact-dialog-head h2 { margin: 0; font-size: 17px; font-weight: 600; font-family: var(--serif); }
.contact-dialog-close { flex: none; width: 44px; height: 44px; padding: 0; border: 0; background: transparent; color: var(--fg-2); font-size: 27px; line-height: 1; cursor: pointer; }
.contact-qr-dialog img { display: block; width: min(232px, 100%); height: auto; margin: 12px auto; padding: 6px; border-radius: 10px; background: #fff; }
.contact-qr-dialog p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; text-align: center; }
@media (max-width: 760px) {
  .ad { margin-top: 40px; padding: 16px; }
  .ad h2 { font-size: 15px; }
}
.lecture-wrap .ad { margin-top: 28px; }
.vmain .ad { max-width: 816px; margin: 28px auto 0; }
.vpages.orig-list + .ad { margin-top: 12px; }
body[data-mode="对照"] .ad { display: none; }
/* 首页上半部分：左边标题，右边联系卡 */
.hero-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 56px; align-items: center; }
.hero-side { padding: 22px 22px 18px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); text-align: center; }
.hs-k { margin: 0 0 4px; font-size: 12px; color: var(--accent); font-weight: 600; letter-spacing: .06em; }
.hero-side h2 { margin: 0 0 14px; font-family: var(--serif); font-size: 18px; font-weight: 600; line-height: 1.4; }
.hs-qr { display: block; width: 176px; margin: 0 auto 12px; padding: 8px; border-radius: 14px; background: #fff; border: 1px solid var(--line); }
.hs-qr img { display: block; width: 100%; height: auto; }
.hs-qr:hover { border-color: var(--accent); }
.hs-id { display: flex; justify-content: center; align-items: baseline; gap: 8px; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.hs-id b { font-size: 15px; color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.hero-side .contact-copy { width: 100%; }
.hs-note { margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); line-height: 1.6; }
@media (max-width: 999px) {
  .hero-wrap { grid-template-columns: minmax(0, 1fr); }
  .hero-side { display: none; }
}
.ad h2, .ad-id { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) {
  .ad { gap: 6px 12px; }
  .ad .cc-long { display: none; }
  .ad .contact-copy { padding: 0 14px; }
}
