/* Story creation extends the existing studio surface and its semantic tokens. */
#childrenStory{max-width:1100px;margin-inline:auto;--story-field:var(--ui-input);--story-field-text:var(--ui-text);color:var(--ui-text)}
#childrenStory [hidden]{display:none!important}
#childrenStory .story-heading{display:flex;align-items:center;justify-content:space-between;gap:24px;padding:24px 0}
#childrenStory h1{font-size:clamp(23px,3vw,32px);line-height:1.6;margin:0 0 8px}
#childrenStory h2{font-size:22px;margin:0 0 24px;line-height:1.7}
#childrenStory h3{font-size:18px;line-height:1.7}
#childrenStory p{line-height:1.95;max-width:72ch}
#childrenStory .story-heading p{margin:0;color:var(--ui-muted)}
#childrenStory :is(.story-hint,.story-billing-note){color:var(--ui-muted);opacity:1;font-size:14px}
#childrenStory .story-form{padding:clamp(16px,3vw,32px);margin:0;overflow:visible}
#childrenStory .story-form>section{min-height:320px;padding-block:32px}
#childrenStory .story-builder-steps{display:flex;gap:8px;border-bottom:1px solid var(--ui-line);padding-bottom:20px}
#childrenStory .story-builder-steps button{display:flex;align-items:center;gap:8px;flex:1;justify-content:center;background:transparent;border:0;color:var(--ui-muted);padding:10px 4px;font:inherit;font-size:14px;cursor:pointer}
#childrenStory .story-builder-steps button span{display:grid;place-items:center;width:28px;height:28px;border-radius:50%;background:var(--ui-input)}
#childrenStory .story-builder-steps [aria-current=step]{color:var(--ui-accent);font-weight:700}
#childrenStory .story-builder-steps [aria-current=step] span{background:var(--ui-accent);color:var(--ui-accent-on)}
#childrenStory label{display:grid;gap:10px;font-size:14px;font-weight:500}
#childrenStory :is(input:not([type=checkbox]):not([type=range]),textarea,select){width:100%;min-width:0;background:var(--ui-input);color:var(--ui-text);border:1px solid var(--ui-line);border-radius:12px;padding:12px 14px;font:inherit;font-size:16px;caret-color:var(--ui-accent)}
#childrenStory textarea{line-height:2;resize:vertical;min-height:140px}
#childrenStory textarea::placeholder,#childrenStory input::placeholder{color:var(--ui-muted);opacity:1}
#childrenStory :is(button,a,input,select,textarea,summary):focus-visible{outline:3px solid var(--ui-accent);outline-offset:4px}
#childrenStory button{font:inherit;min-height:44px;cursor:pointer}
#childrenStory button:disabled{opacity:.55;cursor:not-allowed}
#childrenStory :is(.primary-btn,.secondary-btn){display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:12px 18px}
#childrenStory button svg{width:20px;height:20px;flex-shrink:0}
#childrenStory details{padding-block:20px;border-top:1px solid var(--ui-line);margin-top:24px}
#childrenStory summary{cursor:pointer;color:var(--ui-accent);min-height:44px;padding-block:8px;font-weight:600}
#childrenStory .story-catalog{grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}
#childrenStory .story-card{border:1px solid var(--ui-line);border-radius:12px;background:var(--ui-input);overflow:hidden;text-align:right;color:var(--ui-text);padding:0;transform:none}
#childrenStory .story-card.selected{border:2px solid var(--ui-accent)}
#childrenStory .story-card img{width:100%;height:auto;aspect-ratio:3/2;object-fit:cover}
#childrenStory .story-card>span{padding:16px;display:grid;gap:8px}
#childrenStory .story-card strong{font-size:17px}
#childrenStory .story-card small{color:var(--ui-muted);opacity:1;line-height:1.9}
#childrenStory .story-builder-actions{display:flex;align-items:center;justify-content:space-between;gap:16px;border-top:1px solid var(--ui-line);padding-top:24px}
#childrenStory [data-draft-status]{color:var(--ui-muted);font-size:12px;margin-inline-end:auto}
#childrenStory .story-settings-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:24px}
#childrenStory .story-image-count{margin-top:32px}
#childrenStory input[type=range]{width:100%;accent-color:var(--ui-accent);min-height:44px;direction:ltr}
#childrenStory output{color:var(--ui-accent);font-weight:600}
#childrenStory .story-child{grid-template-columns:repeat(2,minmax(0,1fr));padding-block:24px;border-bottom:1px solid var(--ui-line);margin:0 0 24px;gap:20px;align-items:start}
#childrenStory .story-child-tools{display:flex;gap:12px;flex-wrap:wrap;grid-column:1/-1}
#childrenStory .story-child-photo{display:grid;gap:12px;grid-column:1/-1}
#childrenStory .story-child-photo img{width:100px;height:100px;object-fit:cover;border-radius:12px}
#childrenStory .story-child-photo small{color:var(--ui-muted)}
#childrenStory [data-character-list],#childrenStory [data-server-drafts]{display:flex;gap:12px;flex-wrap:wrap}
#childrenStory [data-character-list]>div{display:flex;gap:4px}
#childrenStory .story-policy-topics{display:flex;gap:20px;flex-wrap:wrap;border:0;padding:20px 0}
#childrenStory .story-policy-topics label{display:flex;align-items:center;gap:8px}
#childrenStory input[type=checkbox]{width:20px;height:20px;accent-color:var(--ui-accent)}
#childrenStory .story-review-summary{margin:0;display:grid;gap:0}
#childrenStory .story-review-summary>div{display:grid;grid-template-columns:120px 1fr;gap:16px;padding:14px 0;border-bottom:1px solid var(--ui-line)}
#childrenStory dt{color:var(--ui-muted)}
#childrenStory dd{margin:0;white-space:pre-wrap;overflow-wrap:anywhere;max-height:180px;overflow:auto;line-height:1.9}
#childrenStory .story-estimate{display:flex;align-items:start;flex-direction:column;gap:6px;padding:24px 0;color:var(--ui-text)}
#childrenStory .story-estimate strong{font-size:26px;color:var(--ui-accent)}
#childrenStory .story-estimate :is(span,small){color:var(--ui-muted)}
#childrenStory :is(.story-error,.story-action-error){color:var(--ui-danger);padding:12px 0;line-height:1.9}
#childrenStory .story-error:empty,#childrenStory .story-action-error:empty{display:none}
#childrenStory .story-project{margin:0;padding:clamp(16px,3vw,32px)}
#childrenStory .story-output-heading{align-items:start}
#childrenStory .story-output-heading span{color:var(--ui-muted);white-space:nowrap}
#childrenStory .story-cover{margin:0}
#childrenStory .story-cover img{width:100%;border-radius:16px;object-fit:contain}
#childrenStory figcaption{font-size:12px;color:var(--ui-muted);padding-block:10px}
#childrenStory .story-player{border:1px solid var(--ui-line);border-radius:16px;padding:20px;background:var(--ui-input)}
#childrenStory .story-player-label{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
#childrenStory .story-player-label>span{display:flex;align-items:center;gap:8px}
#childrenStory .story-player-label svg{width:22px;height:22px}
#childrenStory .story-player-label small{color:var(--ui-muted)}
#childrenStory .story-sound-bars{display:none}
#childrenStory .story-player-timeline{padding-top:20px}
#childrenStory .story-player-timeline>div{display:flex;justify-content:space-between;font-variant-numeric:tabular-nums;font-size:13px}
#childrenStory .story-player-controls{display:flex;justify-content:center;gap:12px;padding-top:20px}
#childrenStory .story-player-controls button{position:relative;border:1px solid var(--ui-line);border-radius:12px;background:var(--ui-surface);color:var(--ui-text);min-width:44px;display:grid;place-items:center}
#childrenStory .story-player-controls svg{width:24px;height:24px}
#childrenStory .story-player-controls b{position:absolute;font-size:10px;top:16px;pointer-events:none}
#childrenStory .story-player-controls .story-play{width:54px;height:54px;background:var(--ui-accent);color:var(--ui-accent-on);border:0}
#childrenStory .story-transfer progress{width:100%;accent-color:var(--ui-accent)}
#childrenStory .story-downloads{display:flex;flex-wrap:wrap;align-items:center;gap:12px;margin-top:20px}
#childrenStory .story-downloads a{display:inline-flex;gap:8px;align-items:center;min-height:44px;color:var(--ui-accent)}
#childrenStory .story-downloads svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.7}
#childrenStory .story-circle-publish{margin-top:20px}
#childrenStory .story-production{padding-top:24px}
#childrenStory .story-production-hero{display:flex;gap:20px;align-items:center}
#childrenStory .story-orbit svg{width:48px;height:48px;color:var(--ui-accent)}
#childrenStory .story-production-track{height:6px;border-radius:3px;overflow:hidden;background:var(--ui-line);margin-block:24px}
#childrenStory .story-production-track>span{display:block;height:100%;background:var(--ui-accent)}
#childrenStory .story-production-stages{display:grid;grid-template-columns:repeat(3,1fr);gap:24px}
#childrenStory .story-production-step{display:grid;gap:8px;color:var(--ui-muted)}
#childrenStory .story-production-step.is-active{color:var(--ui-accent)}
#childrenStory .story-production-step svg{width:24px;height:24px}
#childrenStory .story-production-step small,#childrenStory .story-production-step b{font-size:12px;font-weight:400}
#childrenStory .story-final-text{line-height:2.2;white-space:pre-wrap;max-width:72ch}
#childrenStory ::selection{background:var(--ui-accent);color:var(--ui-accent-on)}
@media(max-width:700px){#childrenStory .story-heading{align-items:start;flex-direction:column;gap:12px}#childrenStory .story-builder-steps{gap:4px}#childrenStory .story-builder-steps button{flex-direction:column;font-size:12px;gap:8px}#childrenStory .story-settings-grid,#childrenStory .story-child{grid-template-columns:1fr}#childrenStory .story-catalog{grid-template-columns:1fr}#childrenStory .story-card{display:grid;grid-template-columns:100px 1fr;align-items:center}#childrenStory .story-card img{height:100%;object-fit:cover;aspect-ratio:auto}#childrenStory .story-builder-actions{flex-wrap:wrap;position:sticky;bottom:0;background:var(--ui-surface);padding:16px 0;z-index:2}#childrenStory [data-draft-status]{order:3;flex-basis:100%}#childrenStory .story-review-summary>div{grid-template-columns:84px 1fr}#childrenStory .story-production-stages{gap:12px}#childrenStory .story-production-step small{display:none}#childrenStory .story-output-heading span{white-space:normal}}
@media(prefers-reduced-motion:reduce){#childrenStory *{animation:none!important;transition:none!important;scroll-behavior:auto!important}}

/* Stories are a workspace page, with the dashboard navigation always available. */
body.dashboard-page:has(#create.active[data-mode="children-story"]){overflow:auto!important}
body.dashboard-page #create.active[data-mode="children-story"]{position:relative!important;inset:auto!important;z-index:auto!important;display:block!important;width:auto!important;height:auto!important;max-width:1100px!important;margin-inline:auto!important;padding:0!important;overflow:visible!important;background:transparent!important;backdrop-filter:none!important}
body.dashboard-page #create[data-mode="children-story"]>#childrenStory.studio-panel{width:100%!important;max-width:100%!important;max-height:none!important;height:auto!important;margin:0!important;padding:0 0 32px!important;overflow:visible!important;border:0!important;border-radius:0!important;background:transparent!important;box-shadow:none!important}
body.dashboard-page:has(#create.active[data-mode="children-story"]) :is(#podlyDiscovery,.welcome-replay){display:none!important}

#childrenStory .story-cover figcaption{position:static!important;color:var(--ui-muted)!important;background:transparent!important;padding:12px 0!important;text-align:center;opacity:1}
#childrenStory .story-cover img{border-radius:12px}
#childrenStory .story-player-label>span,#childrenStory .story-player-timeline time{color:var(--ui-muted)}

#childrenStory .story-failure-icon svg{width:26px;height:26px}

/* A quiet listening room, using the dashboard's warm glass material. */
#childrenStory .story-project-ready{position:relative;background:color-mix(in srgb,var(--ui-surface) 92%,transparent);border:1px solid var(--ui-line);border-radius:24px;box-shadow:inset 0 1px 0 color-mix(in srgb,var(--ui-text) 7%,transparent),0 20px 56px #0002;backdrop-filter:blur(16px)}
#childrenStory .story-project-ready .story-output-heading{margin:0;gap:16px}
#childrenStory .story-project-ready .story-output-heading h2{margin:0;overflow-wrap:anywhere}
#childrenStory .story-project-ready .story-output-heading span:empty{display:none}
#childrenStory .story-project-ready>p:not(.story-action-error){margin:8px 0 28px;font-size:12px;color:var(--ui-muted)}
#childrenStory .story-project-ready .story-finished{display:grid;grid-template-columns:minmax(0,1.12fr) minmax(0,1fr);align-items:center;gap:clamp(24px,4vw,48px);margin:0}
#childrenStory .story-project-ready .story-cover{position:relative;display:grid;place-items:center;isolation:isolate;width:100%;min-width:0;min-height:280px;max-height:none;aspect-ratio:1/1;overflow:hidden;background:var(--ui-input);border:1px solid var(--ui-line);border-radius:18px}
#childrenStory .story-project-ready .story-cover img{display:block;width:100%;height:100%;max-height:520px;aspect-ratio:auto;object-fit:contain;border-radius:0;grid-area:1/1}
#childrenStory .story-cover-placeholder{grid-area:1/1;width:100%;height:100%;min-height:280px;background:color-mix(in srgb,var(--ui-line) 30%,var(--ui-input))}
#childrenStory .story-art-error{grid-area:1/1;text-align:center;padding:24px}
#childrenStory .story-art-error p{margin:0 0 12px;color:var(--ui-muted)}
#childrenStory .story-listening{min-width:0}
#childrenStory .story-listening-icon{display:block;width:88px;height:88px;object-fit:contain;margin:0 auto 12px}
#childrenStory .story-project-ready .story-player{padding:0;border:0;border-radius:0;background:transparent;box-shadow:none}
#childrenStory .story-project-ready .story-player-label{justify-content:center;font-size:13px}
#childrenStory [data-player-state]{display:block;color:var(--ui-danger);line-height:1.9;margin-top:12px;text-align:center}
#childrenStory [data-player-state]:empty{display:none}
#childrenStory .story-project-ready .story-player-timeline{margin:0;padding-top:20px}
#childrenStory .story-project-ready .story-player-timeline input{min-height:44px;height:44px;padding:0;border:0;border-radius:0;background:transparent;accent-color:var(--ui-accent);cursor:pointer}
#childrenStory .story-project-ready .story-player-timeline input::-webkit-slider-runnable-track{height:4px;border-radius:4px;background:linear-gradient(to right,var(--ui-accent) var(--played,0%),var(--ui-line) var(--played,0%))}
#childrenStory .story-project-ready .story-player-timeline input::-webkit-slider-thumb{-webkit-appearance:none;width:14px;height:14px;border:0;border-radius:50%;margin-top:-5px;background:var(--ui-accent)}
#childrenStory .story-project-ready .story-player-timeline input::-moz-range-track{height:4px;border-radius:4px;background:var(--ui-line)}
#childrenStory .story-project-ready .story-player-timeline input::-moz-range-thumb{width:14px;height:14px;border:0;border-radius:50%;background:var(--ui-accent)}
#childrenStory .story-player-controls{position:relative;direction:ltr;align-items:center;padding:20px 48px 0;gap:12px}
#childrenStory .story-player-controls button{width:44px;height:44px;min-height:44px;padding:0;border:0;background:transparent;border-radius:50%}
#childrenStory .story-player-controls button:hover{background:var(--ui-input)}
#childrenStory .story-player-controls .story-play{width:64px;height:64px;min-height:64px;border-radius:50%;background:var(--ui-accent);color:var(--ui-accent-on);box-shadow:0 0 0 4px var(--ui-surface),0 0 0 5px color-mix(in srgb,var(--ui-accent) 45%,transparent)}
#childrenStory .story-player-controls .story-play:hover{background:var(--ui-accent)}
#childrenStory .story-player-controls button[data-speed]{position:absolute;right:0;bottom:10px;font-size:12px;border:1px solid var(--ui-line);border-radius:12px}
#childrenStory .story-player-controls svg{display:block;width:24px;height:24px;pointer-events:none}
#childrenStory .story-detail-actions{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:12px 20px;margin-top:32px}
#childrenStory .story-detail-actions .story-circle-publish{flex-basis:100%;margin:0;min-height:46px;border-radius:12px}
#childrenStory .story-detail-actions a{display:inline-flex;gap:6px;align-items:center;min-height:44px;color:var(--ui-muted);font-size:12px;text-decoration:none}
#childrenStory .story-detail-actions a:hover{color:var(--ui-accent)}
#childrenStory .story-detail-actions a svg{width:18px;height:18px}
#childrenStory .story-audio-recovery{text-align:center;margin-top:16px}
#childrenStory .story-publish-error{font-size:13px;line-height:1.9;color:var(--ui-danger)}
#childrenStory .story-publish-error:empty{display:none}
#childrenStory .story-project-ready .story-transcript{margin-top:32px}
@media(max-width:760px){#childrenStory .story-project-ready .story-finished{grid-template-columns:minmax(0,1fr);gap:24px}#childrenStory .story-project-ready .story-cover{max-width:480px;margin-inline:auto;min-height:0}#childrenStory .story-listening-icon{width:64px;height:64px;margin-bottom:8px}#childrenStory .story-project-ready{border-radius:18px}#childrenStory .story-detail-actions{margin-top:24px}}
