/* Vinvite editor (DESIGN-BRIEF.md): a calm studio — floating cards on a warm workspace, custom controls, a real timeline. */
@font-face { font-family: "Inter Variable"; src: url("/vendor/inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
:root {
  --workspace: #f4f3f0; --panel: #fff; --panel-soft: #f5f6f8; --field: #f3f4f7;
  --line: #e7e8ec; --line-strong: #d3d8e5;
  --text: #282c35; --muted: #707785; --faint: #9aa1ae;
  --accent: #5269d8; --accent-hover: #435abe; --accent-soft: #edf0ff; --danger: #ad454c; --warn: #8a5a00;
  --tl-blue: #1678f7; --tl-blue-deep: #0757bd; --tl-blue-bright: #64b4ff; --tl-playhead: #0aa7eb;
  --tl-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --radius-panel: 16px; --radius-control: 8px; --radius-menu: 11px;
  --shadow-card: 0 1px 2px rgba(20,24,40,.04), 0 6px 20px rgba(20,24,40,.05);
  --shadow-menu: 0 14px 44px #10182838, 0 2px 8px #1018281f;
  --brand: #7a0c1e; /* the Vinvite maroon: the logo word only */
  --ease: 130ms ease;
  --left-w: 320px; --right-w: 360px; --tl-h: 250px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 13px/1.45 "Inter Variable", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); background: var(--workspace); -webkit-font-smoothing: antialiased; }
input, select, textarea, button { font: inherit; color: inherit; }
.mono, .scrub-value, .tl-tick span, .tl-clip-dur, #t-now, .t-of, #total { font-family: var(--tl-mono); font-variant-numeric: tabular-nums; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.vh, .dd-native, .drop-input { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); }
h3 { font-size: 12px; margin: 16px 0 6px; font-weight: 600; color: var(--text); }

/* ---- buttons */
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
.btn, #left button:not([class]), #right button:not([class]), #music button:not([class]), #form button:not([class]), #job button:not([class]) {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-control);
  background: var(--panel); font-weight: 500; white-space: nowrap; transition: border-color var(--ease), background var(--ease), box-shadow var(--ease), transform var(--ease); }
.btn:hover:not(:disabled), #left button:not([class]):hover:not(:disabled), #right button:not([class]):hover:not(:disabled) { border-color: var(--line-strong); background: var(--panel-soft); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(82,105,216,.32), inset 0 1px 0 rgba(255,255,255,.18); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.small, button.small { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
button.small:not(.btn):not(.icon-btn) { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: var(--panel); }
button.small:not(.btn):not(.icon-btn):hover { border-color: var(--line-strong); background: var(--panel-soft); }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid transparent; border-radius: var(--radius-control); background: transparent; color: var(--muted); flex: none;
  transition: background var(--ease), color var(--ease), border-color var(--ease); }
.icon-btn:hover:not(:disabled) { background: var(--panel-soft); color: var(--text); }
.icon-btn.small { width: 28px; height: 28px; }
.icon-btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
[data-icon] { display: inline-flex; }
.ic { flex: none; display: block; }

/* ---- header */
header.top { height: 58px; display: flex; align-items: center; gap: 14px; padding: 0 16px 0 20px; }
.logo { font-size: 19px; font-weight: 700; letter-spacing: -.02em; color: var(--brand); }
.tpl-pick { display: flex; }
.tpl-pick .dd-btn { min-width: 210px; max-width: 280px; background: var(--panel); }
#about { flex: 1; min-width: 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.top-actions .btn { margin-left: 4px; }

/* ---- workspace: [left] [stage + timeline] [inspector] */
#workspace { display: grid; grid-template-columns: var(--left-w) minmax(0, 1fr) var(--right-w); gap: 12px; padding: 0 12px 12px; height: calc(100vh - 58px); min-height: 520px; }
@media (prefers-reduced-motion: no-preference) { #workspace { transition: grid-template-columns 160ms ease; } }
body.left-collapsed { --left-w: 52px; }
body.right-collapsed { --right-w: 52px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-panel); box-shadow: var(--shadow-card); min-width: 0; min-height: 0; }
aside.panel { display: flex; flex-direction: column; overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 10px 10px 10px 18px; border-bottom: 1px solid var(--line); flex: none; }
.panel-head h2 { margin: 0; flex: 1; min-width: 0; font-size: 15px; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#scene-title .muted { font-weight: 450; font-size: 13px; }
.panel-body { position: relative; flex: 1; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: #d6d9e0 transparent; }
.strip { display: none; }
body.left-collapsed #left .panel-body, body.right-collapsed #right .panel-body { display: none; }
body.left-collapsed #left .panel-head, body.right-collapsed #right .panel-head { padding: 8px; justify-content: center; border-bottom: 1px solid var(--line); }
body.left-collapsed #left .panel-head h2, body.right-collapsed #right .panel-head h2 { display: none; }
body.left-collapsed #left .strip { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0; }
body.left-collapsed #left-toggle .ic, body.right-collapsed #right-toggle .ic { transform: scaleX(-1); }

/* ---- collapsible sections */
.sec { border-bottom: 1px solid var(--line); }
.sec > summary { display: flex; align-items: center; gap: 10px; padding: 14px 16px 14px 18px; cursor: pointer; list-style: none; font-weight: 600; font-size: 13.5px; user-select: none; }
.sec > summary::-webkit-details-marker { display: none; }
.sec > summary > .ic, .sec > summary > [data-icon]:first-child { color: var(--muted); }
.sec > summary:hover .sec-chev { opacity: 1; }
.sec-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sec-chev { margin-left: auto; color: var(--muted); opacity: .7; transition: transform var(--ease); }
.sec[open] > summary .sec-chev { transform: rotate(180deg); }
.sec-body { padding: 0 18px 18px; }
#total { font-size: 11.5px; font-weight: 450; color: var(--muted); }

/* ---- fields */
label.field, div.field { display: block; margin: 10px 0 0; min-width: 0; }
label.field > span, div.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; min-width: 0; }
input[type="text"], input[type="date"], input[type="time"], input[type="tel"], input[type="number"], textarea, select:not(.dd-native) {
  width: 100%; height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--field);
  transition: border-color var(--ease), box-shadow var(--ease), background var(--ease); }
textarea { height: auto; min-height: 72px; padding: 8px 11px; resize: vertical; line-height: 1.45; }
input:hover:not(:focus), textarea:hover:not(:focus) { border-color: var(--line-strong); }
input[type="text"]:focus, input[type="date"]:focus, input[type="time"]:focus, input[type="tel"]:focus, textarea:focus { outline: none; background: var(--panel); border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), 0 0 0 3px rgba(82,105,216,.25); }
.event { border: 1px solid var(--line); border-radius: 12px; padding: 4px 12px 12px; margin: 10px 0; background: var(--panel-soft); }
.event input[type="text"], .event input[type="date"], .event input[type="time"] { background: var(--panel); }
.event legend { font-size: 12px; font-weight: 600; padding: 0 6px; }
.event > button { margin-top: 10px; }
#form > button { margin-top: 4px; }
.hint { font-size: 12px; color: var(--muted); }
.song-info { font-size: 12px; color: var(--muted); margin: 6px 0 0; font-variant-numeric: tabular-nums; }

/* ---- custom dropdown */
.dd-btn { display: flex; align-items: center; gap: 8px; width: 100%; height: 36px; padding: 0 10px 0 12px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--panel); text-align: left;
  transition: border-color var(--ease), box-shadow var(--ease); }
.dd-btn:hover:not(:disabled) { border-color: rgba(82,105,216,.4); }
.dd-btn.open { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(82,105,216,.2); }
.dd-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-chev { opacity: .6; transition: transform var(--ease); display: inline-flex; }
.dd-btn.open .dd-chev { transform: rotate(180deg); }
.dd-menu { position: fixed; z-index: 1000; max-height: 320px; overflow-y: auto; padding: 5px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-menu); box-shadow: var(--shadow-menu); scrollbar-width: thin; }
@media (prefers-reduced-motion: no-preference) { .dd-menu { animation: dd-in 120ms ease; } .dd-menu.up { animation-name: dd-in-up; } }
@keyframes dd-in { from { opacity: 0; transform: translateY(-4px); } }
@keyframes dd-in-up { from { opacity: 0; transform: translateY(4px); } }
.dd-row { display: flex; align-items: center; gap: 10px; min-height: 32px; padding: 6px 10px; border-radius: 7px; cursor: pointer; white-space: nowrap; }
.dd-row.active { background: var(--panel-soft); }
.dd-row.sel { color: var(--accent); font-weight: 550; }
.dd-row.off { opacity: .45; cursor: default; }
.dd-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.dd-check { display: inline-flex; color: var(--accent); }
.dd-group { padding: 8px 10px 4px; font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.dd-group:first-child { padding-top: 4px; }

/* ---- scrub field */
.scrub { position: relative; display: flex; align-items: center; height: 36px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--field); overflow: hidden;
  cursor: ew-resize; user-select: none; touch-action: none; transition: border-color var(--ease), box-shadow var(--ease); }
.scrub:hover { border-color: var(--line-strong); }
.scrub:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(82,105,216,.25); }
.scrub.dragging { border-color: var(--accent); }
.scrub-fill { position: absolute; inset: 0 auto 0 0; background: rgba(82,105,216,.11); pointer-events: none; }
.scrub-mark { position: absolute; top: 9px; bottom: 9px; width: 2px; border-radius: 1px; background: rgba(82,105,216,.55); pointer-events: none; }
.scrub-label { position: relative; flex: 1; min-width: 0; padding: 0 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scrub-value { position: relative; display: flex; align-items: baseline; justify-content: flex-end; gap: 3px; min-width: 82px; height: 100%; align-items: center; padding: 0 12px; border-left: 1px solid var(--line); font-size: 12.5px; }
.scrub-unit { color: var(--faint); font-size: 11px; }
.scrub-input { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0 12px; border: 0; background: var(--panel); text-align: right; font-family: var(--tl-mono); font-size: 12.5px; cursor: text; }
.scrub-input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent); border-radius: var(--radius-control); }
.scrub-compact { width: 86px; flex: none; }
.scrub-compact .scrub-value { border-left: 0; min-width: 0; width: 100%; justify-content: center; }
.scrub-compact .scrub-mark { display: none; }
.scrubs { display: grid; gap: 8px; margin-top: 10px; }

/* ---- switch */
input.switch { appearance: none; -webkit-appearance: none; position: relative; width: 36px; height: 20px; margin: 0; flex: none; border-radius: 999px; background: #dfe2e8; cursor: pointer; transition: background var(--ease); }
input.switch::before { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(20,24,40,.25); transition: transform var(--ease); }
input.switch:checked { background: var(--accent); }
input.switch:checked::before { transform: translateX(16px); }
input.switch:disabled { opacity: .5; cursor: default; }
input.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
label.check { display: flex; align-items: center; gap: 10px; margin: 12px 0 0; cursor: pointer; line-height: 1.3; }

/* ---- segmented */
.segmented { display: flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--panel-soft); border: 1px solid var(--line); }
.seg { flex: 1; position: relative; display: flex; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { flex: 1; display: grid; place-items: center; height: 30px; padding: 0 6px; border-radius: 7px; color: var(--muted); cursor: pointer; font-size: 12.5px; white-space: nowrap; transition: background var(--ease), color var(--ease), box-shadow var(--ease); }
.seg span:hover { color: var(--text); }
.seg input:checked + span { background: var(--panel); color: var(--text); font-weight: 550; box-shadow: 0 1px 2px rgba(20,24,40,.08), 0 0 0 1px var(--line); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---- drop zone */
.drop { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; margin-top: 10px; padding: 10px 12px; border: 1.5px dashed var(--line-strong); border-radius: 10px; color: var(--muted); cursor: pointer; text-align: center;
  transition: border-color var(--ease), background var(--ease), color var(--ease); }
.drop:hover, .drop.over { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.drop:has(input:disabled):hover { border-color: var(--line-strong); color: var(--muted); background: none; }
.upload { margin-top: 4px; }
.upload .segmented { margin-top: 10px; }
.upload .hint { margin: 6px 0 0; }

/* ---- scene list */
#scenes { list-style: none; padding: 0; margin: 0 -6px; }
#scenes li { display: grid; grid-template-columns: auto minmax(0, 1fr) 86px auto; gap: 8px; align-items: center; padding: 6px; border-radius: 10px; transition: background var(--ease); }
#scenes li:hover { background: var(--panel-soft); }
#scenes li.sel { background: var(--accent-soft); }
#scenes li.off .name { color: var(--faint); text-decoration: line-through; }
#scenes .name { background: none; border: none; text-align: left; padding: 2px 0; min-width: 0; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#scenes .at { display: block; font-size: 11px; color: var(--muted); font-weight: 400; font-family: var(--tl-mono); }
#scenes .moves { display: flex; }
#scenes .scrub { height: 32px; background: var(--panel); }
#scenes li.sel .scrub { border-color: rgba(82,105,216,.3); }

/* ---- picture tiles and template cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.tile { position: relative; aspect-ratio: 1; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-soft); cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--muted); overflow: visible; transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease); }
.tile img { width: 100%; height: 100%; object-fit: contain; }
.tile:hover { border-color: var(--line-strong); box-shadow: 0 6px 16px rgba(20,24,40,.08); transform: translateY(-1px); }
.tile.sel, .card.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tile.sel::after, .card.sel::after { content: ""; position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(20,24,40,.2);
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 11px no-repeat; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; margin-top: 14px; }
.card { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 5px 5px 7px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); cursor: pointer; font-size: 11.5px; font-weight: 550; line-height: 1.25; text-align: center;
  transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease); }
.card:hover { border-color: var(--line-strong); box-shadow: 0 6px 16px rgba(20,24,40,.08); transform: translateY(-1px); }
.card img { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 8px; background: var(--panel-soft); display: block; }
.card.sel { box-shadow: 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-soft); }
#gallery .hint { grid-column: 1 / -1; padding: 14px; text-align: center; border: 1px dashed var(--line-strong); border-radius: 10px; margin: 0; }

/* ---- inspector */
#inspector .sec-body > .grid + .upload { margin-top: 8px; }
#inspector > .hint { margin: 14px 18px 0; }
.insp-foot { padding: 16px 18px 20px; }

/* ---- messages */
.stage-msgs { flex: none; max-height: 34%; overflow-y: auto; padding: 0 14px; scrollbar-width: thin; }
.stage-msgs:has(#errors:empty):has(#job:empty) { display: none; }
#errors p, #job > p { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; padding: 8px 12px; border-radius: 10px; font-size: 12.5px; line-height: 1.4; }
#errors p:first-child { margin-top: 0; }
.err, #errors p.err { color: var(--danger); background: #fbeff0; border: 1px solid #f1d5d7; }
.warn, #errors p.warn { color: var(--warn); background: #fdf6e7; border: 1px solid #f2e3bf; }
#errors p.hint, #job > p { color: var(--text); background: var(--panel-soft); border: 1px solid var(--line); }
#job > p.err { color: var(--danger); background: #fbeff0; border-color: #f1d5d7; }
#job a { color: var(--accent); font-weight: 550; }
#job video { max-height: 220px; display: block; margin: 0 0 10px; border-radius: 10px; }
progress { flex: 1; max-width: 260px; height: 6px; appearance: none; border: 0; border-radius: 3px; background: var(--line); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--accent); border-radius: 3px; }
progress::-moz-progress-bar { background: var(--accent); }

/* ---- centre: stage on top, timeline below */
#centre { display: grid; grid-template-rows: minmax(0, 1fr) var(--tl-h); gap: 12px; min-width: 0; min-height: 0; }
body.tl-collapsed #centre { grid-template-rows: minmax(0, 1fr) auto; }
#stage { position: relative; display: flex; flex-direction: column; overflow: hidden; background: radial-gradient(ellipse at 40% 30%, #fffaf5, #f2f0ec 70%); }
.stage-bar { position: absolute; top: 12px; right: 12px; z-index: 3; display: flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.92); box-shadow: var(--shadow-card); backdrop-filter: blur(6px); }
.stage-bar .btn { border-color: transparent; background: transparent; }
.stage-bar .btn:hover:not(:disabled) { background: var(--panel-soft); }
.pill { display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border-radius: 8px; color: var(--muted); font-size: 12px; border-right: 1px solid var(--line); border-radius: 0; }
.stage-view { flex: 1; min-height: 0; display: grid; place-items: center; padding: 18px; container-type: size; }
#frame { position: relative; height: min(100cqh, 100cqw * 16 / 9); aspect-ratio: 9 / 16; border-radius: 14px; overflow: hidden; background: #1b1714;
  box-shadow: 0 2px 6px rgba(30,20,10,.08), 0 22px 50px rgba(30,20,10,.18); }
/* two players: the next version loads in the hidden one, then they swap */
#frame hyperframes-player { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }
#frame hyperframes-player.front { opacity: 1; pointer-events: auto; z-index: 1; }
/* full-screen preview: black backdrop, no editing chrome; close at the top centre, play / pause at the bottom centre */
.fs-bar { display: none; }
#stage:fullscreen { background: #000; border-radius: 0; }
#stage:fullscreen :is(.stage-bar, .stage-msgs, .cv) { display: none; }
#stage:fullscreen #frame { border-radius: 0; box-shadow: none; }
#stage:fullscreen .fs-bar { display: contents; }
.fs-close { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 5; width: 44px; height: 44px; border-radius: 50%; color: #fff; background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.25); backdrop-filter: blur(6px); }
.fs-close:hover { background: rgba(0,0,0,.75); }
.fs-track { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 5; width: min(640px, calc(100vw - 32px)); display: flex; align-items: center; gap: 12px; padding: 8px 16px 8px 8px; border-radius: 999px; color: #fff; font-size: 13px; background: rgba(0,0,0,.6); border: 1px solid rgba(255,255,255,.2); backdrop-filter: blur(8px); }
.fs-play { width: 44px; height: 44px; }
#fs-seek { flex: 1; min-width: 0; height: 4px; margin: 0; appearance: none; border-radius: 2px; cursor: pointer;
  background: linear-gradient(to right, #fff var(--p, 0%), rgba(255,255,255,.3) var(--p, 0%)); }
#fs-seek::-webkit-slider-thumb { appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
#fs-seek::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; }

/* ---- timeline card */
#tl-card { position: relative; display: flex; flex-direction: column; overflow: hidden; }
.tl-resize { position: absolute; top: 0; left: 50%; z-index: 6; width: 64px; height: 12px; margin-left: -32px; cursor: ns-resize; touch-action: none; }
.tl-resize::before { content: ""; position: absolute; top: 4px; left: 12px; right: 12px; height: 3px; border-radius: 2px; background: var(--line-strong); transition: background var(--ease); }
.tl-resize:hover::before, .tl-resize:focus-visible::before, .tl-resize.dragging::before { background: var(--accent); }
.tl-resize:focus-visible { outline: none; }
body.tl-collapsed .tl-resize { display: none; }
.transport { display: flex; align-items: center; gap: 8px; padding: 12px 12px 10px 14px; flex: none; }
.transport > * { flex: none; }
.transport .timecode { flex: 0 1 auto; min-width: 0; }
.play-btn { display: grid; place-items: center; width: 36px; height: 36px; padding: 0 0 0 1px; border: 0; border-radius: 50%; color: #fff; flex: none;
  background: linear-gradient(180deg, #3d8cff, var(--tl-blue)); box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 4px 12px rgba(22,120,247,.35); transition: transform var(--ease), box-shadow var(--ease); }
.play-btn.playing { padding-left: 0; }
.play-btn:hover { box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 6px 16px rgba(22,120,247,.45); }
.play-btn:active { transform: scale(.96); }
.timecode { min-width: 112px; line-height: 1.25; margin-left: 4px; }
#t-now { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.t-of { color: var(--faint); font-size: 12px; }
.t-scene { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.t-spacer { flex: 1; }
.t-speed { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.t-speed .dd-btn { width: 76px; color: var(--text); }
.zoom { display: flex; align-items: center; gap: 4px; height: 36px; padding: 0 6px 0 12px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--panel-soft); }
.zoom-label { color: var(--muted); margin-right: 2px; }
#z-val { min-width: 34px; text-align: right; color: var(--muted); font-size: 11.5px; }
input[type="range"] { appearance: none; -webkit-appearance: none; width: 80px; height: 18px; background: transparent; cursor: pointer; margin: 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: #dbe0ea; }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: #dbe0ea; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: #fff; border: 1px solid var(--line-strong); box-shadow: 0 1px 3px rgba(20,24,40,.2); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 1px solid var(--line-strong); box-shadow: 0 1px 3px rgba(20,24,40,.2); }
input[type="range"]:focus-visible { outline-offset: 4px; }
#tl-toggle .ic { transition: transform var(--ease); transform: rotate(180deg); }
body.tl-collapsed #tl-toggle .ic { transform: none; }
body.tl-collapsed #timeline { display: none; }
#timeline { flex: 1; min-height: 0; border-top: 1px solid var(--line); user-select: none; -webkit-user-select: none; position: relative; }

/* ---- timeline body */
.tl-scroll { position: absolute; inset: 0; overflow: auto; scrollbar-width: thin; scrollbar-color: #cfd4de transparent; }
.tl-scroll::-webkit-scrollbar { height: 8px; width: 8px; }
.tl-scroll::-webkit-scrollbar-thumb { background: #cfd4de; border-radius: 8px; border: 2px solid #fff; }
.tl-scroll::-webkit-scrollbar-track { background: transparent; }
.tl-rows { position: relative; min-height: 100%; padding-bottom: 6px; }
.tl-row { display: flex; position: relative; }
.tl-track { position: sticky; left: 0; z-index: 5; flex: none; width: var(--tl-label); display: flex; align-items: center; gap: 8px; padding: 0 12px 0 16px; background: var(--panel); border-right: 1px solid var(--line); color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; }
.tl-track.sel { background: #f3f6ff; color: var(--accent); }
.tl-track .ic { flex: none; }
.tl-corner { justify-content: space-between; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.tl-count { letter-spacing: 0; }
.tl-lane { position: relative; flex: none; }
.tl-ruler-row { position: sticky; top: 0; z-index: 6; background: var(--panel); border-bottom: 1px solid var(--line); }
.tl-ruler-row .tl-corner { z-index: 7; }
.tl-ruler { cursor: col-resize; touch-action: none; }
.tl-tick { position: absolute; bottom: 0; width: 1px; height: 4px; background: #c9ced8; }
.tl-tick.major { height: 7px; background: #b3b9c5; }
.tl-tick span { position: absolute; bottom: 9px; left: 0; transform: translateX(-50%); font-size: 9.5px; color: var(--faint); white-space: nowrap; }
.tl-song canvas { position: absolute; top: 4px; }
.tl-window { position: absolute; top: 2px; bottom: 2px; overflow: hidden; border: 2px solid var(--accent); border-radius: 6px; background: rgba(82,105,216,.08); cursor: grab; touch-action: none; }
.tl-window canvas { position: absolute; top: 0; }
.tl-window.dragging, .tl-musicwave.dragging { cursor: grabbing; }
.tl-scenes .tl-lane { overflow: visible; }
.tl-clip { position: absolute; top: 6px; height: 42px; display: flex; align-items: center; gap: 8px; padding: 0 12px 0 10px; overflow: hidden; border-radius: 9px; color: #fff; cursor: pointer;
  background: linear-gradient(180deg, #3a8eff, var(--tl-blue) 55%, #106ae0);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), inset 0 0 0 1px rgba(7,87,189,.45), 0 1px 2px rgba(7,87,189,.2);
  filter: saturate(.62) brightness(1.06); transition: filter var(--ease), box-shadow var(--ease); }
.tl-clip::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 16px; pointer-events: none; opacity: .55;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='16' viewBox='0 0 60 16'%3E%3Cpath d='M0 9 C10 3 20 3 30 9 S50 15 60 9 V16 H0Z' fill='%2364b4ff' fill-opacity='.55'/%3E%3C/svg%3E") repeat-x bottom / 60px 16px; }
.tl-clip:hover { filter: saturate(.85) brightness(1.04); }
.tl-clip.sel { filter: none; box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 0 0 2px #fff, 0 0 0 4px rgba(22,120,247,.55), 0 3px 10px rgba(7,87,189,.25); }
.tl-clip:focus-visible { outline: 2px solid var(--tl-blue-deep); outline-offset: 3px; }
.tl-clip.trimming { filter: none; }
.tl-thumb { display: none; position: relative; z-index: 1; width: 30px; height: 30px; flex: none; object-fit: contain; border-radius: 6px; background: rgba(255,255,255,.92); border: 1px solid rgba(255,255,255,.7); padding: 2px; }
.tl-clip.thumbed .tl-thumb { display: block; }
.tl-clip-text { position: relative; z-index: 1; min-width: 0; line-height: 1.2; }
.tl-clip-name { font-weight: 650; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 1px rgba(7,87,189,.35); }
.tl-clip-dur { font-size: 10.5px; opacity: .88; white-space: nowrap; }
.tl-clip.narrow { padding-right: 6px; }
.tl-clip.narrow .tl-clip-dur { display: none; }
.tl-grip { position: absolute; top: 6px; z-index: 3; width: 12px; height: 42px; display: grid; place-items: center; cursor: ew-resize; touch-action: none; }
.tl-grip-pill { width: 4px; height: 20px; border-radius: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(7,87,189,.45), 0 1px 3px rgba(7,87,189,.35); transition: height var(--ease); }
.tl-grip:hover .tl-grip-pill, .tl-grip.dragging .tl-grip-pill { height: 28px; }
.tl-musicwave { position: absolute; top: 5px; bottom: 5px; border-radius: 8px; background: #f1f4ff; border: 1px solid #dfe5fb; cursor: grab; touch-action: none; overflow: hidden; }
.tl-musicwave canvas { display: block; }
.tl-reading { display: block; padding: 0 10px; line-height: 32px; font-size: 12px; color: var(--muted); }
.tl-playhead { position: absolute; top: 0; bottom: 0; left: 0; z-index: 4; width: 2px; background: var(--tl-playhead); pointer-events: none; will-change: transform; }
.tl-ph-handle { position: absolute; top: 4px; left: -7px; z-index: 8; width: 16px; height: 22px; cursor: grab; touch-action: none; will-change: transform; }
.tl-ph-handle::before { content: ""; position: absolute; left: 1px; top: 0; width: 14px; height: 14px; border-radius: 5px 5px 4px 4px; background: var(--tl-playhead); box-shadow: 0 1px 3px rgba(10,120,200,.4); }
.tl-ph-handle::after { content: ""; position: absolute; left: 3px; top: 10px; border: 5px solid transparent; border-top: 7px solid var(--tl-playhead); }
.tl-ph-handle.dragging { cursor: grabbing; }
.tl-ph-handle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 5px; }

/* ---- narrow screens: one column, the preview pinned on top */
@media (max-width: 900px) {
  header.top { height: auto; min-height: 56px; flex-wrap: wrap; gap: 8px; padding: 10px 16px; }
  #about { display: none; }
  .tpl-pick { order: 5; flex: 1 1 100%; min-width: 0; }
  .logo { margin-right: auto; }
  .tpl-pick .dd-btn { min-width: 0; max-width: none; }
  .top-actions { margin-left: 0; }
  .top-actions .btn { padding: 0 11px; }
  #reset { display: none; }
  #workspace { display: flex; flex-direction: column; height: auto; min-height: 0; padding: 0 12px 16px; }
  #centre { display: contents; }
  #stage { order: -2; position: sticky; top: 0; z-index: 20; height: 42vh; border-radius: 0 0 var(--radius-panel) var(--radius-panel); margin: 0 -12px; border-top: 0; }
  #tl-card { order: -1; height: auto; }
  body:not(.tl-collapsed) #timeline { flex: none; height: 180px; }
  .tl-resize { display: none; }
  .stage-view { padding: 10px; }
  .stage-bar { top: 8px; right: 8px; }
  aside.panel { overflow: visible; }
  .panel-body { overflow: visible; }
  body.left-collapsed #left .strip { flex-direction: row; padding: 0 8px 8px; justify-content: center; }
  body.left-collapsed #left .panel-head, body.right-collapsed #right .panel-head { justify-content: space-between; padding: 8px 10px 8px 18px; }
  body.left-collapsed #left .panel-head h2, body.right-collapsed #right .panel-head h2 { display: block; }
  .transport { gap: 6px; padding: 10px 10px 8px; flex-wrap: wrap; }
  .transport .timecode { flex: 1 1 auto; }
  .t-spacer { display: none; }
  .zoom { order: 10; flex: 1 1 auto; }
  .zoom input[type="range"] { flex: 1; }
  .zoom-label, .t-speed > span { display: none; }
  .timecode { min-width: 0; }
  input[type="range"] { width: 64px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* layers (E6.2): the scene's props and texts, like the scene list; a dot marks a changed one */
.layers { list-style: none; padding: 0; margin: 6px -6px 0; }
.layers li { display: grid; grid-template-columns: auto minmax(0, 1fr) 8px; gap: 8px; align-items: center; padding: 4px 6px; border-radius: 10px; transition: background var(--ease); }
.layers li:hover { background: var(--panel-soft); }
.layers li.off .name { color: var(--faint); text-decoration: line-through; }
.layers .name { background: none; border: none; text-align: left; padding: 2px 0; min-width: 0; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.layers .at { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.layers .dot { width: 8px; height: 8px; border-radius: 50%; }
.layers li.changed .dot { background: var(--accent); }
#scene-title .crumb { background: none; border: none; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
#scene-title .crumb:hover { text-decoration: underline; }
.row-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-inline input[type=color] { width: 36px; height: 30px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); cursor: pointer; }

/* the timeline's Song / Music labels select the music; "Your details" rings the fields a selection shows */
.tl-track.tl-pick { cursor: pointer; }
.tl-track.tl-pick:hover { color: var(--accent); }
.tl-track.tl-pick:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@keyframes vv-flash { 0%, 60% { box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 1px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
#form .flash { animation: vv-flash 1.2s ease-out; border-radius: 10px; }

/* the preview as a canvas (canvas.js): selection box with corner handles and a rotate knob, centre-line guides */
#frame .cv { position: absolute; inset: 0; z-index: 3; outline: none; touch-action: none; }
#frame .cv:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.cv-box { position: absolute; display: none; border: 1.5px solid var(--accent); box-shadow: 0 0 0 1px rgba(255,255,255,.75); cursor: move; }
.cv-box.on { display: block; }
.cv-box.hidden-layer { border-style: dashed; }
.cv-box.dragging { cursor: grabbing; }
.cv-h { position: absolute; width: 11px; height: 11px; background: #fff; border: 1.5px solid var(--accent); border-radius: 3px; }
.cv-h[data-c=nw] { left: -7px; top: -7px; cursor: nwse-resize; }
.cv-h[data-c=ne] { right: -7px; top: -7px; cursor: nesw-resize; }
.cv-h[data-c=sw] { left: -7px; bottom: -7px; cursor: nesw-resize; }
.cv-h[data-c=se] { right: -7px; bottom: -7px; cursor: nwse-resize; }
.cv-rot { position: absolute; left: 50%; top: -28px; width: 13px; height: 13px; margin-left: -7px; border-radius: 50%; background: #fff; border: 1.5px solid var(--accent); cursor: grab; }
.cv-rot::after { content: ""; position: absolute; left: 5px; top: 12px; width: 1.5px; height: 14px; background: var(--accent); }
.cv-tag { position: absolute; left: -1px; top: calc(100% + 6px); padding: 3px 7px; border-radius: 6px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; white-space: nowrap; pointer-events: none; }
.cv-guide { position: absolute; display: none; background: #e2457a; pointer-events: none; }
.cv-guide.on { display: block; }
.cv-gx { left: 50%; top: 0; bottom: 0; width: 1px; }
.cv-gy { top: 50%; left: 0; right: 0; height: 1px; }

/* the selected repeat scene's cards on their own sub-lane (timeline.js 3b) */
.tl-events .tl-lane { overflow: visible; }
.tl-clip.tl-item { top: 5px; height: 30px; padding: 0 8px; background: linear-gradient(180deg, #6f86e8, #5269d8); }
.tl-clip.tl-item .tl-clip-name { font-size: 12px; }
.tl-hatch { position: absolute; top: 9px; height: 22px; border-radius: 6px; background: repeating-linear-gradient(135deg, rgba(82,105,216,.18) 0 4px, transparent 4px 8px); pointer-events: none; }
.tl-item-grip { top: 5px; height: 30px; }

/* deleting your own text or sticker */
.btn.danger { color: var(--danger); }
#inspector [data-sec="add"] .grid, #inspector [data-sec="extra"] .grid { margin-top: 8px; }

/* ---- Export panel (E7): a modal like the menus (panel, radius, shadow), a bottom sheet on phones */
.export-dlg { width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 26px 28px 24px; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--panel); color: var(--text); box-shadow: var(--shadow-menu); overflow-y: auto; }
.export-dlg::backdrop { background: rgba(20,24,40,.32); }
.exp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.exp-title { margin: 2px 0 0; font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
.exp-x { border-color: var(--line); }
.exp-sub { margin: 6px 0 18px; color: var(--muted); font-size: 13px; }
.exp-row { margin: 0 0 16px; }
.exp-label { display: block; margin: 0 0 7px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.exp-row .segmented .seg span { height: 34px; font-size: 13px; }
.exp-note { margin: 6px 0 0; }
.exp-note[hidden], .exp-msg[hidden] { display: none; }
.exp-summary { margin: 20px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--panel-soft); border: 1px solid var(--line); }
.exp-summary p { margin: 0; }
.exp-summary .exp-est { margin-top: 3px; color: var(--muted); }
.exp-msg { margin: 0 0 14px; padding: 8px 12px; border-radius: 10px; background: var(--panel-soft); border: 1px solid var(--line); }
.exp-msg.err { color: var(--danger); background: #fbeff0; border-color: #f1d5d7; }
.exp-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.exp-foot .btn { height: 40px; padding: 0 18px; font-size: 14px; }
.exp-progress { padding: 14px; border-radius: 12px; background: var(--panel-soft); border: 1px solid var(--line); }
.exp-stage { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; font-weight: 550; }
.exp-progress progress { display: block; width: 100%; max-width: none; height: 8px; border-radius: 4px; }
.exp-progress .hint { margin: 8px 0 0; }
.exp-done { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 12px; background: var(--panel-soft); border: 1px solid var(--line); }
.exp-ok { display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.exp-file { margin: 0 0 2px; font-weight: 600; overflow-wrap: anywhere; }
.exp-done .hint { margin: 0; }
.order-steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
a.btn { text-decoration: none; }
.exp-details { margin-top: 10px; }
.exp-details summary { cursor: pointer; color: var(--muted); }
.exp-details pre { max-height: 160px; overflow: auto; margin: 8px 0 0; padding: 10px; border-radius: 8px; background: var(--panel-soft); font: 11.5px/1.45 var(--tl-mono); white-space: pre-wrap; }
/* the header button while an export runs behind a hidden panel: it fills up */
#export.busy { background: linear-gradient(90deg, var(--accent) var(--p, 0%), color-mix(in srgb, var(--accent) 55%, #fff) var(--p, 0%)); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: no-preference) { .export-dlg[open] { animation: exp-in 160ms ease; } }
@keyframes exp-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@media (max-width: 600px) {
  .export-dlg { width: 100vw; max-width: 100vw; margin: auto 0 0; padding: 22px 16px calc(18px + env(safe-area-inset-bottom)); border-radius: var(--radius-panel) var(--radius-panel) 0 0; }
  .exp-foot .btn { flex: 1; }
}
