/* In the reader, the book leads; navigation floats in the surrounding margin. */
body[data-view="reader"]{--reader-top:calc(56px + env(safe-area-inset-top));--reader-bottom:calc(96px + env(safe-area-inset-bottom));overflow:hidden}
body[data-view="reader"] header{position:fixed;inset:0 0 auto;height:var(--reader-top);padding:env(safe-area-inset-top) max(16px,env(safe-area-inset-right)) 0 max(16px,env(safe-area-inset-left));gap:8px;pointer-events:none}
body[data-view="reader"] header .brand,body[data-view="reader"] footer{display:none}
body[data-view="reader"] header button{pointer-events:auto;flex-shrink:0;min-width:44px;min-height:44px;background:#173b32bf;color:#fff0cc;border:0;backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px)}
body[data-view="reader"] header .library-back{margin:0 auto 0 0;border-radius:24px;padding:8px 14px}
body[data-view="reader"] header .sound{position:static;width:44px;height:44px}
body[data-view="reader"] #reader{position:fixed;inset:0;height:100dvh;min-height:0;display:block;padding:var(--reader-top) max(12px,env(safe-area-inset-right)) var(--reader-bottom) max(12px,env(safe-area-inset-left))}
body[data-view="reader"] .reading-room{height:100%;width:min(100%,calc((100dvh - var(--reader-top) - var(--reader-bottom))*1.5));max-width:1400px;min-height:0;padding:0;margin:auto}
body[data-view="reader"] .book{height:100%;width:100%;transform:none}
body[data-view="reader"] .text-page{overflow-y:auto;scrollbar-width:thin}
body[data-view="reader"] .reader-bar{position:fixed;left:50%;bottom:calc(16px + env(safe-area-inset-bottom));transform:translateX(-50%);z-index:12;display:flex;flex-direction:row;flex-wrap:nowrap;align-items:center;gap:24px;width:max-content;max-width:calc(100% - 24px);min-height:64px;margin:0;padding:8px 20px 12px;border-radius:24px;background:#16382dcc;color:#fff0cc;box-shadow:0 8px 24px #06171340;backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px)}
#reader .controls{margin:0;gap:12px}
#reader .reader-options{display:flex;align-items:center;gap:12px;min-height:44px}
#reader .play-button{background:#f8e7bf26;color:#fff0cc;box-shadow:none;min-width:150px;height:44px}
#reader .round-button,#reader .scene-replay{background:transparent;color:#fff0cc;border:0;min-width:44px;min-height:44px;width:44px;height:44px}
#reader .page-count{color:#fff0cc;font-size:12px}
#reader .auto-label{color:#fff0cc}
#reader .chapter-dot:after{background:#fff0cc70}
#reader .chapter-dot.active:after{background:#ffe0a0;box-shadow:0 0 0 3px #ffe0a026}
/* A longer story must not push navigation beyond the viewport. */
#reader .chapter-dots.many-chapters{display:none}
#reader .progress-track{position:absolute;bottom:0;left:24px;right:24px;width:auto;height:3px;margin:0;background:#fff0cc24;border-radius:3px;overflow:hidden}
#reader .progress-fill{background:#f1d19db3}
#reader .status{position:fixed;left:16px;right:16px;bottom:calc(84px + env(safe-area-inset-bottom));margin:0;text-align:center;color:#fff0cc;font-size:12px;pointer-events:none}
#reader .status:not(:empty){width:fit-content;max-width:calc(100% - 32px);margin:auto;padding:4px 12px;background:#173b32ed;border-radius:8px}
body[data-view="reader"] button:focus-visible{outline:2px solid #ffe0a0;outline-offset:3px}
@media(hover:hover){#reader .play-button:hover,#reader .round-button:not(:disabled):hover,#reader .scene-replay:hover,body[data-view="reader"] header button:hover{background:#f8e7bf40;transform:none}}
@media(max-width:1000px){#reader .chapter-dots{display:none}#reader .reader-options{gap:8px}#reader .reader-bar{gap:16px}}
@media(max-width:700px){body[data-view="reader"]{--reader-bottom:calc(144px + env(safe-area-inset-bottom))}body[data-view="reader"] .reader-bar{flex-wrap:wrap;justify-content:center;gap:0 12px;width:320px;padding:6px 12px 10px;border-radius:20px}#reader .controls{width:100%;justify-content:space-between}#reader .reader-options{min-height:36px;gap:16px}#reader .scene-replay{min-height:44px;height:44px}#reader .auto-label{display:flex;font-size:10px}#reader .status{bottom:calc(104px + env(safe-area-inset-bottom))}body[data-view="reader"] .reading-room{max-width:none}body[data-view="reader"] .story-copy{font-size:clamp(17px,3.8vw,21px)}}
@media(max-width:540px){body[data-view="reader"] #reader{padding-inline:8px}body[data-view="reader"] .spread .text-page{max-height:50%;padding:12px 20px 16px}body[data-view="reader"] header .library-back span{display:none}body[data-view="reader"] header .library-back{width:44px;padding:0;justify-content:center}}
@media(max-height:540px) and (orientation:landscape){body[data-view="reader"]{--reader-top:48px;--reader-bottom:76px}body[data-view="reader"] .reader-bar{width:max-content;flex-wrap:nowrap;gap:16px;min-height:52px;padding:4px 12px 8px;bottom:8px}#reader .controls{width:auto}#reader .reader-options{min-height:44px}#reader .auto-label{display:none}#reader .status{bottom:64px}body[data-view="reader"] .reading-room{width:min(100%,calc((100dvh - 124px)*2.1))}body[data-view="reader"] .text-page{padding:12px 20px}body[data-view="reader"] .story-copy{font-size:17px}}
@media(prefers-reduced-transparency:reduce){body[data-view="reader"] header button,body[data-view="reader"] .reader-bar{background:#173b32;backdrop-filter:none;-webkit-backdrop-filter:none}}

/* Painted atlas cells retain their proportions on live and turning pages. */
.ukhdud-reader #story-scene,.ukhdud-reader .frozen-scene{object-fit:contain}
.ukhdud-reader .scene-wrap{border-radius:4px}

/* Leave the bird story's illustration paper empty for the forthcoming scenes. */
.birds-reader .scene-wrap{background:transparent;box-shadow:none;border:0}
.birds-reader .scene-replay{display:none!important}

.birds-reader #story-scene,.birds-reader .frozen-scene{object-fit:contain}
.birds-reader .scene-wrap{border-radius:4px}
