#studio-montage{display:none;max-width:1230px;margin:auto;scroll-margin-top:90px;min-width:0}
#studio-montage:focus{outline:none}.montage-layout,.montage-preview,.montage-workarea{min-width:0;max-width:100%}.montage-toolbar>label{display:grid;gap:4px}
body[data-studio-view='montage'] #studio-montage{display:block}
body[data-studio-view='montage'] :is(.studio-workbench,#studio-history-panel,#studio-characters,#studio-advanced,.studio-welcome>img){display:none!important}
body[data-studio-view='montage'] .studio-welcome{min-height:0;background:none;border:0;padding:0;margin:12px 0 18px}
body[data-studio-view='montage'] .studio-welcome h1{font-size:1.8rem}
.montage-toolbar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:12px 0}.montage-toolbar>div{flex:1;min-width:180px}.montage-toolbar select{max-width:100%}
.montage-editor button{min-height:44px;margin:0;font-size:.9rem}.montage-editor>input{max-width:450px}.montage-layout{display:grid;grid-template-columns:minmax(240px,.8fr) minmax(0,1.4fr);gap:24px;align-items:start}
.montage-preview{position:sticky;top:100px;border:1px solid var(--line);border-radius:20px;padding:14px;background:var(--surface);overflow:hidden}.montage-preview :is(video,img){width:100%;max-height:460px;object-fit:contain;background:#16111f;border-radius:12px}.montage-preview p{font-size:.85rem;line-height:1.6}
.montage-tabs{display:flex;gap:8px;margin:20px 0 12px}.montage-tabs button[aria-pressed='true']{background:var(--accent);color:#fff}.montage-timeline{display:flex;overflow:auto;gap:8px;padding:4px 2px 12px;scroll-snap-type:x proximity}.montage-clip{flex:0 0 130px;text-align:left;border:1px solid var(--line);background:var(--surface);border-radius:14px;padding:12px;color:var(--heading);scroll-snap-align:start;overflow-wrap:anywhere}.montage-clip[aria-pressed='true']{box-shadow:inset 0 0 0 2px var(--accent);background:var(--soft)}.montage-clip span{display:block;font-size:.8rem;color:var(--muted);margin-top:5px}.montage-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 14px}.montage-fields label{min-width:0;margin:0}.montage-fields :is(input,select,textarea){width:100%;box-sizing:border-box;margin-top:4px}.montage-fields .montage-wide{grid-column:1/-1}.montage-check{display:flex;align-items:center;gap:8px;line-height:1.5}.montage-check input{width:20px!important;height:20px;margin:0!important}
.montage-item{padding:16px;border:1px solid var(--line);border-radius:16px;background:var(--surface);margin:14px 0}.montage-item h3{font-size:1rem;margin:0 0 12px;overflow-wrap:anywhere}.montage-item textarea{min-height:75px}.montage-export-bar{position:sticky;bottom:0;z-index:5;display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:24px;padding:14px 18px;background:var(--surface);border:1px solid var(--line);border-radius:18px;box-shadow:0 -4px 20px #4526600a;padding-bottom:max(14px,env(safe-area-inset-bottom))}.montage-export-bar p{margin:0;font-size:.875rem}.montage-export-bar .field-help{font-size:.8rem}.montage-export-bar button{flex-shrink:0}.montage-editor [data-error='true']{color:#9f2852}.montage-render{margin:12px 0;padding:16px;border:1px solid var(--line);border-radius:16px}.montage-render video{width:100%;max-height:440px;border-radius:12px;background:#16111f}.montage-render progress{display:block;width:100%;margin:8px 0}.montage-renders h2{margin:0;font-size:1.2rem}
@media(max-width:760px){.montage-layout{grid-template-columns:minmax(0,1fr);gap:12px}.montage-preview{position:static}.montage-preview :is(video,img){max-height:260px}.montage-preview:has(#montage-empty:not([hidden])){padding:18px}.montage-fields{gap:10px}.montage-editor button{padding:8px 10px}.montage-export-bar{padding:10px;gap:8px}.montage-export-bar>div{min-width:0}.montage-export-bar button{max-width:50%}.montage-tabs{position:sticky;top:80px;z-index:2;background:var(--surface);padding:8px 0}.montage-item{padding:12px}}

.montage-toolbar>div>label{display:block}.montage-toolbar>div>select{width:100%}

.montage-tabs{flex-wrap:wrap}.montage-fields label{overflow-wrap:anywhere}

/* Full editor: preview, timed tracks and a horizontally scrolling tool shelf. */
#studio-montage{--surface:#1d2029;--soft:#2a293c;--line:#3a3d4d;--heading:#f5f3fa;--muted:#b8b6c8;--accent:#a487f1;color:var(--heading);background:#13151c;padding:20px;border-radius:20px}
#studio-montage :is(h1,h2,h3,label,summary){color:var(--heading)}
#studio-montage .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
#studio-montage #montage-duration{color:#b8b6c8}
#studio-montage .secondary,#studio-montage .editor-back{background:#252833;color:#f4f1fc;border-color:#464858}
#studio-montage :is(input,select,textarea){background:#242631;color:#f6f4fa;border-color:#555666;accent-color:#ad90ff}
#studio-montage .montage-preview{background:#0b0c11;border-color:#343644}
#montage-preview-stage{min-height:180px;display:grid;place-items:center;background:#08090d;overflow:hidden;border-radius:10px}
#montage-canvas{display:block;max-width:100%;max-height:48vh;width:auto;height:auto;background:black;touch-action:pan-y}
#montage-preview-stage:fullscreen,#montage-preview-stage.montage-expanded{width:100vw;height:100dvh;background:#08090d}
#montage-preview-stage:fullscreen canvas,#montage-preview-stage.montage-expanded canvas{max-height:95dvh;max-width:95vw}
#montage-preview-stage.montage-expanded{position:fixed;inset:0;z-index:80}
.montage-exit-fullscreen{display:none}#montage-preview-stage:is(:fullscreen,.montage-expanded) .montage-exit-fullscreen{display:block;position:absolute;top:max(14px,env(safe-area-inset-top));right:14px;width:48px;height:48px;border:1px solid #aaa;background:#222;color:white;font-size:26px;z-index:1}
.montage-playbar{display:flex;align-items:center;justify-content:space-between;gap:6px;padding-top:10px}.montage-playbar button{font-size:.72rem;padding:8px}.montage-playbar output{white-space:nowrap;font-size:.72rem;font-variant-numeric:tabular-nums}
#montage-seek{width:100%;min-height:36px;margin:3px 0;padding:0}.montage-quick-actions{display:flex;gap:8px}.montage-quick-actions button{font-size:.7rem;flex:1}
#studio-montage .montage-tabs{flex-wrap:nowrap;border-color:#3a3d4d;gap:3px;margin-top:8px;background:#13151c}
#studio-montage .montage-tabs>button{flex:0 0 78px;min-height:72px;background:transparent;border:0;color:#c0bed0}
#studio-montage .montage-tabs>button[aria-pressed=true]{color:#dccbff;background:#302c43;box-shadow:inset 0 -3px #b293fb}
#studio-montage .montage-tabs>button[hidden]{display:none}#montage-tool-search{font-size:.8rem;min-height:38px;margin:8px 0 0}
#studio-montage .montage-sequence{background:#1e2029;border:1px solid #3a3d4d;border-radius:12px;padding:12px}
.montage-scroll{overflow:auto;scrollbar-width:thin;padding:6px 2px 10px;max-width:100%}
#montage-time-tracks{position:relative;width:100%;min-width:260px}
#montage-ruler{position:relative;height:28px;color:#aaa7b9;font-size:.68rem}#montage-ruler span{position:absolute;transform:translateX(-50%)}#montage-ruler span:first-child{transform:none}#montage-ruler span:last-child{transform:translateX(-100%)}
#studio-montage #montage-clips{gap:0;overflow:visible;padding:0 0 6px;scroll-snap-type:none;align-items:stretch}
#studio-montage #montage-clips .montage-clip{min-width:0;border-radius:5px;padding:3px;box-sizing:border-box;overflow:hidden}
#studio-montage #montage-clips .montage-clip strong{font-size:.67rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;max-width:none}
#studio-montage #montage-clips .montage-clip span:not(.montage-clip-visual){font-size:.6rem;white-space:nowrap;overflow:hidden}
#montage-playhead{position:absolute;top:21px;bottom:0;width:2px;background:#fff;box-shadow:0 0 2px #000;pointer-events:none;z-index:2}
#montage-playhead:before{content:'';position:absolute;top:-5px;left:-4px;width:10px;height:10px;background:#fff;border-radius:2px}
.montage-lane{position:relative;height:36px;margin:5px 0;background:#15171f;border-radius:4px;overflow:hidden}
#studio-montage .montage-lane button{position:absolute;top:1px;height:34px;min-height:34px;font-size:.65rem;text-align:left;border:1px solid #746599;border-radius:4px;background:#42345e;color:#eee7fb;padding:4px 7px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;box-sizing:border-box}
#studio-montage .montage-lane[data-lane=audio] button{background:#204e53;border-color:#3e7d82}#studio-montage .montage-lane[data-lane=text] button{background:#554a26;border-color:#927d3f}#studio-montage .montage-lane .montage-lane-empty{background:transparent;border:0;width:100%;color:#a7a5b7}
.montage-zoom{display:flex;align-items:center;gap:10px;font-size:.68rem;margin:6px 0 0}.montage-zoom input{width:100px;min-height:30px}
#studio-montage .editor-project-settings[open],#studio-montage .montage-item{background:#1d2029;border-color:#414351}
#studio-montage .editor-project-settings>summary,#studio-montage .editor-help>summary,#studio-montage .field-help{color:#b4b1c4}
#studio-montage .montage-export-bar{background:#232533;color:#e1dcee}#studio-montage [data-error=true]{color:#ff9baa}
.montage-stickers{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.montage-stickers button{display:flex;align-items:center;flex-direction:column;gap:7px;padding:10px;font-size:.75rem}.montage-stickers canvas{width:65px;height:65px}
.montage-ai-entry{margin-top:20px;padding-top:15px;border-top:1px solid #393b49}.montage-ai-entry a{font-size:.8rem}.montage-ai-entry p{font-size:.72rem}
.montage-media-dialog{width:min(620px,calc(100vw - 24px));max-height:85dvh;background:#171920;color:#fff;border:1px solid #444;border-radius:18px;box-sizing:border-box;padding:16px}
.montage-media-dialog::backdrop{background:#000b}.montage-media-dialog form{text-align:right}.montage-media-dialog h2{font-size:1.1rem;margin:10px 0}.montage-media-dialog article{margin:12px 0;border:1px solid #444;border-radius:10px;padding:10px}.montage-media-dialog :is(video,img){max-height:50dvh;max-width:100%;display:block;margin:auto}.montage-media-dialog p{font-size:.8rem;overflow-wrap:anywhere}#montage-media-confirm{position:sticky;bottom:0;width:100%;background:#9c7ce4;color:#fff}
@media(max-width:760px){#studio-montage{padding:10px;border-radius:0;margin:0 -12px;max-width:none}#studio-montage>.editor-heading{background:#13151c;color:#fff;border-color:#373a46}#studio-montage .montage-layout{grid-template-columns:minmax(0,1fr)}#montage-canvas{max-height:30dvh}#studio-montage .montage-preview{padding:7px}#studio-montage .montage-tabs{position:sticky;top:66px;z-index:5}#studio-montage .montage-fields label{font-size:.76rem}.montage-playbar button{min-height:40px}.montage-media-dialog{max-height:88dvh}}

/* Keep the tools reachable while the mobile user watches or edits a clip. */
.upscale-header{display:flex;align-items:center;gap:12px;margin-bottom:14px}.upscale-header h2{flex:1;min-width:0;color:#fff}.upscale-header button{flex:none;font-size:.8rem;padding:8px 12px}
@media(max-width:760px),(max-width:1024px) and (max-height:500px){
 #studio-montage{padding-bottom:calc(100px + env(safe-area-inset-bottom));scroll-padding-bottom:100px}
 #studio-montage .montage-tabs{position:fixed;inset:auto 0 0;z-index:18;box-sizing:border-box;margin:0;padding:4px max(8px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));background:#171920;border-top:1px solid #464858;border-bottom:0;box-shadow:0 -8px 20px #08090d66;scroll-padding-inline:8px}
 #studio-montage .montage-tabs>button{min-height:68px;font-size:.75rem}
 #studio-montage .montage-workarea>section{scroll-margin-top:88px;scroll-margin-bottom:100px}
}

.speech-dialog .speech-fields{display:grid;gap:.5rem}.speech-dialog textarea{width:100%;resize:vertical;min-height:7rem}.speech-dialog audio{width:100%;margin:.75rem 0}.speech-dialog .montage-toolbar{display:flex;flex-wrap:wrap}.speech-dialog select{width:100%}
.speech-dialog .montage-item{background:#242732;color:#fff;border-color:#484b5b}.speech-dialog .montage-item h3{color:inherit}.speech-dialog .montage-item p{color:#cdd2e1}
