/* Reader dimensions belong to the platform viewport, including the WeCom dock. */
.bookshelf-page { max-width: 1400px; min-width: 0; }
.bookshelf-page .compact-header { margin-bottom: 18px; }
.bookshelf-page .compact-header h1 { font-size: 30px; }
.ebook-page { width: 100%; max-width: 1440px; min-width: 0; padding: 20px 28px 24px; }
.ebook-page-header { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; }
.ebook-page-header > .back-button { grid-column: 1 / -1; justify-self: start; margin-bottom: 0; }
.ebook-page-header h1 { margin: 3px 0; font-size: 21px; overflow-wrap: anywhere; }
.ebook-page .detail-kicker { font-size: 11px; }
.ebook-header-actions { flex-wrap: wrap; gap: 8px; min-width: 0; }
.ebook-reader-tools { min-width: 0; flex-wrap: wrap; }
.ebook-layout-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 12px 0; min-width: 0; }
.ebook-layout-choices, .ebook-font-tools { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; }
.ebook-layout-toolbar button { min-height: 32px; padding: 5px 12px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); cursor: pointer; font: inherit; font-size: 13px; }
.ebook-layout-toolbar button[aria-pressed="true"] { color: var(--white); background: var(--green-deep); }
.ebook-layout-toolbar button:disabled { opacity: .45; cursor: default; }
.ebook-layout-toolbar button:focus-visible { outline: 2px solid var(--green-deep); outline-offset: 2px; }
.ebook-layout-hint { font-size: 11px; color: var(--muted); }
.ebook-font-tools { margin-left: auto; }
.ebook-progress-track { margin-top: 0; }
.ebook-workspace { width: 100%; min-width: 0; min-height: 0; padding-top: 10px; }
.ebook-stage { min-width: 0; min-height: 0; border-radius: 10px; }
.epub-view { width: 100%; min-width: 0; height: calc(100vh - 220px); min-height: 120px; overflow: hidden; }
.epub-view > foliate-view { display: block; width: 100%; height: 100%; min-width: 0; }
.ebook-stage:has(foliate-view) .ebook-page-turn { width: 28px; height: 48px; font-size: 28px; box-shadow: none; }
@media (max-width: 1100px) {
  .ebook-page-header { grid-template-columns: minmax(0, 1fr); }
  .ebook-header-actions { justify-content: flex-start; }
}
@media (max-width: 1000px) {
  .ebook-panel { position: fixed; left: 50%; width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 190px); transform: translateX(-50%); }
  .ebook-panel-scrim { position: fixed; inset: 0; }
  .ebook-page { width: 100%; padding: 16px 16px calc(90px + env(safe-area-inset-bottom)); }
}
@media (max-width: 720px) {
  .ebook-panel { left: 12px; right: 12px; width: auto; transform: none; }
}
@media (max-width: 600px) {
  .bookshelf-page { padding: 28px 16px calc(100px + env(safe-area-inset-bottom)); }
  .bookshelf-page .compact-header h1 { font-size: 25px; }
  .ebook-page { width: auto; padding: 12px 10px calc(90px + env(safe-area-inset-bottom)); }
  .ebook-page-header { gap: 6px; }
  .ebook-page-header h1 { font-size: 17px; }
  .ebook-header-actions { gap: 6px; }
  .ebook-page .detail-kicker { display: none; }
  .ebook-layout-toolbar { gap: 5px; margin: 8px 0; }
  .ebook-layout-toolbar button { padding: 5px 9px; min-height: 34px; }
  .ebook-layout-hint { order: 3; width: 100%; }
  .ebook-workspace { padding-top: 5px; }
  .ebook-stage:has(foliate-view) .ebook-page-turn { width: 23px; opacity: .66; }
}
@media (prefers-reduced-motion: reduce) { .ebook-page * { scroll-behavior: auto; } }

@media (min-width: 600px) and (max-height: 500px) {
  .ebook-page { padding-top: 8px; }
  .ebook-page-header { grid-template-columns: auto minmax(0, 1fr) auto; gap: 5px 12px; }
  .ebook-page-header > .back-button { grid-column: auto; }
  .ebook-page-header h1 { font-size: 15px; margin: 0; }
  .ebook-page .detail-kicker, .ebook-header-actions .reader-timer { display: none; }
  .ebook-header-actions { gap: 5px; }
  .ebook-reader-tools { padding: 0; }
  .ebook-tool-button { padding: 6px 8px; }
  .ebook-header-actions .ebook-complete-button { font-size: 11px; padding: 6px; }
  .ebook-layout-toolbar { margin: 7px 0; }
  .ebook-layout-toolbar button { min-height: 28px; }
}
