/* ═══════════════════════════════════════════════════════════════════
   Media Master — Studio: the full-screen video editor
   Layout: top bar / media shelf + picture / one row of verbs / tracks.
   Nothing lives in a side panel that has to be scrolled: what acts on a clip opens from the verb row.
   ═══════════════════════════════════════════════════════════════════ */
html.st-lock, html.st-lock body { overflow: hidden; }
html.st-lock .discord-fab { display: none; }
.st {
    --st-bg: #0b0b0d; --st-panel: #121215; --st-panel2: #1b1b20; --st-line: rgba(255, 255, 255, .07); --st-text2: #a1a1aa;
    --st-part: #5e8eff; --st-music: #34d399; --st-over: #a78bfa;
    --tl-h: clamp(252px, 38vh, 430px); --shelf-w: 264px; --drawer-w: 0px;
    position: fixed; inset: 0; z-index: 900; display: grid; color: #f4f4f5; background: var(--st-bg); font-family: var(--font);
    grid-template-columns: var(--shelf-w) minmax(0, 1fr) var(--drawer-w);
    grid-template-rows: 48px auto minmax(0, 1fr) 6px var(--tl-h);
    grid-template-areas: "top top top" "restore restore restore" "shelf stage drawer" "split split split" "tl tl tl";
}
.st.has-over { --tl-h: clamp(304px, 44vh, 520px); }
.st.drawer-on { --drawer-w: 300px; }
.st.drop-on::after { content: 'Drop to add to your video'; position: absolute; inset: 10px; z-index: 40; display: flex; align-items: center; justify-content: center; border: 2px dashed var(--st-part); border-radius: 18px; background: rgba(94, 142, 255, .1); color: #dbeafe; font-size: 1.05rem; font-weight: 700; pointer-events: none; }

/* top bar */
.st-top { grid-area: top; display: flex; align-items: center; gap: 8px; padding: 0 12px; background: var(--st-panel); border-bottom: 1px solid var(--st-line); min-width: 0; }
.st-title { font-size: .86rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 34vw; margin-left: 4px; }
.st-saved { font-size: .68rem; color: #6ee7b7; white-space: nowrap; }
.st-pill { padding: 6px 13px; border-radius: 999px; background: rgba(94, 142, 255, .14); border: 1px solid rgba(94, 142, 255, .4); color: #dbeafe; font-size: .72rem; font-weight: 600; cursor: pointer; white-space: nowrap; font-family: var(--font); }
.st-export { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 20px; border-radius: 10px; background: var(--grad-red); color: #fff; font-size: .84rem; font-weight: 700; cursor: pointer; border: 0; font-family: var(--font); transition: var(--transition); }
.st-export:hover { box-shadow: 0 8px 26px rgba(255, 45, 85, .3); transform: translateY(-1px); }

.st-tool {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 34px; height: 34px; padding: 0 11px; border-radius: 9px; flex-shrink: 0;
    background: var(--st-panel2); border: 1px solid var(--st-line); color: #d4d4d8; font-size: .76rem; font-weight: 600; cursor: pointer; font-family: var(--font); transition: color .15s, border-color .15s, background .15s; white-space: nowrap;
}
.st-tool:hover:not(:disabled) { color: #fff; border-color: rgba(255, 255, 255, .22); }
.st-tool.active { color: #fff; background: var(--red-dim); border-color: rgba(255, 45, 85, .45); }
.st-tool.add { color: #fff; background: var(--red-dim); border-color: rgba(255, 45, 85, .4); }
.st-tool.add:hover { background: rgba(255, 45, 85, .22); }
.st-tool:disabled { opacity: .32; cursor: default; }
.st-tool svg, .st-verb svg, .st-med-btn svg, .st-wide svg { flex-shrink: 0; }
.st-tool:focus-visible, .st-verb:focus-visible, .st-play:focus-visible, .st-export:focus-visible, .st-chips button:focus-visible, .st-med-btn:focus-visible, .st-wide:focus-visible, .tl-head-btn:focus-visible, .st-pos button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.st-restore { grid-area: restore; display: flex; align-items: center; gap: 12px; padding: 9px 14px; background: rgba(94, 142, 255, .12); border-bottom: 1px solid rgba(94, 142, 255, .3); font-size: .82rem; }
.st-restore span { flex: 1; min-width: 0; }

/* media shelf: one compact row per file, so ten files are as easy to read as one */
.st-shelf { grid-area: shelf; display: flex; flex-direction: column; min-height: 0; background: var(--st-panel); border-right: 1px solid var(--st-line); }
.st-shelf-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 10px 8px 14px; }
.st-shelf-head h4 { font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--st-text2); }
.st-shelf-list { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 8px 10px; display: flex; flex-direction: column; gap: 6px; scrollbar-width: thin; scrollbar-color: var(--gray-3) transparent; }
.st-med { flex-shrink: 0; position: relative; display: grid; grid-template-columns: 60px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 6px; border-radius: 10px; background: var(--st-panel2); border: 1px solid var(--st-line); cursor: grab; }
.st-med:hover { border-color: rgba(255, 255, 255, .16); }
.st-med.bad { border-color: rgba(239, 68, 68, .5); }
.st-med-pic { width: 60px; height: 38px; border-radius: 6px; background: #000; display: flex; align-items: center; justify-content: center; color: var(--st-music); overflow: hidden; }
.st-med-pic canvas { width: 100%; height: 100%; display: block; object-fit: cover; }
.st-med-info { min-width: 0; }
.st-med-info b { display: block; font-size: .74rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-med-info small { display: block; font-size: .65rem; color: var(--st-text2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-med-acts { display: flex; gap: 4px; }
.st-med-btn { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; border: 1px solid var(--st-line); background: rgba(255, 255, 255, .04); color: #e4e4e7; cursor: pointer; }
.st-med-btn:hover { color: #fff; background: var(--red-dim); border-color: rgba(255, 45, 85, .45); }
.st-med-btn.top { display: none; }
.st-med:hover .st-med-btn.top, .st-med:focus-within .st-med-btn.top { display: inline-flex; }
.st-med-prog { grid-column: 1 / -1; }
.st-shelf-tip { padding: 10px 14px 12px; font-size: .68rem; line-height: 1.5; color: #71717a; border-top: 1px solid var(--st-line); }
.st-bar { height: 4px; border-radius: 99px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.st-bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--grad-red); transition: width .4s var(--ease-out-expo); }
.st-bar.big { height: 12px; }

/* picture */
.st-stage { grid-area: stage; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #070708; }
.st-stagewrap { flex: 1; min-height: 0; padding: 12px 16px 4px; display: flex; }
.st-screen { position: relative; flex: 1; min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; }
.st-canvas { position: relative; background: #000; overflow: hidden; box-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 20px 60px rgba(0, 0, 0, .6); transform-origin: center; }
.st-deck { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; }
.st-deck.on { opacity: 1; }
.st-layer { position: absolute; display: none; object-fit: fill; pointer-events: none; }
.st-layer.on { display: block; }
.st-fade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; z-index: 8; }
.st-canvas .ed-cropper { z-index: 9; }
.st-ovbox { position: absolute; z-index: 7; border: 2px solid #ff2d55; cursor: move; touch-action: none; box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); }
.st-ovbox i { position: absolute; width: 13px; height: 13px; background: #fff; border: 2px solid #ff2d55; border-radius: 3px; }
.st-ovbox .nw { left: -7px; top: -7px; cursor: nwse-resize; } .st-ovbox .ne { right: -7px; top: -7px; cursor: nesw-resize; }
.st-ovbox .sw { left: -7px; bottom: -7px; cursor: nesw-resize; } .st-ovbox .se { right: -7px; bottom: -7px; cursor: nwse-resize; }
.st-msg { position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: rgba(0, 0, 0, .55); text-align: center; }
.st-msg p { font-size: .95rem; font-weight: 600; }
.st-msg .st-bar { width: min(420px, 70%); height: 8px; }
.st-msg small { font-size: .8rem; color: #d4d4d8; font-variant-numeric: tabular-nums; }
.st-transport { flex-shrink: 0; height: 48px; display: flex; align-items: center; gap: 6px; padding: 0 16px 6px; }
.st-tcbox { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; font-family: var(--ed-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.st-tcbox.right { justify-content: flex-end; font-family: var(--font); font-size: .72rem; color: var(--st-text2); overflow: hidden; }
.st-tc { font-size: 1.02rem; font-weight: 700; color: #fff; }
.st-tc-all { font-size: .76rem; color: var(--st-text2); }
.st-play { width: 50px; height: 36px; flex-shrink: 0; border-radius: 11px; border: 0; background: var(--grad-red); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }

/* picture settings: opens on the right only when asked for */
.st-drawer { grid-area: drawer; display: none; flex-direction: column; min-height: 0; min-width: 0; background: var(--st-panel); border-left: 1px solid var(--st-line); }
.st.drawer-on .st-drawer { display: flex; }
.st-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 4px 16px; }
.st-drawer-head b { font-size: .86rem; }
.st-pane { flex: 1; overflow-y: auto; padding: 4px 16px 20px; min-height: 0; scrollbar-width: thin; scrollbar-color: var(--gray-3) transparent; }
.st-lbl { font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: var(--st-text2); margin: 16px 0 8px; }
.st-pane > .st-lbl:first-child, .st-pop > .st-lbl:first-child { margin-top: 4px; }
.st-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 38px; font-size: .8rem; color: #d4d4d8; }
.st-row label { flex: 1; min-width: 0; }
.st-row input[type=range] { flex: 1.6; min-width: 90px; accent-color: var(--red); }
.st-row input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--red); }
.st-val { font-family: var(--ed-mono); font-size: .76rem; color: #fff; min-width: 46px; text-align: right; }
.st-input { background: var(--st-bg); color: #fff; border: 1px solid rgba(255, 255, 255, .12); border-radius: 9px; padding: 8px 10px; font-size: .82rem; font-family: var(--ed-mono); min-width: 140px; }
select.st-input { font-family: var(--font); }
.st-sub { display: block; font-family: var(--ed-mono); font-size: .7rem; color: var(--st-text2); margin: 6px 0; word-break: break-all; }
.st-tip { font-size: .76rem; color: var(--st-text2); line-height: 1.55; margin-top: 10px; }
.st-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.st-chips button { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 50px; padding: 8px 10px; border-radius: 9px; background: var(--st-bg); border: 1px solid rgba(255, 255, 255, .1); color: #d4d4d8; font-size: .78rem; font-weight: 700; cursor: pointer; font-family: var(--font); line-height: 1.25; }
.st-chips button small { font-size: .62rem; font-weight: 500; color: var(--st-text2); margin-top: 2px; }
.st-chips button:hover:not(:disabled) { color: #fff; border-color: rgba(255, 255, 255, .26); }
.st-chips button.on { color: #fff; background: var(--red-dim); border-color: rgba(255, 45, 85, .55); }
.st-chips button.on small { color: #fda4af; }
.st-chips button:disabled { opacity: .3; cursor: not-allowed; }
.st-chips.big button { min-width: 72px; padding: 11px 14px; font-size: .84rem; background: var(--st-panel2); }
.st-pos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.st-pos button { padding: 9px 4px; border-radius: 9px; background: var(--st-bg); border: 1px solid rgba(255, 255, 255, .1); color: #fff; font-size: .76rem; font-weight: 600; cursor: pointer; font-family: var(--font); }
.st-pos button:hover { border-color: rgba(255, 45, 85, .5); }
.st-wide { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; border-radius: 10px; background: var(--st-panel2); border: 1px solid var(--st-line); color: #fff; font-size: .8rem; font-weight: 600; cursor: pointer; font-family: var(--font); margin-bottom: 10px; }
.st-wide.on { background: var(--red-dim); border-color: rgba(255, 45, 85, .5); }
.st-xf { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0; }

/* what opens from a verb: speed, volume, details */
.st-pop { position: fixed; z-index: 60; width: 320px; max-width: calc(100vw - 16px); padding: 14px 16px 16px; border-radius: 14px; background: #1d1d23; border: 1px solid rgba(255, 255, 255, .13); box-shadow: 0 22px 60px rgba(0, 0, 0, .65); opacity: 0; visibility: hidden; transform: translateY(8px) scale(.98); transform-origin: 50% 100%; pointer-events: none; transition: opacity .13s linear, transform .2s var(--ease-out-expo), visibility 0s .2s; }
.st-pop.on { opacity: 1; visibility: visible; transform: none; pointer-events: auto; transition-delay: 0s; }
.st-pop::after { content: ''; position: absolute; left: var(--arrow, 50%); bottom: -6px; width: 11px; height: 11px; margin-left: -6px; background: #1d1d23; border-right: 1px solid rgba(255, 255, 255, .13); border-bottom: 1px solid rgba(255, 255, 255, .13); transform: rotate(45deg); }
.st-pop.below { transform-origin: 50% 0; }
.st-pop.below::after { bottom: auto; top: -6px; transform: rotate(225deg); }
.st-pop .st-chips { display: grid; grid-template-columns: repeat(5, 1fr); }
.st-pop .st-chips.six { grid-template-columns: repeat(6, 1fr); }
.st-pop .st-chips button { min-width: 0; padding: 9px 0; }
.st-pop .st-row { margin-top: 8px; }
.st-pop-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.st-pop-head b { font-size: .9rem; }
.st-pop-head span { font-size: .7rem; color: var(--st-text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-pop-note { font-size: .72rem; color: var(--st-text2); line-height: 1.5; margin-top: 10px; }
.st-pop-note b { color: #fff; font-weight: 600; }

/* timeline */
.st-split { grid-area: split; cursor: row-resize; background: var(--st-panel); border-top: 1px solid var(--st-line); touch-action: none; position: relative; }
.st-split::after { content: ''; position: absolute; left: 50%; top: 1px; width: 44px; height: 3px; margin-left: -22px; border-radius: 3px; background: rgba(255, 255, 255, .22); }
.st-split:hover::after { background: var(--red); }
.st-tl { grid-area: tl; display: flex; flex-direction: column; min-height: 0; background: var(--st-panel); user-select: none; -webkit-user-select: none; }
.tl-bar { flex-shrink: 0; height: 50px; display: flex; align-items: center; gap: 6px; padding: 0 12px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--st-line); }
.tl-bar::-webkit-scrollbar { display: none; }
.st-verb { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 12px; border-radius: 10px; flex-shrink: 0; background: var(--st-panel2); border: 1px solid var(--st-line); color: #e4e4e7; font-size: .78rem; font-weight: 600; cursor: pointer; font-family: var(--font); white-space: nowrap; transition: color .15s, border-color .15s, background .15s, transform .12s; }
.st-verb:hover:not(:disabled) { color: #fff; border-color: rgba(255, 255, 255, .24); }
.st-verb:active:not(:disabled) { transform: scale(.96); }
.st-verb:disabled { opacity: .3; cursor: default; }
.st-verb.on, .st-verb.open { color: #fff; background: var(--red-dim); border-color: rgba(255, 45, 85, .5); }
.st-verb.part.on { background: rgba(94, 142, 255, .16); border-color: rgba(94, 142, 255, .6); }
.st-verb.for-part:not(:disabled) { border-color: rgba(94, 142, 255, .7); box-shadow: inset 0 -2px 0 var(--st-part); }
.st-verb.changed span { color: #fda4af; }
.st-verb.icon { width: 36px; padding: 0; }
.tl-part { display: none; align-items: center; gap: 6px; flex-shrink: 0; }
.tl-part.on { display: inline-flex; }
.tl-part-chip { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 6px 0 12px; border-radius: 10px; background: rgba(94, 142, 255, .16); border: 1px solid rgba(94, 142, 255, .55); color: #dbeafe; font-size: .76rem; font-weight: 600; font-family: var(--ed-mono); white-space: nowrap; }
.tl-part-chip button { width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 7px; background: rgba(255, 255, 255, .08); color: #dbeafe; cursor: pointer; }
.tl-part-chip button:hover { background: rgba(255, 255, 255, .18); }
.tl-sep { width: 1px; height: 22px; background: var(--st-line); margin: 0 3px; flex-shrink: 0; }
.tl-status { font-size: .72rem; color: var(--st-text2); margin-left: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tl-status.hint { color: #bfdbfe; }
.tl-zoom { width: 120px; accent-color: var(--red); flex-shrink: 0; }
.tl-host { flex: 1; display: flex; min-height: 0; }
.tl-heads { width: 88px; flex-shrink: 0; position: relative; background: #0d0d10; border-right: 1px solid var(--st-line); overflow: hidden; }
.tl-head { position: absolute; left: 0; right: 0; display: flex; align-items: center; justify-content: center; gap: 5px; border-bottom: 1px solid rgba(255, 255, 255, .05); color: #d4d4d8; }
.tl-head.col { flex-direction: column; gap: 4px; }
.tl-head b { font-size: .62rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.tl-head.main { color: #fff; }
.tl-head.over { color: #c4b5fd; }
.tl-head.audio { color: #6ee7b7; }
.tl-head.wave { color: #fda4af; }
.tl-head-btn { display: inline-flex; padding: 4px; border: 0; background: none; color: inherit; cursor: pointer; border-radius: 6px; opacity: .9; }
.tl-head-btn:hover { background: rgba(255, 255, 255, .08); opacity: 1; }
.tl-head-btn.on { color: #71717a; }
.tl-area { position: relative; flex: 1; min-width: 0; overflow: hidden; }
.tl-c { position: absolute; left: 0; top: 0; display: block; }
.tl-c.top { touch-action: none; }
.tl-sb { position: absolute; left: 0; right: 0; bottom: 0; height: 12px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; scrollbar-color: var(--gray-3) transparent; }
.tl-sb::-webkit-scrollbar { height: 9px; }
.tl-sb::-webkit-scrollbar-thumb { background: var(--gray-3); border-radius: 99px; }
.tl-sb-in { height: 1px; }

/* export */
.st-modal { position: absolute; inset: 0; z-index: 70; display: none; align-items: center; justify-content: center; padding: 24px; background: rgba(0, 0, 0, .62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.st-modal.on { display: flex; }
.st-modal-card { width: min(620px, 100%); max-height: 100%; overflow-y: auto; background: var(--st-panel); border: 1px solid rgba(255, 255, 255, .1); border-radius: 18px; padding: 22px 24px 24px; box-shadow: 0 30px 90px rgba(0, 0, 0, .6); }
.st-form .st-lbl:first-child { margin-top: 6px; }
.st-summary { margin: 16px 0; padding: 13px 14px; border-radius: 11px; background: var(--st-panel2); font-family: var(--ed-mono); font-size: .8rem; color: #fff; }
.st-modal .cx-smooth { background: var(--st-panel2); margin-top: 12px; }
.st-progress { padding: 14px 2px 4px; }
.st-prog-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.st-pct { font-family: var(--ed-mono); font-size: 2.4rem; font-weight: 700; }
.st-eta { font-size: .95rem; color: #d4d4d8; }
.st-phase { margin-top: 14px; font-size: .92rem; color: #fff; }
.st-gpus { margin: 8px 0 18px; min-height: 1.3em; font-family: var(--ed-mono); font-size: .76rem; color: var(--st-text2); }
.st-modal .ed-result { flex-wrap: wrap; }
.st .cx-help { z-index: 80; }

@media (max-width: 1680px) {
    .st-verb.slim span { display: none; }
    .st-verb.slim { width: 36px; padding: 0; }
    .tl-zoom { width: 92px; }
}
@media (max-width: 1400px) {
    .tl-zoom { display: none; }
    .st { --shelf-w: 236px; }
}
@media (max-width: 1240px) {
    .st-verb.mid span { display: none; }
    .st-verb.mid { width: 36px; padding: 0; }
}
@media (max-width: 1180px) {
    .st { --shelf-w: 204px; }
    .st-tool.wide span { display: none; }
    .st.drawer-on { --drawer-w: 264px; }
}
@media (max-width: 1140px) {
    .st-verb span { display: none; }
    .st-verb { width: 36px; padding: 0; }
    .st-verb.changed { width: auto; padding: 0 10px; }
    .st-verb.changed span { display: inline; }
}
@media (max-width: 860px) {
    html.st-lock .st { overflow-y: auto; display: flex; flex-direction: column; }
    .st-top { flex-shrink: 0; min-height: 48px; }
    .st-stage { min-height: 44vh; flex-shrink: 0; order: 1; }
    .st-split { display: none; }
    .st-tl { height: 330px; flex-shrink: 0; order: 2; }
    .st-shelf { order: 3; flex-shrink: 0; border: 0; border-top: 1px solid var(--st-line); }
    .st-drawer { order: 4; flex-shrink: 0; border: 0; border-top: 1px solid var(--st-line); }
    .st-pane { overflow: visible; }
    .st-shelf-list { flex-direction: row; overflow-x: auto; }
    .st-med { flex: 0 0 220px; }
    .st-med-btn.top { display: inline-flex; }
    .st-shelf-tip { display: none; }
    .st-tcbox.right { display: none; }
    .st-title { max-width: 26vw; }
    .tl-heads { width: 46px; }
    .tl-head b { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .st-bar i, .st-pop, .st-verb { transition: none; }
}
