/* 抗日戰史 閱讀站 —— 線裝紙本：暖紙、墨字、一點朱 */

:root {
  --bg: #f1ebdf;
  --surface: #f8f4ec;
  --ink: #211c16;
  --ink-2: #5b5246;
  --dim: #8d8374;
  --rule: #d6cab5;
  --rule-2: #e4dacb;
  --accent: #a2382a;
  --accent-ink: #fbf5ec;
  --shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 10px 30px -18px rgba(60, 40, 20, .45);
  --plank: #cdbb9c;

  --f-body: "Noto Serif TC", "Source Han Serif TC", "Noto Serif CJK TC", "Songti TC", "PMingLiU", "MingLiU", serif;
  --f-kai: "LXGW WenKai TC", "BiauKai", "DFKai-SB", "STKaiti", "KaiTi", serif;
  --fs: 20px;
  --measure: 34em;
  --bar: 3.25rem;

  /* 書衣：每一套書一種布色 */
  --c0: #2d3e4e;  /* 藏青 */
  --c1: #7a3b27;  /* 赭 */
  --c2: #33493a;  /* 墨綠 */
  --c3: #5e2a2c;  /* 絳 */
  --c4: #4a4744;  /* 鐵灰 */
  --c5: #6a5232;  /* 茶褐 */
}

html[data-theme="plain"] {
  --bg: #fcfbf8;
  --surface: #ffffff;
  --ink: #1d1d1b;
  --ink-2: #55524c;
  --dim: #8e8a82;
  --rule: #dedad2;
  --rule-2: #ecE8e1;
  --plank: #d9d2c6;
  --shadow: 0 10px 30px -20px rgba(0, 0, 0, .35);
}

html[data-theme="night"] {
  --bg: #161411;
  --surface: #1d1a16;
  --ink: #ddd3c2;
  --ink-2: #aca092;
  --dim: #7b7163;
  --rule: #3a332a;
  --rule-2: #2a251f;
  --accent: #df7a5e;
  --accent-ink: #1a1512;
  --plank: #3a3128;
  --shadow: 0 10px 30px -18px rgba(0, 0, 0, .8);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--bar) + 1rem); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.7;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }

/* ------------------------------------------------------------ 頂欄 */

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--bar);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0 1rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.2) blur(10px);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--rule-2);
}
.topbar-l { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.topbar-r { display: flex; gap: .5rem; }

.brand {
  font-family: var(--f-kai);
  font-size: 1.2rem; letter-spacing: .12em;
  display: inline-flex; align-items: center; gap: .5rem; white-space: nowrap;
}
.brand::before {
  content: ""; width: .62rem; height: .62rem; background: var(--accent); border-radius: 1px;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--accent);
}
.crumbs { display: flex; align-items: center; min-width: 0; color: var(--ink-2); font-size: .9rem; white-space: nowrap; overflow: hidden; }
.crumbs > * { overflow: hidden; text-overflow: ellipsis; }
.crumbs .sep { color: var(--rule); margin: 0 .4rem; flex: none; }
.crumbs a:hover { color: var(--accent); }

.icon-btn {
  width: 2.1rem; height: 2.1rem; flex: none;
  display: grid; place-items: center;
  font-family: var(--f-kai); font-size: 1.05rem;
  background: transparent; border: 1px solid var(--rule); border-radius: 50%;
  cursor: pointer; transition: border-color .15s, color .15s, background .15s;
}
.icon-btn:hover, .icon-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }

.progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .1s linear; }

/* 閱讀設定 */
.prefs {
  position: fixed; z-index: 40; top: calc(var(--bar) + .5rem); right: 1rem;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 10px;
  padding: .9rem 1rem; box-shadow: var(--shadow); min-width: 16rem;
}
.prefs[hidden] { display: none; }
.prefs-row { display: flex; align-items: center; gap: .4rem; }
.prefs-row + .prefs-row { margin-top: .6rem; }
.prefs-k { width: 3rem; color: var(--dim); font-size: .85rem; }
.prefs button {
  flex: 1; padding: .3rem .5rem; cursor: pointer;
  background: transparent; border: 1px solid var(--rule); border-radius: 6px;
  font-family: var(--f-kai);
}
.prefs button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.prefs output { width: 2.5rem; text-align: center; font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* ------------------------------------------------------------ 首頁 */

.home { max-width: 72rem; margin: 0 auto; padding: 3rem 1.5rem 4rem; }

.hero { display: grid; grid-template-columns: auto 1fr; gap: 3rem; align-items: start; margin-bottom: 3.5rem; }
.hero-title { display: flex; gap: 1rem; align-items: flex-start; }
.hero-t {
  writing-mode: vertical-rl;
  font-family: var(--f-kai); font-size: clamp(2.8rem, 6vw, 4.4rem); line-height: 1; letter-spacing: .28em;
  padding: 1.1rem .7rem .6rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  outline: 1px solid var(--rule); outline-offset: 4px;
  box-shadow: var(--shadow);
}
.seal {
  writing-mode: vertical-rl;
  font-family: var(--f-kai); font-size: .95rem; letter-spacing: .2em; line-height: 1.15;
  color: var(--accent-ink); background: var(--accent);
  padding: .55rem .35rem; border-radius: 3px;
  margin-top: 1.4rem;
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent-ink) 35%, transparent);
}
.hero-text { max-width: 34rem; padding-top: .4rem; color: var(--ink-2); font-size: 1.02rem; }
.hero-text p { margin: 0 0 .8rem; }
.hero-lead { font-family: var(--f-kai); font-size: 1.35rem; color: var(--ink); line-height: 1.6; }
.hero-stats { display: flex; gap: 1.5rem; font-family: var(--f-kai); color: var(--ink); font-size: 1.1rem; }
.hero-stats span::before { content: "◆"; color: var(--accent); font-size: .6em; margin-right: .45em; vertical-align: .2em; }
.legend { display: flex; flex-wrap: wrap; gap: 1.2rem; font-size: .85rem; color: var(--dim); }
.legend i { display: inline-block; vertical-align: middle; margin-right: .35rem; position: static; }

.resume {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin: 1.2rem 0 1rem; padding: .8rem 1rem;
  background: var(--surface); border: 1px solid var(--rule); border-left: 3px solid var(--accent); border-radius: 4px;
}
.resume[hidden] { display: none; }
.resume small { display: block; color: var(--dim); font-size: .78rem; letter-spacing: .1em; }
.resume a.go { font-family: var(--f-kai); color: var(--accent); white-space: nowrap; }

.shelf-sec { margin-bottom: 3rem; }
.shelf-h {
  display: flex; align-items: baseline; gap: .9rem;
  font-family: var(--f-kai); font-weight: 400; font-size: 1.45rem; letter-spacing: .1em;
  margin: 0 0 1.1rem;
}
.shelf-h::after { content: ""; flex: 1; border-bottom: 1px solid var(--rule); transform: translateY(-.35em); }
.shelf-range { font-size: .85rem; color: var(--accent); letter-spacing: .05em; }

.shelf-row {
  --sh: 15.5rem;  /* 書脊高 */
  --rg: 1.8rem;   /* 行距（含擱板） */
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--rg) .32rem;
  padding: 0 .4rem 7px;
  /* 每一行書下面都有一塊擱板 */
  background: repeating-linear-gradient(to bottom,
    transparent 0 var(--sh),
    var(--plank) var(--sh) calc(var(--sh) + 7px),
    transparent calc(var(--sh) + 7px) calc(var(--sh) + var(--rg)));
}

.spine {
  --cloth: var(--c0);
  position: relative;
  width: 2.75rem; height: var(--sh);
  display: flex; flex-direction: column; align-items: center;
  padding: 1.1rem 0 .7rem;
  border-radius: 3px 3px 1px 1px;
  background:
    linear-gradient(90deg, rgba(0,0,0,.28), rgba(255,255,255,.07) 28%, rgba(255,255,255,.02) 62%, rgba(0,0,0,.3)),
    var(--cloth);
  color: #efe6d4;
  box-shadow: 0 1px 0 rgba(0,0,0,.25), 0 8px 16px -10px rgba(0,0,0,.6);
  transition: transform .18s ease, box-shadow .18s ease;
}
.spine::before, .spine::after {
  content: ""; position: absolute; left: 0; right: 0; height: 3px;
  border-top: 1px solid rgba(239, 222, 186, .45); border-bottom: 1px solid rgba(239, 222, 186, .45);
}
.spine::before { top: .45rem; }
.spine::after { bottom: 2.6rem; }
.spine:hover, .spine:focus-visible { transform: translateY(-7px); box-shadow: 0 1px 0 rgba(0,0,0,.25), 0 16px 22px -12px rgba(0,0,0,.6); outline: none; }

.c0 { --cloth: var(--c0); } .c1 { --cloth: var(--c1); } .c2 { --cloth: var(--c2); }
.c3 { --cloth: var(--c3); } .c4 { --cloth: var(--c4); } .c5 { --cloth: var(--c5); }

.sp-label {
  writing-mode: vertical-rl;
  display: flex; align-items: center; gap: .35rem;
  max-height: 11.4rem;
  padding: .55rem .2rem;
  background: #efe7d6; color: #2a231b;
  font-family: var(--f-kai); font-size: .98rem; line-height: 1.05; letter-spacing: .06em;
  box-shadow: inset 0 0 0 1px rgba(80, 60, 30, .25);
  overflow: hidden;
}
.spine.long .sp-label { font-size: .84rem; }
.spine.xlong .sp-label { font-size: .7rem; letter-spacing: 0; gap: .2rem; }
.sp-part { font-size: .72em; color: #8b2f22; }
.sp-no {
  writing-mode: vertical-rl; margin-top: auto;
  font-family: var(--f-kai); font-size: .78rem; letter-spacing: .05em; opacity: .85;
}
.sp-proof { position: absolute; bottom: .35rem; width: .42rem; height: .42rem; border-radius: 50%; }
.sp-proof.hand { background: #e9c46a; }
.sp-proof.dual { background: #e7a08c; }
.sp-proof.ocr { background: transparent; box-shadow: inset 0 0 0 1px rgba(239, 222, 186, .55); }
.legend .sp-proof.ocr { box-shadow: inset 0 0 0 1px var(--dim); }
.legend .sp-proof.hand { background: #d4a83a; }
.legend .sp-proof.dual { background: #d77f69; }

.foot { margin-top: 3rem; text-align: center; color: var(--dim); font-size: .85rem; }
.foot a { border-bottom: 1px solid var(--rule); }
.foot a:hover { color: var(--accent); border-color: var(--accent); }

/* ------------------------------------------------------------ 冊目錄頁 */

.volume {
  max-width: 68rem; margin: 0 auto; padding: 3rem 1.5rem 4rem;
  display: grid; grid-template-columns: 15rem 1fr; gap: 3.5rem; align-items: start;
}
.cover {
  --cloth: var(--c0);
  position: sticky; top: calc(var(--bar) + 2rem);
  aspect-ratio: 3 / 4.3;
  background:
    linear-gradient(100deg, rgba(255,255,255,.06), rgba(0,0,0,.18)),
    var(--cloth);
  border-radius: 2px 6px 6px 2px;
  box-shadow: 0 22px 40px -24px rgba(0,0,0,.7), inset -2px 0 0 rgba(0,0,0,.25);
  padding: 1.2rem;
  display: flex; flex-direction: column; align-items: flex-end;
}
.cover::before { /* 線裝：右側四眼釘 */
  content: ""; position: absolute; right: .9rem; top: 0; bottom: 0; width: 1px;
  background: repeating-linear-gradient(transparent 0 18%, rgba(239,222,186,.5) 18% 18.6%, transparent 18.6% 27%);
}
.cover-label {
  writing-mode: vertical-rl;
  margin-right: 1.6rem;
  background: #efe7d6; color: #2a231b;
  padding: .8rem .45rem;
  display: flex; gap: .55rem; align-items: flex-start;
  box-shadow: inset 0 0 0 1px rgba(80,60,30,.3), inset 0 0 0 4px #efe7d6, inset 0 0 0 5px rgba(80,60,30,.22);
  font-family: var(--f-kai);
}
.cover-book { font-size: .95rem; letter-spacing: .2em; }
.cover-name { font-size: 1.35rem; letter-spacing: .1em; }
.cover-no { margin-top: auto; align-self: flex-start; writing-mode: vertical-rl; font-family: var(--f-kai); color: #efe6d4; opacity: .8; letter-spacing: .15em; }

.vol-kicker { margin: 0; color: var(--accent); font-family: var(--f-kai); letter-spacing: .15em; }
.vol-title { margin: .2rem 0 .8rem; font-family: var(--f-kai); font-weight: 400; font-size: clamp(2rem, 4vw, 2.8rem); letter-spacing: .08em; line-height: 1.3; }
.vol-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.2rem; color: var(--ink-2); font-size: .92rem; margin: 0 0 1.4rem; }
.badge { font-family: var(--f-kai); padding: .1rem .6rem; border-radius: 3px; border: 1px solid currentColor; font-size: .88rem; letter-spacing: .08em; }
.badge.hand { color: #9a6d0e; } .badge.dual { color: var(--accent); } .badge.ocr { color: var(--dim); }
html[data-theme="night"] .badge.hand { color: #d9b25a; }

.vol-actions { display: flex; gap: .7rem; margin-bottom: 2.2rem; }
.btn {
  font-family: var(--f-kai); letter-spacing: .12em;
  padding: .5rem 1.3rem; border-radius: 4px;
  background: var(--ink); color: var(--bg); border: 1px solid var(--ink);
  transition: background .15s, color .15s, border-color .15s;
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); background: transparent; }

.vol-toc ol, .drawer-toc ol { list-style: none; margin: 0; padding: 0; }
.vol-toc { border-top: 1px solid var(--rule); padding-top: 1.2rem; }
.vol-toc li { margin: 0; }
.vol-toc a { display: block; padding: .28rem 0; transition: color .12s; }
.vol-toc a:hover { color: var(--accent); }
.vol-toc li li { padding-left: 1.4rem; }
.vol-toc .t1 > a, .vol-toc .t2 > a { font-family: var(--f-kai); font-size: 1.3rem; padding-top: .9rem; letter-spacing: .05em; }
.vol-toc .t3 > a { font-family: var(--f-kai); font-size: 1.12rem; padding-top: .55rem; }
.vol-toc .t4 > a { font-size: 1rem; }
.vol-toc .t5 > a, .vol-toc .t6 > a { font-size: .9rem; color: var(--ink-2); padding: .12rem 0; }
.vol-toc > ol > li { border-bottom: 1px dashed var(--rule-2); padding-bottom: .5rem; }

.volnav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--rule); font-family: var(--f-kai); color: var(--ink-2); }
.volnav a:hover { color: var(--accent); }

/* 總目錄 */
.grand-toc { list-style: none; margin: 0; padding: 1rem 0 0; border-top: 1px solid var(--rule); }
.gt { display: flex; align-items: baseline; gap: .5rem; padding: .18rem 0; }
.gt-t { flex: none; max-width: 85%; }
.gt-dots { flex: 1; border-bottom: 1px dotted var(--rule); transform: translateY(-.3em); min-width: 1rem; }
.gt-p { flex: none; color: var(--dim); font-size: .85rem; font-family: var(--f-kai); }
.gt.d1 { font-family: var(--f-kai); font-size: 1.4rem; margin-top: 1.6rem; color: var(--accent); }
.gt.d2 { font-family: var(--f-kai); font-size: 1.15rem; margin-top: .7rem; padding-left: 1rem; }
.gt.d3 { padding-left: 2.2rem; }
.gt.d4 { padding-left: 3.4rem; font-size: .93rem; color: var(--ink-2); }
.gt.d5, .gt.d6 { padding-left: 4.6rem; font-size: .88rem; color: var(--dim); }

/* ------------------------------------------------------------ 閱讀頁 */

.reader { padding: 2.5rem 1.25rem 4rem; }
.text {
  max-width: var(--measure); margin: 0 auto;
  font-size: var(--fs); line-height: 2.05;
  text-align: justify; text-justify: inter-ideograph;
  hanging-punctuation: allow-end;
  font-feature-settings: "palt" 0;
}
.page-kicker {
  display: flex; justify-content: space-between; gap: 1rem;
  margin: 0 0 2.5rem; padding-bottom: .6rem; border-bottom: 1px solid var(--rule);
  font-family: var(--f-kai); font-size: .8rem; letter-spacing: .12em; color: var(--dim);
  text-indent: 0;
}
.text p { margin: 0 0 .85em; text-indent: 2em; }
.text strong { font-weight: 700; }

.text h1, .text h2, .text h3, .text h4, .text h5, .text h6 { text-indent: 0; text-align: start; line-height: 1.5; }
.text .lv1 {
  font-family: var(--f-kai); font-weight: 400; font-size: 2em; letter-spacing: .18em; text-align: center;
  margin: 2.2em 0 1.4em; padding: .7em 0;
  border-block: 3px double var(--rule);
}
.text .lv2 {
  font-family: var(--f-kai); font-weight: 400; font-size: 1.7em; letter-spacing: .12em; text-align: center;
  margin: 2em 0 1.1em;
}
.text .lv2::before {
  content: ""; display: block; width: .42em; height: .42em; margin: 0 auto .7em;
  background: var(--accent); transform: rotate(45deg);
}
.text .lv3 {
  display: flex; align-items: center; gap: .9em;
  font-family: var(--f-kai); font-weight: 400; font-size: 1.32em; letter-spacing: .08em;
  margin: 2.2em 0 1em;
}
.text .lv3::before, .text .lv3::after { content: ""; flex: 1; border-top: 1px solid var(--rule); min-width: 1.5em; }
.text .lv3 span { flex: 0 1 auto; text-align: center; }
.text .lv4 {
  font-family: var(--f-kai); font-weight: 400; font-size: 1.16em; letter-spacing: .05em;
  margin: 1.9em 0 .8em; padding-inline-start: .7em;
  border-inline-start: 3px solid var(--accent);
}
.text .lv5 { font-size: 1.04em; font-weight: 700; margin: 1.6em 0 .6em; }
.text .lv6 { font-size: 1em; font-weight: 700; color: var(--ink-2); margin: 1.4em 0 .5em; }
.text .lv1 + .subnote, .text .lv2 + .subnote, .text .lv3 + .subnote { text-align: center; }
.text .subnote {
  text-indent: 0; font-size: .82em; color: var(--ink-2); line-height: 1.7;
  margin: -.4em 0 .5em;
}
.text .subnote + p:not(.subnote) { margin-top: 1.2em; }
.text .cont { text-indent: 0; text-align: center; font-family: var(--f-kai); color: var(--dim); letter-spacing: .1em; margin-bottom: 1.6em; }

.text blockquote { margin: 1em 0; padding-inline-start: 1em; border-inline-start: 2px solid var(--rule); color: var(--ink-2); }
.text table {
  display: block; overflow-x: auto; max-width: 100%;
  border-collapse: collapse; margin: 1.2em 0; font-size: .8em; line-height: 1.6;
  writing-mode: horizontal-tb;
}
.text th, .text td { border: 1px solid var(--rule); padding: .3em .6em; text-align: start; vertical-align: top; }
.text th { background: var(--surface); font-weight: 700; }

.fig {
  display: flex; align-items: center; gap: .8em;
  margin: 1.4em 0; padding: .65em .9em;
  border: 1px dashed var(--rule); border-radius: 4px;
  font-size: .8em; line-height: 1.5; color: var(--ink-2);
}
.fig-mark {
  flex: none; width: 1.9em; height: 1.9em; display: grid; place-items: center;
  font-family: var(--f-kai); color: var(--accent); border: 1px solid var(--accent); border-radius: 2px;
}
.fig-text { flex: 1; }
.fig-link { flex: none; color: var(--accent); font-family: var(--f-kai); white-space: nowrap; }
.fig-link:hover { text-decoration: underline; }

.pager {
  max-width: var(--measure); margin: 3.5rem auto 0; font-size: var(--fs);
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
}
.pn { display: block; padding: .9rem 1.1rem; border: 1px solid var(--rule); border-radius: 6px; font-size: .9rem; transition: border-color .15s, background .15s; min-height: 1px; }
span.pn { border: 0; }
.pn small { display: block; color: var(--dim); font-size: .78em; letter-spacing: .15em; font-family: var(--f-kai); }
.pn span { font-family: var(--f-kai); font-size: 1.08em; }
.pn.next { text-align: end; }
a.pn:hover { border-color: var(--accent); background: var(--surface); }
a.pn:hover span { color: var(--accent); }

.doc p { text-indent: 0; }
.doc h1 { font-family: var(--f-kai); font-weight: 400; font-size: 1.8em; }
.doc h2 { font-family: var(--f-kai); font-weight: 400; font-size: 1.3em; margin-top: 1.6em; }
.doc ul { padding-inline-start: 1.2em; }
.page-doc .text { font-size: calc(var(--fs) * .85); line-height: 1.8; }

.tcy { text-combine-upright: none; }

/* ------------------------------------------------------------ 目錄抽屜 */

.drawer {
  position: fixed; z-index: 50; top: 0; bottom: 0; left: 0;
  width: min(23rem, 86vw);
  background: var(--surface); border-right: 1px solid var(--rule);
  box-shadow: 20px 0 40px -30px rgba(0,0,0,.5);
  display: flex; flex-direction: column;
  transform: translateX(-102%); transition: transform .22s ease;
}
.drawer.open { transform: none; }
.drawer[hidden] { display: flex; visibility: hidden; }
.drawer.open[hidden] { visibility: visible; }
.drawer-h { padding: 1rem 1.2rem; border-bottom: 1px solid var(--rule); font-family: var(--f-kai); font-size: 1.1rem; letter-spacing: .08em; }
.drawer-h a:hover { color: var(--accent); }
.drawer-toc { overflow-y: auto; padding: .6rem 1.2rem 2rem; font-size: .92rem; }
.drawer-toc a { display: block; padding: .22rem .5rem; border-radius: 4px; }
.drawer-toc a:hover { background: var(--bg); color: var(--accent); }
.drawer-toc li li { padding-left: 1rem; }
.drawer-toc .t1 > a, .drawer-toc .t2 > a, .drawer-toc .t3 > a { font-family: var(--f-kai); font-size: 1.05rem; margin-top: .3rem; }
.drawer-toc .t5 > a, .drawer-toc .t6 > a { color: var(--ink-2); font-size: .85rem; }
.drawer-toc a.here { color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); }
.scrim { position: fixed; inset: 0; z-index: 45; background: rgba(20, 14, 8, .28); }
.scrim[hidden] { display: none; }

/* ------------------------------------------------------------ 直排 */

html[data-mode="v"] .page-read { overflow: hidden; height: 100vh; }
html[data-mode="v"] .page-read .reader {
  writing-mode: vertical-rl;
  width: 100%;  /* 不給定寬度，正交排版的容器會撐到內容全寬，就無從橫向捲動 */
  height: calc(100vh - var(--bar));
  overflow-x: auto; overflow-y: hidden;
  padding: 2.2rem 3rem;
  overscroll-behavior: contain;
}
html[data-mode="v"] .page-read .text {
  max-width: none; height: 100%; max-height: calc(var(--fs) * 38 * 1); margin: auto 0;
  line-height: 2.1;
}
html[data-mode="v"] .page-read .text .tcy { text-combine-upright: all; }
html[data-mode="v"] .page-read .page-kicker { margin: 0 0 0 2.2em; padding: 0 0 0 .6em; border-bottom: 0; border-left: 1px solid var(--rule); }
html[data-mode="v"] .page-read .text .lv2::before { margin: 0 auto .7em; }
html[data-mode="v"] .page-read .text table { max-height: 100%; overflow: auto; margin: 0 1.4em; }
html[data-mode="v"] .page-read .pager { max-width: none; height: 100%; max-height: calc(var(--fs) * 38); margin: auto 3rem auto 0; grid-template-columns: none; grid-template-rows: 1fr 1fr; writing-mode: vertical-rl; }
html[data-mode="v"] .page-read .pn.next { text-align: start; }

/* ------------------------------------------------------------ 窄屏 */

@media (max-width: 760px) {
  :root { --fs: 18px; }
  .topbar { padding: 0 .7rem; }
  .crumbs > *:not(:last-child) { display: none; }
  .hero { grid-template-columns: 1fr; gap: 1.5rem; }
  .hero-title { justify-content: center; }
  .home { padding-top: 2rem; }
  .shelf-row { --sh: 13rem; --rg: 1.4rem; }
  .spine { width: 2.3rem; }
  .sp-label { max-height: 9.4rem; font-size: .86rem; }
  .volume { grid-template-columns: 1fr; gap: 2rem; padding-top: 2rem; }
  .cover { position: static; width: 11rem; margin: 0 auto; }
  .reader { padding: 1.6rem 1.1rem 3rem; }
  .pager { grid-template-columns: 1fr; }
  html[data-mode="v"] .page-read .reader { padding: 1.4rem 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
