:root{--ink:#193c39;--muted:#61706a;--paper:#fffdf7;--line:#dce2d6;--accent:#e9eee1}*{box-sizing:border-box}body.book-app{margin:0;background:#f6f3ea;color:var(--ink);font:15px/1.5 system-ui,sans-serif}.book-app [hidden]{display:none!important}.book-app main{width:100%;max-width:1050px;margin:auto;padding:0;min-height:100dvh}.book-app h1,.book-app h2{font-family:Georgia,serif;font-weight:400;line-height:1.12}.book-app p{margin:0 0 16px}.book-app a{color:inherit}.book-app button,.book-app .button{font:600 14px/1.2 system-ui;display:inline-flex;align-items:center;justify-content:center;min-height:44px;border:1px solid #cbd6c5;border-radius:12px;padding:10px 16px;background:var(--paper);color:var(--ink);text-decoration:none;cursor:pointer;touch-action:manipulation}.book-app button:disabled{opacity:.4;cursor:default}.book-app .primary{background:var(--ink);color:#fff}.book-app button:focus-visible,.book-app a:focus-visible,.book-app select:focus-visible{outline:3px solid #416cbb;outline-offset:2px}.book-app input,.book-app select{font:16px system-ui;min-height:44px;padding:10px;border:1px solid #b8c9b5;border-radius:8px;background:var(--paper);color:var(--ink);max-width:100%}.book-app label{display:grid;gap:8px;margin:18px 0}.book-app .small{font-size:12px;color:var(--muted)}.eyebrow{font:600 10px/1.5 system-ui;letter-spacing:.13em}.app-top{display:flex;align-items:center;gap:12px;min-height:64px;padding:10px 20px;padding-top:max(10px,env(safe-area-inset-top));border-bottom:1px solid var(--line);background:var(--paper);flex-shrink:0}.app-top>a{font-size:13px;font-weight:600;text-decoration:none;min-height:44px;display:flex;align-items:center;white-space:nowrap}.app-top h1,.app-top strong{font:600 14px/1.3 system-ui;text-align:center;flex:1;min-width:0;margin:0}.app-top>button{min-width:44px;padding:8px;border:0}.app-intro{padding:28px 24px 20px}.app-intro h1{font-size:42px;margin:8px 0 14px}.app-intro em{font-weight:400;color:#65826a}.app-intro>p:last-child{color:var(--muted)}.app-library{display:grid;grid-template-columns:repeat(4,1fr);gap:24px;padding:0 24px}.app-book{text-decoration:none;min-width:0}.app-book img{width:100%;height:230px;object-fit:contain;padding:12px;border-radius:16px;background:#e8e5d8;box-shadow:0 4px 12px #193c3908}.app-book h2{font-size:23px;margin:12px 0 6px}.app-book p{font-size:12px;color:var(--muted)}.library-note{text-align:center;padding:10px 20px;font-size:12px;color:var(--muted)}.app-bottom{display:flex;justify-content:space-between;border-top:1px solid var(--line);padding:16px 24px;padding-bottom:max(16px,env(safe-area-inset-bottom));font-size:13px}.book-choice{display:grid;grid-template-columns:1fr 1fr;gap:38px;align-items:center;padding:30px}.book-choice>img{width:100%;height:440px;object-fit:contain}.book-choice h1{font-size:40px;margin:12px 0}.book-choice p{color:var(--muted)}.choice-actions{display:grid;gap:10px}.choice-actions p{margin:0;text-align:center}.book-app.in-book{height:100dvh;overflow:hidden}.in-book main{height:100dvh;min-height:0;display:flex;flex-direction:column;position:relative;background:#f5f1e6;max-width:850px}.app-state{display:flex;align-items:center;justify-content:center;gap:8px;min-height:27px;padding:4px 12px;background:#e9eee1;flex-shrink:0}.app-state p{font-size:11px;margin:0;line-height:1.3;text-align:center}.app-state button{font-size:11px;min-height:36px;padding:4px 8px}.error-text{color:#9a3d26}.studio-workspace{flex:1;min-height:0;display:flex;flex-direction:column;padding:10px 12px;gap:10px}.picture-scroll{overflow:auto;min-height:0;flex:1;border-radius:14px;background:#eee8da;overscroll-behavior:contain}.coloring .picture-scroll{touch-action:none}.picture-plane{min-width:100%;min-height:100%;display:flex;align-items:center;justify-content:center;width:max-content}.book-app #picture{line-height:0;flex-shrink:0;margin:auto}.book-app #picture>svg,.book-app #picture>img{display:block;width:100%;height:100%;object-fit:contain;max-width:none}.book-app #picture [role=button]{cursor:pointer;outline:none}.book-app #picture [role=button]:focus-visible{stroke:#102e59;stroke-width:7;stroke-dasharray:12 6}.reading .picture-scroll{flex:1;min-height:80px;overflow:hidden}.reading .picture-plane{height:100%;width:100%}.reading #picture{width:100%;height:100%}.studio-story{flex:0 1 auto;max-height:55%;overflow:auto;padding:8px 12px 0;overscroll-behavior:contain}.studio-story .eyebrow{font-size:10px;margin:0 0 7px}.studio-story h2{font-size:24px;margin:0 0 9px}.studio-story>p:last-child{font:19px/1.55 Georgia,serif;margin:0}.app-dock{background:var(--paper);border-top:1px solid var(--line);padding:12px 16px max(12px,env(safe-area-inset-bottom));flex-shrink:0}.studio-modes{display:grid;grid-template-columns:1fr 1fr;gap:6px;background:#eef0e6;padding:4px;border-radius:12px}.studio-modes button{border:0;min-height:40px;background:transparent;padding:8px;font-size:12px}.studio-modes button[aria-pressed=true]{background:var(--ink);color:white;box-shadow:0 2px 4px #193c391a}.book-app .color-hint{font-size:12px;text-align:center;margin:10px 0 4px;min-height:18px}.studio-palette{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:3px;margin:5px 0 10px}.studio-palette button{min-width:0;height:44px;padding:5px;background:transparent;border:2px solid transparent;border-radius:50%}.studio-palette span{width:30px;height:30px;border:1px solid #193c3940;border-radius:50%;background:var(--swatch)}.studio-palette button[aria-pressed=true]{border-color:var(--ink)}.studio-palette button[aria-pressed=true] span:after{content:'✓';color:#183b37;font-size:20px;font-weight:800}.dock-actions{display:flex;gap:6px}.dock-actions button{flex:1;padding:8px 6px;font-size:12px}.studio-pages{display:flex;justify-content:space-between;align-items:center;gap:12px}.studio-pages span{font-size:13px}.read-color{display:block!important;text-align:center;font-size:12px!important;width:100%;border:0!important;background:none!important;text-decoration:none;padding:8px!important;margin-top:5px;min-height:36px!important}.app-sheet{position:absolute;z-index:20;bottom:0;left:0;right:0;max-height:85%;overflow:auto;background:var(--paper);border:1px solid #cad4c3;border-radius:22px 22px 0 0;padding:22px;padding-bottom:max(22px,env(safe-area-inset-bottom));box-shadow:0 -100px 0 100vmax #102c2944}.sheet-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:15px}.sheet-heading h2{margin:0;font-size:28px}.app-sheet>.button,.app-sheet>button{margin:5px 6px 5px 0}.app-sheet p{font-size:14px}.app-sheet form{display:grid;gap:8px}.app-sheet label{font-size:13px}.notice{position:fixed;z-index:30;left:50%;top:50%;transform:translate(-50%,-50%);width:min(90vw,480px);padding:24px;background:var(--paper);border:1px solid var(--line);border-radius:18px;box-shadow:0 0 0 100vmax #193c3966}.actions{display:flex;flex-wrap:wrap;gap:10px}.studio-heading{padding:28px 24px}.studio-heading h1{font-size:38px;margin:0 0 12px}.studio-heading p{font-size:14px}.saved-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px;padding:0 24px 24px}.saved-card{background:var(--paper);border:1px solid var(--line);border-radius:16px;padding:18px;overflow-wrap:anywhere}.saved-card>img{width:100%;height:150px;object-fit:contain}.saved-card h2{font-size:26px;margin:12px 0}.saved-card p{font-size:13px}.book-finished{padding:24px;text-align:center;display:grid;justify-items:center;gap:15px}.book-finished img{height:230px;max-width:100%;object-fit:contain}.book-finished h1{font-size:36px;margin:0}.book-finished p{margin:0}#saved-list>p,#saved-list>.button{margin:20px 24px}
@media(max-width:650px){.app-top{padding-left:12px;padding-right:12px;gap:8px;min-height:58px}.app-top strong{font-size:13px}.app-library{grid-template-columns:1fr 1fr;gap:16px;padding:0 18px}.app-book img{height:175px;padding:8px}.app-book h2{font-size:20px;margin-top:8px}.app-intro{padding:20px 18px 16px}.app-intro h1{font-size:36px}.app-intro p{font-size:14px;margin-bottom:10px}.app-bottom{padding:14px 18px}.book-choice{display:flex;flex-direction:column;gap:16px;padding:20px}.book-choice>img{height:210px}.book-choice h1{font-size:30px}.book-choice .eyebrow{display:none}.book-choice p{font-size:14px}.saved-grid{grid-template-columns:1fr}.app-dock{padding-left:10px;padding-right:10px}}
@media(max-height:700px){.app-top{min-height:50px;padding-top:4px;padding-bottom:4px}.app-dock{padding-top:6px;padding-bottom:max(6px,env(safe-area-inset-bottom))}.color-hint{margin-top:5px!important}.studio-story h2{font-size:20px}.studio-story>p:last-child{font-size:18px;line-height:1.45}.book-choice>img{height:150px}.book-choice{gap:10px}.book-choice h1{font-size:26px}.book-choice>div>p:not(.eyebrow){display:none}}
@media(min-width:700px) and (max-height:550px){.in-book main{max-width:none}.studio-workspace{padding-right:310px}.app-dock{position:absolute;right:0;top:80px;bottom:0;width:300px;border-left:1px solid var(--line);display:flex;flex-direction:column;justify-content:center}.reading{flex-direction:row}.reading .picture-scroll{flex:1}.studio-story{width:45%;max-height:100%}.studio-palette{grid-template-columns:repeat(4,1fr)}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}}
body.book-app>header,body.book-app>footer,body.book-app>.skip-link{display:none}.book-app .app-top{position:static;width:auto;box-shadow:none}.book-app .app-top a{letter-spacing:normal}.book-app main>.app-top{margin:0}
@media(max-width:360px){.studio-palette{grid-template-columns:repeat(4,1fr);gap:0;margin:2px 0 5px}.studio-palette button{justify-self:center;width:44px}.color-hint{font-size:11px!important}}
body.book-app>#sp-site-header{display:none!important}.book-app .app-library .app-book h2{font-family:Georgia,serif;letter-spacing:normal}
.book-app .app-dock{margin:0;width:auto;max-width:none}.book-app .app-top{margin:0}.book-app .app-dock button{box-shadow:none;letter-spacing:normal}

/* Reserve illustration space from the viewport, never from the length of the story. */
.studio-workspace.reading{padding-top:4px;gap:6px}
.reading-visual{flex:0 0 auto;min-width:0}
.reading .picture-scroll{flex:none;height:min(calc((100vw - 24px) * .75),36svh);min-height:0;background:transparent}
.reading .picture-plane{align-items:flex-start}
.reading #picture>img{object-position:center top}
.reading .studio-story{flex:1;min-height:0;max-height:none;padding-top:4px}
.book-app .picture-color-action{display:flex;align-items:center;justify-content:center;gap:8px;min-height:44px;width:100%;margin:2px 0 0;padding:6px 12px;border:0;background:transparent;font-size:13px}
.picture-color-action svg{flex-shrink:0}
@media(min-width:700px) and (max-height:550px){
 .reading .reading-visual{width:55%}
 .reading .picture-scroll{height:calc(100svh - 160px)}
 .reading .studio-story{width:auto;flex:1}
}

/* Reading is the main next step; account saving is optional. */
.dock-actions{display:grid;grid-template-columns:1fr 1fr 1.35fr}
.dock-actions .continue-reading{grid-column:1/-1;grid-row:2;font-size:15px;min-height:46px}
.book-app .continue-note{margin:6px 0 0;text-align:center;font-size:12px;line-height:1.35;color:var(--muted)}
#save-panel #skip-save{width:100%;margin:12px 0 0}

.app-loading{padding:48px 24px;text-align:center}.app-loading p{font:20px/1.5 Georgia,serif}.app-loading a{font-size:13px}

/* A single-screen, swipeable bookshelf on phones. */
body.in-library{height:100dvh;overflow:hidden}
.in-library main{height:100dvh;min-height:0;display:flex;flex-direction:column}
.in-library .app-intro{padding:16px 20px 12px;flex-shrink:0}
.in-library .app-intro h1{font-size:34px;margin:0 0 6px}
.in-library .app-intro p{font-size:14px;margin:0}
.in-library .swipe-books{--book-width:min(78vw,300px);display:flex;flex:1;min-height:0;gap:16px;padding:0 calc((100% - var(--book-width))/2);overflow-x:auto;overflow-y:hidden;scroll-snap-type:x mandatory;overscroll-behavior-x:contain;scrollbar-width:none}
.swipe-books::-webkit-scrollbar{display:none}
.in-library .app-book{flex:0 0 var(--book-width);height:100%;min-height:0;display:flex;flex-direction:column;scroll-snap-align:center;scroll-snap-stop:always}
.in-library .app-book img{display:block;flex:1;min-height:0;height:0;width:100%;padding:12px;object-fit:contain}
.in-library .app-book h2{font-size:23px;line-height:1.15;height:53px;flex-shrink:0;margin:12px 0 4px}
.in-library .app-book p{font-size:13px;margin:0;flex-shrink:0}
.shelf-navigation{padding:10px 20px 0;flex-shrink:0}
.shelf-controls{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:8px}
.shelf-controls button{min-width:48px;font-size:22px;padding:6px}
#book-position{font-size:13px;font-weight:600}
#open-book{display:flex;width:100%;min-height:46px}
.in-library .library-note{flex-shrink:0;margin:0;padding:10px 16px max(10px,env(safe-area-inset-bottom));font-size:12px}
@media(min-width:700px){
 .in-library .app-intro p{display:none}
 .in-library .swipe-books{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));padding:0 24px;gap:24px;overflow:visible}
 .in-library .app-book{min-width:0}
 .in-library .app-book h2{font-size:22px;height:76px}
 .in-library .shelf-navigation{display:none}
}
/* Preserve access when browser zoom or a very short window needs more room. */
@media(max-height:480px){body.in-library{height:auto;overflow:auto}.in-library main{height:480px;min-height:480px}}
