.book-view-page { overflow: hidden; }
.book-view {
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  grid-template-columns: minmax(175px, .65fr) minmax(430px, 2.65fr) minmax(205px, .82fr);
  gap: clamp(15px, 2vw, 32px);
  align-items: center;
  padding: 74px 22px 52px;
}

.book-context { align-self: start; padding-top: 17px; }
.book-context > p:first-child { margin: 0; font-size: 7px; line-height: 1.35; letter-spacing: .09em; text-transform: uppercase; }
.book-context h1 { max-width: 205px; margin: 11px 0 0; font-family: var(--font-display); font-size: clamp(27px, 2.4vw, 38px); font-weight: 400; line-height: .86; letter-spacing: -.05em; }
.book-context__subtitle { margin: 9px 0 0; color: var(--muted); font-size: 8px; letter-spacing: .08em; text-transform: uppercase; }
.book-context__zh { max-width: 190px; margin: 21px 0 0; font-size: 11px; line-height: 1.6; }
.book-context dl { margin: 34px 0 0; border-top: 1px solid var(--ink); }
.book-context dl div { display: grid; grid-template-columns: 44px 1fr; gap: 7px; padding: 6px 0; border-bottom: 1px solid var(--faint); font-size: 6px; letter-spacing: .08em; }
.book-context dt { color: var(--muted); }
.book-context dd { margin: 0; text-align: right; }

.book-stage { position: relative; width: 100%; max-width: 980px; justify-self: center; perspective: 1900px; }
.book-scene {
  --book-scale: 1;
  --book-tilt: 0deg;
  position: relative;
  width: 100%;
  aspect-ratio: 1985 / 1404;
  outline: none;
  perspective: 1900px;
  cursor: grab;
  touch-action: none;
  transform: scale(var(--book-scale)) rotateZ(var(--book-tilt));
  transform-origin: center;
  transition: transform 580ms cubic-bezier(.16, 1, .3, 1);
  will-change: transform;
}
.book-scene:focus-visible { outline: 1px solid var(--accent); outline-offset: 9px; }
.book-scene.is-dragging { cursor: grabbing; transition: none; }
.book-scene.is-turning { cursor: progress; }
.book-bed { position: absolute; inset: 8px -7px -9px 7px; border: 1px solid rgba(23, 23, 22, .28); background: #d8d5ce; box-shadow: 8px 11px 0 rgba(23, 23, 22, .07); }
.book-bed::before,
.book-bed::after { content: ""; position: absolute; inset: -5px 3px 4px -3px; border: 1px solid rgba(23, 23, 22, .18); background: #e8e5de; }
.book-bed::after { inset: -9px 7px 8px -6px; z-index: -1; }
.book-bed i { position: absolute; display: block; border: 1px solid rgba(23,23,22,.2); background: #dedad1; }
.book-bed i:nth-child(1) { top: 8%; right: -8px; bottom: 7%; width: 7px; border-left: 0; }
.book-bed i:nth-child(2) { right: 6%; bottom: -8px; left: 7%; height: 7px; border-top: 0; }
.book-bed i:nth-child(3) { top: 7%; bottom: 8%; left: -5px; width: 5px; border-right: 0; background: #cfcbc2; }

.book-current,
.book-turning-sheet { position: absolute; inset: 0; margin: 0; transform-style: preserve-3d; backface-visibility: hidden; }
.book-current { z-index: 4; transform: none; transition: opacity 130ms ease; transform-origin: left center; }
.book-current.is-under-turn { opacity: .88; }
.book-scene.is-dragging .book-current { transition: none; }
.book-current img,
.book-turning-sheet img { display: block; width: 100%; height: 100%; border: 1px solid var(--ink); background: white; object-fit: contain; box-shadow: 0 15px 38px rgba(23, 23, 22, .12); user-select: none; }
.book-current figcaption,
.book-turning-sheet figcaption { position: absolute; right: 0; bottom: -18px; left: 0; display: flex; justify-content: space-between; font-size: 6px; letter-spacing: .09em; text-transform: uppercase; }
.book-turning-sheet { z-index: 18; backface-visibility: visible; pointer-events: none; transform-origin: left center; will-change: transform; contain: layout paint; }
.book-turning-sheet[data-direction="backward"] { transform-origin: right center; }
.book-turning-face { position: absolute; inset: 0; margin: 0; overflow: hidden; backface-visibility: hidden; transform-style: preserve-3d; }
.book-turning-face--back { transform: rotateY(180deg); }
.book-turning-sheet__fold { position: absolute; inset: 0; z-index: 4; background: rgba(23,23,22,.14); opacity: 0; backface-visibility: hidden; pointer-events: none; will-change: opacity; }
.book-turning-sheet__edge { position: absolute; top: 0; right: -1px; bottom: 0; z-index: 8; width: 2px; background: rgba(255,255,255,.85); box-shadow: -5px 0 18px rgba(23,23,22,.2); pointer-events: none; }
.book-scene.is-turning .book-current figcaption { opacity: .12; }
.book-spine { position: absolute; top: 0; bottom: 0; left: 50%; z-index: 8; width: 1px; background: rgba(23, 23, 22, .35); box-shadow: -3px 0 7px rgba(23, 23, 22, .13), 3px 0 7px rgba(23, 23, 22, .13); pointer-events: none; }
.book-edge-light { position: absolute; top: 0; right: 0; bottom: 0; z-index: 23; width: 1px; background: rgba(255,255,255,.72); box-shadow: -8px 0 20px rgba(255,255,255,.16); opacity: .7; pointer-events: none; }
.book-motion-line { position: absolute; right: 0; bottom: -31px; left: 0; z-index: 9; height: 1px; background: var(--accent); transform: scaleX(0); transform-origin: left; }
.book-motion-line.is-active { animation: book-line 720ms cubic-bezier(.22, 1, .36, 1) both; }
.book-click-wave { position: absolute; z-index: 30; width: 26px; height: 26px; margin: -13px 0 0 -13px; border: 1px solid var(--accent); border-radius: 50%; pointer-events: none; }

.book-step { position: absolute; top: 50%; z-index: 12; width: 31px; height: 31px; padding: 0; border: 1px solid var(--ink); border-radius: 50%; background: var(--paper); font-size: 12px; cursor: pointer; transform: translateY(-50%); transition: color 180ms ease, background 180ms ease, transform 320ms cubic-bezier(.22, 1, .36, 1); }
.book-step--previous { left: -48px; }
.book-step--next { right: -48px; }
.book-step:hover { color: var(--paper); background: var(--ink); transform: translateY(-50%) scale(1.08); }
.book-step:disabled { opacity: .2; cursor: default; }
.book-step:disabled:hover { color: var(--ink); background: var(--paper); transform: translateY(-50%); }
.book-instructions { position: absolute; right: 0; bottom: -49px; left: 0; margin: 0; color: var(--muted); font-size: 6px; letter-spacing: .09em; text-align: center; text-transform: uppercase; }

.book-readout { align-self: end; padding: 9px 0 18px 12px; border-top: 1px solid var(--ink); border-left: 1px solid var(--ink); transition: opacity 180ms ease, transform 360ms cubic-bezier(.22, 1, .36, 1); }
.book-readout.is-updating { opacity: .12; transform: translateY(8px); }
.book-readout__counter { display: block; color: var(--accent); font-size: 8px; letter-spacing: .11em; }
.book-readout h2 { margin: 9px 0 0; font-family: var(--font-display); font-size: clamp(21px, 2.4vw, 38px); font-weight: 400; line-height: .88; letter-spacing: -.05em; text-transform: uppercase; }
.book-readout p { margin: 9px 0 0; font-size: 8px; line-height: 1.45; }
.book-readout__zh { font-size: 10px !important; line-height: 1.55 !important; }
.book-readout > p:not(.book-readout__zh) { color: var(--muted); }
.book-readout dl { margin: 17px 0 0; border-top: 1px solid var(--faint); }
.book-readout dl div { display: grid; grid-template-columns: 1fr auto; padding: 6px 0; border-bottom: 1px solid var(--faint); font-size: 6px; letter-spacing: .08em; }
.book-readout dt { color: var(--muted); }
.book-readout dd { margin: 0; }
.book-readout > a { display: flex; justify-content: space-between; margin-top: 15px; padding: 8px 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); font-size: 7px; letter-spacing: .08em; text-transform: uppercase; }
.book-readout > a:hover { color: var(--accent); }

.page-rail { position: fixed; right: 0; bottom: 30px; left: 0; z-index: 35; display: grid; height: 68px; grid-template-columns: repeat(11, minmax(0, 1fr)); border-top: 1px solid var(--line); background: rgba(243, 241, 236, .97); }
.page-rail button { position: relative; display: grid; grid-template-columns: 22px 1fr; gap: 5px; align-items: center; min-width: 0; padding: 7px 5px; border: 0; border-right: 1px solid var(--faint); background: transparent; text-align: left; cursor: pointer; }
.page-rail button::after { content: ""; position: absolute; right: 0; bottom: 0; left: 0; height: 2px; background: var(--accent); transform: scaleX(0); transition: transform 380ms cubic-bezier(.22, 1, .36, 1); }
.page-rail button.is-active::after { transform: scaleX(1); }
.page-rail img { display: block; width: 22px; height: 37px; border: 1px solid rgba(23, 23, 22, .35); object-fit: cover; filter: grayscale(1); opacity: .45; transition: filter 180ms ease, opacity 180ms ease; }
.page-rail button:hover img,
.page-rail button.is-active img { filter: grayscale(0); opacity: 1; }
.page-rail span { overflow: hidden; font-size: 6px; letter-spacing: .06em; text-overflow: ellipsis; white-space: nowrap; }
.page-rail strong { display: block; margin-top: 3px; font-size: 7px; font-weight: 400; }

@keyframes book-line {
  0% { transform: scaleX(0); transform-origin: left; }
  48% { transform: scaleX(1); transform-origin: left; }
  52% { transform: scaleX(1); transform-origin: right; }
  100% { transform: scaleX(0); transform-origin: right; }
}

@media (max-width: 1050px) {
  .book-view { grid-template-columns: minmax(150px, .55fr) minmax(420px, 2.3fr); }
  .book-readout { position: absolute; right: 22px; bottom: 48px; z-index: 15; width: 220px; padding: 9px 9px 10px; background: rgba(243, 241, 236, .94); }
  .book-readout__zh,
  .book-readout > p:not(.book-readout__zh) { display: none; }
  .book-readout h2 { font-size: 21px; }
}

@media (max-width: 760px) {
  .book-view { display: block; padding: 77px 14px 52px; }
  .book-context { display: grid; grid-template-columns: 1fr auto; align-items: end; padding: 0 0 18px; }
  .book-context > p:first-child,
  .book-context__subtitle,
  .book-context__zh,
  .book-context dl { display: none; }
  .book-context h1 { margin: 0; font-size: 34px; }
  .book-stage { width: calc(100% - 44px); margin: 5vh auto 0; }
  .book-step--previous { left: -38px; }
  .book-step--next { right: -38px; }
  .book-readout { position: relative; right: auto; bottom: auto; width: auto; margin-top: 65px; padding: 8px 0 0; border-left: 0; background: transparent; }
  .book-readout dl,
  .book-readout > a { display: none; }
  .book-readout h2 { font-size: 22px; }
  .page-rail { overflow-x: auto; grid-template-columns: repeat(11, 74px); }
  .page-rail img { display: none; }
  .page-rail button { display: block; padding: 9px; }
}

@media (max-width: 480px) {
  .book-stage { width: calc(100% - 30px); margin-top: 8vh; }
  .book-step { top: calc(100% + 34px); }
  .book-step--previous { left: 0; }
  .book-step--next { right: 0; }
  .book-instructions { bottom: -43px; }
  .book-readout { margin-top: 72px; }
}

/* A spread is two pages: turn only the page beside the spine, never the whole board. */
.book-scene {
  --pointer-light-x: 50%;
  --pointer-light-y: 50%;
  isolation: isolate;
  perspective: 5200px;
}
.book-scene::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  z-index: 26;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  filter: blur(31px);
  mix-blend-mode: screen;
  opacity: 0;
  pointer-events: none;
  transform: translate3d(calc(var(--pointer-light-x) - 85px), calc(var(--pointer-light-y) - 85px), 28px);
  transition: opacity 420ms cubic-bezier(.16,1,.3,1);
  will-change: transform, opacity;
}
.book-scene.has-pointer-light::before { opacity: .72; }

.book-turning-sheet {
  --fold-strength: 0;
  top: 0;
  bottom: 0;
  width: 50%;
  height: 100%;
  transform-style: preserve-3d;
  backface-visibility: visible;
  will-change: transform, filter;
}
.book-turning-sheet[data-direction="forward"] { right: 0; left: 50%; transform-origin: left center; }
.book-turning-sheet[data-direction="backward"] { right: 50%; left: 0; transform-origin: right center; }
.book-turning-face { inset: 0; border: 0; }
.book-turning-face img {
  position: absolute;
  top: 0;
  width: 200%;
  max-width: none;
  height: 100%;
  border: 1px solid var(--ink);
  object-fit: fill;
  box-shadow: none;
}
.book-turning-face[data-half="left"] img { left: 0; }
.book-turning-face[data-half="right"] img { left: -100%; }
.book-turning-face figcaption { display: none; }
.book-turning-sheet__fold {
  background: rgba(23,23,22,.14);
  box-shadow: inset 22px 0 38px rgb(23 23 22 / calc(var(--fold-strength) * .28));
}
.book-turning-sheet[data-direction="backward"] .book-turning-sheet__fold {
  background: rgba(23,23,22,.14);
  box-shadow: inset -22px 0 38px rgb(23 23 22 / calc(var(--fold-strength) * .28));
}
.book-turning-sheet[data-direction="forward"] .book-turning-sheet__edge { right: -1px; left: auto; }
.book-turning-sheet[data-direction="backward"] .book-turning-sheet__edge { right: auto; left: -1px; box-shadow: 5px 0 18px rgba(23,23,22,.2); }
.book-turning-sheet__edge { opacity: calc(.35 + var(--fold-strength) * .65); filter: blur(calc(var(--fold-speed) * .45px)); }
.book-current.is-under-turn { opacity: .95; filter: brightness(.93) saturate(.97); }
.book-scene.is-turning .book-bed { box-shadow: 10px 15px 0 rgba(23,23,22,.06), 0 30px 58px rgba(23,23,22,.14); }

@media (prefers-reduced-motion: reduce) {
  .book-scene { transition: none; }
  .book-scene::before { display: none; }
}

/* Dark presentation skin; geometry and page-turn motion remain unchanged. */
html { background: #050505 !important; }
body.book-view-page {
  --paper: #050505;
  --ink: #f2f0e9;
  --muted: rgba(242,240,233,.5);
  --faint: rgba(242,240,233,.14);
  --line: rgba(242,240,233,.22);
  background: #050505 !important;
  color: var(--ink);
}
.book-view-page .chapter-header {
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.book-view-page .chapter-one-archive-mode,
.book-view-page .reader-footer { color: var(--muted); }
.book-view-page .chapter-one-archive-mode { background: transparent; }
.book-view-page .reader-footer {
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.book-view-page .book-bed { border-color: rgba(255,255,255,.2); background: #101010; box-shadow: 8px 11px 0 rgba(255,255,255,.025); }
.book-view-page .book-bed::before,
.book-view-page .book-bed::after { border-color: rgba(255,255,255,.13); background: #181818; }
.book-view-page .book-bed i { border-color: rgba(255,255,255,.13); background: #111; }
.book-view-page .book-current img,
.book-view-page .book-turning-face img { border-color: rgba(255,255,255,.42); box-shadow: 0 18px 48px rgba(0,0,0,.68); }
.book-view-page .book-step { display: none; }
.book-view-page .book-scene { cursor: grab; }
.book-view-page .book-scene.is-dragging { cursor: grabbing; }
.book-view-page .page-rail { display: none !important; }
.book-view-page .page-rail {
  border-color: var(--line);
  background: rgba(5,5,5,.97);
}
.book-view-page .page-rail button { color: var(--ink); pointer-events: none; cursor: default; }
.book-view-page .book-readout { border-color: var(--ink); }

@media (max-width: 1050px) {
  .book-view-page .book-readout { background: rgba(5,5,5,.94); }
}
