.creation-options{margin:18px 0;padding:18px;border:1px solid var(--line,#39313e);border-radius:22px;background:linear-gradient(145deg,#211929,#151219)}
.creation-options h3{font-size:14px;margin:0 0 12px}.creation-options .hint{font-size:12px}
.duration-control{padding:5px 0 18px}.duration-heading{display:flex;justify-content:space-between;align-items:center;gap:12px}.duration-heading strong{font-size:29px;font-variant-numeric:tabular-nums}.duration-cost{font-size:15px}
.duration-range{display:block;width:100%;height:36px;margin:12px 0 0;accent-color:#e6a8fa;cursor:pointer;touch-action:pan-y;background:transparent}
.duration-ticks{display:flex;justify-content:space-between;font-size:12px;color:var(--hint,#b9adbe);padding:0 5px}
.resolution-choices,.format-choices{display:flex;gap:8px;margin-bottom:18px}.resolution-choices button,.format-choices button{flex:1;min-width:0;min-height:76px;padding:10px 5px;border:1px solid var(--line,#39313e);border-radius:15px;background:#211a29;color:inherit;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:5px}
.resolution-choices button.on,.format-choices button.on{border-color:#e6a8fa;background:#b85dde28;box-shadow:inset 0 0 0 1px #e6a8fa}
.resolution-choices b{font-size:13px}.resolution-choices small,.format-choices small{font-size:10px;line-height:1.3;color:var(--hint,#b9adbe)}.format-choices b{font-size:12px}.format-choices small{font-size:9px;max-width:100%;overflow-wrap:anywhere}.format-choices .frame{display:block;border:1.5px solid currentColor;border-radius:3px}
.personalize-scenario{margin:14px 0;padding:16px;border:1px solid var(--line,#39313e);border-radius:18px}.personalize-scenario button{width:100%}.personalize-scenario p{font-size:12px;margin:9px 0 0}
.watermark-offer{padding:17px;margin-top:14px;border:1px solid #ac6fc06b;border-radius:18px;background:#ac6fc013}.watermark-offer p{font-size:13px;line-height:1.45}.watermark-offer button{width:100%}.watermark-unlocked{color:#a8d7b5;font-size:13px;margin:12px 0}
@media(max-width:360px){.creation-options{padding:13px}.format-choices{gap:4px}.resolution-choices small{font-size:9px}}

/* One compact composer in both modes. Keep the existing UNDO ME palette. */
.creation-header .creation-modebar{display:flex;align-items:center;justify-content:space-between;gap:12px}
.creation-header .creation-modebar .creation-modes{flex:1;min-width:0}
.creation-header .composer-close{flex:0 0 44px;width:44px;min-height:44px;padding:0;border:1px solid var(--line);font-size:23px}
body:has(.creation-dock) .creation-header{margin:0;gap:10px}
body:has(.creation-dock) main{gap:14px}
body:has(.creation-dock) .creation-modes button{min-height:44px;padding:7px 6px}
.compact-composer,.v2.compact-composer{display:flex;flex-direction:column;gap:14px;width:100%}
.reference-zone{min-width:0}
.reference-zone .reference-zone-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:8px}
.reference-zone .reference-zone-heading h2{margin:0;font-size:14px;font-weight:600}
.reference-zone-heading>span{font-size:12px;color:var(--hint);font-variant-numeric:tabular-nums}
.reference-zone .reference-droparea{display:flex;flex-wrap:wrap;gap:10px;align-items:flex-start;min-height:120px;padding:12px;border:1px solid var(--line);border-radius:20px;background:var(--card)}
.reference-droparea[data-upload-zone]{cursor:pointer}
.reference-droparea:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
.reference-zone .reference-item{position:relative;flex:0 0 90px;min-width:0}
.reference-zone .reference-item .reference-tile{position:relative;height:auto;aspect-ratio:1;display:flex;flex-direction:column;justify-content:center;align-items:center;border-radius:14px;min-height:0;padding:0;gap:0;overflow:hidden}
.reference-zone .reference-tile img{position:absolute;inset:0;width:100%;height:100%;min-height:0;object-fit:cover;background:#15121c}
.reference-zone .reference-tile span{position:absolute;bottom:0;left:0;z-index:1;width:100%;font-size:11px;line-height:16px;padding:5px 3px;text-align:center;background:#211729c9;color:#fff;backdrop-filter:blur(6px)}
.reference-zone .reference-tile.mentioned{border-color:var(--accent)}
.reference-zone .reference-remove{right:0;top:0;width:36px;height:36px;min-height:36px;min-width:36px;border:0;border-radius:0 14px 0 12px;background:#211829b8;backdrop-filter:blur(6px);line-height:1;font-size:22px;z-index:2}
.reference-zone .reference-add{flex:0 0 90px;min-height:0;aspect-ratio:1;border:1px dashed #785588;border-radius:14px;padding:8px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px}
.reference-zone .reference-add b,.reference-zone .reference-plus{font-size:27px;font-weight:400;line-height:1.2}
.reference-zone .reference-add span{font-size:11px;line-height:1.3;overflow-wrap:anywhere}
.reference-zone .reference-droparea.empty{padding:10px}
.reference-zone:not(.scenario-reference-zone) .reference-droparea.empty .reference-add{flex:1;min-height:112px;aspect-ratio:auto;border:0;background:transparent}
.reference-zone .reference-instructions{font-size:11px;line-height:1.4;margin:7px 2px 0}
.scenario-reference-zone .reference-item{flex:1 1 100px;max-width:100%}
.scenario-reference-zone .reference-item .reference-tile{width:100%;height:auto;aspect-ratio:1}
.scenario-reference-zone .reference-tile img{height:100%}
.scenario-reference-zone .reference-empty{border:1px dashed #785588;background:#211829}
.scenario-reference-zone .reference-empty span{position:static;background:none;backdrop-filter:none;padding:10px 5px;color:var(--hint)}
.scenario-reference-zone .reference-role{display:block;font-size:12px;font-weight:600;line-height:1.4;margin:8px 2px 0;text-align:center;overflow-wrap:anywhere}
.compact-composer .reference-swap,.compact-composer .personalize-compact{align-self:center;min-height:44px;padding:7px 12px;font-size:12px;margin:-5px 0}
.compact-composer .scene-editor{padding:14px;border-radius:20px}
.compact-composer .scene-editor .scene-label{font-size:14px;margin:0 0 10px}
.compact-composer .scene-editor textarea{display:block;min-height:142px;max-height:40dvh;padding:10px 0;border:0;border-radius:0;background:transparent;resize:vertical;font-size:16px;line-height:1.5;scroll-margin:90px 0}
.compact-composer .scene-editor .writer-meta{margin-top:8px;gap:8px;align-items:flex-start}
.compact-composer .writer-meta .hint{font-size:11px;line-height:1.3}
.compact-composer #chars{white-space:nowrap;flex:none}
.compact-composer .reference-feedback:empty{display:none}
.compact-composer .save-row[hidden]{display:none}
.compact-settings{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:7px}
.compact-settings button{display:flex;justify-content:center;align-items:center;gap:6px;min-width:0;min-height:48px;padding:8px 5px;border:1px solid var(--line);border-radius:13px;background:var(--card);color:var(--text)}
.compact-settings b,.compact-settings small{font-size:12px;line-height:1.25;font-weight:600;overflow-wrap:anywhere}
.compact-settings button>span:not(.frame){font-size:20px;color:var(--hint);line-height:1}
.compact-settings .frame{flex:none;color:var(--hint);max-width:20px;max-height:18px}
.compact-composer .magic-option{margin:0;padding:12px 14px;border-radius:16px}
.compact-composer .magic-toggle{gap:10px}
.compact-composer .magic-toggle>span{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:4px 10px;width:100%;min-width:0}
.compact-composer .magic-toggle strong{font-size:13px;line-height:1.4}
.compact-composer .magic-toggle small{font-size:11px;margin:0;white-space:nowrap}
.compact-composer .magic-details{margin:6px 0 0 30px;font-size:11px;color:var(--hint)}
.magic-details summary{cursor:pointer;min-height:24px;display:flex;align-items:center;gap:5px;width:fit-content}
.magic-details summary::after{content:'⌄';font-size:13px}
.magic-details[open] summary::after{content:'⌃'}
.compact-composer .magic-details p{margin:4px 0 0;font-size:11px}
.compact-composer .scene-guide{margin:0;padding:10px 14px;border:0;background:transparent;border-radius:12px}
.compact-composer .scene-guide summary{font-size:12px;color:var(--hint);min-height:24px}
.compact-composer .scene-guide .hint{font-size:12px;margin-top:10px}
.v2.compact-composer .scenario-stage{max-width:100%;border-radius:20px}
/* Constrain the media, not the caption: portrait previews must not squeeze the title. */
.v2.compact-composer .scenario-stage .detail-art{width:100%;max-width:min(100%,calc(290px * var(--scenario-aspect,1.777778)),calc(38svh * var(--scenario-aspect,1.777778)));margin-inline:auto}
.v2.compact-composer .scenario-stage-heading{gap:8px;padding:8px 12px}
.v2.compact-composer .scenario-stage-heading h2{flex:1 1 140px;min-width:0;font-size:14px}
.v2.compact-composer .scenario-stage-heading button{border:0;padding:5px;min-height:40px;font-size:11px}
.compact-composer>p.hint{font-size:11px;margin:0 2px}

/* Replace the navigation bar while composing; the header keeps an exit home. */
body:has(.creation-dock){padding-bottom:calc(144px + env(safe-area-inset-bottom))}
body:has(.creation-dock) nav{display:none}
.creation-dock{position:fixed;inset:auto 0 var(--composer-keyboard-inset,0px);z-index:15;width:100%;max-width:760px;margin:auto;padding:14px 18px calc(14px + env(safe-area-inset-bottom));border-top:1px solid var(--line);background:#151019f5;backdrop-filter:blur(18px)}
.creation-dock .actions{margin:0;flex-wrap:nowrap;gap:8px}
.creation-dock .actions .primary{min-height:56px;font-size:16px;line-height:1.4}
.creation-dock .actions .primary{position:relative;isolation:isolate;display:flex;align-items:center;justify-content:center;gap:10px;border:1px solid #ffe5ffb3;background:linear-gradient(112deg,#ffd4ff 0%,#efb4f9 45%,#d997ef 100%);color:#301339;box-shadow:inset 0 1px 0 #ffffff8c,0 6px 22px #cf70ee38,0 0 28px #e59bfa20;transition:box-shadow .18s,filter .18s,transform .18s}
.creation-dock .primary .generate-spark{display:inline-block;flex:none;font-size:22px;line-height:1;color:#663575;text-shadow:0 1px 1px #ffffffa6}
.creation-dock .primary .generate-label{min-width:0}
@media(hover:hover){.creation-dock .actions .primary:not(:disabled):hover{filter:brightness(1.06);box-shadow:inset 0 1px 0 #fff,0 7px 26px #d37ef05c,0 0 32px #e59bfa38;transform:translateY(-1px)}}
.creation-dock .actions .primary:not(:disabled):active{filter:brightness(.97);transform:translateY(1px);box-shadow:inset 0 1px 3px #833c8f28,0 3px 14px #cf70ee30}
.creation-dock .actions .primary:disabled{box-shadow:none;border-color:#d9b5e040;opacity:.5}
.creation-dock .actions .back{flex:0 0 46px;padding:10px;min-height:56px}
.creation-dock>.hint{margin:7px 0 0;text-align:center;font-size:11px;line-height:1.4}
/* The action stays immediately above the keyboard without covering the text. */
.creation-dock .actions .keyboard-done{display:none;flex:0 0 48px;min-height:52px;padding:0;font-size:24px;border:1px solid #b38abc66;background:#5f416847;border-radius:15px;color:#f5d8ff}
html.composer-editing .creation-dock .keyboard-done{display:grid;place-items:center}
html.composer-editing .creation-dock{padding:8px 18px}
html.composer-editing .creation-dock .primary{min-height:52px}
html.composer-editing body:has(.creation-dock){padding-bottom:calc(96px + var(--composer-keyboard-inset,0px))}
html.composer-editing .compact-composer .scene-editor textarea{min-height:120px;max-height:max(120px,calc(var(--composer-visible-height,100dvh) - 160px))}
@media(max-width:360px){.compact-settings{gap:5px}.compact-settings button{gap:4px}.compact-settings b,.compact-settings small{font-size:11px}.creation-dock{padding-inline:12px}.reference-zone .reference-droparea{padding:10px;gap:8px}.reference-zone .reference-item,.reference-zone .reference-add{flex-basis:82px}.scenario-reference-zone .reference-item{flex-basis:100px}}

/* Shared compact Normal / Fast control, without an extra settings panel. */
.fast-mode-toggle{display:inline-flex;align-items:center;gap:8px;min-height:38px;padding:7px 12px;border:1px solid var(--line,#45334d);border-radius:99px;background:rgba(155,112,184,.06);color:var(--hint,#b4a6bc);font-size:13px;cursor:pointer;flex:none;width:max-content}
.fast-mode-bolt{font-size:23px;line-height:1;color:inherit}.fast-mode-toggle.on{color:#f0d5ff;background:linear-gradient(115deg,rgba(172,89,218,.2),rgba(196,109,255,.08));border-color:rgba(216,157,255,.65);box-shadow:0 0 16px rgba(166,83,223,.12)}
.fast-mode-track{display:block;width:26px;height:16px;border-radius:99px;background:rgba(185,166,196,.2);padding:3px;box-sizing:border-box}.fast-mode-track:after{content:"";display:block;width:10px;height:10px;border-radius:50%;background:currentColor;transition:transform .15s}.fast-mode-toggle.on .fast-mode-track{background:rgba(212,148,251,.3)}.fast-mode-toggle.on .fast-mode-track:after{transform:translateX(10px)}.sc-model-controls .fast-mode-toggle{align-self:end;margin-bottom:1px}.fast-mode-toggle:focus-visible{outline:2px solid var(--accent,#e5b4f8);outline-offset:3px}
@media(prefers-reduced-motion:reduce){.fast-mode-track:after{transition:none}}

/* Subtle affordance on the existing compact option chips. */
.compact-settings button{position:relative;padding-right:17px;border-color:#9269a0;background:linear-gradient(135deg,#35253e,#281f30);box-shadow:inset 0 1px 0 #ffffff0d,0 0 12px #d58ee421;transition:border-color .16s,box-shadow .16s,background .16s,transform .16s}
.compact-settings button>span:not(.frame),.compact-settings .frame{color:#d8c1e3}
.compact-settings .setting-chevron{position:absolute;right:4px;top:50%;transform:translateY(-50%);width:11px;height:11px;fill:none;stroke:#efb4f9;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;pointer-events:none}
.compact-settings button:focus-visible{outline:2px solid var(--accent);outline-offset:3px;box-shadow:0 0 16px #d58ee43b}
.compact-settings button:not(:disabled):active{background:#48304f;border-color:#efb4f9;box-shadow:inset 0 1px 4px #160c2240,0 0 8px #d58ee433}
.compact-settings button:disabled{box-shadow:none;border-color:var(--line)}
@media(hover:hover){.compact-settings button:not(:disabled):hover{border-color:#dab0e7;background:#3d2b46;box-shadow:inset 0 1px 0 #ffffff12,0 0 16px #d58ee43b}}
@media(prefers-reduced-motion:reduce){.compact-settings button{transition:none}}
@media(max-width:360px){.compact-settings button[data-setting-focus="resolution"]>span[aria-hidden="true"]{display:none}}

/* Keep dialogs usable on short screens and above the on-screen keyboard. */
html.app-dialog-open #sheet,html.app-dialog-open #modal{top:auto;bottom:var(--composer-keyboard-inset,0px);height:var(--composer-visible-height,100dvh)}
html.app-dialog-open #sheet .sh,html.app-dialog-open #modal .sheet{--sheet-pad:20px;padding:var(--sheet-pad) 18px calc(22px + env(safe-area-inset-bottom));max-height:calc(100% - 16px);scroll-padding-top:80px;scrollbar-gutter:stable;overflow-x:hidden;outline:none}
#sheet .sh>.hd{position:sticky;top:calc(-1 * var(--sheet-pad,20px));z-index:3;isolation:isolate;margin:calc(-1 * var(--sheet-pad,20px)) -18px 18px;padding:16px 18px 12px;background:var(--card2);border-bottom:1px solid var(--line)}
#sheet .sh>.hd h2{min-width:0;font-size:21px;line-height:1.3}
#sheet .sh>.hd [data-close]{flex:0 0 44px;min-width:44px;min-height:44px;border:1px solid var(--line)}
#sheet .setting-price{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;padding:14px 0;border-top:1px solid var(--line)}
#sheet .setting-price>span{flex:1;min-width:120px;color:var(--hint);font-size:13px}
#sheet .setting-price>b{flex:none;font-size:18px}
#view .who>div:last-child{min-width:0;overflow-wrap:anywhere}
#view .top{flex-wrap:wrap}
#view .top .pill{max-width:100%}
html.app-dialog-open #toast{bottom:calc(var(--composer-keyboard-inset,0px) + 24px + env(safe-area-inset-bottom))}
@media(min-width:768px){
 html.app-dialog-open #sheet,html.app-dialog-open #modal{align-items:center}
 html.app-dialog-open #sheet .sh,html.app-dialog-open #modal .sheet{max-width:640px;max-height:min(820px,calc(100% - 48px));margin:auto;border-radius:24px;box-shadow:0 24px 80px #0006}
}
