.reader-heading{margin:4px 0 20px}.reader-heading h1{font-size:38px;margin:10px 0}.reader-heading>p{font-size:12px}.reader-story-art,.reader-doodle{display:none}
.reading-page{padding:23px 30px 22px;min-height:0}.reading-page>p{font-size:23px;line-height:1.75;margin-bottom:23px}.reader-tools{margin-bottom:20px;gap:10px}.reader-tools>span{flex:1}
.reading-scene{margin:0;border:1px solid #e2d5bf;border-radius:16px;overflow:hidden;background:#efe4ce}.reading-scene>svg{display:block;width:100%;height:auto;max-height:475px}.reading-scene figcaption{font-size:11px;color:#8c7c6e;text-align:center;padding:10px 16px 12px;background:#faf3e4;line-height:1.5}
.reader-controls{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:9px 15px;padding:15px 0 0}.reader-controls .button{font-size:12px}.reader-auto-label{display:flex;align-items:center;gap:8px;font-size:11px;color:#8a7b87;min-height:44px}.reader-auto-label input{width:19px;height:19px;accent-color:#796482}.reader-status{text-align:center;min-height:26px;line-height:1.6;color:#8b7869;font-size:11px;margin:4px 0 14px}.reader-stop{font-size:11px;padding:10px 15px;background:#eee6dc;border-radius:9px;min-height:44px}.reader-stop:disabled{opacity:.45;cursor:default}.page-narration-note{font-size:10px;color:#a09084;margin-top:14px;text-align:center}
@media(max-width:700px){.reader{padding-top:10px}.reader-heading h1{font-size:31px}.reading-page{padding:18px 17px}.reading-page>p{font-size:21px;line-height:1.8;margin-bottom:18px}.reading-scene{border-radius:11px}.reading-scene figcaption{font-size:9px;padding:9px 10px}.reader-controls{gap:5px 10px}.reader-controls .button{font-size:11px;padding:12px 15px}.reader-heading{margin-bottom:12px}.reader-status{font-size:10px;margin-bottom:10px}.reader-auto-label{font-size:10px}.reader-pagination{margin-top:20px}}

.reading-scene{position:relative}.reading-scene [data-talk]{cursor:pointer;outline:none}.reading-scene [data-talk]:focus-visible{filter:drop-shadow(0 0 5px #b6996d)}.story-visual .reading-scene figcaption{font-size:10px}.story-visual .reading-scene{border-radius:25px}.story-visual .speech-bubble{font-size:12px}.story-visual .reading-scene>svg{max-height:none}

.reading-page{opacity:1;transition:opacity .22s ease;animation:reader-page-appear .32s ease-out}.reading-page.page-fading-out{animation:none;opacity:0}
@keyframes reader-page-appear{from{opacity:0}to{opacity:1}}
@media(prefers-reduced-motion:reduce){.reading-page{animation:none!important;transition:none!important}}

/* A quiet picture book: one listening control and two large page arrows. */
.in-reader{background:#f2ecdf}.in-reader .site-header,.in-reader footer{display:none}.in-reader main{max-width:1000px;padding:0 24px;min-height:100dvh}.in-reader .reader{max-width:900px;padding:18px 0 0}
.book-topline{display:grid;grid-template-columns:90px 1fr 90px;align-items:center;gap:12px;margin:0 0 16px}.book-topline h1{text-align:center;font-size:19px;line-height:1.35;margin:0;color:#6e6171}.book-topline .back-link{font-size:13px;min-height:44px;display:flex;align-items:center}.book-settings{justify-self:end;width:44px;height:44px;border-radius:50%;background:transparent;color:#948294;font-size:23px}
.in-reader .reading-page{padding:0;overflow:hidden;border-radius:24px;box-shadow:0 8px 30px #7761470c;border:1px solid #e1d5bf;min-height:0}.in-reader .reading-scene{border:0;border-radius:0;background:#e9ddc6}.in-reader .reading-scene>svg{width:100%;height:auto;max-height:min(51dvh,470px)}.in-reader .reading-scene figcaption{display:none}.book-words{padding:22px 38px 26px;display:flex;align-items:center;justify-content:center;min-height:130px}.book-words>p{font-family:Georgia,serif;font-size:25px;line-height:1.65;color:#55485c;margin:0;max-width:740px;text-align:center;overflow-wrap:anywhere}
.in-reader .reader-status{font-size:12px;min-height:20px;margin:10px 0 0;color:#8b7c83}.book-controls{position:static;display:grid;grid-template-columns:70px minmax(150px,250px) 70px;justify-content:center;align-items:center;gap:28px;padding:12px 16px max(15px,env(safe-area-inset-bottom));background:#f2ecdfed;z-index:5}.book-arrow{display:flex;width:64px;height:64px;align-items:center;justify-content:center;border-radius:50%;background:#fffdf7;border:1px solid #e2d7c8;color:#6e5b7a;font-size:29px;text-decoration:none;box-shadow:0 3px 0 #e2d7c8}.book-arrow:hover{background:#e7ddec;transform:translateY(-2px)}.book-arrow.placeholder{visibility:hidden}.book-listen{display:flex;flex-direction:column;align-items:center;gap:7px}.book-listen .button{width:100%;min-height:58px;font-size:17px;justify-content:center;border-radius:19px;gap:11px}.book-page-count{color:#9a8c92;font-size:11px;letter-spacing:1px}.pause-symbol{font-size:23px;line-height:1}
@media(max-width:700px){.in-reader main{padding:0 13px}.in-reader .reader{padding-top:8px}.book-topline{grid-template-columns:72px 1fr 44px;gap:5px;margin-bottom:8px}.book-topline h1{font-size:15px}.book-topline .back-link{font-size:12px}.in-reader .reading-page{border-radius:18px}.in-reader .reading-scene>svg{max-height:46dvh}.book-words{padding:18px 21px 22px;min-height:136px}.book-words>p{font-size:22px;line-height:1.6}.book-controls{gap:16px;grid-template-columns:55px minmax(135px,220px) 55px;padding:10px 0 max(12px,env(safe-area-inset-bottom))}.book-arrow{width:54px;height:54px;font-size:26px}.book-listen .button{font-size:16px;min-height:54px}.in-reader .reader-status{font-size:11px}}


/* Keep the whole book visible; scroll long text inside its own pane. */
body.in-reader:not(.story-editor-open){overflow:hidden}
body.in-reader:not(.story-editor-open) main{height:100vh;height:100dvh;min-height:0;max-width:1320px;padding:max(8px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left))}
body.in-reader:not(.story-editor-open) .reader{height:100%;max-width:none;padding:0;display:grid;grid-template-rows:auto minmax(0,1fr) auto auto;gap:8px}
body.in-reader:not(.story-editor-open) .book-topline{margin:0;min-height:44px}
body.in-reader .reading-page{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1.8fr) minmax(0,1fr);min-width:0;min-height:0;margin:0;align-items:stretch}
body.in-reader .reading-scene{display:flex;align-items:center;justify-content:center;min-width:0;min-height:0;height:100%}
body.in-reader .reading-scene>svg{display:block;width:100%;height:100%;max-height:none;flex:none}
body.in-reader .book-words{min-width:0;min-height:0;padding:16px 24px;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;display:flex;flex-direction:column;justify-content:flex-start;align-items:center}
body.in-reader .book-words>p{flex:none;margin-block:auto;font-size:clamp(22px,2.7vw,26px);line-height:1.5;max-width:740px}
body.in-reader:not(.story-editor-open) .reader-status{min-height:0;margin:0;font-size:12px;line-height:1.4}
body.in-reader:not(.story-editor-open) .book-controls{position:static;margin:0;padding:4px 0 0;background:#f2ecdf}
@media(min-width:760px) and (orientation:landscape){
 body.in-reader .reading-page{grid-template-columns:minmax(0,1.6fr) minmax(0,1fr);grid-template-rows:minmax(0,1fr)}
 body.in-reader .book-words{padding:18px;border-left:1px solid #e1d5bf}
 body.in-reader .book-words>p{font-size:clamp(20px,2.15vw,25px)}
}
@media(max-width:700px){
 body.in-reader:not(.story-editor-open) .reader{gap:6px}
 body.in-reader .book-words{padding:12px 18px}
 body.in-reader .book-words>p{font-size:21px;line-height:1.5}
 body.in-reader:not(.story-editor-open) .reader-status{font-size:11px}
}

/* Preview the same book composition while keeping the admin tools scrollable. */
body.in-reader.story-editor-open main{max-width:1320px;padding:0 max(12px,env(safe-area-inset-right)) 0 max(12px,env(safe-area-inset-left))}
body.in-reader.story-editor-open .reader{max-width:none}
body.in-reader.story-editor-open .reading-page{height:calc(100vh - 186px);height:calc(100dvh - 186px);min-height:320px}

body.large-type-reader .book-words{overflow-y:hidden;padding-top:16px;padding-bottom:16px}
body.large-type-reader .book-words>p{font-family:'Avenir Next',Avenir,'Trebuchet MS',sans-serif;font-size:30px;font-weight:400;line-height:1.4}
.reader-word{display:inline-grid;vertical-align:baseline;border-radius:5px}
.reader-word>span,.reader-word::before{grid-area:1/1}
.reader-word::before{content:attr(data-word);font-weight:700;visibility:hidden;pointer-events:none}
.reader-word.is-current{font-weight:700;background:#f8dfa0;box-shadow:0 0 0 2px #f8dfa0;text-decoration:none}

/* Fit the panel to its picture, rather than letterboxing a fixed picture in a
   window-shaped panel. The outer slot retains the available reader grid area. */
.story-page-slot{display:contents}
@supports (container-type:size) and (width:1cqh){
 body.in-reader .story-page-slot{display:grid;place-items:center;container-type:size;width:100%;height:100%;min-width:0;min-height:0;--story-picture-aspect:1.1666666667}
 body.in-reader .story-reading-page{grid-area:auto!important;container-type:size;width:100%;height:100%!important;min-height:0!important;border:0;border-radius:0;box-shadow:none;background:transparent;overflow:visible}
 body.in-reader .story-reading-page>.reading-scene{width:min(100%,calc(100cqh * var(--story-picture-aspect) * 1.8 / 2.8));height:auto;aspect-ratio:var(--story-picture-aspect);align-self:center;justify-self:center;border-radius:24px;box-shadow:0 0 0 1px #e1d5bf}
 body.in-reader .story-reading-page>.book-words{border:1px solid #e1d5bf;border-radius:24px;background:#fffdf7}
 body.in-reader.story-editor-open .story-page-slot{height:calc(100dvh - 186px);min-height:320px}
 @media(min-width:700px){
  body.in-reader.story-editor-open .story-page-slot{grid-column:2;grid-row:3;height:calc(100dvh - 196px);min-height:400px;align-self:start}
 }
 @media(min-width:760px) and (orientation:landscape){
  body.in-reader .story-reading-page{height:min(100%,calc(100cqw * 8 / 13 / var(--story-picture-aspect)))!important;grid-template-columns:minmax(0,min(calc(100cqw * 8 / 13),calc(100cqh * var(--story-picture-aspect)))) minmax(0,1fr);grid-template-rows:minmax(0,1fr);border-radius:24px;overflow:hidden;background:#fffdf7;box-shadow:0 0 0 1px #e1d5bf,0 8px 30px #7761470c}
  body.in-reader .story-reading-page>.reading-scene{width:100%;height:100%;aspect-ratio:auto;border-radius:0;box-shadow:none}
  body.in-reader .story-reading-page>.book-words{border:0;border-left:1px solid #e1d5bf;border-radius:0;background:transparent}
 }
}
