:root{font-family:system-ui,-apple-system,sans-serif;color:#2a3f4c;background:#f7f5ef;--accent:#4c6f84}*{box-sizing:border-box}body{margin:0}button,input,textarea,select{font:inherit}button,a,input,select,textarea{-webkit-tap-highlight-color:transparent}button{cursor:pointer;min-height:44px;border:1px solid #c0d1db;border-radius:12px;background:#fffef9;color:#2a3f4c;padding:10px 16px;font-weight:650}button:hover{background:#e6eef3}button:disabled{opacity:.4;cursor:default}.primary{background:#4c6f84;color:white;border-color:#4c6f84}.primary:hover{background:#3d5e73}a{color:inherit;text-decoration:none}button:focus-visible,a:focus-visible{outline:3px solid #c79340;outline-offset:3px}[hidden]{display:none!important}.top{max-width:1160px;margin:auto;padding:16px 24px;display:flex;justify-content:space-between;align-items:center}.top a{padding:10px 0;font-weight:650}.test-tag,.eyebrow{font-size:12px;font-weight:750;letter-spacing:.13em}.test-tag{border:1px solid #c0d1db;border-radius:6px;padding:5px 8px}main{max-width:1160px;margin:auto;padding:0 24px 40px}.intro{display:flex;align-items:center;justify-content:space-between;gap:18px;margin:12px 0 28px}.intro h1{font-size:clamp(32px,6vw,46px);line-height:1.1;margin:8px 0 12px;letter-spacing:-.04em}.intro p:not(.eyebrow){margin:0;color:#50768e;max-width:510px;line-height:1.6}.eyebrow{color:#50778f;margin:0}.intro img{border-radius:28px;object-fit:contain;width:112px;height:112px;mix-blend-mode:multiply}.shelf-actions,.book-actions,.editor-top,.reorder,.image-actions{display:flex;flex-wrap:wrap;gap:10px;align-items:center}.books{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:20px;margin:28px 0}.book-card{background:white;border:1px solid #cddde7;border-radius:20px;padding:18px;box-shadow:0 8px 24px #1f2d3606}.book-cover{height:185px;width:100%;border:0;border-left:8px solid var(--book-color);border-radius:8px;background:#f3f0e5;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px}.book-cover img{max-width:100%;height:110px;object-fit:contain}.book-card h2{font-size:20px;overflow-wrap:anywhere;margin:16px 0 5px}.book-card p{color:#557e97;font-size:14px;margin:0 0 14px}.book-card .card-tools{display:flex;gap:8px}.empty{text-align:center;background:#e5edf2;padding:44px 20px;border-radius:18px;color:#537b94;grid-column:1/-1}.note,.hint{font-size:14px;line-height:1.6;color:#567f98}.note{margin:22px 0}.editor-top{justify-content:space-between;margin-bottom:18px}#save-status{font-size:13px;color:#4c7087}.book-settings{display:grid;grid-template-columns:2fr 1.4fr 1fr 1fr;gap:14px;padding:18px;background:#e3ecf1;border-radius:16px;margin-bottom:24px}label{display:flex;flex-direction:column;gap:7px;font-size:14px;font-weight:650}label small{font-weight:400}input,textarea,select{width:100%;border:1px solid #c0d1db;background:#fffefb;border-radius:9px;padding:11px;color:#2a3f4c;min-height:44px}textarea{resize:vertical;line-height:1.55;min-height:145px}input:focus,textarea:focus,select:focus{outline:2px solid #80a2b8;outline-offset:1px}.workbench{display:grid;grid-template-columns:146px minmax(240px,1fr) 290px;gap:24px;align-items:start}.rail-heading{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.rail-heading h2,.page-fields h2{font-size:18px;margin:0}.rail-heading button{padding:5px 12px}#page-list{display:flex;flex-direction:column;gap:10px}.thumbnail{display:flex;align-items:center;gap:9px;padding:8px;text-align:left;background:#fff;min-width:0;border:2px solid transparent}.thumbnail[aria-current=true]{border-color:#4c6f84;background:#e9f0f4}.thumbnail img,.thumbnail .mini-cover{width:40px;height:52px;object-fit:contain;border-radius:4px;background:#f2efe5}.mini-cover{display:grid;place-items:center;font-size:22px}.thumbnail span:last-child{font-size:13px}.page-area{min-width:0}.story-page{container-type:inline-size;aspect-ratio:148/210;display:flex;flex-direction:column;padding:7%;background:#fffef9;border:1px solid #e2dfd3;border-radius:4px;box-shadow:0 12px 38px #27394412;position:relative;overflow:hidden;color:#2b404d}.page-inner{display:flex;flex-direction:column;flex:1;min-height:0;gap:5cqw}.page-inner h2{font-size:8cqw;line-height:1.15;letter-spacing:-.025em;margin:0;overflow-wrap:anywhere;text-align:center;color:var(--book-color)}.story-image{flex:1 1 0;min-height:0;display:flex;align-items:center;justify-content:center;overflow:hidden}.story-image img{height:100%;width:100%;object-fit:contain;border-radius:4px}.story-text{font-size:5cqw;line-height:1.5;white-space:pre-wrap;overflow-wrap:anywhere;margin:0;flex:0 0 auto}.story-page[data-size=small] .story-text{font-size:4.4cqw}.story-page[data-size=large] .story-text{font-size:5.6cqw}.page-author{font-size:4.3cqw;text-align:center;margin:0;color:#547d96}.page-footer{font-size:2.8cqw;display:flex;justify-content:space-between;border-top:1px solid #d4e2ea;margin-top:5cqw;padding-top:2cqw;color:#6991aa}.cover-page{border-left:8px solid var(--book-color)}.cover-page .page-inner{gap:6cqw}.cover-page .story-image{min-height:10px}.cover-page .page-footer{border:0;justify-content:center}.cover-page h2{padding-top:5cqw}.image-placeholder{height:100%;min-height:100px;width:100%;border:1px dashed #c0d1dc;border-radius:12px;display:grid;place-items:center;color:#7ea1b6;font-size:clamp(14px,4cqw,22px);text-align:center;padding:16px}.page-nav,.reader-nav{display:flex;justify-content:center;align-items:center;gap:20px;margin-top:16px;font-size:14px;color:#547d96}.page-fields .hint{margin:10px 0 16px}.page-fields>label{margin-top:16px}#text-count{display:block;color:#6891aa;text-align:right;margin-top:5px}.image-actions{margin:18px 0}.image-actions button{flex:1 1 100%}.quiet{background:transparent}.danger{color:#9a5045;border-color:#e4ccc6}.reorder{margin-top:18px}.reorder button{flex:1;font-size:13px;padding:9px}.book-actions{margin-top:28px;padding-top:20px;border-top:1px solid #cedde7}dialog{border:0;border-radius:20px;padding:24px;color:#2a3f4c;background:#fffef9;max-width:min(650px,calc(100vw - 24px));max-height:90dvh;overflow:auto}dialog::backdrop{background:#1f2d3699;backdrop-filter:blur(3px)}.dialog-head,.reader-top{display:flex;justify-content:space-between;align-items:center;gap:18px;margin-bottom:16px}.dialog-head h2{margin:0;font-size:24px}.dialog-head button,.reader-top button{font-size:24px;padding:0;width:44px;flex-shrink:0}.art-options{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}.art-options button{padding:9px;display:flex;flex-direction:column;gap:6px;align-items:center;font-size:13px}.art-options img{width:100%;aspect-ratio:1;object-fit:contain;border-radius:8px}.message{position:fixed;bottom:20px;left:50%;transform:translateX(-50%);max-width:calc(100vw - 24px);background:#2a3f4c;color:white;padding:14px 22px;border-radius:14px;box-shadow:0 5px 25px #0002;z-index:100}.message.error{background:#994e41}#reader{width:min(520px,100%);max-height:100dvh;padding:18px;background:#f7f5ef}#reader-title{font-size:14px;overflow-wrap:anywhere}#reader-page{max-width:100%;margin:auto;width:min(410px,calc((100dvh - 170px)*.705))}.reader-nav{margin-bottom:0}.reader-nav button{min-width:65px}.reader-top{margin-bottom:12px}.reader-nav span{min-width:90px;text-align:center}.reader-nav button{font-size:22px}.dialog-actions{margin-top:20px}#print-dialog p{line-height:1.7}#print-summary{font-weight:650;color:#496d83}
@media screen and (min-width:900px){#page-preview{max-width:420px;margin:auto}.page-fields{position:sticky;top:16px}}@media screen and (max-width:900px){.workbench{grid-template-columns:110px minmax(220px,1fr) 240px;gap:16px}.book-settings{grid-template-columns:1fr 1fr}}@media screen and (max-width:700px){.top{padding:10px 18px}main{padding:0 16px 24px}.intro{margin:12px 0 24px}.intro img{width:84px;height:84px}.intro p:not(.eyebrow){font-size:14px}.eyebrow{font-size:10px}.book-settings{padding:14px;gap:12px}.book-settings label{font-size:12px}.workbench{display:flex;flex-direction:column;gap:20px}.page-sidebar,.page-area,.page-fields{width:100%}.rail-heading{margin-bottom:8px}#page-list{flex-direction:row;overflow-x:auto;padding-bottom:5px}.thumbnail{flex:0 0 auto;padding:6px}.thumbnail img,.thumbnail .mini-cover{width:32px;height:40px}.thumbnail span:last-child{font-size:12px}#page-preview{max-width:390px;margin:auto}.page-fields{background:#e3ecf1;border-radius:16px;padding:18px}.page-fields .hint{margin:8px 0}.image-actions button{flex:1 1 42%}.image-actions .quiet{flex-basis:100%}.book-actions{display:grid;grid-template-columns:1fr 1fr;position:static}.shelf-actions{display:grid;grid-template-columns:1fr 1fr}.shelf-actions .primary{grid-column:1/-1}.books{grid-template-columns:1fr 1fr;gap:12px}.book-card{padding:12px}.book-cover{height:150px}.book-cover img{height:85px}.book-card h2{font-size:17px}.book-card .card-tools{flex-wrap:wrap}.art-options{grid-template-columns:repeat(3,1fr);gap:8px}.art-options button{font-size:11px;padding:5px}dialog{padding:18px}#reader{max-width:100vw;border-radius:0}}@media screen and (max-width:370px){.books{grid-template-columns:1fr}.book-settings{grid-template-columns:1fr}.book-actions{grid-template-columns:1fr}}

#reader-page{touch-action:pan-y}
/* Edit the page itself; keep secondary actions contextual. */
body.editing-book .intro{display:none}
body.editing-book main{padding-top:16px;max-width:850px}
.editor-top{display:grid;grid-template-columns:1fr auto auto;gap:6px 10px;margin-bottom:14px}
.editor-top #to-shelf{justify-self:start}
#save-status{grid-column:1/-1;grid-row:2;justify-self:end;font-size:11px;min-height:16px}
.icon-button{width:44px;padding:0;font-size:26px;line-height:1}
.workbench{grid-template-columns:130px minmax(0,1fr);max-width:700px;margin:0 auto;gap:28px}
.page-area{max-width:430px;margin:auto;width:100%}
.edit-hint{color:#59849e;text-align:center;font-size:12px;line-height:1.4;margin:0 0 10px}
#page-list{max-height:70dvh;overflow:auto}
#page-preview .story-page [data-edit]{cursor:pointer;border-radius:6px;outline:1px dashed #6b93ac60;outline-offset:4px;transition:background .12s}
#page-preview .story-page [data-edit]:hover{background:#dde8ef66;outline-color:#5b87a3}
#page-preview .story-page [data-edit]:focus-visible{outline:3px solid #c79340;outline-offset:3px}
#page-preview .story-image{position:relative;min-height:60px}
#page-preview .story-text{min-height:44px}
#page-preview .page-author{min-height:30px;display:grid;place-items:center}
.edit-placeholder{color:#7b9fb5;font-style:italic}
.image-placeholder{border:0;gap:4px;align-content:center;font-size:4cqw}
.image-placeholder span{font-size:10cqw;line-height:1.3}
.edit-mark{position:absolute;right:8px;bottom:8px;border:1px solid #c5d5df;border-radius:50%;width:25px;height:25px;display:grid;place-items:center;background:#fffef9e6;color:#517891;font-size:15px}
.page-nav{gap:12px;margin-top:12px}
.page-nav #page-count{min-width:60px;text-align:center}
#page-more{font-size:23px}
#book-dialog,#text-dialog{width:480px}
#book-dialog label{margin-top:16px}
.settings-pair{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.dialog-actions{display:flex;justify-content:flex-end}
#text-dialog textarea{margin-top:8px}
.actions-dialog{width:350px}
.actions-dialog>button{display:block;width:100%;text-align:left;margin-top:10px;border-color:transparent;background:#e7eff4}
.actions-dialog>button:hover{background:#dce7ee}
.upload-button{width:100%;margin:0 0 20px;background:#e5eef3}
#image-settings{margin-top:20px;display:grid;grid-template-columns:1fr auto;gap:12px;align-items:end}
#image-settings button{font-size:13px}
@media screen and (max-width:900px){.workbench{grid-template-columns:110px minmax(0,1fr);gap:20px}}
@media screen and (max-width:700px){
 body.editing-book main{padding-top:12px;padding-bottom:16px}
 .editor-top{margin-bottom:12px;gap:4px 8px}
 .editor-top button{font-size:14px;padding:8px 12px}
 .editor-top .icon-button{padding:0;font-size:26px}
 .workbench{display:flex;gap:14px}
 .page-sidebar{display:flex;gap:10px;align-items:center}
 .rail-heading{order:2;margin:0;flex:none}
 .rail-heading h2{display:none}
 .rail-heading button{height:52px;width:44px;padding:0;font-size:25px;background:transparent;border-style:dashed}
 #page-list{display:flex;flex:1;max-height:none;min-width:0;gap:7px;padding:0 0 4px}
 .thumbnail{gap:6px;padding:4px 6px;min-height:52px;border-radius:8px}
 .thumbnail img,.thumbnail .mini-cover{width:26px;height:36px}
 .thumbnail span:last-child{font-size:11px;white-space:nowrap}
 .page-area{width:min(390px,calc((100svh - 275px)*.705));min-width:210px;max-width:100%;margin:auto}
 .page-nav{gap:9px}
 .page-nav button{padding:6px 10px;min-width:42px}
 .edit-hint{font-size:11px;margin:0 0 9px}
 #image-settings{grid-template-columns:1fr}
 #image-settings button{justify-self:end}
}

.story-brand{display:flex;align-items:center;flex-wrap:wrap;gap:7px}
.story-brand img{display:block;object-fit:contain;flex:none}
.story-brand span{margin-left:4px}
#to-shelf{display:flex;align-items:center;gap:6px}
#to-shelf img{object-fit:contain;flex:none}
.cover-brand{display:flex;align-items:center;justify-content:center;gap:1.2cqw;opacity:.8}
.cover-brand img:first-child{width:6cqw;height:6cqw;object-fit:contain}
.cover-brand img:last-child{width:18cqw;height:6cqw;object-fit:contain}
.cover-page .page-footer{margin-top:3cqw;padding-top:0}
.intro .story-brand img:first-child{width:26px;height:26px;border-radius:0;mix-blend-mode:normal}
.intro .story-brand img:nth-child(2){width:74px;height:24px;border-radius:0;mix-blend-mode:normal}

/* Theme frames keep decoration in a dedicated margin around the picture. */
.story-page{background:var(--theme-paper,#fffef9)}
.story-image.has-frame{position:relative;padding:5cqw;border-radius:3cqw;background:var(--theme-mat,#e4edf2);isolation:isolate}
.story-image.has-frame>img{min-height:0;min-width:0;border-radius:1.5cqw}
.story-frame{position:absolute;inset:0;z-index:1;display:block;pointer-events:none;overflow:hidden;border-radius:3cqw}
.frame-line{position:absolute;inset:1.6cqw;border:.45cqw solid var(--frame-soft);border-radius:2cqw;display:block}
.frame-corner{position:absolute;width:14cqw;height:14cqw;max-width:32%;max-height:40%;overflow:visible}
.frame-tl{left:0;top:0}.frame-tr{right:0;top:0;transform:scaleX(-1)}
.frame-bl{left:0;bottom:0;transform:scaleY(-1)}.frame-br{right:0;bottom:0;transform:scale(-1)}
.frame-waves{position:absolute;bottom:.5cqw;left:13cqw;width:calc(100% - 26cqw);height:4cqw}
.story-image .edit-mark{z-index:2;right:5.5cqw;bottom:5.5cqw}
#theme-preview{display:flex;align-items:center;justify-content:center;gap:18px;margin-top:18px;background:#f4f3ed;padding:12px;border-radius:12px;font-size:14px;color:#4d738a}
.theme-sample{position:relative;display:block;width:105px;height:92px;container-type:inline-size;padding:14px;background:var(--theme-mat);border-radius:8px;isolation:isolate}
.theme-sample>img{display:block;width:100%;height:100%;object-fit:contain;border-radius:3px}
.theme-sample .story-frame{border-radius:8px}
.theme-sample .frame-corner{width:30px;height:30px;max-width:none;max-height:none}
.theme-sample .frame-line{inset:4px;border-width:1.5px;border-radius:5px}
.theme-sample .frame-waves{left:25px;width:calc(100% - 50px);height:8px;bottom:1px}
#image-settings{margin:0 0 18px;padding:0 0 16px;border-bottom:1px solid #d1e0e9}

.editor-top{grid-template-columns:minmax(0,1fr) auto auto auto}
#voice-page{display:grid;place-items:center;position:relative}
#voice-page.has-recording:after{content:'';position:absolute;width:7px;height:7px;border-radius:50%;background:#57809a;right:5px;top:5px}
#voice-dialog{width:500px}
.voice-text{font-size:18px;line-height:1.55;white-space:pre-wrap;background:#e8eff4;padding:16px;border-radius:12px;max-height:30dvh;overflow:auto}
#voice-status{font-size:14px;line-height:1.5;min-height:24px;color:#4e738a}
#voice-playback,#reader-audio{width:100%;height:42px}
.voice-buttons{display:flex;gap:10px;flex-wrap:wrap;margin-top:16px}
.record-stop{background:#f1e4df;color:#943e32;border-color:#d1a599}
#reader-voice{margin:10px auto 0;max-width:410px}
#reader.has-voice #reader-page{width:min(410px,calc((100dvh - 230px)*.705))}
@media screen and (max-width:380px){.editor-top #to-shelf{font-size:12px;padding-left:0;padding-right:0}.editor-top #to-shelf img{display:none}}

/* A clear, labelled narration action directly beneath the edited page. */
.editor-top{grid-template-columns:minmax(0,1fr) auto auto}
.voice-action{margin-top:12px}
#voice-page.voice-page-button{display:flex;align-items:center;justify-content:center;gap:10px;min-height:48px;width:100%;padding:10px 14px;border:1.5px solid #84a5ba;border-radius:13px;background:#dee9ef;color:#3d5e73;font-size:16px;line-height:1.25}
#voice-page.voice-page-button:hover{background:#d0dfe8}
#voice-page.has-recording:after{right:12px;top:10px}
#reader-voice{padding:7px;border:1px solid #bdcfda;border-radius:14px;background:#e2ebf1}
#reader-audio{display:block}
.reader-audio-status{font-size:13px;color:#426276;line-height:1.4;margin:5px 6px 2px;text-align:center}
@media screen and (max-width:700px){.page-area{width:min(390px,calc((100svh - 335px)*.705))}}

/* Child materials are a reading shelf; editing stays in the parent tool. */
.child-visibility{flex-direction:row;align-items:center;gap:10px;line-height:1.5;cursor:pointer}
.child-visibility input{width:22px;height:22px;min-height:22px;padding:0;flex:none;accent-color:#4c6f84}
.child-library .intro{margin-bottom:12px}
.child-library .intro>img{display:none}
.child-library .book-cover{min-height:185px}
.child-library .book-card{--book-color:#4c6f84}
.child-library .book-cover span{font-size:11px;letter-spacing:.06em}
.photo-actions{display:flex;gap:10px;margin-bottom:20px;flex-wrap:wrap}
.photo-actions .upload-button{flex:1 1 160px;width:auto;margin:0}
#take-photo{background:#d6e3eb;border-color:#84a5ba}
#reader.has-voice #reader-page{width:min(410px,calc((100dvh - 270px)*.705))}

.child-home-link{display:block;padding:14px;background:#dee9ef;border-radius:12px;font-weight:700;text-align:center}
#child-rest{max-width:420px;line-height:1.6}

.top-actions,.editor-actions{display:flex;align-items:center;gap:8px}
.editor-top{grid-template-columns:minmax(0,1fr) auto}
.editor-actions{grid-column:2;grid-row:1;justify-self:end}
.child-library .material-help-button{display:none}

.editor-actions .material-help-button{font:italic 700 24px/1 Georgia,serif;padding:0}

body.child-library .material-nav .material-parent-link{display:none}
@media screen and (max-width:700px){body.editing-book .page-area{width:min(390px,calc((100svh - 405px)*.705))}}

.page-footer{align-items:center;gap:2cqw}.cover-brand{justify-content:flex-start;flex-shrink:0}.cover-page .page-footer{justify-content:flex-start}.page-footer-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:center;flex:1}

@media screen and (max-width:620px){.editor-top{grid-template-columns:1fr}.editor-actions{grid-column:1;grid-row:2;justify-self:stretch;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) 44px}.editor-actions button{font-size:13px;padding:8px}#save-status{grid-row:3}}

.fit-modes{margin:0;padding:0;border:0;min-width:0}.fit-modes legend{font-size:14px;font-weight:650;margin-bottom:10px}.fit-mode-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.fit-mode-grid>button{padding:10px;background:#fffef9;border:2px solid #cbd9e2;text-align:left;display:flex;flex-direction:column;gap:9px;min-width:0}.fit-mode-grid>button[aria-pressed=true]{border-color:#4c6f84;background:#e6eef3;box-shadow:0 0 0 1px #4c6f84}.fit-mode-preview{display:block;width:100%;height:130px;border:1px solid #cad8e1;border-radius:8px;overflow:hidden;background:white}.fit-mode-preview img{display:block;width:100%;height:100%;border-radius:0}.fit-mode-grid strong{font-size:14px;line-height:1.35}.fit-mode-note{font-size:12px;line-height:1.45;font-weight:400;color:#4e738a}#image-settings{grid-template-columns:1fr}#image-settings #remove-image{justify-self:end}@media screen and (max-width:480px){.fit-mode-grid{gap:8px}.fit-mode-grid>button{padding:8px}.fit-mode-preview{height:110px}.fit-mode-grid strong{font-size:13px}}

.editor-actions{display:flex;flex-wrap:wrap;justify-content:flex-end}.editor-actions #book-more{width:auto;min-width:0;font-size:14px;padding:10px 14px}.page-actions-row{display:flex;justify-content:center;margin:12px 0}.page-actions-row #page-more{width:auto;max-width:100%;font-size:14px;padding:9px 16px;line-height:1.3}
