.books-library {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 16px 24px;
  text-align: center;
}

.book-reader {
  margin: 24px 0;
  padding: 12px;
  color: #fffdf7;
  background: #18261b;
  border: 2px solid #73865a;
  border-radius: 8px;
}

.book-reader-heading,
.book-reader-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

body.dr-zone-page .book-reader h2 {
  margin: 0;
  color: #fffdf7;
}

.book-reader-heading { justify-content: center; text-align: center; }

.book-reader button,
.book-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 5px 14px;
  border: 1px solid #bdcaa4;
  border-radius: 999px;
  color: #fffdf7;
  background: #30392b;
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.book-reader button:hover:not(:disabled),
.book-actions a:hover { background: #3d4a36; }

.book-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 10px 0 0;
}
.book-actions .book-order { color: #18261b; background: #dfc89d; border-color: #dfc89d; font-weight: 700; }

.book-reader button:disabled { opacity: .45; cursor: default; }
.book-reader button:focus-visible,
.book-reader-pages:focus-visible { outline: 3px solid #dfc89d; outline-offset: 2px; }
.book-reader-hint { margin: 8px 0 12px; font-size: 12px; }

.book-reader-pages {
  display: flex;
  width: 100%;
  height: min(70vh, 820px);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  background: #101710;
}

.book-reader-page {
  position: relative;
  display: flex;
  flex: 0 0 100%;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 100%;
  margin: 0;
  scroll-snap-align: center;
}

.book-reader-page img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.book-reader-controls { padding-top: 10px; font-size: 12px; }
.book-reader-status { margin: 8px 0 0; font-size: 12px; }
.book-reader-status:empty { display: none; }

.book-reader-transcript {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.book-reader.is-expanded,
.book-reader:fullscreen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  height: 100dvh;
  margin: 0;
  padding: 8px;
  padding-top: max(8px, env(safe-area-inset-top));
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  border: 0;
  border-radius: 0;
}

.book-reader.is-expanded .book-reader-pages,
.book-reader:fullscreen .book-reader-pages {
  flex: 1;
  min-height: 0;
  height: auto;
}

.book-reader.is-expanded .book-reader-hint,
.book-reader:fullscreen .book-reader-hint { display: none; }

body.book-reader-expanded { overflow: hidden; }

@media (max-width: 480px) {
  .books-library { padding-right: 8px; padding-left: 8px; }
  .book-reader { padding: 8px; }
  .book-reader-heading { gap: 8px; }
  .book-reader-heading h2 { font-size: 22px; }
  .book-reader-controls { gap: 6px; font-size: 11px; }
  .book-reader button, .book-actions a { padding: 5px 12px; font-size: 12.5px; }
}

.book-reader { scroll-margin-top: 84px; }

/* Full page: only the page itself, a small close mark and page arrows. */
.book-reader.is-expanded,
.book-reader:fullscreen { padding: 0; background: #000; }
.book-reader.is-expanded .book-reader-heading,
.book-reader.is-expanded .book-reader-hint,
.book-reader.is-expanded .book-copy-link,
.book-reader.is-expanded .book-print,
.book-reader.is-expanded .book-order,
.book-reader.is-expanded .book-page-count,
.book-reader.is-expanded .book-reader-status:empty { display: none; }
.book-reader.is-expanded .book-reader-pages {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #000;
}
.book-reader.is-expanded .book-actions {
  position: absolute;
  z-index: 3;
  top: max(8px, env(safe-area-inset-top));
  right: max(8px, env(safe-area-inset-right));
  margin: 0;
}
.book-reader.is-expanded .book-full-size,
.book-reader.is-expanded .book-previous,
.book-reader.is-expanded .book-next {
  width: 36px;
  min-height: 36px;
  height: 36px;
  padding: 0;
  border-color: rgba(255, 255, 255, .55);
  background: rgba(0, 0, 0, .5);
  font-size: 16px;
}
.book-reader.is-expanded .book-reader-controls {
  position: absolute;
  z-index: 2;
  inset: 0;
  padding: 0;
  pointer-events: none;
}
.book-reader.is-expanded .book-previous,
.book-reader.is-expanded .book-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0;
  pointer-events: auto;
}
.book-reader.is-expanded .book-previous { left: max(6px, env(safe-area-inset-left)); }
.book-reader.is-expanded .book-next { right: max(6px, env(safe-area-inset-right)); }
.book-reader.is-expanded .book-previous::before { content: '\2039'; font-size: 22px; }
.book-reader.is-expanded .book-next::before { content: '\203A'; font-size: 22px; }
.book-reader.is-expanded .book-previous:disabled,
.book-reader.is-expanded .book-next:disabled { visibility: hidden; }

.proof-entry { display: inline-block; width: 6px; height: 6px; margin-left: 14px; border-radius: 50%; background: currentColor; opacity: .18; vertical-align: middle; }

.book-fund-box { max-width: 520px; margin: 28px auto; padding: 16px 18px; color: #fffdf7; background: #18261b; border: 2px solid #c9a676; border-radius: 8px; }
body.dr-zone-page .book-fund-box h2, .book-fund-box h2 { margin: 0 0 6px; font-size: 20px; color: #fffdf7; }
.book-fund-box p { margin: 0 0 12px; font-size: 14px; line-height: 1.45; }
.book-fund-button { display: inline-block; min-height: 44px; padding: 11px 18px; border-radius: 4px; color: #18261b; background: #dfc89d; font-weight: 700; text-decoration: none; }
.book-fund-button:hover, .book-fund-button:focus-visible { background: #f0dcb4; }
