:root {
  color-scheme: dark;
  --paper: #f2ede3;
  --sub: #c0b7ac;
  --red: #dc8271;
  --line: #534c45;
  --bg: #191817;
  font-family: "PingFang HK", "Microsoft JhengHei", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--paper); background: var(--bg); }
main {
  max-width: 1330px; margin: auto; display: grid;
  grid-template-columns: minmax(240px,.52fr) minmax(0,1fr);
  gap: clamp(30px,5vw,80px); padding: 38px clamp(22px,4vw,72px) 18px;
}
aside { align-self: start; position: sticky; top: 24px; padding: 32px 0; }
h1, .chapter-name { font-family: "Songti TC","Noto Serif TC","PMingLiU",serif; }
h1 { font-size: clamp(46px,5vw,78px); font-weight: 900; line-height: 1.22; letter-spacing: .035em; margin: 0; }
.rule { width: 42px; height: 3px; background: var(--red); margin: 26px 0 34px; transform: skewX(-20deg); }
.chapters { display: grid; gap: 4px; }
.chapters a { display: grid; gap: 4px; padding: 12px 14px; border-left: 2px solid var(--line); color: var(--sub); text-decoration: none; }
.chapters a:hover { background: #272522; color: var(--paper); }
.chapters a[aria-current] { background: #302926; color: var(--paper); border-color: var(--red); }
.ordinal { font-size: 13px; letter-spacing: .12em; }
[aria-current] .ordinal { color: var(--red); }
.chapter-name { font-weight: 600; line-height: 1.4; font-size: clamp(18px,1.8vw,25px); }
.paging { border-top: 1px solid var(--line); margin-top: 32px; padding-top: 18px; }
[hidden] { display: none !important; }
label { display: block; color: var(--sub); font-size: 13px; margin-bottom: 10px; }
.controls { display: flex; gap: 6px; }
select, button { font: inherit; background: #272522; border: 1px solid var(--line); border-radius: 3px; color: var(--paper); height: 44px; }
select { min-width: 0; flex: 1; padding: 0 6px; }
button { width: 42px; flex: none; cursor: pointer; font-size: 18px; }
button:disabled { opacity: .36; cursor: default; }
button:hover:enabled, select:hover { border-color: var(--red); }
article { min-width: 0; }
figure { margin: 0 0 16px; scroll-margin-top: 14px; }
img { display: block; width: 100%; height: auto; background: #c6c1b8; }
footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding: 22px 0 36px; font-size: 14px; }
a { color: var(--paper); text-underline-offset: .3em; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; background: black; z-index: 5; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
@media (max-width: 760px) {
  main { display: block; padding: 0; }
  aside { display: contents; }
  .identity { padding: 22px 16px 14px; }
  h1 { font-size: 38px; }
  .rule { width: 30px; margin: 8px 0 0; }
  .chapters { position: sticky; top: 0; z-index: 2; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0; background: var(--bg); }
  .chapters a { display: flex; flex-direction: column; justify-content: center; padding: 5px 9px; border-left: 0; border-bottom: 2px solid var(--line); gap: 1px; }
  .ordinal { font-size: 12px; }
  .chapter-name { font-size: 14px; line-height: 1.3; }
  .paging { position: fixed; bottom: 0; left: 0; right: 0; background: var(--bg); z-index: 3; display: flex; align-items: center; gap: 10px; margin: 0; padding: 7px max(12px,env(safe-area-inset-right)) max(7px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left)); }
  label { white-space: nowrap; margin: 0; }
  .controls { flex: 1; min-width: 0; }
  figure { scroll-margin-top: 54px; margin-bottom: 10px; }
  footer { margin-bottom: calc(64px + env(safe-area-inset-bottom)); padding-inline: 12px; }
}
@media print {
  aside, footer, .skip { display: none; }
  main, article { display: block; padding: 0; }
  figure { margin: 0; break-after: page; }
}

.identity h1 small { display: block; margin-top: .5rem; font-size: .4em; letter-spacing: .15em; }
