.book-masthead {
  max-width: 1280px;
  min-height: 74px;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 12px clamp(20px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
}
.book-masthead .logo { font-size: 38px; }
.book-masthead a:not(.logo), .book-download, .book-back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--forest);
  font-size: 14px;
  font-weight: 800;
  text-underline-offset: .2em;
}
.book-reader {
  max-width: 1280px;
  display: grid;
  grid-template-columns: minmax(208px, 244px) minmax(0, 1fr);
  align-items: start;
  gap: clamp(24px, 4vw, 52px);
  padding: clamp(24px, 4vw, 48px);
}
.book-intro {
  position: sticky;
  top: 20px;
  min-width: 0;
  padding-block: 8px;
}
.book-intro .eyebrow { margin-bottom: 9px; font-size: 12px; }
.book-intro h1 {
  margin: 0 0 10px;
  font: 700 clamp(32px, 3.5vw, 47px)/1.04 Georgia, serif;
  letter-spacing: -.045em;
  text-wrap: pretty;
}
.book-meta { margin: 0 0 20px; color: var(--muted); font-size: 14px; }
.book-actions { display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
.book-download {
  align-self: start;
  gap: 9px;
  padding: 0 13px;
  border: 1px solid #c3ceba;
  border-radius: 8px;
  background: var(--paper);
  text-decoration: none;
}
.book-download::before {
  content: "↓" / "";
  font-size: 18px;
  line-height: 1;
}
.book-jump { border-block: 1px solid var(--line); }
.book-jump summary {
  display: flex;
  min-height: 46px;
  padding: 6px 0;
  gap: 8px;
  font-size: 14px;
  color: var(--forest);
}
.book-jump summary::after {
  content: "+" / "";
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
}
.book-jump[open] > summary::after { content: "−" / ""; }
.book-jump nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  max-height: min(310px, 39dvh);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding: 6px 6px 12px;
}
.book-jump nav a {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 2px;
  min-width: 0;
  border: 1px solid #d9dfce;
  border-radius: 5px;
  padding: 4px 4px 1px;
  color: var(--forest);
  background: var(--paper);
  font-size: 12px;
  font-weight: 800;
  line-height: 20px;
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}
.book-jump nav a img {
  display: block;
  width: 100%;
  height: auto;
  background: #f3e5cb;
  border-radius: 2px;
}
.book-jump nav a[aria-current="page"] {
  border-color: var(--forest);
  box-shadow: 0 0 0 1px var(--forest);
  background: var(--forest);
  color: var(--paper);
}
.book-stage {
  min-width: 0;
  border: 1px solid #d9dec8;
  border-radius: 20px;
  padding: clamp(14px, 3vw, 36px);
  padding-bottom: 14px;
  background: radial-gradient(ellipse at 50% 12%, #f4f2e2, #e9edda 78%);
}
.book-pages { display: grid; gap: 32px; max-width: 676px; margin-inline: auto; }
.book-page { min-width: 0; scroll-margin-top: 16px; }
.book-page h2, .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.book-sheet {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 1px 3px 3px 1px;
  background: #faecd3;
  box-shadow: 2px 2px #f6ead6, 3px 3px #c8bb9f, 5px 5px #f6ead6, 6px 6px #cdc4aa, 0 12px 25px #39492c1e;
}
.book-page-links {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}
.book-page-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 7px 12px;
  border: 1px solid #cdd7bf;
  border-radius: 7px;
  color: var(--forest);
  background: var(--paper);
  font-size: 14px;
  font-weight: 800;
}
.book-back { grid-column: 2; justify-self: end; }
.book-controls {
  position: sticky;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: clamp(6px, 2vw, 24px);
  max-width: 508px;
  margin: 24px auto 0;
  padding: 7px;
  border: 1px solid #c7d0ba;
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 5px 20px #364c2c28;
  font-variant-numeric: tabular-nums;
}
.book-controls button {
  min-height: 44px;
  min-width: 0;
  padding: 4px 12px;
  border: 1px solid #ced7c4;
  border-radius: 7px;
  background: #f5f6ea;
  color: var(--forest);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.15;
}
.book-controls button:last-child {
  border-color: var(--forest);
  background: var(--forest);
  color: var(--paper);
}
.book-controls button[aria-disabled="true"] {
  background: #eeeee3;
  border-color: #d9dfcf;
  color: #58665c;
  cursor: default;
}
.book-controls button:not([aria-disabled="true"]):hover { filter: brightness(.93); }
.book-controls button:not([aria-disabled="true"]):active { transform: translateY(1px); }
.book-jump nav a:hover, .book-download:hover { outline: 1px solid var(--forest); }
.book-position {
  display: grid;
  justify-items: stretch;
  gap: 3px;
  min-width: 84px;
  max-width: 100%;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
}
.book-position::after {
  content: "";
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(to right, #71a28b var(--book-progress, 0%), #dee4d6 var(--book-progress, 0%));
}
.book-paginated .book-page { position: relative; perspective: 1600px; }
.book-paginated .book-page[hidden] { display: none; }
.book-paginated .book-sheet { touch-action: pan-y pinch-zoom; }
.book-sheet-pending { visibility: hidden; }
.book-image-status {
  position: absolute;
  inset: 0 0 auto;
  aspect-ratio: 1000 / 1415;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: clamp(54px, 13vw, 152px) 12px 12px;
  border: 1px solid #e3d7bc;
  border-radius: 1px 3px 3px 1px;
  background: #faecd3;
  color: var(--forest);
  font-weight: 800;
  text-align: center;
  touch-action: pan-y pinch-zoom;
}
.book-image-status [hidden], .book-image-status[hidden] { display: none; }
.book-image-status p { margin: 0; }
.book-image-status button {
  min-height: 44px;
  padding-inline: 14px;
  border: 1px solid var(--forest);
  border-radius: 7px;
  background: var(--forest);
  color: var(--paper);
}
.book-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #ccdac5;
  border-top-color: var(--forest);
  border-radius: 50%;
  animation: book-loading .8s linear infinite;
}
@keyframes book-loading {
  to { transform: rotate(1turn); }
}
.book-paginated .book-turn-sheet {
  position: absolute;
  inset: 0 0 auto;
  z-index: 1;
  pointer-events: none;
  transform-origin: left center;
  --book-turn-angle: -94deg;
  animation: book-turn 390ms cubic-bezier(.55,.12,.46,.98) both;
  backface-visibility: hidden;
}
.book-paginated .book-turn-back {
  transform-origin: right center;
  --book-turn-angle: 94deg;
}
@keyframes book-turn {
  from { transform: rotateY(0); filter: brightness(1); }
  to { transform: rotateY(var(--book-turn-angle)); filter: brightness(.58); }
}
@media (max-width: 760px) {
  .book-masthead { min-height: 60px; gap: 10px; padding: 6px 16px; }
  .book-masthead .logo { font-size: 34px; }
  .book-masthead a:not(.logo) { font-size: 13px; text-align: right; }
  .book-reader { display: block; padding: 16px 12px 18px; }
  .book-intro { position: static; padding: 0 4px 13px; }
  .book-intro h1 { margin-bottom: 8px; font-size: clamp(30px, 8vw, 42px); }
  .book-meta { margin-bottom: 10px; }
  .book-actions { flex-direction: row; align-items: start; gap: 8px; }
  .book-jump { flex: 1; min-width: 0; border-block: 0; }
  .book-jump summary {
    min-height: 44px;
    padding: 6px 10px;
    border: 1px solid #c3ceba;
    border-radius: 8px;
    background: var(--paper);
  }
  .book-jump nav { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); max-height: min(236px, 38dvh); }
  .book-stage { padding: 10px 10px 12px; border-radius: 12px; }
  .book-controls { margin-top: 18px; }
  .book-back { display: flex; justify-content: end; padding-inline: 4px; }
}
@media (max-width: 350px) {
  .book-controls { gap: 4px; }
  .book-controls button { padding-inline: 5px; font-size: 12px; }
  .book-position { min-width: 68px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .book-paginated .book-turn-sheet { display: none; }
  .book-spinner { display: none; animation: none; }
}
