/* 革命理想高于天 —— 竖版渲染器样式（内容层与表现层分离） */
@font-face {
  font-family: "Guotu Serif";
  src: url("assets/fonts/source-han-serif-cn-heavy.subset.woff2?v=20260908-v116") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Guotu Sans";
  src: url("assets/fonts/fz-lanting-hei-pro-global-regular.subset.woff2?v=20260908-v116") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Guotu Sans";
  src: url("assets/fonts/fz-lanting-hei-pro-global-regular.subset.woff2?v=20260908-v116") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
:root {
  --ratio: 0.5679;
  --page-w: min(100vw, calc(100vh * var(--ratio)));
  --page-h: min(calc(100vw / var(--ratio)), 100vh);
  --letterbox: #0f0a08;
  /* 以下由 app.js 依据 theme.json 注入 */
  --font-title: "Guotu Serif", serif; --font-heading: "Guotu Serif", serif;
  --font-body: "Guotu Sans", sans-serif; --font-caption: "Guotu Sans", sans-serif;
  --title-color: #98210e; --heading-color: #98210e; --ink: #1a1512; --caption-color: #1a1512;
  --shadow: none; --paper: #f7ecc9; --text-halo: 0 0 0 transparent;
  --kicker-scale: .0362; --title-scale: .0362; --heading-scale: .0281;
  --body-scale: .0312; --caption-scale: .0133;
  --pad-x: .078; --pad-top: .049;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; background: var(--letterbox); }
body { font-family: var(--font-body); color: var(--ink); }

/* 舞台：黑边留白区 */
.stage {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, #3a120a 0%, var(--letterbox) 78%);
}

/* 页面：固定纵横比，居中；黑边由 stage 填充 */
.page {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: var(--page-w); height: var(--page-h);
  overflow: hidden; background: #c9b28a;
  box-shadow: 0 0 0 1px rgba(253,248,194,.18), 0 16px 60px rgba(0,0,0,.7);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .35s ease, visibility .35s;
}
.page.active { opacity: 1; visibility: visible; pointer-events: auto; }

/* 底图：整铺背景（页比例与底图一致，故严丝合缝） */
.bg { position: absolute; inset: 0; z-index: 0; }
.bg img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }

/* 原图页（封面/前言/结语） */
.full-img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; display: block; }
/* 旧版前言地图叠加图；新版整图使用同样坐标的透明热区触发放大。 */
.full-overlay-img {
  position: absolute; z-index: 2; left: 23%; top: 46%;
  width: 54%; height: 28.18%;
  object-fit: fill; display: block; cursor: zoom-in;
}
.full-overlay-hitarea {
  position: absolute; z-index: 2;
  left: var(--hit-left, 20.46875%); top: var(--hit-top, 46.938776%);
  width: var(--hit-width, 58.828125%); height: var(--hit-height, 30.700976%);
  padding: 0; border: 0; background: transparent; cursor: zoom-in;
}
.full-overlay-hitarea:focus-visible { outline: 2px solid rgba(253,248,194,.9); outline-offset: -2px; }
.full-overlay-caption {
  position: absolute; z-index: 3; left: 8%; top: 75.2%; width: 84%;
  font-family: var(--font-caption); font-weight: 400;
  font-size: calc(var(--page-w) * var(--caption-title-scale) * var(--cap-scale, 1) + 2px);
  line-height: 1.4; color: #fdf8c2; text-align: center;
  white-space: pre-line; text-shadow: var(--shadow); pointer-events: none;
}

/* 内容：叠加于底图之上；flex 列布局让文字页可整体下移/补图贴底 */
.content {
  position: absolute; inset: 0; z-index: 1;
  display: flex; flex-direction: column;
  padding: calc(var(--page-h) * var(--pad-top)) calc(var(--page-w) * var(--pad-x)) calc(var(--page-h) * .06);
  overflow: hidden;
}

/* 文字块主体：可整体下移（--t-y，占页高比例）；两段间距（--t-gap） */
.body {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  margin-top: calc(var(--page-h) * var(--t-y, 0) + var(--heading-body-gap, 0px));
  overflow: hidden;
}
.body .para { margin-bottom: .25em; }
.body .para + .para { margin-top: var(--t-gap, 0em); }

/* 适老化：仅在文字确实溢出时显示阅读全文提示；提示层不参与正文尺寸计算。 */
.read-more-tools { display: none; position: absolute; z-index: 4; left: calc(var(--page-w) * var(--pad-x)); right: calc(var(--page-w) * var(--pad-x)); bottom: calc(var(--page-h) * .06); height: calc(var(--page-h) * .16); pointer-events: none; align-items: flex-end; justify-content: center; }
.page.has-text-overflow .read-more-tools { display: flex; }
.read-more-mask { position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(255,253,245,0), rgba(255,253,245,.88) 58%, #fffdf5 88%); pointer-events: none; }
.read-more-button { position: relative; z-index: 1; pointer-events: auto; min-width: 7em; min-height: 2.4em; padding: .45em 1.1em; border: 1px solid rgba(139,37,19,.35); border-radius: 999px; background: rgba(255,253,245,.96); color: #8b2513; font: inherit; font-size: max(12px, calc(var(--page-w) * .019)); line-height: 1.2; letter-spacing: .08em; cursor: pointer; box-shadow: 0 2px 8px rgba(70,35,15,.16); }
.read-more-button:focus-visible { outline: 2px solid #8b2513; outline-offset: 3px; }
.read-more-button[hidden] { display: none; }

/* 短文字页（无图且文字不足 72% 页高）：正文块垂直居中、两段间距拉大（--t-y 可再整体下移） */
.page.spacious .body { justify-content: center; margin-top: calc(var(--page-h) * var(--t-y, 0) + var(--heading-body-gap, 0px)); }
.page.spacious .body .para { margin-bottom: 1.15em; }
.page.spacious .body .para + .para { margin-top: .35em; }

/* 标题（红字，居中，可多行） */
.page-title { margin-bottom: .5em; line-height: 1.28; letter-spacing: .06em; text-align: center; }
.page-title .kicker {
  display: block; font-family: var(--font-heading); font-weight: 900;
  font-size: calc(var(--page-w) * var(--kicker-scale)); color: var(--title-color);
  text-shadow: var(--shadow);
}
.page-title .main {
  display: block; font-family: var(--font-title); font-weight: 900;
  font-size: calc(var(--page-w) * var(--title-scale)); color: var(--title-color);
  text-shadow: var(--shadow);
}

/* 部分分隔页（-1）：共用用户提供的红色底图，标题集中在页面上方约 40% */
.part-divider-content {
  padding: 0;
  height: 100%;
  justify-content: flex-start;
}
.part-divider-content .page-title {
  width: 100%;
  margin: 0;
  color: #fdf8c2;
  letter-spacing: .04em;
  transform: translateY(calc(var(--page-h) * .16));
}
.part-divider-content .page-title .kicker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .85em;
  font-size: calc(var(--page-w) * .05);
  color: #fdf8c2;
  line-height: 1.35;
}
.part-divider-content .page-title .kicker::before,
.part-divider-content .page-title .kicker::after {
  content: '';
  display: block;
  width: 1.2em;
  height: .07em;
  flex: none;
  background: currentColor;
  box-shadow: var(--shadow);
}
.part-divider-content .page-title .main {
  margin-top: calc(var(--page-h) * .055);
  padding-top: calc(var(--page-h) * .045);
  border-top: 0;
  font-size: calc(var(--page-w) * .07);
  color: #fdf8c2;
  line-height: 1.25;
  letter-spacing: .025em;
  white-space: nowrap;
}

/* 部分第 0 页：保留综述文字，隐藏原有两行部分标题；改用分隔页红色底图 */
.part-intro-content {
  padding: calc(var(--page-h) * .1) calc(var(--page-w) * .15) calc(var(--page-h) * .08);
  --body-scale: .034;
}
.part-intro-content .body {
  width: 100%;
}
.part-intro-content > .heading {
  position: absolute;
  left: 15%;
  right: 15%;
  top: 10%;
  margin: 0;
  text-align: center;
}
.part-intro-content .heading,
.part-intro-content .para {
  color: #fdf8c2;
  text-shadow: 0 0 0.18em rgba(0,0,0,.7), var(--text-halo);
}
.part-intro-content .heading {
  font-size: calc(var(--page-w) * .04);
  margin-top: .25em;
  margin-bottom: .45em;
}
.part-intro-content .para {
  line-height: var(--para-line-height, 1.35);
  margin-bottom: .35em;
}
.part-intro-content .body .para + .para {
  margin-top: .8em;
}
.page[data-id="p1.p0"] .part-intro-content .para {
  line-height: var(--para-line-height, 1.5);
}
.page[data-id="p2.p0"] .part-intro-content .para,
.page[data-id="p3.p0"] .part-intro-content .para {
  line-height: var(--para-line-height, 1.7);
}

/* 小节标题 */
.heading {
  font-family: var(--font-heading); font-weight: 900;
  font-size: calc(var(--page-w) * var(--heading-scale)); color: var(--heading-color);
  margin: .9em 0 .3em; letter-spacing: .05em; padding-left: 0;
  text-shadow: var(--shadow);
  position: relative;
}
.heading::before {
  display: none;
}

/* 段落（正文不加粗，标题加粗由 heading 承担） */
.para {
  font-size: calc(var(--page-w) * var(--body-scale)); line-height: var(--para-line-height, 1.2);
  font-weight: 400;
  text-align: justify; text-indent: 2em; letter-spacing: 0; margin-bottom: .2em; white-space: pre-line;
  text-shadow: var(--shadow);
}

/* 引言 / 诗词 */
.quote {
  margin: .8em 0; padding: 0;
  border: none;
  font-family: var(--font-title); font-size: calc(var(--page-w) * var(--quote-body-scale, var(--body-scale)));
  line-height: 1.8; letter-spacing: .03em; white-space: pre-line;
  text-align: justify; text-indent: 2em;
  transform: translateY(var(--quote-y, 0));
  text-shadow: var(--shadow);
}
.quote .author { display: block; text-align: right; font-size: .8em; margin-top: .5em; color: var(--title-color); text-indent: 0; }

/* 第三部分第二单元末页：横版长征书法占位图 + 诗文排版。 */
.page[data-id="p3.u2.p9"] .content {
  padding: calc(var(--page-h) * .035) calc(var(--page-w) * .065) calc(var(--page-h) * .045);
}
.page[data-id="p3.u2.p9"] .page-title { margin-bottom: .2em; }
.page[data-id="p3.u2.p9"] .gallery {
  flex: none; width: 100%; height: auto;
  margin: 0 auto .15em;
}
.page[data-id="p3.u2.p9"] .gallery .g-block { margin: auto 0; }
.page[data-id="p3.u2.p9"] .gallery .im { width: 100%; max-width: 100%; }
.page[data-id="p3.u2.p9"] .gallery .im img {
  width: 100%; max-width: 100%; max-height: none; filter: none;
}
.page[data-id="p3.u2.p9"] .gallery .im.tall img {
  width: auto; max-width: 100%;
  max-height: calc(var(--page-h) * .36 * var(--g-fit, 1));
}
.page[data-id="p3.u2.p9"] .heading {
  margin: .3em 0 .8em; text-align: center; line-height: 1.35;
  white-space: pre-line; letter-spacing: .1em;
  transform: translateY(calc(-4 * 1.35em));
}
.page[data-id="p3.u2.p9"] .poem-author {
  margin: .2em 0 1.8em; color: var(--ink);
  font-family: var(--font-title); font-size: calc(var(--page-w) * var(--body-scale));
  line-height: 1.55; text-align: center; letter-spacing: .12em;
  transform: translate(0, calc(-4 * 1.55em));
}
.page[data-id="p3.u2.p9"] .quote {
  margin: .2em auto 0; text-align: center; text-indent: 0;
  line-height: 1.55; letter-spacing: .12em;
  transform: translateY(calc(-4 * 1.55em));
}
.page[data-id="p3.u2.p9"] .quote > span:first-child {
  letter-spacing: .12em;
}

/* 第二部分第一单元索引页：讲话按展板格式居中，出处与日期分两行。 */
.page[data-id="p2.u1.p1"] .quote,
.page[data-id="p2.u1.p1b"] .quote {
  text-align: left;
  text-indent: 2em;
}
.page[data-id="p2.u1.p1"] .quote .author,
.page[data-id="p2.u1.p1b"] .quote .author {
  text-align: right;
  line-height: 1.7;
}

/* 前言后的独立讲话页：复用红色标题页底图，正文放大并在上半部均衡居中。 */
.quote-page-content {
  padding: calc(var(--page-h) * .14) calc(var(--page-w) * .12) calc(var(--page-h) * .18);
  color: #fdf8c2;
}
.quote-page-content .body {
  justify-content: center;
}
.quote-page-content .quote {
  color: #fdf8c2;
  font-size: calc(var(--page-w) * var(--quote-body-scale, var(--body-scale)));
  line-height: 1.7;
  letter-spacing: .04em;
  text-align: justify;
  text-justify: inter-ideograph;
  text-indent: 2em;
  text-shadow: 0 0 .18em rgba(0,0,0,.7), var(--text-halo);
}
.quote-page-content .quote .author {
  color: #fdf8c2;
  text-align: right;
  line-height: 1.7;
  margin-top: .85em;
}

/* 馆藏文献图页（按图片编号分组；自动按张数与横竖排版，点开单张放大） */
/* 图库为页内最后一个块时：占满标题下剩余高度，图片+图注整体垂直居中 → 单图页/双图页不再下半截空 */
.gallery { margin-top: calc(.8em + var(--page-h) * var(--g-top, 0)); display: flex; flex-direction: column; }
.content > .gallery:last-child { flex: 1; min-height: 0; }
.content > .gallery:last-child .g-block { margin: auto 0; }
.gallery .g-block { display: flex; flex-direction: column; }
.gallery .imgs {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: center;
  gap: calc(var(--page-w) * .035);
}
.gallery .im { position: relative; display: flex; flex-direction: column; align-items: center; flex: none; }
.gallery .im img {
  cursor: zoom-in; height: auto; display: block; width: auto; max-width: 100%;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,.35));
  opacity: 1; transition: opacity .18s ease;
}
.gallery.g-no-zoom .im img { cursor: default; }
.gallery.is-pending .im img { opacity: 0; }
.gallery.is-pending .im::before {
  content: ""; position: absolute; inset: 0; border-radius: 2px;
  background: linear-gradient(135deg, rgba(255,255,255,.08), rgba(0,0,0,.12));
  border: 1px solid rgba(255,255,255,.12);
}
.gallery.is-ready .im::before { opacity: 0; pointer-events: none; }
/* 单图：居中放大，占屏比例更高（可经 --g-scale 再放大，--g-fit 为安全带收缩） */
.gallery.g-one .im { max-width: calc(96% * var(--g-scale, 1) * var(--g-fit, 1)); }
.gallery.g-one .im img { max-height: calc(var(--page-h) * .6 * var(--g-scale, 1) * var(--g-fit, 1)); }
/* 两张竖版：并排、对齐、等高（高度由 JS 按两图比例算出 --ph） */
.gallery.g-two-v .imgs { align-items: center; }
.gallery.g-two-v .im img { height: calc(var(--ph, auto) * var(--g-fit, 1)); max-height: calc(var(--page-h) * .6 * var(--g-scale, 1) * var(--g-fit, 1)); }
/* 两张横版 / 一横一竖：上下堆叠、居中对齐 */
.gallery.g-two-h .imgs { flex-direction: column; align-items: center; }
.gallery.g-two-h .im { max-width: calc(88% * var(--g-scale, 1) * var(--g-fit, 1)); }
.gallery.g-two-h .im img { max-height: calc(var(--page-h) * .3 * var(--g-scale, 1) * var(--g-fit, 1)); }
.gallery.g-two-h .im.tall img { max-height: calc(var(--page-h) * .36 * var(--g-scale, 1) * var(--g-fit, 1)); }
/* 三张及以上：整齐两列网格（不交错位移） */
.gallery.g-many .im { max-width: calc(47% * var(--g-scale, 1) * var(--g-fit, 1)); }
.gallery.g-many .im img { max-height: calc(var(--page-h) * .42 * var(--g-scale, 1) * var(--g-fit, 1)); }
/* 重点三图：第1张置顶，第2、3张置于第二排；可用 perImageScale 分别控制视觉比重。 */
.gallery.g-lead-top .imgs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  row-gap: calc(var(--page-h) * .018);
  column-gap: 0;
  width: calc(47% * 1.5 * var(--g-scale, 1));
  margin-inline: auto;
}
.gallery.g-lead-top .im {
  max-width: calc(47% * var(--im-scale, 1) * var(--g-scale, 1) * var(--g-fit, 1));
  justify-self: center;
}
.gallery.g-lead-top .im img {
  max-height: calc(var(--page-h) * .42 * var(--im-scale, 1) * var(--g-scale, 1) * var(--g-fit, 1));
}
.gallery.g-lead-top .im:first-child {
  grid-column: 1 / -1;
  width: 100%;
  max-width: none;
}
.gallery.g-lead-top .im:first-child img {
  width: 100%;
  max-width: none;
}
.gallery.g-lead-top .im:not(:first-child) {
  width: calc(80% * var(--im-scale, 1) * var(--g-scale, 1) * var(--g-fit, 1));
  max-width: none;
}
.gallery.g-lead-top .im:not(:first-child) img {
  width: 100%;
  max-width: none;
}
/* 重点四图：两列两行；首行封面与内页同宽并底端对齐，次行两张内页列边对齐。 */
.gallery.g-cover-grid .imgs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: end;
  row-gap: calc(var(--page-h) * .018);
  column-gap: calc(var(--page-w) * .035);
}
.gallery.g-cover-grid .im {
  width: calc(100% * var(--g-fit, 1));
  max-width: none;
  justify-self: center;
}
.gallery.g-cover-grid .im img {
  width: 100%;
  max-width: none;
  max-height: none;
}
/* 三角形排布：第1张竖版居中置顶，第2、3张横版等宽并排置底。 */
.gallery.g-triangle .imgs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  row-gap: calc(var(--page-h) * .018);
  column-gap: calc(var(--page-w) * .035);
  width: 100%;
}
.gallery.g-triangle .im {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: none;
  min-width: 0;
  width: auto;
}
.gallery.g-triangle .im:first-child {
  flex: 0 0 100%;
  width: 100%;
}
.gallery.g-triangle .im:first-child img {
  width: auto;
  height: auto;
  max-width: calc(48% * var(--g-scale, 1) * var(--g-fit, 1));
  max-height: calc(var(--page-h) * .34 * var(--g-scale, 1) * var(--g-fit, 1));
}
.gallery.g-triangle .im:not(:first-child) {
  flex: 0 0 auto;
}
.gallery.g-triangle .im:not(:first-child) img {
  display: block;
  width: auto;
  height: calc(var(--th) * var(--g-fit, 1));
  max-width: none;
  max-height: none;
}
/* 个别三图文献页：三张图纵向上中下排列，避免横向并排拥挤。 */
.gallery.g-stack-v .imgs { flex-direction: column; align-items: center; gap: calc(var(--page-h) * .018); }
.gallery.g-stack-v .im { max-width: calc(88% * var(--g-scale, 1) * var(--g-fit, 1)); }
.gallery.g-stack-v .im img { max-height: calc(var(--page-h) * .24 * var(--g-scale, 1) * var(--g-fit, 1)); }
/* 重点多图页：统一实际图片高度，并让同一行图片底端对齐。高度由 JS 按比例和列宽计算。 */
.gallery.g-equal .imgs { align-items: flex-end; }
.gallery.g-equal .im img { height: calc(var(--eh) * var(--g-fit, 1)); max-height: none; }
.gallery.g-equal.g-single-row .imgs { flex-wrap: nowrap; }
.gallery.g-equal.g-single-row .im { flex: 1 1 0; min-width: 0; max-width: none; }
/* 文字页补图（X.Y.0）：贴页底（不参与垂直居中伸展） */
.gallery.g-zero { flex: none; margin-top: auto; padding-top: calc(var(--page-h) * .05); }
.gallery.g-zero .g-block { margin: 0; }
.gallery.g-zero .im img { max-height: calc(var(--page-h) * .4 * var(--g-fit, 1)); }

/* 图注：标题与第二行（出版信息等）同字号；多图各自图注用 .im-cap */
.gallery .cap-title, .gallery .cap-lead, .gallery .cap-desc, .gallery .im-cap {
  font-family: var(--font-caption); font-weight: 700;
  font-size: calc(var(--page-w) * var(--caption-title-scale) * var(--cap-scale, 1) + 2px);
  line-height: 1.4; color: var(--caption-color); text-align: center;
  text-shadow: var(--shadow);
}
.gallery .cap-title { margin-top: 2em; }
.gallery .cap-lead { margin: .1em auto 0; text-align: center; }
.gallery .cap-desc {
  opacity: 1;
  margin: .1em auto 0;
  width: fit-content;
  max-width: 100%;
  text-align: left;
  white-space: pre-line;
}
.gallery.g-desc-center .cap-desc { text-align: center; }
.gallery.g-desc-indent .cap-desc-paragraph {
  text-indent: 2em;
}
.gallery .im-cap { margin-top: 2em; max-width: 100%; white-space: pre-line; }

/* 文字白描边/光晕（theme.json parts.*.halo 启用，压深色底图时保证可读；默认透明） */
.content :is(.kicker, .main, .heading, .para, .quote, .quote .author, .cap-title, .cap-lead, .cap-desc, .im-cap) {
  text-shadow: var(--shadow), var(--text-halo);
}

/* 内容占位（待补充的页面） */
.placeholder {
  position: absolute; left: 0; right: 0; top: 62%; text-align: center;
  font-size: calc(var(--page-w) * .022); color: rgba(0,0,0,.35); letter-spacing: .2em;
}

/* 浮动目录按钮（无标题栏，仅一个角落小按钮） */
#btn-toc {
  position: fixed; top: calc(10px + env(safe-area-inset-top)); right: 14px; z-index: 30;
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 0; cursor: pointer; font-size: 18px;
  background: rgba(0,0,0,.25); color: #fdf8c2;
  border: 1px solid rgba(253,248,194,.18);
}

/* 底部翻页 */
.nav {
  position: fixed; left: 0; right: 0; bottom: max(10px, env(safe-area-inset-bottom)); z-index: 30;
  display: flex; justify-content: space-between; padding: 0 14px; pointer-events: none;
}
.nav button {
  pointer-events: auto; border: 0; border-radius: 999px; cursor: pointer;
  padding: 9px 18px; font-size: 14px; background: rgba(0,0,0,.18); color: rgba(253,248,194,.45);
  border: 1px solid rgba(253,248,194,.12);
}
.nav button[disabled] { opacity: .3; }

/* 目录抽屉 */
#index-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; max-height: 72%;
  padding: 18px 20px calc(22px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(58,18,10,.97), rgba(20,16,14,.98));
  border-top: 1px solid rgba(253,248,194,.25); border-radius: 16px 16px 0 0;
  transform: translateY(105%); transition: transform .4s cubic-bezier(.22,.9,.3,1);
  overflow-y: auto;
}
#index-sheet.open { transform: translateY(0); }
#index-sheet h3 { color: #fdf8c2; letter-spacing: 4px; font-size: 16px; margin-bottom: 10px; }
#index-sheet button {
  display: block; width: 100%; text-align: left; margin-bottom: 6px;
  padding: 9px 14px; background: rgba(253,248,194,.06);
  border: 1px solid rgba(253,248,194,.22); border-radius: 8px;
  color: #f2e8c8; font-size: 14px; cursor: pointer;
}
#index-sheet button.nav-index, #index-sheet button.nav-part {
  font-family: var(--font-title); font-weight: 900;
}
#index-sheet button.nav-unit { padding-left: 22px; font-weight: 400; }
#index-sheet button.nav-unit .u-no { font-size: 11px; color: #b3a686; letter-spacing: 2px; }
#index-sheet button.nav-unit .u-title { font-size: 14px; }

/* 前言三块（第一部分/第二部分/第三部分） */
#part-blocks {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 38;
  padding: 0 16px calc(18px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 10px;
  transform: translateY(105%); transition: transform .4s cubic-bezier(.22,.9,.3,1);
  pointer-events: none;
}
#part-blocks.open { transform: translateY(0); pointer-events: auto; }
#part-blocks button {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 15px 18px; border-radius: 12px; cursor: pointer; text-align: left;
  background: linear-gradient(180deg, rgba(58,18,10,.96), rgba(40,14,9,.96));
  border: 1px solid rgba(253,248,194,.28);
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
#part-blocks button b {
  flex: none; font-family: var(--font-title); font-size: 22px; color: #fdf8c2;
  letter-spacing: 2px;
}
#part-blocks button span { font-size: 14px; color: #e8dcc0; letter-spacing: 1px; }

/* 放大细读 lightbox */
#lightbox {
  position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.94);
  display: none; overflow: hidden; align-items: center; justify-content: center; flex-direction: column;
}
#lightbox.open { display: flex; }
#lightbox .lb-viewport {
  position: absolute; inset: 0; z-index: 0; overflow: hidden;
  touch-action: none; cursor: grab;
}
#lightbox .lb-viewport.dragging { cursor: grabbing; }
#lightbox .lb-img {
  position: absolute; left: 0; top: 0; display: block;
  max-width: none; max-height: none; object-fit: contain; transform-origin: 0 0;
  background: #fff; box-shadow: 0 10px 40px rgba(0,0,0,.6);
  user-select: none; -webkit-user-select: none; -webkit-user-drag: none;
}
#lightbox .lb-toolbar {
  position: absolute; z-index: 2; top: max(12px, env(safe-area-inset-top)); left: 16px; right: 16px;
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  pointer-events: none;
}
#lightbox .lb-toolbar > * { pointer-events: auto; }
#lightbox .lb-hint { margin-right: auto; color: rgba(255,255,255,.7); font-size: 12px; }
#lightbox .lb-reset, #lightbox .lb-close, #lightbox .lb-zoom-controls button {
  min-width: 40px; min-height: 40px; padding: 7px 12px; border: 1px solid rgba(255,255,255,.3);
  border-radius: 999px; color: #fff; background: rgba(0,0,0,.48); cursor: pointer;
}
#lightbox .lb-reset { font-size: 13px; }
#lightbox .lb-close {
  font-size: 28px; line-height: 1; padding: 4px 10px;
}
#lightbox .lb-zoom-controls {
  position: absolute; z-index: 2; left: 50%; bottom: max(14px, env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 8px; transform: translateX(-50%);
  padding: 5px 7px; border-radius: 999px; background: rgba(0,0,0,.5); color: #fff;
}
#lightbox .lb-zoom-controls button { font-size: 22px; line-height: 1; padding: 5px 12px; }
#lightbox .lb-zoom-controls span { min-width: 52px; text-align: center; font-size: 12px; }
#lightbox .lb-cap {
  position: absolute; z-index: 2; left: 6vw; right: 6vw; bottom: 74px;
  color: #eee; font-size: 14px; text-align: center; line-height: 1.6;
  text-shadow: 0 1px 3px #000; pointer-events: none;
}

/* 适老化全文浮层：正文使用 rem/vw，保留系统字体放大能力；仅浮层内部滚动。 */
#reading-modal { position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center; }
#reading-modal.open { display: flex; }
.reading-backdrop { position: absolute; inset: 0; background: rgba(30,18,12,.58); }
.reading-dialog { position: relative; z-index: 1; display: flex; flex-direction: column; width: min(100%, 780px); height: calc(100% - 16px); border-radius: 12px; background: #fffdf5; color: #2a201a; box-shadow: 0 12px 50px rgba(0,0,0,.35); }
.reading-toolbar { flex: none; display: flex; align-items: center; gap: 12px; padding: max(14px, env(safe-area-inset-top)) 18px 12px; border-bottom: 1px solid rgba(139,37,19,.16); background: #fffdf5; }
#reading-title { flex: 1; min-width: 0; font-family: var(--font-title); font-size: clamp(1.1rem, 4.8vw, 1.6rem); line-height: 1.35; color: #8b2513; }
#reading-close { flex: none; width: 2.25em; height: 2.25em; border: 1px solid rgba(139,37,19,.3); border-radius: 50%; background: transparent; color: #8b2513; font-size: 1.45rem; line-height: 1; cursor: pointer; }
#reading-close:focus-visible { outline: 2px solid #8b2513; outline-offset: 3px; }
.reading-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.reading-scroll::-webkit-scrollbar { display: none; }
.reading-content { max-width: 720px; margin: 0 auto; padding: 1.5rem clamp(1.2rem, 6vw, 3.2rem) calc(2.5rem + env(safe-area-inset-bottom)); }
.reading-content > .heading { margin: 0 0 .8em; padding: 0; font-size: clamp(1.15rem, 5vw, 1.65rem); line-height: 1.45; }
.reading-content > .heading::before { display: none; }
.reading-body { font-size: clamp(1.08rem, 4.7vw, 1.55rem); line-height: 1.85; }
.reading-body .heading { margin: 1.1em 0 .55em; font-size: 1.1em; line-height: 1.45; }
.reading-body .heading::before { display: none; }
.reading-body .para { font-size: 1em; line-height: inherit; margin: 0 0 .75em; text-align: left; text-indent: 2em; white-space: pre-line; }
.reading-body .quote { margin: 1.2em 0; padding: .8em 1em; font-size: 1em; line-height: 1.85; }
.reading-body .quote .author { font-size: .85em; }
body.reading-open { overflow: hidden; }

@media (min-width: 700px) {
  .reading-dialog { width: min(780px, calc(100% - 48px)); height: min(92vh, 980px); border-radius: 14px; }
  .reading-toolbar { padding-top: 16px; }
}

/* ==================== PC 三栏 ==================== */
#pc-layout { display: block; }
#left-nav, #right-panel { display: none; }

body.pc #pc-layout { display: flex; height: 100vh; overflow: hidden; }
body.pc .stage { position: relative; flex: 1; min-width: 0; height: 100vh; }

/* 左栏：目录（封面/前言/结语 + 各部分一行 + 各单元两行缩进） */
body.pc #left-nav {
  display: flex; flex-direction: column; flex: none;
  width: var(--side-w); overflow-y: auto;
  background: rgba(18,14,12,.96); border-right: 1px solid rgba(253,248,194,.14);
  padding: 14px 0 20px;
  scrollbar-width: thin; scrollbar-color: rgba(253,248,194,.22) transparent;
}
#left-nav::-webkit-scrollbar { width: 6px; }
#left-nav::-webkit-scrollbar-thumb { background: rgba(253,248,194,.2); border-radius: 3px; }
#left-nav button {
  display: block; width: calc(100% - 16px); text-align: left;
  margin: 0 8px 2px; padding: 7px 12px; border: 0; border-radius: 5px;
  background: transparent; color: #e8dcc0; font-size: 14px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#left-nav button:hover { background: rgba(253,248,194,.08); }
#left-nav button.active { background: rgba(139,37,19,.55); color: #fdf8c2; border-left: 2px solid #fdf8c2; }
/* 封面/前言/结语/部分：加粗 */
#left-nav button.nav-index, #left-nav button.nav-part {
  font-family: var(--font-title); font-weight: 900; color: #f2e8c8;
}
#left-nav button.nav-part { margin-top: 8px; font-size: 15px; }
/* 单元：两行、缩进、不加粗 */
#left-nav button.nav-unit { padding: 5px 12px 6px 26px; font-weight: 400; }
#left-nav button.nav-unit .u-no { font-size: 11px; color: #b3a686; letter-spacing: 2px; }
#left-nav button.nav-unit .u-title { font-size: 14px; color: #ddd2ba; }

/* 右栏：当前页图片放大面板（无图时留空深色底） */
body.pc #right-panel {
  display: flex; flex-direction: column; flex: none;
  width: var(--side-w); overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(18,14,12,.96); border-left: 1px solid rgba(253,248,194,.14);
  padding: 22px 22px; gap: 14px;
  scrollbar-width: thin; scrollbar-color: rgba(253,248,194,.22) transparent;
}
#right-panel::-webkit-scrollbar { width: 6px; }
#right-panel::-webkit-scrollbar-thumb { background: rgba(253,248,194,.2); border-radius: 3px; }
#right-panel .rp-title { font-family: var(--font-caption); font-weight: 700; font-size: 18px; color: #f2e8c8; text-align: center; letter-spacing: 1px; }
#right-panel .rp-desc { font-size: 13px; color: #b3a686; text-align: center; }
#right-panel .rp-imgs { display: flex; flex-direction: column; gap: 18px; align-items: center; }
#right-panel .rp-imgs img { max-width: 100%; height: auto; box-shadow: 0 8px 26px rgba(0,0,0,.55); }

/* PC 隐藏移动端 chrome */
body.pc #btn-toc, body.pc .nav { display: none; }

/* PC 页面尺寸：左右栏等宽 → 中栏居中；页宽自适应中栏 */
body.pc {
  --side-w: clamp(340px, 24vw, 480px);
  --mid-w: calc(100vw - 2 * var(--side-w));
  --page-w: min(var(--mid-w), calc(100vh * var(--ratio)));
  --page-h: min(calc(var(--mid-w) / var(--ratio)), 100vh);
}
body.pc #part-blocks { display: none; }
