/* 布局：1600×900 的 16:9 画布按窗口等比缩放；固定页脚是四步论证链，当前所在步骤高亮。
   单一浅色主题：matplotlib 图都是白底，投影仪上也最稳。
   颜色语义沿用图里的配色：朱红 = 单条轨道（不可信），青绿 = 统计量（可信），藏青 = 结构与参考解。 */
:root {
  color-scheme: light;
  --paper: #ffffff;
  --surround: #dde2ea;
  --ink: #16213a;
  --ink-2: #4b5770;
  --rule: #d6dbe4;
  --navy: #1f3a73;
  --orbit: #c2410c;
  --stat: #0f7a6e;
  --wash-navy: #ecf0f7;
  --wash-orbit: #fcefe7;
  --wash-stat: #e4f3f0;
  --chrome-fg: #33405a;
  --chrome-bg: #f4f6f9;

  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--surround);
  color: var(--ink);
  font-family: var(--sans);
  overflow: hidden;
}

.app {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding-inline: 16px;
  box-sizing: border-box;
}
/* 讲稿打开时停在幻灯片右侧，画布按剩下的宽度缩放；窄屏退回到下方 */
.main { flex: 1; min-height: 0; display: flex; gap: 12px; }
.stage-area { flex: 1; position: relative; min-width: 0; min-height: 0; margin-block: 12px 6px; }
.stage {
  --s: 0.5;
  position: absolute;
  left: 50%; top: 50%;
  width: 1600px; height: 900px;
  transform: translate(-50%, -50%) scale(var(--s));
  background: var(--paper);
  box-shadow: 0 1px 2px rgba(22, 33, 58, .10), 0 12px 40px rgba(22, 33, 58, .14);
  overflow: hidden;
}

/* ---------- slide frame ---------- */
.slide {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column;
  padding: 60px 96px 108px;
  box-sizing: border-box;
  font-size: 28px;
  line-height: 1.6;
}
.slide.active { display: flex; }
.slide > header { margin-bottom: 34px; }
.eyebrow {
  font-size: 19px;
  font-weight: 500;
  letter-spacing: .14em;
  color: var(--navy);
  margin: 0 0 10px;
}
.slide h2 {
  font-family: var(--serif);
  font-weight: 900;
  font-size: 54px;
  line-height: 1.25;
  margin: 0;
  text-wrap: balance;
}
.slide p { margin: 0; }
.slide .notes { display: none; }

.lede { font-size: 30px; color: var(--ink-2); max-width: 30em; }
.muted { color: var(--ink-2); }
.orbit { color: var(--orbit); }
.stat { color: var(--stat); }
.navy { color: var(--navy); }
strong { font-weight: 700; }
code, .mono { font-family: var(--mono); font-size: .86em; }

/* ---------- layouts ---------- */
.split { flex: 1; min-height: 0; display: grid; grid-template-columns: 1.7fr 1fr; gap: 56px; }
.split.even { grid-template-columns: 1fr 1fr; }
.split.text-first { grid-template-columns: 1fr 1.5fr; }
.col { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 26px; justify-content: center; }

.fig { margin: 0; min-height: 0; min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.fig img { flex: 1; min-height: 0; width: 100%; object-fit: contain; display: block; }
.fig figcaption { font-family: var(--mono); font-size: 16px; color: var(--ink-2); text-align: right; }
.full { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 22px; }

.strip { display: flex; gap: 56px; align-items: flex-end; flex-wrap: wrap; }
.kv { display: flex; flex-direction: column; gap: 2px; }
.kv .v { font-family: var(--mono); font-weight: 500; font-size: 50px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kv .k { font-size: 21px; color: var(--ink-2); line-height: 1.4; }
.kv.small .v { font-size: 38px; }

.callout { padding: 22px 28px; border-radius: 4px; font-size: 26px; line-height: 1.6; }
.callout.navy-bg { background: var(--wash-navy); }
.callout.orbit-bg { background: var(--wash-orbit); }
.callout.stat-bg { background: var(--wash-stat); }
.callout .tag { display: block; font-size: 18px; font-weight: 700; letter-spacing: .14em; margin-bottom: 6px; }

ul.plain { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 18px; }
ul.plain li { padding-left: 1.1em; position: relative; }
ul.plain li::before { content: ""; position: absolute; left: 0; top: .72em; width: .42em; height: 2px; background: var(--navy); }

table.data { border-collapse: collapse; font-size: 26px; width: 100%; }
table.data th, table.data td { text-align: left; padding: 14px 18px; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.data th { font-size: 19px; font-weight: 700; letter-spacing: .08em; color: var(--ink-2); border-bottom: 2px solid var(--ink); }
table.data td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
table.data tr.hl td { background: var(--wash-orbit); }
table.data tr.hl-navy td { background: var(--wash-navy); }
table.data.tight th, table.data.tight td { padding: 8px 18px; }

/* 备用「本征结构」：左边裁出 fig15 的左格，右边是可旋转的三维视图 */
.eig3d { flex: 1; min-height: 0; display: grid; grid-template-columns: 500px 1fr; gap: 36px; margin-bottom: 18px; }
.crop-left > div { overflow: hidden; aspect-ratio: 975 / 780; }
.crop-left img { width: calc(1920 / 975 * 100%); max-width: none; margin-top: -6.2%; object-fit: initial; flex: none; }
.view3d { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 8px; position: relative; }
.view3d canvas { width: 780px; height: 400px; display: block; background: var(--wash-navy); border-radius: 4px; cursor: grab; touch-action: none; }
.view3d canvas:active { cursor: grabbing; }
.legend3d { position: absolute; top: 10px; left: 14px; margin: 0; padding: 0; list-style: none; font-size: 16px; line-height: 1.6; color: var(--ink-2); pointer-events: none; }
.legend3d i { display: inline-block; width: 22px; height: 4px; margin-right: 8px; vertical-align: middle; }
.legend3d i.plane { height: 12px; background: var(--orbit); opacity: .3; }
.view3d .ctrl { gap: 10px; flex-wrap: wrap; align-items: center; }
.view3d .ctrl button { padding: 4px 12px; }
.view3d .readout, .view3d .hint3d { position: absolute; top: 372px; font-size: 16px; color: var(--ink-2); pointer-events: none; }
.view3d .readout { left: 14px; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.view3d .hint3d { right: 14px; }

pre.eig {
  margin: 0; font-family: var(--mono); font-size: 22px; line-height: 1.7;
  background: var(--wash-navy); padding: 18px 26px; border-radius: 4px; overflow-x: auto;
}

.big-statement { font-family: var(--serif); font-weight: 900; font-size: 64px; line-height: 1.35; text-wrap: balance; margin: 0; }
.center { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 36px; }

/* 论证路线 */
.route { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.route li { display: grid; grid-template-columns: 70px 1fr 300px; gap: 24px; align-items: baseline; padding: 20px 0; border-bottom: 1px solid var(--rule); }
.route .n { font-family: var(--serif); font-weight: 900; font-size: 40px; color: var(--navy); }
.route .ev { font-family: var(--mono); font-size: 19px; color: var(--ink-2); text-align: right; }

/* 封面 */
.cover { padding: 0; display: none; }
.cover.active { display: grid; grid-template-columns: 1fr 760px; }
.cover .left { padding: 96px 0 96px 96px; display: flex; flex-direction: column; justify-content: center; gap: 30px; }
.cover h1 { font-family: var(--serif); font-weight: 900; font-size: 84px; line-height: 1.2; margin: 0; letter-spacing: .02em; }
.cover .sub { font-family: var(--serif); font-weight: 600; font-size: 38px; color: var(--ink-2); }
.cover .params { font-family: var(--mono); font-size: 24px; color: var(--navy); display: flex; gap: 32px; flex-wrap: wrap; }
.cover .right { position: relative; background: var(--wash-navy); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px; }
.cover canvas { width: 640px; height: 640px; display: block; }
.cover .readout { font-family: var(--mono); font-size: 19px; color: var(--ink-2); display: flex; gap: 28px; font-variant-numeric: tabular-nums; }
.cover .legend { font-size: 19px; color: var(--ink-2); display: flex; gap: 24px; }
.cover .ctrl { font-size: 20px; }
.swatch { display: inline-block; width: 22px; height: 3px; vertical-align: middle; margin-right: 8px; }

/* 现场演示：左边相空间里的两条轨道，右边 log|Δ| 随 t，下面是 ε 滑块 */
.demo { flex: 1; min-height: 0; display: grid; grid-template-columns: 520px 1fr; gap: 48px; }
.demo .pane { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.demo canvas { display: block; width: 100%; height: auto; background: var(--wash-navy); border-radius: 4px; }
.demo .readout { display: flex; gap: 28px; flex-wrap: wrap; font-family: var(--mono); font-size: 19px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ctrl { display: flex; align-items: center; gap: 16px; font-size: 22px; }
.ctrl input[type="range"] { flex: 1; min-width: 0; height: 30px; accent-color: var(--orbit); cursor: pointer; }
.ctrl .eps { font-family: var(--mono); font-weight: 500; font-size: 26px; color: var(--orbit); min-width: 3.6em; font-variant-numeric: tabular-nums; }
.ctrl button {
  font: inherit; font-size: 19px; color: var(--ink); background: var(--chrome-bg);
  border: 1px solid var(--rule); border-radius: 4px; padding: 6px 16px; cursor: pointer; white-space: nowrap;
}
.ctrl button:hover { border-color: var(--navy); color: var(--navy); }
.ctrl button:focus-visible, .ctrl input:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.demo .fitline { font-size: 23px; line-height: 1.5; }

/* 演示①：左边对流层与 x(t)，右边 ρ 滑块与 x–z 相平面 */
.demo.roll { grid-template-columns: 1fr 440px; }
.demo.paradox { grid-template-columns: 1fr 440px; }
.demo.paradox .ctrl { gap: 10px; flex-wrap: wrap; }
.demo.paradox .ctrl button { padding: 4px 12px; }
.demo.roll .pane { gap: 12px; }
.rho-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 21px; }
.rho-head .eps { font-family: var(--mono); font-weight: 500; font-size: 30px; color: var(--orbit); font-variant-numeric: tabular-nums; }
.demo.roll input[type="range"] { width: 100%; height: 30px; margin: 0; accent-color: var(--orbit); cursor: pointer; }
.ruler { position: relative; height: 46px; font-size: 16px; line-height: 1.3; color: var(--ink-2); }
.ruler span { position: absolute; top: 6px; left: calc(9px + (100% - 18px) * var(--at)); transform: translateX(-50%); text-align: center; white-space: nowrap; }
.ruler span::before { content: ""; position: absolute; left: 50%; top: -8px; height: 7px; border-left: 2px solid var(--ink-2); }
.regime { font-size: 22px; line-height: 1.45; min-height: 2.9em; }
.demo.roll .ctrl { gap: 10px; flex-wrap: wrap; }
.demo.roll .ctrl button { padding: 4px 12px; }
#rollNu { font-family: var(--mono); font-size: 19px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* 目录思维导图：左边题目，右边五行按讲的顺序排；分隔页复用同一张图，只高亮当前一行 */
.map-host { flex: 1; min-height: 0; display: flex; align-items: center; }
.mmap { position: relative; width: 100%; height: 580px; display: grid; grid-template-columns: 300px 1fr; column-gap: 90px; }
.mm-root {
  align-self: center; background: var(--navy); color: var(--paper); border-radius: 6px;
  padding: 30px 28px; display: flex; flex-direction: column; gap: 14px;
}
.mm-root b { font-family: var(--serif); font-weight: 900; font-size: 36px; line-height: 1.35; }
.mm-root span { font-size: 20px; opacity: .8; }
.mm-wires { position: absolute; left: 300px; top: 0; width: 90px; height: 580px; overflow: visible; }
.mm-wires path { fill: none; stroke: var(--ink-2); stroke-opacity: .45; stroke-width: 3; }
.mm-rows { display: grid; grid-template-rows: repeat(5, 1fr); }
.mm-row { display: grid; grid-template-columns: 410px 1fr; gap: 40px; align-items: center; cursor: pointer; position: relative; }
.mm-row::after { content: ""; position: absolute; left: 410px; width: 40px; top: 50%; border-top: 3px solid var(--ink-2); opacity: .45; }
.mm-q {
  font-size: 24px; font-weight: 700; line-height: 1.35; background: var(--wash-navy);
  border-radius: 4px; padding: 14px 20px; display: flex; gap: 14px; align-items: baseline;
}
.mm-q i { font-style: normal; font-family: var(--serif); font-weight: 900; color: var(--navy); flex: 0 0 auto; }
.mm-a { font-size: 23px; line-height: 1.45; display: flex; flex-direction: column; gap: 4px; }
.mm-a small { font-family: var(--mono); font-size: 16px; color: var(--ink-2); }
.mm-row:hover .mm-q { outline: 2px solid var(--navy); }
.mmap[data-focus] .mm-row:not(.on) { opacity: .3; }
.mmap[data-focus] .mm-row.on .mm-q { background: var(--navy); color: var(--paper); }
.mmap[data-focus] .mm-row.on .mm-q i { color: var(--paper); }
.mmap[data-focus] .mm-row.on::after { border-color: var(--navy); opacity: 1; }
.mm-wires path.on { stroke: var(--navy); stroke-opacity: 1; }
.mmap[data-focus] .mm-wires path:not(.on) { stroke-opacity: .15; }

.backup-list { margin: 0; padding: 0 0 0 1.6em; columns: 2; column-gap: 72px; font-size: 26px; line-height: 1.5; }
.backup-list li { break-inside: avoid; padding: 8px 0; border-bottom: 1px solid var(--rule); cursor: pointer; }
.backup-list li:hover { color: var(--navy); }
.goto { align-self: flex-start; font-size: 18px; color: var(--ink-2); cursor: pointer; border-bottom: 1px dashed var(--rule); }
.goto:hover { color: var(--navy); border-color: var(--navy); }
.backup-list li span { font-size: 18px; color: var(--ink-2); margin-left: 12px; }

/* ---------- persistent footer: argument chain ---------- */
.foot {
  position: absolute; left: 96px; right: 96px; bottom: 34px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  font-size: 17px; color: var(--ink-2);
  border-top: 1px solid var(--rule); padding-top: 16px;
}
.foot .chain { display: flex; gap: 6px; }
.foot .chain span { padding: 4px 12px; border-radius: 3px; letter-spacing: .04em; }
.foot .chain span.on { background: var(--navy); color: var(--paper); }
.foot .pg { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.stage.is-cover .foot { display: none; }

/* ---------- chrome outside the slide ---------- */
.bar {
  display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
  padding-block: 6px 12px; color: var(--chrome-fg); font-size: 14px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}
.bar button {
  font: inherit; color: var(--chrome-fg); background: var(--chrome-bg);
  border: 1px solid var(--rule); border-radius: 4px; padding: 6px 14px; cursor: pointer;
}
.bar button:hover { border-color: var(--navy); color: var(--navy); }
.bar button:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.bar button[aria-pressed="true"] { background: var(--navy); color: var(--paper); border-color: var(--navy); }
.bar .count { font-family: var(--mono); min-width: 5.5em; text-align: center; font-variant-numeric: tabular-nums; }
.bar .hint { color: var(--ink-2); font-size: 13px; }

.notes-panel {
  flex: 0 0 clamp(320px, 32%, 560px); overflow-y: auto; box-sizing: border-box;
  background: var(--chrome-bg); color: var(--ink); border: 1px solid var(--rule); border-radius: 4px;
  padding: 14px 20px; margin-block: 12px 6px; font-size: 16px; line-height: 1.75;
}
.notes-panel .meta { font-family: var(--mono); font-size: 13px; color: var(--ink-2); margin-bottom: 6px; display: flex; gap: 20px; flex-wrap: wrap; }
.notes-panel p { margin: 0 0 8px; }
.notes-panel .q { color: var(--orbit); }
.notes-panel .key { color: var(--navy); font-weight: 700; }

@media (max-width: 900px) {
  .main { flex-direction: column; gap: 0; }
  .notes-panel { flex: 0 0 auto; max-height: 34%; margin-block: 0 8px; }
}
@media (max-width: 640px) {
  .bar .hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
