.daily-library {
  .heading{margin-bottom:36px}.heading h1{font-size:42px;line-height:1.2;letter-spacing:-1.5px;margin:0 0 16px;font-weight:600}.heading p{color:#65708a;line-height:1.8;margin:0}
  h2{font-size:30px;line-height:1.3;font-weight:600;letter-spacing:-.7px;margin:22px 0 16px}
  .featured{display:grid;grid-template-columns:1fr 1fr;overflow:hidden;background:#fff;border:1px solid #ece7df;border-radius:30px;box-shadow:0 12px 40px #14224206}
  .featured-art{background:#f8ead1;min-height:400px}.featured-art img{width:100%;height:100%;object-fit:cover;display:block}.featured-copy{padding:42px;align-self:center}.featured-copy p{color:#65708a;line-height:1.8}
  .tags{display:flex;flex-wrap:wrap;gap:8px}.tags span,.lesson{font-size:12px;font-weight:600;color:#815a21}.tags span{padding:7px 11px;background:#fff0c4;border-radius:99px}.tags span+span{background:#f5f2ec;color:#646777}
  .primary{display:inline-flex;align-items:center;justify-content:center;gap:25px;background:#0066ff;color:#fff;border:0;border-radius:13px;padding:16px 23px;font:600 14px Poppins;cursor:pointer;margin-top:14px;min-height:48px}.primary:hover{background:#004ed0}
  .section-heading{margin:36px 0 22px}.section-heading h2{font-size:24px;margin:0}
  .shelf{display:grid;grid-template-columns:1fr 1fr;gap:24px}.book{display:grid;grid-template-columns:160px minmax(0,1fr);overflow:hidden;border:1px solid #ece7df;background:#fff;border-radius:22px}.book>div{padding:24px}.book h3{font-size:19px;font-weight:600;line-height:1.4;margin:10px 0}.book p{font-size:12px;line-height:1.8;color:#65708a}.book-art{padding:0!important}.book-art img{min-height:240px}
  .text-button{font:600 13px Poppins;color:#0066ff;background:none;border:0;padding:12px 0;min-height:44px;cursor:pointer}
  .tomorrow{display:grid;grid-template-columns:280px minmax(0,1fr);gap:0;padding:0;overflow:hidden;border-radius:22px;background:#eef0f9;border:1px solid #e1e4f0}.tomorrow-art{height:240px}.tomorrow-copy{padding:30px 36px;align-self:center}.tomorrow-copy h3{font-size:20px;font-weight:600;line-height:1.4;margin:0 0 12px}.tomorrow-copy p{color:#65708a;font-size:14px;line-height:1.8;margin:0}
  .book-art img,.tomorrow-art img{display:block;width:100%;height:100%;object-fit:cover}.book-art img:not([src]),.tomorrow-art img:not([src]){background:#f8ead1;min-height:200px}.empty-art{min-height:240px;display:grid;place-items:center;font-size:72px;color:#bc8a34;background:#f8ead1;height:100%}
  button:focus-visible,select:focus-visible,input:focus-visible{outline:3px solid #0066ff;outline-offset:4px}
  .reader{max-width:820px;margin:auto}.reader-heading{text-align:center;margin:10px 0 28px}.reader-heading h2{font-size:36px}.reader-heading p{font-size:12px;color:#65708a}.reader>img{display:block;max-height:440px;width:100%;object-fit:cover;border-radius:25px}.prose{max-width:650px;margin:36px auto}.prose>p{font-size:17px;line-height:2.1;margin-bottom:25px;white-space:pre-line}
  .archive-filters{display:grid;grid-template-columns:2fr 1fr;gap:20px;margin-bottom:20px}.archive-filters label{display:block;font-size:13px;font-weight:600}.archive-filters input,.archive-filters select{display:block;width:100%;margin-top:8px;padding:13px 16px;min-height:48px;border:1px solid #dddfe7;border-radius:12px;background:#fff;color:#102143;font:400 14px Poppins}.archive-count{font-size:13px;color:#65708a;margin:0 0 20px}.more-stories{text-align:center;margin-top:22px}
  @media(max-width:760px){
    .heading{margin-bottom:26px}.heading h1{font-size:31px}.heading p{font-size:14px}.featured{grid-template-columns:1fr;border-radius:23px}.featured-art{min-height:0;height:235px}.featured-copy{padding:25px}.featured-copy .primary{width:100%}h2{font-size:27px}.section-heading{margin-top:30px}.section-heading h2{font-size:22px}.shelf{grid-template-columns:1fr;gap:18px}.book{grid-template-columns:110px minmax(0,1fr)}.book>div{padding:18px}.book h3{font-size:17px}.tomorrow{grid-template-columns:1fr}.tomorrow-art{height:200px}.tomorrow-copy{padding:24px}.tomorrow-copy h3{font-size:19px}.reader-heading h2{font-size:28px}.reader>img{max-height:270px}.prose>p{font-size:16px}.archive-filters{grid-template-columns:1fr;gap:16px}
  }

.library .section-heading{display:flex;align-items:center;justify-content:space-between;gap:16px}.library .section-heading h2{min-width:0}.library .view-all{flex-shrink:0;white-space:nowrap;color:#0066ff;background:none;border:0;padding:10px 0;min-height:44px}.library .view-all:hover{text-decoration:underline}
}

.daily-library .cover-frame{position:relative;width:100%;height:100%;min-height:240px;overflow:hidden;background:#fff8eb}
.daily-library .cover-frame img{display:block;width:100%;height:100%;object-fit:cover}
.daily-library .cover-image{position:absolute;inset:0;opacity:0}
.daily-library .cover-frame.is-ready .cover-image{opacity:1}
.daily-library .cover-placeholder{position:absolute;inset:0}
.daily-library .cover-frame.is-ready .cover-placeholder{visibility:hidden}
.daily-library .cover-status{position:absolute;inset:0;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;padding:22px 12px;background:linear-gradient(transparent 55%,#fffaf2e8);text-align:center}
.daily-library .cover-status-label{font-size:12px;color:#35456b}
.daily-library .cover-status .session-loading-dots{margin-top:12px}
.daily-library .featured-art .cover-frame{min-height:400px}
.daily-library .reader>.cover-frame{height:440px;border-radius:25px}
.daily-library button>.session-loading-dots{margin:0;min-width:100px;padding:7px 0}
.daily-library .primary>.session-loading-dots span{background:#fff}
@media(max-width:760px){.daily-library .featured-art .cover-frame{min-height:235px}.daily-library .tomorrow-art .cover-frame{min-height:200px}.daily-library .reader>.cover-frame{height:270px}.daily-library .book-art .cover-status-label{font-size:11px}}

.daily-library .cover-loading-label{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}

/* Equal rows keep every previous-night card the same size without clipping copy. */
.daily-library .shelf{grid-auto-rows:1fr}
.daily-library .book{min-width:0;height:100%}
.daily-library .book>div:not(.book-art){display:flex;flex-direction:column;min-width:0;overflow-wrap:anywhere}
.daily-library .book p{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:5;line-clamp:5;max-height:9em;overflow:hidden}
.daily-library .book .text-button{margin-top:auto;align-self:flex-start}

/* Fixed leaves: text pagination is measured against this space, never content height. */
.daily-library .reader{max-width:1120px;--book-paper:url('/public/assets/stories/book-paper-v1.jpg')}
.daily-library .reader-heading{min-height:110px;display:flex;flex-direction:column;justify-content:center;margin:0 0 24px}
.daily-library .reader-heading h2{margin:0 0 12px}
.daily-library .reader-heading .content-title-row{display:grid;grid-template-columns:90px minmax(0,1fr) 90px;align-items:baseline;gap:0}
.daily-library .reader-heading .content-title-row h2{grid-column:2;text-align:center;overflow-wrap:anywhere}
.daily-library .reader-heading .content-back{grid-column:3;justify-self:end;margin-left:0}
@media(max-width:650px){
 .daily-library .reader-heading .content-title-row{grid-template-columns:minmax(0,1fr)}
 .daily-library .reader-heading .content-title-row h2{grid-column:1;grid-row:2}
 .daily-library .reader-heading .content-back{grid-column:1;grid-row:1}
}
.daily-library .reader-heading p{margin:0}
.daily-library .reading-spread{position:relative;isolation:isolate;display:grid;grid-template-columns:1fr 1fr;height:600px;perspective:2200px;background:#f9f0dc;border:1px solid #dfceb1;border-radius:8px 16px 16px 8px;box-shadow:0 24px 55px #382c1722,0 3px 0 #ede1cd,0 6px 0 #d7c5a5,0 9px 0 #fbf1df,0 12px 0 #9c7859;align-items:stretch}
.daily-library .reading-spread::after{content:'';position:absolute;z-index:5;left:50%;top:0;bottom:0;width:34px;transform:translateX(-50%);background:linear-gradient(90deg,transparent,#37260c26 48%,#fff9e51a 53%,transparent);pointer-events:none}
.daily-library .storybook-art{min-width:0;height:100%;padding:0;position:relative;overflow:hidden;border-radius:7px 0 0 7px;background:transparent}
.daily-library .storybook-art .cover-frame{height:100%;width:100%;min-height:0;border-radius:0;background:transparent}
.daily-library .storybook-art .cover-frame img{object-fit:cover;object-position:center;width:100%;height:100%}
.daily-library .storybook-page,.daily-library .turn-face{position:relative;min-width:0;height:100%;padding:38px 38px 56px;background-image:linear-gradient(90deg,#5a3f181c,transparent 9%,#fffaf055 75%,#8868310a),var(--book-paper);background-color:#fffaf0;background-size:100% 100%,cover;border-radius:0 15px 15px 0;overflow-wrap:anywhere;color:#263348}
.daily-library .storybook-page{overflow:hidden}
.daily-library .page-prose{height:100%;overflow:hidden}
.daily-library .page-prose p{font-family:Georgia,serif;font-size:20px;line-height:1.8;margin:0 0 20px;white-space:pre-line}
.daily-library .page-prose p:last-child{margin-bottom:0}
.daily-library .printed-page{position:absolute;bottom:22px;right:38px;color:#8a785c;font:14px Georgia,serif}
.daily-library .book-controls{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:32px auto 0;max-width:600px}
.daily-library .book-controls .text-button{padding:12px;flex-shrink:0}
.daily-library .book-controls [aria-disabled=true]{opacity:.4;cursor:default}
.daily-library #page-status{font-size:13px;color:#65708a;text-align:center}
.daily-library .storybook-page:focus-visible{outline:3px solid #0066ff;outline-offset:-5px}
.daily-library .page-leaf{position:absolute;z-index:6;top:0;right:0;width:50%;height:100%;transform-origin:left center;transform-style:preserve-3d;pointer-events:none}
.daily-library .turn-face,.daily-library .turn-back{position:absolute;inset:0;backface-visibility:hidden;box-shadow:0 8px 25px #36281222}
.daily-library .turn-back .cover-frame{height:100%;width:100%;min-height:0;border-radius:0;background:transparent}
.daily-library .turn-back .cover-frame img{object-fit:cover;object-position:center;width:100%;height:100%}
.daily-library .turn-back{overflow:hidden;transform:rotateY(180deg);border-radius:15px 0 0 15px;background:#fffaf0 var(--book-paper) center/cover;box-shadow:inset -18px 0 24px #47301218}
@media(max-width:760px){
 .daily-library .reader-heading{min-height:100px;margin-bottom:20px}
 .daily-library .reading-spread{grid-template-columns:1fr;grid-template-rows:190px 490px;height:680px;border-radius:12px}
 .daily-library .reading-spread::after{display:none}
 .daily-library .storybook-art{border-radius:11px 11px 0 0}
 .daily-library .storybook-page,.daily-library .turn-face{padding:26px 24px 50px;border-radius:0 0 11px 11px}
 .daily-library .page-prose p{font-size:18px;line-height:1.8;margin-bottom:18px}
 .daily-library .page-leaf{top:190px;width:100%;height:490px}
 .daily-library .book-controls{gap:4px}.daily-library .book-controls .text-button{padding:12px 4px}
}
@media(prefers-reduced-motion:reduce){.daily-library .page-leaf{display:none}}

/* Library startup shares the session-recovery screen's full-page shell. */
#app:has(.library-loading) > .site-header,
#app:has(.library-loading) > .landing-footer{display:none}
#app:has(.library-loading) .workspace{width:100%;max-width:none;margin:0;padding:0;background:#fffaf2}
#app:has(.library-loading) .workspace #main{width:100%;max-width:none;margin:0;padding:32px 20px;min-height:100svh;display:grid;place-items:center}
#app:has(.library-loading) .workspace #main > :not(.daily-library){display:none}
#app:has(.library-loading) .daily-library{width:100%;display:grid;place-items:center}

/* A compact listening strip accompanies the book without competing with its pages. */
.daily-library .story-narration{max-width:760px;margin:0 auto 26px;padding:12px 18px;border:1px solid #e5dccd;border-radius:22px;background:#fffdf8;box-shadow:0 6px 18px #604d3010}
.daily-library .narration-bar{display:grid;grid-template-columns:44px 165px minmax(70px,1fr) auto 48px;align-items:center;gap:14px}
.daily-library .narration-play{display:grid;place-items:center;width:44px;height:44px;padding:0;border:0;border-radius:50%;background:#0066ff;color:#fff;box-shadow:0 3px 8px #0066ff25}
.daily-library .narration-play:hover{background:#0054d6}.daily-library .narration-play svg{width:22px;height:22px;fill:currentColor}
.daily-library .narration-copy{text-align:left;line-height:1.5}.daily-library .narration-copy span{display:block;font-size:12px;font-weight:600;color:#132c48}.daily-library .narration-copy small{display:block;font-size:10px;color:#788090}
.daily-library #narration-seek{--played:0%;appearance:none;width:100%;height:5px;margin:0;padding:0;border:0;border-radius:8px;background:linear-gradient(to right,#ec7970 var(--played),#e7e0d6 var(--played));cursor:pointer}
.daily-library #narration-seek::-webkit-slider-thumb{appearance:none;width:12px;height:12px;border:2px solid #fff;border-radius:50%;background:#ec7970;box-shadow:0 1px 4px #6d4a3425}.daily-library #narration-seek::-moz-range-thumb{width:10px;height:10px;border:2px solid #fff;border-radius:50%;background:#ec7970}
.daily-library #narration-seek:disabled{opacity:.55;cursor:default}.daily-library .narration-time{font-size:11px;font-variant-numeric:tabular-nums;white-space:nowrap;color:#67718a}
.daily-library .narration-speed{padding:0;width:48px;min-height:44px;border:0;background:transparent;color:#315582;font-size:12px;font-weight:600;border-radius:12px}.daily-library .narration-speed:hover{background:#eef3fb}
.daily-library .story-narration button:focus-visible,.daily-library #narration-seek:focus-visible{outline:3px solid #0066ff;outline-offset:4px}
.daily-library #narration-status{margin:0;font-size:12px;color:#65708a;text-align:center}.daily-library #narration-status:not(:empty){margin-top:10px}
@media(max-width:650px){.daily-library .story-narration{padding:10px 14px;margin-bottom:20px;border-radius:18px}.daily-library .narration-bar{grid-template-columns:44px minmax(0,1fr) auto 44px;gap:8px 10px}.daily-library .narration-copy span{font-size:11px}.daily-library #narration-seek{grid-column:1/-1;grid-row:2;margin:8px 0 5px}.daily-library .narration-time{font-size:10px}.daily-library .narration-speed{width:44px}}
.daily-library #narration-seek{height:44px;background-size:100% 5px;background-repeat:no-repeat;background-position:center}.daily-library .narration-copy small{font-size:11px}
@media(max-width:650px){.daily-library #narration-seek{margin:0}}

.daily-library .story-play{text-align:center;margin:24px auto 36px}.daily-library .story-play[hidden]{display:none}.daily-library .story-play p{margin:0 0 16px}.game-page:has(.story-game-return){flex-direction:column}.story-game-return{align-self:stretch;padding:12px 20px;background:#fffaf2}.game-page:has(.story-game-return) .game-section{height:calc(100svh - 264px)}

/* The final reading action folds the last leaf into an illustrated closed book. */
.daily-library .reading-spread[hidden],.daily-library .book-controls[hidden],.daily-library .closed-story[hidden]{display:none}
.daily-library .closed-story{display:grid;grid-template-columns:1fr 1fr;align-items:start;text-align:center;scroll-margin-top:24px;column-gap:0}.daily-library .closed-story-book{min-width:0;padding-right:8px}
.daily-library .closed-book{position:relative;width:100%;height:600px;margin:0 0 20px;overflow:hidden;border-radius:18px 6px 6px 18px;background:#173a59;box-shadow:inset -8px 0 0 #ffffff20,-5px 4px 0 #e4d4b5,-9px 8px 0 #173a59,0 22px 40px #382c1726}
.daily-library .closed-book::after{content:'';position:absolute;inset:0;pointer-events:none;background:linear-gradient(270deg,#071b4055,transparent 7%,#ffffff22 9%,transparent 12%);border:1px solid #173a5940;border-radius:inherit}
.daily-library .closed-book-back{display:block;width:100%;height:100%;object-fit:fill}
.daily-library .closing-leaf .turn-back{border-radius:15px 0 0 15px;background:#173a59;overflow:hidden}
.daily-library .closing-leaf .closed-book{width:100%;height:100%;margin:0;border-radius:0;box-shadow:none}
.daily-library .closed-story .story-play{align-self:center;min-width:0;margin:0;padding:16px 30px 50px}.daily-library .story-play-art{display:block;width:100%;height:300px;object-fit:contain;margin:0 auto 24px}.daily-library .closed-story .story-play p{font-size:24px;line-height:1.55;font-weight:600;color:#153f60;margin:0 0 26px}
@media(max-width:760px){.daily-library .closed-story{grid-template-columns:1fr;gap:24px}.daily-library .closed-story-book{padding-right:8px}.daily-library .closed-book{height:490px;width:100%}.daily-library .closed-story .story-play{padding:0 12px 24px}.daily-library .story-play-art{height:230px;margin-bottom:16px}.daily-library .closed-story .story-play p{font-size:22px}}

/* Hide the stationary final page while the solid back cover folds over it. */
.daily-library .reading-spread.is-closing{background:transparent;border-color:transparent;box-shadow:none}
.daily-library .reading-spread.is-closing::after{display:none}
.daily-library .is-closing>.storybook-page{visibility:hidden}
.daily-library .closing-leaf .turn-face{background:#fffaf0 var(--book-paper) center/cover;box-shadow:inset 14px 0 24px #47301218}

.daily-library .story-quiz[hidden]{display:none}.daily-library .story-quiz{align-self:center;min-width:0;text-align:left;padding:28px;margin:16px}.daily-library .story-quiz fieldset{border:0;margin:20px 0;padding:0;min-width:0}.daily-library .story-quiz legend{font-size:20px;font-weight:600;margin-bottom:18px}.daily-library .story-quiz-option{display:flex;align-items:center;gap:12px;padding:14px;margin:10px 0;background:#fff;border:2px solid #d4deea;border-radius:14px;cursor:pointer;overflow-wrap:anywhere}.daily-library .story-quiz-option:has(input:checked){border-color:#347cc0;background:#edf5ff}.daily-library .story-quiz-option:focus-within{outline:3px solid #153f60;outline-offset:3px}.daily-library .story-quiz-option input{width:20px;height:20px;flex-shrink:0;accent-color:#347cc0}.daily-library .story-quiz-feedback{line-height:1.6;overflow-wrap:anywhere}.daily-library .story-quiz .primary{min-height:48px;width:100%}@media(max-width:760px){.daily-library .story-quiz{margin:0;padding:22px}}

/* Keep the finished leaf and both ending panels on the same fixed anchor.
   Hidden panels retain their footprint so changing steps cannot clamp scroll. */
.daily-library .closed-story{padding:1px;min-height:600px}
.daily-library .closed-story-book{padding-right:0}
.daily-library .closed-book{height:598px;border-radius:15px 0 0 15px}
.daily-library .closing-leaf .closed-book{border-radius:15px 0 0 15px;box-shadow:inset -8px 0 0 #ffffff20,-5px 4px 0 #e4d4b5,-9px 8px 0 #173a59,0 22px 40px #382c1726}
.daily-library .closing-leaf .turn-back{overflow:visible;box-shadow:none}
.daily-library .story-ending-panel{display:grid;min-width:0;align-self:stretch}
.daily-library .story-ending-panel>.story-quiz,.daily-library .story-ending-panel>.story-play{grid-area:1/1}
.daily-library .story-ending-panel>[hidden]{display:block;visibility:hidden;pointer-events:none}
@media(max-width:760px){
 .daily-library .closed-story{min-height:680px}
 .daily-library .closed-book{height:490px}
}

/* One stage keeps pagination and the footer below an unchanged footprint. */
.daily-library .story-stage{display:grid;align-items:start}
.daily-library .story-stage>.reading-spread,.daily-library .story-stage>.closed-story{grid-area:1/1;min-width:0}
.daily-library .story-stage>[hidden]{display:grid;visibility:hidden;pointer-events:none}
.daily-library .closed-story .closed-book{margin-bottom:0}
.daily-library .story-ending-panel{height:598px;overflow:auto;overscroll-behavior:contain}
@media(max-width:760px){
 .daily-library .closed-story-book{display:none}
 .daily-library .closed-story{gap:0}
 .daily-library .story-ending-panel{height:678px}
}

.daily-library [data-read]:has(.button-lock){display:inline-flex;align-items:center;justify-content:center;gap:10px;}
