/* Generated readers share resilient sizing, recovery and an ordinary-photo fallback. */
html { --available-height: calc(100vh - 160px); }
.room { height: 100vh; height: 100dvh; }
.book-rig { --available-height: inherit; height: min(var(--available-height), 640px); width: min(100%, calc(var(--available-height) * var(--page-ratio) * 2), 1280px); }
.book:not(.is-ready) { width: min(100%, calc(var(--available-height) * var(--page-ratio)), 512px); aspect-ratio: var(--page-ratio); }
.book:not(.is-ready) .book-page { display: none; }
.book:not(.is-ready) .book-page:first-child { display: block; width: 100%; height: 100%; }
.reader-options { flex-wrap: wrap; row-gap: 0; }
.reader-options a { display: inline-flex; align-items: center; min-height: 44px; padding: 4px 8px; color: inherit; text-underline-offset: 4px; }
.photo-unavailable img { opacity: .22; }
.photo-retry { position: absolute; inset: 45% auto auto 50%; transform: translate(-50%, -50%); z-index: 20; width: max-content; max-width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid currentColor; background: var(--paper, #f7f6f0); color: var(--ink, #253947); font: 500 12px/1.5 var(--book-sans, sans-serif); cursor: pointer; }
html[data-reader-mode="gallery"] .stage { display: block; overflow: auto; overscroll-behavior: contain; padding: 0 0 16px; }
html[data-reader-mode="gallery"] .controls { display: block; }
.in-reader-gallery { max-width: 860px; margin: 0 auto; }
.in-reader-gallery figure { position: relative; margin: 24px 0 56px; }
.in-reader-gallery img { display: block; width: 100%; height: auto; max-height: 78vh; object-fit: contain; }
.in-reader-gallery figcaption, .gallery-note { text-align: center; font: 400 13px/1.6 var(--book-sans, sans-serif); }
.plain-gallery { margin: 0; background: #090a09; color: #eeeae1; font: 400 16px/1.6 "PingFang SC", system-ui, sans-serif; }
.plain-gallery header, .plain-gallery main { width: min(100% - 40px, 900px); margin: 0 auto; }
.plain-gallery header { padding: 24px 0 8px; }
.plain-gallery h1 { font-size: clamp(20px, 4vw, 28px); font-weight: 500; }
.plain-gallery a { color: inherit; display: inline-flex; align-items: center; min-height: 44px; text-underline-offset: 5px; }
.plain-gallery figure { margin: 32px 0 56px; }
.plain-gallery img { display: block; width: 100%; height: auto; max-height: 85vh; object-fit: contain; }
.plain-gallery figcaption { margin-top: 12px; text-align: center; font-size: 14px; }
@media (max-width: 700px) { .book-rig { width: min(100%, calc(var(--available-height) * var(--page-ratio)), 640px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0s !important; animation-duration: 0s !important; } }

.plain-gallery figure > a { display: block; }
.controls [hidden], .reader-options [hidden] { display: none; }
.in-reader-gallery { color: #eeeee7; }
.gallery-note { color: #a3a69f; }
noscript p { position: fixed; inset: 12px 12px auto auto; z-index: 100; margin: 0; }
noscript a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; background: #eeeee7; color: #090a09; font: 500 14px/1.5 sans-serif; text-underline-offset: 4px; }
