.book-page { max-width: 960px; margin-inline: auto; }
.book-page .book-back { margin-bottom: 12px; }
.book-detail {
  display: grid;
  grid-template-columns: clamp(160px, 17vw, 224px) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  align-items: start;
  align-content: start;
  gap: 16px clamp(24px, 4vw, 40px);
}
.book-detail-cover {
  grid-row: span 2;
  width: 100%;
  box-shadow: none;
}
.book-detail-cover::after { display: none; }
.book-identity, .book-controls { min-width: 0; }
.book-identity h1 {
  max-width: 23ch;
  font: var(--weight-heading) clamp(1.75rem, 3.25vw, 2.75rem)/1.13 var(--sans);
  letter-spacing: -.035em;
  overflow-wrap: anywhere;
}
.book-author {
  margin-block: 6px 12px;
  color: var(--muted);
  font-size: 1rem;
  font-weight: var(--weight-label);
  overflow-wrap: anywhere;
}
.book-author a, .book-facts a {
  display: inline-flex;
  align-items: center;
  min-width: 24px;
  min-height: 28px;
  overflow-wrap: anywhere;
}
.book-author a:hover, .book-facts a:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }
.book-identifiers { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; }
.book-facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  color: var(--muted);
  font-size: .875rem;
}
.book-facts .badge { font-weight: var(--weight-label); }
.book-cycle { margin-top: 8px; font-size: .85rem; overflow-wrap: anywhere; }
.book-page .book-save { flex: none; width: 44px; min-height: 44px; color: var(--muted); }
.book-page .book-save:hover, .book-page .book-save.is-saved { color: var(--accent-ink); }
.book-controls { display: grid; align-content: start; justify-items: start; gap: 10px; }
.book-progress { display: grid; width: min(100%, 400px); gap: 8px; }
.book-progress-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: .875rem;
}
.book-progress-label > span { overflow-wrap: anywhere; }
.book-progress-label strong { flex: none; color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.book-progress .meter { height: 4px; }
.book-release {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--muted);
  font-size: .875rem;
}
.book-release svg { align-self: center; }
.book-release time { color: var(--ink); font-weight: var(--weight-label); }
.book-action-dock { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; }
.book-action-dock .button { min-height: 50px; font-size: .925rem; }
.book-action-dock .book-primary { min-width: 172px; }
.book-purchase { flex-wrap: wrap; align-content: center; gap: 2px 5px; }
.book-purchase.secondary { color: var(--ink); }
.book-purchase.secondary:hover { color: var(--accent-ink); }
.book-action-price { font-weight: var(--weight-strong); white-space: nowrap; }
.book-action-price .book-old-price { margin-inline-start: 2px; }
.book-action-dock .button:focus-visible { outline-offset: -3px; }
.book-action-dock .book-primary:focus-visible { outline-color: var(--on-accent); }
.book-access-note { color: var(--muted); font-size: .875rem; }

.book-section-links {
  position: sticky;
  inset-block-start: var(--safe-top);
  z-index: 3;
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-top: 28px;
  border-block: 1px solid var(--line);
  background: var(--canvas);
}
.book-section-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 48px;
  padding-inline: 12px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: .9rem;
  font-weight: var(--weight-label);
}
.book-section-links a:hover, .book-section-links a[aria-current='location'] { color: var(--accent-ink); }
.book-section-links a[aria-current='location'] { border-bottom-color: var(--focus); }
.book-section-links a:focus-visible { outline-offset: -3px; }
.book-metrics { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin-top: 8px; font-size: .875rem; }
.book-metrics .is-empty, .book-metrics:not(:has(> :not(.is-empty))) { display: none; }
.book-section { max-width: 820px; margin-top: 28px; }
.book-page :is(.book-section, .review-section)[id] { scroll-margin-block-start: calc(64px + var(--safe-top)); }
.book-synopsis { max-width: 60ch; color: var(--ink); line-height: 1.65; white-space: pre-line; overflow-wrap: anywhere; }
.book-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.book-tags .chip { min-height: 44px; overflow-wrap: anywhere; }
.book-empty-chapters { color: var(--muted); }
.book-page .chapter-list { gap: 0; border-top: 1px solid var(--line); }
.book-page .chapter-list :is(a, button) {
  min-height: 52px;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}
.book-page .chapter-list :is(a, button):focus-visible { outline-offset: -2px; }
.book-page .review-section .section-head .button { min-height: 44px; padding: 8px 12px; font-size: .875rem; }
.book-page .review-card, .book-page .review-empty { border-radius: var(--radius-panel); }
.review-retry { display: flex; align-items: center; flex-wrap: wrap; gap: 0 12px; }
.review-retry .text-link { min-height: 44px; }

@media (max-width: 800px), (max-width: 960px) and (max-height: 500px) and (pointer: coarse) {
  .book-detail { grid-template-columns: clamp(88px, 27vw, 144px) minmax(0, 1fr); grid-template-rows: auto auto; gap: 12px 14px; }
  .book-detail-cover { grid-row: 1; }
  .book-identity h1 { font-size: clamp(1.35rem, 6vw, 2rem); }
  .book-author { margin-block: 4px 8px; font-size: .9rem; }
  .book-facts { font-size: .81rem; }
  .book-controls { grid-column: 1 / -1; }
  .book-metrics { gap: 4px 8px; font-size: .81rem; }
  .book-action-dock { display: grid; width: 100%; grid-template-columns: minmax(0, 1fr); }
  .book-action-dock.book-action-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .book-action-dock .button { min-width: 0; min-height: 50px; padding: 6px 8px; font-size: .875rem; }
  .book-action-pair .book-primary svg { display: none; }
  .book-section-links { margin-top: 16px; gap: 0; }
  .book-section-links a { flex: 1 1 auto; gap: 5px; padding-inline: 4px; font-size: .825rem; }
  .book-section { margin-top: 24px; }
  .book-page .review-section .section-head { flex-wrap: wrap; gap: 8px 12px; }
}

@media (max-width: 800px) and (min-height: 520px) {
  .reader-layout:has(.book-action-dock) {
    --book-dock-height: 72px;
    padding-bottom: calc(var(--mobile-nav-space) + var(--book-dock-height));
  }
  .book-action-dock {
    position: fixed;
    z-index: 4;
    inset: auto 0 var(--mobile-nav-space);
    min-height: var(--book-dock-height);
    padding: 8px max(var(--gutter), var(--safe-right)) 8px max(var(--gutter), var(--safe-left));
    border-top: 1px solid var(--line);
    background: var(--surface);
  }
  .book-action-dock .button { line-height: 1.18; }
  body:has(.book-action-dock) #toast { bottom: calc(var(--mobile-nav-space) + 80px); }
}
