/* =========================================================
   editor.css — in-browser video editor (#/editor). Desktop editor layout:
   slim top bar · media / player / inspector panels · toolbar + multi-track timeline.
   Neutral near-black panels with a teal accent, scoped to .ed so the app chrome keeps UGC Lab yellow.
   ========================================================= */
body.lab .ed {
  --cc-bg: #0E0E10; --cc-panel: #17171A; --cc-panel2: #212125; --cc-line: #2A2A2F; --cc-hover: #2B2B30;
  --cc-teal: #22C7CF; --cc-teal-dim: rgba(34,199,207,.16); --cc-text: #E7E7EA; --cc-dim: #8D8D95;
  --cc-video: #145C61; --cc-video-line: #2A9AA1; --cc-text-chip: #B4532C; --cc-text-line: #E07A47; --cc-audio: #1D4C86; --cc-audio-line: #3F7DD0;
  --accent: var(--cc-teal); --panel: var(--cc-panel); --panel2: var(--cc-panel2); --border: var(--cc-line); --text: var(--cc-text);
  --lab-inner: #111113; --lab-line: #303036; --lab-row: #1E1E22; --lab-hover: var(--cc-hover);
  --lab-sub: #C6C6CC; --lab-dim: var(--cc-dim); --lab-faint: #67676F; --green: #5FD7A0;
}
/* The editor fills the workspace under the app top bar like a desktop app. */
body.lab[data-page="editor"] #app:has(.ed[data-ed-root]) { padding: 8px 10px !important; height: calc(100vh - 52px); height: calc(100dvh - 52px); box-sizing: border-box; overflow: hidden; background: #0B0B0D; }
body.lab[data-page="editor"] .page:has(> .ed[data-ed-root]) { max-width: none !important; height: 100%; }
.ed { height: 100%; display: flex; flex-direction: column; gap: 6px; min-width: 0; min-height: 0; color: var(--cc-text); font-size: 12px; }
.ed-grow { flex: 1; }
.ed-muted { color: var(--lab-dim); font-size: 11.5px; }
.ed button:disabled { opacity: .4; cursor: default; }
.ed-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* top bar: back · undo/redo · save state | ticket name | compact actions */
.ed-top { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, auto) minmax(0, 1fr); align-items: center; gap: 12px; min-width: 0; padding: 5px 8px; background: var(--cc-panel); border: 1px solid var(--cc-line); border-radius: 8px; }
.ed-top-l, .ed-top-r { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ed-top-r { justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.ed-top-l > .ed-status { flex: 1 1 auto; line-height: 1.3; }
.ed-top > .ed-title { align-items: center; text-align: center; max-width: 36vw; }
.ed-history { padding-right: 6px; border-right: 1px solid var(--cc-line); }
body.lab .ed-back { display: inline-flex; align-items: center; gap: 4px; min-height: 28px; padding: 4px 9px !important; border-radius: 6px !important; border: 1px solid var(--cc-line) !important; background: var(--cc-panel2) !important; color: var(--cc-text) !important; font: inherit; font-size: 12px; font-weight: 700; text-decoration: none; flex: none; cursor: pointer; }
.ed-history { display: flex; gap: 4px; flex: none; }
.ed-history button { white-space: nowrap; }
body.lab .ed-top .lab-ghost { padding: 4px 9px !important; font-size: 12px !important; border-radius: 6px !important; min-height: 28px !important; }
body.lab .ed-top .lab-btn { min-height: 28px; padding: 0 12px !important; font-size: 12px !important; border-radius: 6px !important; color: #061314 !important; background: var(--cc-teal) !important; border-color: var(--cc-teal) !important; box-shadow: none !important; white-space: nowrap; }
body.lab .ed-top .lab-btn[data-ed="deliver"] { background: var(--cc-panel2) !important; border: 1px solid var(--cc-teal) !important; color: var(--cc-teal) !important; }
body.lab .ed-top .ed-upl { white-space: nowrap; }
.ed-title { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; line-height: 1.2; }
.ed-title b { font-size: 13.5px; font-weight: 700; letter-spacing: -.01em; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-title small { font-size: 11px; color: var(--lab-dim); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.lab .ed-ic { width: 26px; height: 26px; min-height: 0 !important; padding: 0 !important; display: grid; place-items: center; border-radius: 6px !important; border: 1px solid transparent !important; background: none !important; color: var(--cc-text) !important; font-size: 15px !important; cursor: pointer; box-shadow: none !important; flex: none; }
body.lab .ed-ic:hover { background: var(--cc-hover) !important; }
.ed-status { min-width: 0; font-size: 11.5px; color: var(--lab-dim); display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.ed-status a { color: var(--green); font-weight: 700; text-decoration: none; }
.ed-err { color: #FF8A7A; font-weight: 700; }
.ed-spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--lab-line); border-top-color: var(--accent); animation: ed-spin .8s linear infinite; }
@keyframes ed-spin { to { transform: rotate(360deg); } }
.ed-copy-note { flex: none; margin: 0; padding: 8px 12px; font-size: 12px; border-radius: 8px !important; }
.ed-copy-note a { color: var(--accent); }

/* upper half: media · player · inspector */
.ed-body { flex: 1 1 0; display: grid; grid-template-columns: minmax(250px, 27%) minmax(0, 1fr) minmax(260px, 25%); gap: 6px; min-height: 0; }
.ed-bin, .ed-insp, .ed-center, .ed-tl, .ed-pick { background: var(--cc-panel); border: 1px solid var(--cc-line); border-radius: 8px; }
.ed-pick { background: var(--panel); border-color: var(--border); border-radius: 16px; }
.ed-panel-hd { flex: none; display: flex; align-items: baseline; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--cc-line); min-width: 0; }
.ed-panel-hd b { font-size: 12.5px; font-weight: 700; }
.ed-panel-hd small { font-size: 11px; color: var(--lab-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* media panel: icon tab strip, then the active tab (thumbnail grid for Media) */
.ed-bin { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.ed-tabs { flex: none; display: flex; gap: 2px; padding: 4px 6px 0; border-bottom: 1px solid var(--cc-line); overflow-x: auto; scrollbar-width: none; }
.ed-tabs::-webkit-scrollbar { display: none; }
body.lab .ed .ed-tab { position: relative; flex: 1 0 auto; min-width: 48px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 6px 7px !important; min-height: 0 !important; border: 0 !important; border-bottom: 2px solid transparent !important; border-radius: 0 !important; background: none !important; color: var(--lab-dim) !important; font: 600 11px/1 inherit !important; cursor: pointer; box-shadow: none !important; }
body.lab .ed .ed-tab:hover { color: var(--cc-text) !important; }
body.lab .ed .ed-tab.on { color: var(--cc-teal) !important; border-bottom-color: var(--cc-teal) !important; }
.ed-tab::before { display: grid; place-items: center; height: 16px; font-size: 15px; line-height: 1; }
.ed-tab[data-ic="media"]::before { content: "▣"; }
.ed-tab[data-ic="audio"]::before { content: "♫"; }
.ed-tab[data-ic="text"]::before { content: "T"; font-weight: 800; font-family: Georgia, serif; }
.ed-tab[data-ic="cc"]::before { content: "CC"; font-size: 8.5px; font-weight: 800; height: 12px; margin: 2px 0; padding: 0 2px; border: 1.5px solid currentColor; border-radius: 3px; }
.ed-tab[data-ic="filters"]::before { content: "◐"; }
.ed-tab.warn::after { content: ""; position: absolute; top: 5px; right: 10px; width: 6px; height: 6px; border-radius: 50%; background: #FFB446; }
.ed-bin-list { padding: 8px; }
.ed-bin-hd { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.ed-bin-hd b { font-size: 12.5px; }
body.lab .ed-addtext { display: flex; align-items: center; gap: 8px; padding: 7px !important; border-radius: 7px !important; border: 1px solid var(--cc-line) !important; background: var(--cc-panel2) !important; color: var(--cc-text) !important; text-align: left; cursor: pointer; min-height: 0 !important; min-width: 0; }
body.lab .ed-addtext:hover { border-color: var(--cc-teal) !important; }
.ed-addtext > b { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; background: var(--cc-teal-dim); color: var(--cc-teal); font-size: 12px; font-weight: 800; }
.ed-addtext span { display: flex; flex-direction: column; min-width: 0; font-size: 12px; font-weight: 700; }
.ed-addtext small { font-size: 10.5px; font-weight: 500; color: var(--lab-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-bin-list { flex: 1; display: flex; flex-direction: column; gap: 8px; overflow: auto; min-height: 0; scrollbar-width: thin; }
.ed-bin-group { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.ed-bin-group + .ed-bin-group { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--cc-line); }
.ed-bin-group .ed-bin-hd { margin-bottom: 2px; }
.ed-bin-group .ed-bin-hd small { font-weight: 600; }
.ed-bin-empty { padding: 12px 10px; border-radius: 8px; background: var(--lab-inner); border: 1px dashed var(--lab-line); }
.ed-bin-empty p { margin: 0; font-size: 12px; color: var(--lab-dim); line-height: 1.45; }
.ed-bin-filters { display: flex; flex-wrap: wrap; gap: 2px; margin: 2px 0 0; }
body.lab .ed-bin-filters .ed-bin-filter { border: 0 !important; border-radius: 5px !important; background: none !important; color: var(--lab-dim) !important; font: inherit; font-size: 11px; font-weight: 600; padding: 3px 7px; cursor: pointer; text-align: left; }
body.lab .ed-bin-filters .ed-bin-filter:hover { color: var(--cc-text) !important; }
body.lab .ed-bin-filters .ed-bin-filter.on { color: var(--cc-text) !important; background: var(--cc-panel2) !important; }
/* Media tab: vertical sub-nav beside Import, search and the grid; it folds into a chip row in a narrow panel. */
.ed-bin-list:has(> .ed-media) { padding: 0; container-type: inline-size; }
.ed-media { flex: none; display: grid; grid-template-columns: 86px minmax(0, 1fr); min-height: 100%; }
.ed-subnav { position: sticky; top: 0; align-self: start; flex-direction: column; flex-wrap: nowrap; gap: 1px; margin: 0; padding: 8px 6px; min-height: 100%; box-sizing: border-box; border-right: 1px solid var(--cc-line); }
.ed-subnav-hd { padding: 6px 7px 3px; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--lab-faint); }
.ed-subnav-hd:first-child { padding-top: 0; }
body.lab .ed-subnav .ed-bin-filter { display: block; width: 100%; padding: 5px 7px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.lab .ed-subnav .ed-bin-filter.on { color: var(--cc-teal) !important; background: var(--cc-teal-dim) !important; }
.ed-media-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 8px; }
.ed-media-hd { display: flex; align-items: center; gap: 6px; }
.ed-media-hd .ed-bin-search { flex: 1; min-width: 0; margin: 0; }
@container (max-width: 300px) {
  .ed-media { display: flex; flex-direction: column; min-height: 0; }
  .ed-subnav { position: static; flex-direction: row; flex-wrap: wrap; min-height: 0; padding: 8px 8px 6px; border-right: 0; border-bottom: 1px solid var(--cc-line); }
  .ed-subnav-hd { display: none; }
  body.lab .ed-subnav .ed-bin-filter { width: auto; }
}
.ed-bin-search { display: block; margin: 2px 0 4px; }
.ed-bin-search input { width: 100%; min-height: 28px; padding: 4px 9px; border-radius: 6px; border: 1px solid var(--lab-line); background: var(--lab-inner); color: inherit; font: inherit; font-size: 12px; }
/* thumbnail grid: poster frame, "Added" + duration badges, name, hover actions */
.ed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.ed-bin-item { position: relative; display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 0; border-radius: 6px; }
.ed-bin-item[draggable="true"] { cursor: grab; }
.ed-bin-item[draggable="true"]:active { cursor: grabbing; }
.ed-thumb { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 10; border-radius: 6px; overflow: hidden; background: #0A0A0B; border: 1px solid var(--cc-line); }
.ed-bin-item:hover .ed-thumb { border-color: #4A4A52; }
.ed-bin-item.on-tl .ed-thumb { border-color: color-mix(in srgb, var(--accent) 55%, var(--cc-line)); }
.ed-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.ed-thumb[data-ed-thumb="audio"] { background: linear-gradient(135deg, #15243A, #1D4C86); }
.ed-thumb[data-ed-thumb="import"] { background: repeating-linear-gradient(135deg, #18181B 0 8px, #141416 8px 16px); }
.ed-bin-ic { color: var(--lab-dim); font-size: 18px; }
.ed-thumb[data-ed-thumb="audio"] .ed-bin-ic { color: #9CC3FF; font-size: 22px; }
.ed-bin-nm { min-width: 0; padding: 0 2px; font-size: 11px; color: var(--lab-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-bin-dur { position: absolute; right: 4px; bottom: 4px; padding: 1px 4px; border-radius: 3px; background: rgba(0,0,0,.72); font-size: 10px; font-weight: 600; color: #F1F1F3; font-variant-numeric: tabular-nums; }
.ed-bin-used { position: absolute; left: 4px; top: 4px; padding: 1px 5px; border-radius: 3px; background: rgba(0,0,0,.72); font-size: 9.5px; font-weight: 700; color: #F1F1F3; }
.ed-bin-acts { position: absolute; top: 4px; right: 4px; display: flex; gap: 3px; opacity: 0; transition: opacity .12s; }
.ed-bin-item:hover .ed-bin-acts, .ed-bin-item:focus-within .ed-bin-acts { opacity: 1; }
.ed-bin-acts .ed-muted { display: none; }
body.lab .ed-bin-item .lab-ghost { min-height: 0 !important; padding: 2px 6px !important; font-size: 10.5px !important; border-radius: 4px !important; border: 0 !important; background: rgba(10,10,12,.86) !important; color: #F1F1F3 !important; }
body.lab .ed-bin-item .lab-ghost:hover { background: var(--cc-teal) !important; color: #061314 !important; }
@media (hover: none) { .ed-bin-acts { opacity: 1; } }
body.lab .ed .ed-import { min-height: 26px !important; padding: 2px 10px !important; font-size: 11.5px !important; border-radius: 6px !important; border: 1px solid var(--cc-teal) !important; color: var(--cc-teal) !important; background: var(--cc-teal-dim) !important; }
/* audio / text / captions / filters tabs */
.ed-tab-note { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 8px; padding: 8px 10px; border-radius: 7px; background: var(--lab-inner); border: 1px solid var(--cc-line); }
.ed-tab-note b { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-tab-note small { grid-column: 1; font-size: 11px; color: var(--lab-dim); }
.ed-tab-note .lab-ghost { grid-row: 1 / span 2; grid-column: 2; }
.ed-tab-note.warn { border-color: rgba(255,180,70,.6); } .ed-tab-note.warn small { color: #FFB446; }
body.lab .ed-bin-list > .lab-ghost { align-self: flex-start; padding: 4px 9px !important; font-size: 11.5px !important; border-radius: 6px !important; }
.ed-tpls { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
body.lab .ed-tpls button { min-height: 52px !important; padding: 0 6px !important; border-radius: 6px !important; border: 1px solid var(--cc-line) !important; background-color: #0A0A0B; font-size: 16px !important; cursor: pointer; overflow: hidden; white-space: nowrap; box-shadow: none !important; }
body.lab .ed-tpls button:hover { border-color: var(--cc-teal) !important; }
.ed-looks { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
body.lab .ed-looks button { display: flex; flex-direction: column; gap: 4px; padding: 0 !important; min-height: 0 !important; border: 0 !important; background: none !important; color: var(--lab-sub) !important; font: 600 11px/1.2 inherit !important; cursor: pointer; text-align: left; box-shadow: none !important; }
.ed-looks i { display: block; aspect-ratio: 1; border-radius: 6px; border: 2px solid var(--cc-line); background: linear-gradient(160deg, #F2B880 0%, #E2725B 38%, #4B8F8C 70%, #1E3D59 100%); }
body.lab .ed-looks button.on { color: var(--cc-teal) !important; } .ed-looks button.on i { border-color: var(--cc-teal); }
body.lab .ed-looks button:hover:not(:disabled) i { border-color: #5A5A62; }

/* Fit both available axes; derive height from width so cover matches the 9:16 export. */
.ed-center { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.ed-stage-wrap { flex: 1 1 0; min-height: 0; min-width: 0; container-type: size; box-sizing: border-box; display: flex; align-items: center; justify-content: center; padding: 10px; background: #0A0A0B; }
.ed-stage { position: relative; flex: none; width: min(100cqw, 56.25cqh); height: auto; aspect-ratio: 9 / 16; border-radius: 2px; overflow: hidden; background: #000; container-type: size; box-shadow: 0 0 0 1px #1E1E22; }
.ed-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
/* Preloaded players have inline fade opacity, so hide them independently. */
.ed-stage video:not(.on) { visibility: hidden; }
.ed-stage video.on { opacity: 1; visibility: visible; }
.ed-stage-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; font-size: 12px; color: var(--lab-dim); }
.ed-stage-empty[hidden] { display: none; }
.ed-texts { position: absolute; inset: 0; pointer-events: none; }
/* text overlays: positioned by their centre, draggable on the video; sizes come from editor.js (scaled from 1080×1920) */
.ed-ov { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; cursor: move; touch-action: none; user-select: none; -webkit-user-select: none; }
.ed.ro .ed-ov { pointer-events: none; }
.ed-ov-in { display: flex; justify-content: center; align-items: center; overflow: hidden; }
.ed-text-overflow { position: absolute; bottom: 48px; left: 12px; right: 12px; z-index: 4; margin: 0; padding: 6px 12px; color: #FFD477; background: #302617; font-size: 12px; }
[data-ed-caption-overflow]{bottom:90px}
.ed-text-overflow[hidden] { display: none; }
.ed-ov-t { display: inline-block; white-space: pre-wrap; overflow-wrap: anywhere; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.ed-ov.sel::before { content: ""; position: absolute; inset: -7px; border: 1.5px dashed rgba(255,255,255,.9); border-radius: 6px; box-shadow: 0 0 0 1px rgba(0,0,0,.35); pointer-events: none; }
.ed-hd { position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2.5px solid var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.5); }
.ed-hd.hs { right: -16px; bottom: -16px; cursor: nwse-resize; }
.ed-hd.hr { left: 50%; top: -38px; margin-left: -8px; cursor: grab; }
.ed-hd.hr::after { content: ""; position: absolute; left: 50%; top: 14px; width: 1.5px; height: 17px; margin-left: -.75px; background: rgba(255,255,255,.9); }
.ed-guide { position: absolute; background: var(--accent); pointer-events: none; z-index: 2; }
.ed-guide[hidden] { display: none; }
.ed-guide.gx { top: 0; bottom: 0; left: 50%; width: 1px; } .ed-guide.gy { left: 0; right: 0; top: 50%; height: 1px; }
.ed-transport { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 10px; padding: 6px 12px; border-top: 1px solid var(--cc-line); }
body.lab .ed-play { width: 30px; height: 30px; min-height: 0 !important; padding: 0 !important; border-radius: 50% !important; border: 0 !important; background: none !important; cursor: pointer; position: relative; box-shadow: none !important; }
body.lab .ed-play:hover { background: var(--cc-hover) !important; }
.ed-play::before { content: ""; position: absolute; left: 11px; top: 8px; border-left: 11px solid var(--cc-text); border-top: 7px solid transparent; border-bottom: 7px solid transparent; }
.ed-play.on::before { left: 10px; top: 9px; width: 3px; height: 12px; border: 0; background: var(--cc-text); box-shadow: 7px 0 0 var(--cc-text); }
.ed-time { font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--cc-teal); white-space: nowrap; }
.ed-ratio { justify-self: end; padding: 2px 6px; border: 1px solid var(--lab-line); border-radius: 4px; font-size: 10.5px; font-weight: 700; color: var(--lab-sub); font-variant-numeric: tabular-nums; }

/* inspector: Details when nothing is selected, otherwise the clip / text / caption / soundtrack controls */
.ed-insp { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; overflow: auto; scrollbar-width: thin; }
.ed-insp > h3:first-child { position: sticky; top: 0; z-index: 2; margin: 0 -12px; padding: 8px 12px; background: var(--cc-panel); border-bottom: 1px solid var(--cc-line); font-size: 12.5px; font-weight: 700; }
.ed-insp h3 { margin: 0; font-size: 12.5px; font-weight: 700; }
.ed-insp-sec { display: flex; flex-direction: column; gap: 10px; padding-top: 10px; border-top: 1px solid var(--cc-line); }
.ed-details { display: grid; gap: 7px; margin: 0; }
.ed-details div { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; font-size: 11.5px; }
.ed-details dt { color: var(--lab-dim); }
.ed-details dd { margin: 0; color: var(--cc-text); overflow-wrap: anywhere; }
.ed-nm { margin: -4px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-f { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--lab-dim); }
.ed-f em { font-style: normal; color: var(--text); font-variant-numeric: tabular-nums; }
.ed-f input[type=number] { min-height: 30px; }
.ed-f input[type=range] { accent-color: var(--accent); width: 100%; }
.ed-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ed-row { display: flex; flex-wrap: wrap; gap: 5px; }
body.lab .ed-insp .lab-ghost { padding: 4px 9px !important; font-size: 11.5px !important; border-radius: 6px !important; }
.ed-seg { width: 100%; flex-wrap: wrap; }
.ed-seg button { flex: 1 0 auto; min-width: 34px !important; padding: 0 5px !important; font-size: 11px !important; }
body.lab .ed-text { width: 100%; resize: vertical; font: inherit; font-size: 13px; padding: 8px 9px; border-radius: 7px; background: var(--lab-inner) !important; border: 1px solid var(--lab-line) !important; color: var(--text); }
.ed-swatches { display: flex; gap: 7px; }
body.lab .ed-swatches button { width: 22px; height: 22px; min-height: 0 !important; padding: 0 !important; border-radius: 50% !important; border: 2px solid var(--lab-line) !important; cursor: pointer; box-shadow: none !important; }
body.lab .ed-swatches button.on { border-color: var(--accent) !important; box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent) !important; }
.ed-check { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.ed-check input { accent-color: var(--accent); }
body.lab .ed-danger { color: #FF8A7A !important; align-self: flex-start; }
.ed-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ed-facts span { display: flex; flex-direction: column; gap: 2px; padding: 8px; border-radius: 7px; background: var(--lab-inner); border: 1px solid var(--cc-line); }
.ed-facts small { font-size: 11px; color: var(--lab-dim); font-weight: 600; }
.ed-facts b { font-size: 14px; font-variant-numeric: tabular-nums; }
.ed-keys { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--lab-dim); }
.ed-keys kbd { display: inline-block; min-width: 18px; padding: 0 5px; margin-right: 4px; border-radius: 4px; border: 1px solid var(--lab-line); background: var(--lab-inner); color: var(--text); font: 600 10.5px/1.5 inherit; text-align: center; }

/* lower half: toolbar + timeline */
.ed-tl { flex: 0 0 clamp(220px, 38%, 400px); display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.ed-tools { flex: none; display: flex; align-items: center; gap: 2px; padding: 4px 8px; border-bottom: 1px solid var(--cc-line); min-width: 0; overflow-x: auto; scrollbar-width: none; }
.ed-tools::-webkit-scrollbar { display: none; }
body.lab .ed .ed-tb { display: inline-flex; align-items: center; justify-content: center; gap: 0; flex: none; height: 26px; min-width: 26px; min-height: 0 !important; padding: 0 6px !important; border: 0 !important; border-radius: 5px !important; background: none !important; color: var(--cc-text) !important; font-family: inherit !important; font-weight: 600 !important; font-size: 11.5px !important; line-height: 1 !important; white-space: nowrap; cursor: pointer; box-shadow: none !important; }
.ed-tb-l { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
body.lab .ed .ed-tb:hover:not(:disabled) { background: var(--cc-hover) !important; }
body.lab .ed .ed-tb.on, body.lab .ed .ed-tb[aria-pressed="true"] { color: var(--cc-teal) !important; }
body.lab .ed .ed-tb[data-ic="keys"], body.lab .ed .ed-tb[data-ic="fit"] { font-size: 11.5px !important; padding: 0 8px !important; }
.ed-tb::before { font-size: 14px; line-height: 1; }
.ed-tb[data-ic="select"]::before { content: "↖"; }
.ed-tb[data-ic="undo"]::before { content: "↶"; }
.ed-tb[data-ic="redo"]::before { content: "↷"; }
.ed-tb[data-ic="split"]::before { content: "✂"; }
.ed-tb[data-ic="trim-l"]::before { content: "⇤"; }
.ed-tb[data-ic="trim-r"]::before { content: "⇥"; }
.ed-tb[data-ic="dup"]::before { content: "⧉"; }
.ed-tb[data-ic="delete"]::before { content: "⌫"; font-size: 13px; }
.ed-tb[data-ic="text"]::before { content: "T"; font-weight: 800; font-size: 13px; }
.ed-tb[data-ic="cc"]::before { content: "CC"; font-weight: 800; font-size: 9.5px; padding: 2px 3px; border: 1.5px solid currentColor; border-radius: 3px; }
.ed-tb[data-ic="magnet"]::before { content: "⋒"; font-size: 16px; }
.ed-tsep { flex: none; width: 1px; height: 16px; margin: 0 5px; background: var(--cc-line); }
.ed-zoomr { flex: none; width: 110px; accent-color: var(--cc-teal); }
.ed-hotkeys { cursor: help; user-select: none; }
.ed-scroll { flex: 1 1 0; min-height: 0; overflow: auto; background: #111113; scrollbar-width: thin; }
/* Track headers stay pinned on the left while the lanes scroll; both share one vertical scroll. */
.ed-tlgrid { display: flex; min-width: 100%; width: max-content; }
.ed-heads { position: sticky; left: 0; z-index: 9; flex: none; width: 104px; padding: 0 0 10px; background: var(--cc-panel); border-right: 1px solid var(--cc-line); }
.ed-head { display: flex; align-items: center; gap: 6px; height: 22px; margin-top: 6px; padding: 0 6px 0 8px; font-size: 10.5px; font-weight: 600; color: var(--lab-dim); }
.ed-head span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-head-ruler { position: sticky; top: 0; z-index: 2; height: 22px; margin-top: 0; background: var(--cc-panel); border-bottom: 1px solid var(--cc-line); }
.ed-head-t + .ed-head-t { margin-top: 3px; }
.ed-head-v { height: 50px; color: var(--cc-text); } .ed-head-a { height: 26px; }
.ed-head-ic { flex: none; display: grid; place-items: center; width: 16px; height: 16px; border-radius: 3px; font-style: normal; font-size: 10px; font-weight: 800; }
.ed-head-ic[data-ic="text"] { background: var(--cc-text-chip); color: #FFF4EC; } .ed-head-ic[data-ic="text"]::before { content: "T"; }
.ed-head-ic[data-ic="video"] { background: var(--cc-video); color: #E9FBFC; } .ed-head-ic[data-ic="video"]::before { content: "▶"; font-size: 8px; }
.ed-head-ic[data-ic="cc"] { background: var(--cc-text-chip); color: #FFF4EC; font-size: 7.5px; } .ed-head-ic[data-ic="cc"]::before { content: "CC"; }
.ed-head-ic[data-ic="audio"] { background: var(--cc-audio); color: #E6F0FF; } .ed-head-ic[data-ic="audio"]::before { content: "♪"; font-size: 11px; }
body.lab .ed .ed-head-btn { flex: none; display: grid; place-items: center; width: 22px; height: 22px; min-height: 0 !important; padding: 0 !important; border: 0 !important; border-radius: 4px !important; background: none !important; color: var(--lab-dim) !important; cursor: pointer; box-shadow: none !important; }
body.lab .ed .ed-head-btn:hover { background: var(--cc-hover) !important; color: var(--cc-text) !important; }
body.lab .ed .ed-head-btn.on { color: #FF8A7A !important; }
.ed-head-btn::before { content: ""; width: 14px; height: 14px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 9v6h4l5 5V4L7 9H3z'/%3E%3Cpath d='M14 7.5v9a4.5 4.5 0 0 0 0-9z'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 9v6h4l5 5V4L7 9H3z'/%3E%3Cpath d='M14 7.5v9a4.5 4.5 0 0 0 0-9z'/%3E%3C/svg%3E") center / contain no-repeat; }
.ed-head-btn.on::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 9v6h4l5 5V4L7 9H3z'/%3E%3Cpath d='M15 9l6 6M21 9l-6 6' stroke='%23000' stroke-width='2.2'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 9v6h4l5 5V4L7 9H3z'/%3E%3Cpath d='M15 9l6 6M21 9l-6 6' stroke='%23000' stroke-width='2.2'/%3E%3C/svg%3E"); }
.ed-lanes { position: relative; flex: 1 0 auto; min-width: 0; padding: 0 0 10px; user-select: none; -webkit-user-select: none; touch-action: none; }
.ed-ruler { position: sticky; top: 0; z-index: 6; height: 22px; background: #111113; border-bottom: 1px solid var(--cc-line); cursor: pointer; }
.ed-ruler span { position: absolute; top: 4px; padding-left: 4px; border-left: 1px solid #3A3A40; font-size: 10px; line-height: 14px; color: var(--lab-faint); font-variant-numeric: tabular-nums; }
.ed-lane { position: relative; margin-top: 6px; }
.ed-lane-t { height: 22px; } .ed-lane-v { height: 50px; } .ed-lane-c { height: 22px; } .ed-lane-a { height: 26px; }
.ed-lane-t + .ed-lane-t { margin-top: 3px; }
.ed-cblock { position: absolute; top: 0; bottom: 0; margin: 0; border: 1px solid var(--cc-text-line) !important; border-radius: 4px !important; background: color-mix(in srgb, var(--cc-text-chip) 70%, #000) !important; color: #FBEDE4 !important; font: 600 10.5px/1.2 inherit; padding: 0 5px !important; overflow: hidden; text-align: left; cursor: pointer; min-height: 0 !important; }
.ed-cblock.on { background: var(--cc-text-chip) !important; box-shadow: inset 0 0 0 1px #FFB48A !important; }
.ed-cblock span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-lane-c.stale .ed-cblock { opacity: .45; }
.ed-lane-stale { position: absolute; z-index: 2; left: 8px; top: 1px; bottom: 1px; margin: 0; border: 0 !important; border-radius: 4px !important; padding: 0 8px !important; background: rgba(255, 180, 70, .92) !important; color: #14120E !important; font: 700 10.5px/1 inherit; cursor: pointer; min-height: 0 !important; }
.ed-lab { position: sticky; left: 0; z-index: 3; display: none; }
.ed-lane-hint { position: absolute; left: 8px; top: 4px; font-size: 11px; }
button.ed-lane-hint { margin: 0; border: 0 !important; padding: 0 !important; background: transparent !important; color: var(--lab-dim) !important; font: inherit; font-size: 11px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; min-height: 0 !important; }
.ed-clip, .ed-tblock, .ed-ablock { position: absolute; top: 0; bottom: 0; display: flex; flex-direction: column; justify-content: center; padding: 0 10px; border-radius: 4px; overflow: hidden; cursor: grab; min-width: 4px; }
.ed-clip { background: var(--cc-video); border: 1px solid var(--cc-video-line); color: #E9FBFC; }
.ed-clip span, .ed-tblock span, .ed-ablock span { font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-clip small { font-size: 10.5px; color: #A9DCDF; white-space: nowrap; }
.ed-clip.film { justify-content: flex-start; padding-top: 4px; background: linear-gradient(180deg, rgba(8,44,47,.92) 0, rgba(8,44,47,.55) 18px, rgba(8,44,47,.08) 100%), var(--ed-film) 0 0 / auto 100% repeat-x, var(--cc-video); }
.ed-clip.film span, .ed-clip.film small { text-shadow: 0 1px 2px rgba(0,0,0,.8); }
.ed-clip.miss { background: repeating-linear-gradient(135deg, #1B2A2B 0 8px, #162223 8px 16px); }
.ed-clip.drag { z-index: 5; opacity: .85; cursor: grabbing; box-shadow: 0 6px 18px rgba(0,0,0,.4); }
.ed-tblock { background: var(--cc-text-chip); border: 1px solid var(--cc-text-line); color: #FFF4EC; }
.ed-ablock { background: var(--cc-audio); border: 1px solid var(--cc-audio-line); color: #E6F0FF; cursor: pointer; }
.ed-clip.sel, .ed-tblock.sel, .ed-ablock.sel { outline: 2px solid #FFFFFF; outline-offset: -1px; }
.ed-clip .h, .ed-tblock .h { position: absolute; top: 0; bottom: 0; width: 9px; cursor: ew-resize; z-index: 2; }
.ed-clip .h.l, .ed-tblock .h.l { left: 0; } .ed-clip .h.r, .ed-tblock .h.r { right: 0; }
.ed-clip.sel .h, .ed-tblock.sel .h { background: #FFFFFF; }
.ed-clip.sel .h::after, .ed-tblock.sel .h::after { content: ""; position: absolute; left: 3.5px; top: 35%; bottom: 35%; width: 2px; border-radius: 1px; background: #111113; }
/* fade wedges: soft edge marks when fade in/out is enabled on a clip or soundtrack */
.ed-clip .ed-fade, .ed-ablock .ed-fade { position: absolute; top: 0; bottom: 0; width: min(28%, 36px); pointer-events: none; z-index: 1; }
.ed-clip .ed-fade.in, .ed-ablock .ed-fade.in { left: 0; background: linear-gradient(90deg, rgba(8,8,10,.72), transparent); }
.ed-clip .ed-fade.out, .ed-ablock .ed-fade.out { right: 0; background: linear-gradient(270deg, rgba(8,8,10,.72), transparent); }
.ed-ablock .ed-fade.in { background: linear-gradient(90deg, rgba(8,8,10,.55), transparent); }
.ed-ablock .ed-fade.out { background: linear-gradient(270deg, rgba(8,8,10,.55), transparent); }
.ed-drop { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--accent); z-index: 6; }
.ed-drop[hidden], .ed-drop-replace[hidden] { display: none; }
.ed-drop-replace { position: absolute; top: 4px; z-index: 8; pointer-events: none; padding: 5px 8px; border-radius: 4px; background: #111113; color: #FFFFFF; border: 1px solid var(--accent); font-size: 12px; font-weight: 600; white-space: nowrap; }
/* only the knob (in the ruler row) is grabbable, so the line never covers clip trim handles */
.ed-ph { position: absolute; top: 0; bottom: 0; width: 15px; margin-left: -7px; z-index: 7; pointer-events: none; }
.ed-ph::before { content: ""; position: absolute; left: 7px; top: 0; bottom: 0; width: 1px; background: #FFFFFF; }
.ed-ph i { position: absolute; left: 1px; top: 0; width: 13px; height: 16px; border-radius: 3px 3px 50% 50%; background: #FFFFFF; pointer-events: auto; cursor: ew-resize; touch-action: none; }

/* picker (#/editor with no variation chosen) */
.ed-pick { padding: 16px 18px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 12px; }
.ed-pick-hd { display: flex; flex-direction: column; gap: 2px; }
.ed-pick-hd b { font-size: 15px; } .ed-pick-hd small { font-size: 12.5px; color: var(--lab-dim); }
.ed-pick .lab-none a { color: var(--accent); }
.ed-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
.ed-pick-card { display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none; }
.ed-pick-card .fr { position: relative; aspect-ratio: 9 / 16; border-radius: 10px; overflow: hidden; background: repeating-linear-gradient(135deg, #1D1B18 0 9px, #181613 9px 18px); border: 1px solid var(--border); }
.ed-pick-card .fr video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ed-pick-card .fr em { position: absolute; top: 6px; left: 6px; padding: 2px 7px; border-radius: 6px; background: var(--accent); color: #14120E; font-style: normal; font-size: 11px; font-weight: 800; }
.ed-pick-card b { font-size: 12.5px; }
.ed-pick-card:hover .fr { border-color: var(--accent); }

.ed-rotag { font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 6px; background: var(--cc-panel2); color: var(--lab-sub); white-space: nowrap; }
.ed-upl { cursor: pointer; }
.ed.ro .ed-body { grid-template-columns: minmax(0, 1fr) minmax(260px, 25%); }
.ed.ro .ed-clip, .ed.ro .ed-tblock, .ed.ro .ed-ablock { cursor: default; }

/* Narrow desktops tighten the side panels; tablets and phones stack the panels and scroll the page. */
@media (max-width: 1280px) { .ed-body { grid-template-columns: 230px minmax(0, 1fr) 250px; } .ed-zoomr { width: 80px; } }
@media (max-width: 1000px) {
  body.lab[data-page="editor"] #app:has(.ed[data-ed-root]) { height: auto; overflow: visible; }
  .ed { height: auto; }
  .ed-body { flex: none; grid-template-columns: minmax(0, 1fr) 260px; }
  .ed-bin { grid-column: 1 / -1; order: 3; max-height: 300px; }
  .ed-insp { max-height: min(70vh, 560px); }
  .ed-stage-wrap { flex: none; height: calc(min(58vh, 520px) + 20px); }
  .ed-tl { flex: none; height: 320px; }
  .ed-top { grid-template-columns: minmax(0, 1fr) auto; }
  .ed-top > .ed-title { grid-row: 1; grid-column: 1; align-items: flex-start; text-align: left; max-width: none; }
  .ed-top-r { grid-row: 1; grid-column: 2; }
  .ed-top-l { grid-row: 2; grid-column: 1 / -1; flex-wrap: wrap; }
  .ed-heads { width: 84px; }
}
@media (max-width: 720px) {
  .ed-body, .ed.ro .ed-body { grid-template-columns: minmax(0, 1fr); }
  .ed-insp { max-height: none; }
  .ed-stage-wrap { height: calc(min(62vh, 520px) + 20px); }
  .ed-top { grid-template-columns: minmax(0, 1fr); }
  .ed-top-r { grid-row: 2; grid-column: 1; justify-content: flex-start; }
  .ed-top-l { grid-row: 3; }
  .ed-bin { order: 2; max-height: 360px; }
  .ed-insp { order: 3; }
  .ed-heads { width: 40px; }
  .ed-head span { display: none; }
  .ed-head { padding: 0 4px; justify-content: center; flex-direction: column; gap: 2px; }
  .ed-head-v .ed-head-btn, .ed-head-a .ed-head-btn { width: 20px; height: 18px; }
}
@media (prefers-reduced-motion: reduce) { .ed-spin { animation: none; } }

/* text inspector: presets, grouped options, any-colour pickers */
.ed-insp h3 small { font-weight: 600; font-size: 11px; margin-left: 6px; }
.ed-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
body.lab .ed-presets button { min-height: 32px !important; padding: 0 4px !important; border-radius: 6px !important; border: 1px solid var(--lab-line) !important; background: #26262B; font-size: 13px !important; cursor: pointer; overflow: hidden; white-space: nowrap; box-shadow: none !important; }
body.lab .ed-presets button:hover { border-color: var(--accent) !important; }
body.lab .ed-presets button.on { border-color: var(--accent) !important; box-shadow: inset 0 0 0 1px var(--accent) !important; }
.ed-cap-presets { margin: 0 0 8px; }
body.lab .ed-cap-presets button { font-size: 11.5px !important; font-weight: 700; }
.ed-grp { border: 1px solid var(--cc-line); border-radius: 7px; background: var(--lab-inner); }
.ed-grp > summary { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 12px; font-weight: 700; cursor: pointer; list-style: none; }
.ed-grp > summary::-webkit-details-marker { display: none; }
.ed-grp > summary::before { content: "›"; color: var(--lab-dim); transition: transform .15s; }
.ed-grp[open] > summary::before { transform: rotate(90deg); }
.ed-grp-b { display: flex; flex-direction: column; gap: 9px; padding: 0 10px 10px; }
.ed-sw { margin-left: auto; appearance: none; -webkit-appearance: none; width: 30px; height: 17px; border-radius: 9px; background: var(--lab-line); position: relative; cursor: pointer; flex: none; }
.ed-sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: var(--text); transition: transform .15s; }
.ed-sw:checked { background: var(--accent); } .ed-sw:checked::after { transform: translateX(13px); background: #061314; }
.ed-crow { display: flex; align-items: flex-end; gap: 10px; } .ed-crow .ed-f { flex: 1; }
.ed-color { width: 30px; height: 30px; padding: 0; border: 2px solid var(--lab-line); border-radius: 50%; background: none; cursor: pointer; flex: none; overflow: hidden; }
.ed-color::-webkit-color-swatch-wrapper { padding: 0; } .ed-color::-webkit-color-swatch { border: 0; border-radius: 50%; }
.ed-color::-moz-color-swatch { border: 0; border-radius: 50%; }
.ed-swatches { flex-wrap: wrap; align-items: center; }
body.lab .ed-sel { min-height: 30px; }
.ed-brief { display: flex; flex-direction: column; gap: 5px; padding: 9px 10px; border-radius: 7px; background: var(--lab-inner); border: 1px solid var(--cc-line); font-size: 12px; }
.ed-brief p { margin: 0; white-space: pre-wrap; color: var(--lab-sub); } .ed-brief a { color: var(--accent); font-weight: 700; text-decoration: none; } .ed-brief small { color: var(--lab-dim); }

.ed-tint{position:absolute;inset:0;pointer-events:none;z-index:2;opacity:0}.ed-texts{z-index:3}.ed-stage{overflow:hidden}.ed-insp select{max-width:100%}

/* Editable captions and their portrait preview. */
.ed-caption-preview{position:absolute;left:50%;display:flex;align-items:center;overflow:hidden;transform:translate(-50%,-50%);text-align:center;z-index:5;pointer-events:none;line-height:1.25;word-break:normal}
.ed-caption-content{width:100%;flex-shrink:0}
.ed-caption-preview span{paint-order:stroke fill}
.ed-caption-controls{display:grid;grid-template-columns:2fr 1fr 1fr;gap:12px}
.ed-caption-controls label{display:flex;flex-direction:column;gap:6px;font-size:12px}
.ed-caption-actions{display:flex;gap:10px;margin:18px 0}
.ed-caption-words{max-height:42vh;overflow:auto}
.ed-caption-word,.ed-caption-labels{display:grid;grid-template-columns:minmax(100px,1fr) 82px 82px 32px 32px;gap:6px;margin:6px 0;align-items:center}
.ed-caption-labels{font-size:11px;color:var(--muted);margin-top:16px}
.ed-caption-word input{min-width:0;padding:8px}
@media(max-width:640px){.ed-caption-controls{grid-template-columns:1fr 1fr}.ed-caption-controls label:first-child{grid-column:1/-1}.ed-caption-word,.ed-caption-labels{grid-template-columns:minmax(85px,1fr) 65px 65px 26px 26px;gap:3px}}

.ed-keys-list { display: grid; gap: 8px; font-size: 13px; }
.ed-keys-list p { margin: 0; }
.ed-keys-list b { font-variant-numeric: tabular-nums; }
button.ed-hotkeys { margin-left: 6px; }
.ticket-kind{display:flex;gap:8px;margin-top:10px;flex-wrap:wrap}.ticket-kind .active{outline:2px solid currentColor}
