/* Tshow web: glass panels over a soft backdrop, dark and light themes. */

:root {
  --accent: #3e6ae1;
  --accent-2: #6b8cff;
  --accent-ink: #ffffff;
  --danger: #ff453a;
  --ok: #34c77b;
  --warn: #f5a524;
  --radius: 22px;
  --radius-sm: 14px;
  --font: system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --playhead: #ffffff;
  --stage-bg: radial-gradient(120% 70% at 50% 35%, #1b1d22 0%, #0b0c0f 55%, #050506 100%);
  --switch-off: rgba(255, 255, 255, .06);
  --switch-edge: rgba(255, 255, 255, .16);
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #07080b;
  --bg-blob-1: rgba(62, 106, 225, .34);
  --bg-blob-2: rgba(232, 33, 39, .18);
  --bg-blob-3: rgba(120, 80, 230, .2);
  --glass: rgba(24, 26, 32, .55);
  --glass-strong: rgba(30, 32, 40, .78);
  --glass-inset: rgba(255, 255, 255, .045);
  --glass-hover: rgba(255, 255, 255, .08);
  --stroke: rgba(255, 255, 255, .09);
  --stroke-strong: rgba(255, 255, 255, .16);
  --highlight: rgba(255, 255, 255, .07);
  --shadow: 0 20px 60px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .3);
  --text: #f4f6fb;
  --text-2: #a7abb5;
  --text-3: #6f737d;
  --seg-bg: rgba(255, 255, 255, .06);
  --seg-thumb: rgba(255, 255, 255, .16);
  --tl-track: rgb(38, 40, 46);
  --tl-past: rgb(26, 28, 33);
  --lamp-white: rgb(232, 238, 255);
  --playhead: #ffffff;
}

:root[data-theme='light'] {
  color-scheme: light;
  --bg: #eef1f7;
  --bg-blob-1: rgba(62, 106, 225, .28);
  --bg-blob-2: rgba(255, 120, 90, .2);
  --bg-blob-3: rgba(150, 110, 255, .2);
  --glass: rgba(255, 255, 255, .58);
  --glass-strong: rgba(255, 255, 255, .82);
  --glass-inset: rgba(20, 30, 60, .045);
  --glass-hover: rgba(20, 30, 60, .07);
  --stroke: rgba(20, 30, 60, .09);
  --stroke-strong: rgba(20, 30, 60, .16);
  --highlight: rgba(255, 255, 255, .9);
  --shadow: 0 20px 50px rgba(40, 60, 110, .16), 0 2px 8px rgba(40, 60, 110, .08);
  --text: #12151c;
  --text-2: #4d5361;
  --text-3: #626c7d;
  --accent-2: #345cca;
  --seg-bg: rgba(20, 30, 60, .06);
  --seg-thumb: #ffffff;
  --tl-track: rgb(226, 230, 239);
  --tl-past: rgb(240, 242, 247);
  --lamp-white: rgb(92, 112, 168);
  --playhead: #12151c;
  --stage-bg: linear-gradient(180deg, #ffffff 0%, #f6f8fc 100%);
  --switch-off: #cbd2de;
  --switch-edge: #747f91;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
html:not(.ready) body { opacity: 0; }
body { transition: opacity .25s ease; }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
[hidden] { display: none !important; }
.grow { flex: 1 1 auto; min-width: 0; }
.caption { color: var(--text-2); font-size: 12.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; word-break: break-all; }
.noscript { padding: 40px; text-align: center; }

/* ---------------------------------------------------------------- backdrop */

.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.backdrop i { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .9; }
.backdrop i:nth-child(1) { width: 55vw; height: 55vw; left: -12vw; top: -18vw; background: var(--bg-blob-1); }
.backdrop i:nth-child(2) { width: 45vw; height: 45vw; right: -10vw; bottom: -16vw; background: var(--bg-blob-2); }
.backdrop i:nth-child(3) { width: 35vw; height: 35vw; right: 20vw; top: -12vw; background: var(--bg-blob-3); }

/* ---------------------------------------------------------------- glass */

.glass {
  background: var(--glass);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow), inset 0 1px 0 var(--highlight);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  backdrop-filter: blur(28px) saturate(170%);
}
.glass-inset { background: var(--glass-inset); border: 1px solid var(--stroke); }

/* ---------------------------------------------------------------- top bar */

.topbar {
  position: fixed; top: 12px; left: 12px; right: 12px; height: 52px; z-index: 5;
  display: flex; align-items: center; gap: 8px; padding: 0 10px 0 8px; border-radius: 18px;
}
.brand {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 6px; border: 0; border-radius: 12px;
  background: none; cursor: pointer; font-weight: 600; letter-spacing: .22em; font-size: 13px;
}
.brand img { border-radius: 8px; }
.brand:hover { background: var(--glass-hover); }

/* ---------------------------------------------------------------- layout */

.layout {
  position: fixed; inset: 76px 12px 12px 12px;
  display: grid; grid-template-columns: minmax(0, 60fr) minmax(0, 40fr); gap: 12px;
}

/* ---------------------------------------------------------------- buttons */

.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0;
  border-radius: 12px; border: 1px solid transparent; background: var(--glass-inset); cursor: pointer;
  color: var(--text); transition: background .15s, transform .15s var(--ease), color .15s;
}
.icon-btn:hover { background: var(--glass-hover); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.round { border-radius: 50%; }
.icon-btn.active { background: var(--accent); color: var(--accent-ink); }
.icon-btn.small { width: 28px; height: 28px; border-radius: 9px; background: transparent; }
.icon-btn:disabled { opacity: .35; cursor: default; }
.ic { display: inline-grid; place-items: center; width: 20px; height: 20px; flex: none; }
.ic svg { width: 100%; height: 100%; }
.ic.accent { color: var(--accent-2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px;
  border-radius: 13px; border: 1px solid var(--stroke-strong); background: var(--glass-inset);
  font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background .15s, transform .15s var(--ease), box-shadow .15s, opacity .15s;
}
.btn .ic { width: 18px; height: 18px; }
.btn:hover { background: var(--glass-hover); }
.btn:active { transform: scale(.97); }
.btn.primary {
  background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--accent-ink); border-color: transparent;
  box-shadow: 0 8px 24px rgba(62, 106, 225, .35), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--glass-hover); color: var(--text); }
.btn.small { height: 34px; padding: 0 12px; border-radius: 10px; font-size: 13px; }
.btn:disabled { opacity: .4; cursor: default; transform: none; box-shadow: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-row.center { justify-content: center; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ---------------------------------------------------------------- segmented */

.segmented {
  --i: 0;
  position: relative; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  padding: 3px; border-radius: 13px; background: var(--seg-bg); border: 1px solid var(--stroke);
}
.segmented button {
  position: relative; z-index: 1; height: 34px; padding: 0 10px; border: 0; background: none; cursor: pointer;
  color: var(--text-2); font-weight: 500; font-size: 13px; border-radius: 10px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; transition: color .2s;
}
.segmented button[aria-checked='true'] { color: var(--text); font-weight: 600; }
.seg-thumb {
  position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / var(--n)); border-radius: 10px;
  background: var(--seg-thumb); box-shadow: 0 2px 8px rgba(0, 0, 0, .18), inset 0 1px 0 var(--highlight);
  transform: translateX(calc(var(--i) * 100%)); transition: transform .3s var(--ease);
}

/* ---------------------------------------------------------------- switch */

.switch { position: relative; display: inline-block; width: 52px; height: 30px; flex: none; cursor: pointer; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch .track { position: absolute; inset: 0; border-radius: 99px; background: var(--switch-off); border: 1px solid var(--switch-edge); transition: background .2s; }
.switch .knob { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); transition: transform .25s var(--ease); }
.switch input:checked + .track { background: var(--accent); border-color: transparent; }
.switch input:checked + .track .knob { transform: translateX(22px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ---------------------------------------------------------------- stage */

.stage {
  position: relative; display: grid; min-height: 0; overflow: hidden;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 300px);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "head head" "cars sync" "media sync";
  border-radius: var(--radius); border: 1px solid var(--stroke);
  background: var(--stage-bg);
  box-shadow: var(--shadow); color: var(--text);
}
.stage-head { grid-area: head; display: flex; align-items: center; gap: 10px; padding: 18px 18px 4px 22px; }
.stage-head h1 { font-size: 26px; }
#stage-view { width: 210px; }
.cars { grid-area: cars; position: relative; min-height: 0; display: flex; flex-direction: column; padding: 4px 8px; }
.car { position: relative; flex: 1 1 0; min-height: 0; margin: 0; }
.car canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.car figcaption { position: absolute; left: 14px; top: 6px; z-index: 1; font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }
.stage:not([data-view='both']) .car figcaption { display: none; }
.stage-hint {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); white-space: nowrap;
  padding: 6px 14px; border-radius: 99px; font-size: 12.5px; color: var(--text-2);
  background: rgba(0, 0, 0, .5); border: 1px solid rgba(255, 255, 255, .08);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}

/* sync column: under the view buttons, beside the car it shapes */
.stage-sync {
  grid-area: sync; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  margin: 8px 14px 14px 6px; padding: 14px 16px 16px; border-radius: 18px;
  display: flex; flex-direction: column; gap: 12px;
  background: rgba(32, 34, 40, .55); border-color: rgba(255, 255, 255, .09);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .07);
}
.stage-sync h2 { font-size: 16px; }
.stage-sync .switch-row { padding: 0; }
.stage-sync .sliders { grid-template-columns: 1fr; gap: 14px; padding-top: 14px; }
.stage-sync .slider .caption { font-size: 11.5px; color: var(--text-3); }
@media (min-width: 981px) and (max-height: 1040px) {
  /* short screens: the plain-word ends carry the meaning; the full hint is on hover */
  .stage-sync .slider .caption { display: none; }
}
.stage-sync::-webkit-scrollbar { width: 8px; }
.stage-sync::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 8px; }

/* media card */
.media {
  grid-area: media; margin: 0 8px 14px 14px; padding: 14px 16px 10px; border-radius: 18px;
  background: rgba(32, 34, 40, .55); border-color: rgba(255, 255, 255, .09);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .07);
}
.media-top { display: flex; align-items: center; gap: 12px; }
.media-art {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; flex: none; color: #fff;
  background: linear-gradient(135deg, #3e6ae1, #7a3ee1 55%, #e82127);
  box-shadow: 0 6px 18px rgba(122, 62, 225, .35);
}
.media-art .ic { width: 24px; height: 24px; }
.stage.playing .media-art { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 6px 28px rgba(122, 62, 225, .7); } }
.media-text { display: flex; flex-direction: column; }
.media-text strong { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter { display: flex; align-items: flex-end; gap: 3px; height: 22px; }
.meter i { width: 5px; border-radius: 2px; background: rgba(255, 255, 255, .13); transition: background .08s; }
.meter i:nth-child(1) { height: 44%; } .meter i:nth-child(2) { height: 58%; } .meter i:nth-child(3) { height: 72%; }
.meter i:nth-child(4) { height: 86%; } .meter i:nth-child(5) { height: 100%; }
.meter i.on { background: var(--accent-2); }
.scrub { position: relative; height: 22px; margin-top: 8px; cursor: pointer; touch-action: none; }
.scrub.disabled { cursor: default; }
.scrub-track { position: absolute; left: 0; right: 0; top: 9px; height: 4px; border-radius: 4px; background: var(--stroke-strong); overflow: hidden; }
.scrub-fill { height: 100%; width: 100%; background: var(--text); transform-origin: left; transform: scaleX(0); }
.scrub-knob { position: absolute; top: 5px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--text); box-shadow: 0 1px 6px rgba(0, 0, 0, .2); transition: transform .15s; }
.scrub.disabled .scrub-knob { display: none; }
.scrub:hover .scrub-knob { transform: scale(1.25); }
.media-times { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.transport { display: flex; justify-content: center; align-items: center; gap: 26px; margin-top: 2px; }
.transport .icon-btn { width: 42px; height: 42px; border-radius: 50%; background: transparent; }
.transport .icon-btn .ic { width: 24px; height: 24px; }
.play-btn {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--text); color: var(--bg); box-shadow: 0 6px 20px rgba(0, 0, 0, .1);
  transition: transform .15s var(--ease), opacity .15s;
}
.play-btn .ic { width: 24px; height: 24px; }
.play-btn:hover { transform: scale(1.05); }
.play-btn:active { transform: scale(.95); }
.play-btn:disabled { opacity: .3; cursor: default; transform: none; }

/* ---------------------------------------------------------------- panel */

.panel { display: flex; flex-direction: column; min-height: 0; border-radius: var(--radius); overflow: hidden; }
.panel-view { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px 16px 18px; display: flex; flex-direction: column; gap: 12px; scrollbar-gutter: stable; }
.panel-view::-webkit-scrollbar { width: 10px; }
.panel-view::-webkit-scrollbar-thumb { background: var(--stroke-strong); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }

.card {
  display: flex; flex-direction: column; gap: 14px; padding: 18px 20px; border-radius: 18px;
  background: var(--glass-inset); border: 1px solid var(--stroke);
}
.card h2 { font-size: 16px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field-label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }

/* song */
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 26px 18px; text-align: center;
  border: 1.5px dashed var(--stroke-strong); border-radius: 16px; cursor: pointer; transition: border-color .2s, background .2s;
}
.dropzone:hover { border-color: var(--accent-2); background: rgba(62, 106, 225, .06); }
.dropzone h3 { font-size: 19px; }
.dropzone .btn-row { margin-top: 8px; }
.drop-icon { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 16px; background: var(--glass-hover); color: var(--accent-2); }
.drop-icon .ic { width: 26px; height: 26px; }
.dropzone.busy { cursor: progress; pointer-events: none; }
.dropzone.busy .btn-row, .dropzone.busy .caption { visibility: hidden; }
.dropzone.busy .drop-icon { animation: spin-glow 1.2s linear infinite; }
@keyframes spin-glow { 50% { box-shadow: 0 0 0 10px rgba(62, 106, 225, .15); } }
.song-now { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.song-meta { display: flex; flex-direction: column; }
.song-meta strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* paint */
.swatches { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.swatch {
  width: 38px; height: 38px; border-radius: 50%; padding: 0; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .45), transparent 45%), var(--c);
  border: 1px solid var(--stroke-strong); box-shadow: inset 0 -3px 8px rgba(0, 0, 0, .25);
  transition: transform .15s var(--ease), box-shadow .15s;
}
.swatch:hover { transform: scale(1.08); }
.swatch[aria-pressed='true'] { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent-2), inset 0 -3px 8px rgba(0, 0, 0, .25); }
.paint-name { margin-left: 6px; font-weight: 500; }

.switch-row { display: flex; align-items: center; gap: 16px; }
.switch-row strong { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14.5px; }
.switch-row strong .ic { width: 17px; height: 17px; }
.switch-row .caption { margin-top: 2px; }

/* sync sliders */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head .btn:disabled { visibility: hidden; }
.sliders { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px 24px; border-top: 1px solid var(--stroke); padding-top: 18px; }
.slider { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.slider-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.slider-head label { font-weight: 600; font-size: 14px; }
.slider-value { font-size: 12.5px; color: var(--accent-2); font-variant-numeric: tabular-nums; }
.slider-track { position: relative; height: 26px; display: flex; align-items: center; }
.slider-track::after { /* default mark */
  content: ''; position: absolute; left: calc(11px + (100% - 22px) * var(--d)); top: 3px; width: 2px; height: 6px;
  margin-left: -1px; border-radius: 1px; background: var(--text-3); pointer-events: none;
}
.slider input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 26px; margin: 0; background: transparent; cursor: pointer;
  --fill: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.slider input[type=range]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 99px; border: 1px solid var(--stroke);
  background: var(--fill) 0 0 / var(--p, 50%) 100% no-repeat, var(--seg-bg);
}
.slider input[type=range]::-moz-range-track { height: 6px; border-radius: 99px; background: var(--seg-bg); border: 1px solid var(--stroke); }
.slider input[type=range]::-moz-range-progress { height: 6px; border-radius: 99px; background: var(--fill); }
.slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%;
  background: #fff; border: 0; box-shadow: 0 2px 8px rgba(0, 0, 0, .35), 0 0 0 1px rgba(0, 0, 0, .06); transition: transform .15s var(--ease);
}
.slider input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); }
.slider input[type=range]:active::-webkit-slider-thumb { transform: scale(1.12); }
.slider input[type=range]:focus-visible { outline: none; }
.slider input[type=range]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.slider input[type=range]:focus-visible::-moz-range-thumb { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.slider-ends { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-3); margin-top: -4px; }
.slider .caption { font-size: 12px; }

/* usb */
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--text); }
.steps li::marker { color: var(--text-3); font-weight: 600; }
.checks { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: 14px; background: var(--glass-inset); border: 1px solid var(--stroke); }
.checks h3 { font-size: 14.5px; margin-bottom: 4px; }
.check { display: flex; align-items: flex-start; gap: 10px; }
.check .ic { width: 19px; height: 19px; }
.check.ok .ic { color: var(--ok); }
.check.warn .ic { color: var(--warn); }
.check.bad .ic { color: var(--danger); }

/* ---------------------------------------------------------------- timeline */

/* the timeline is a dropdown at the bottom of the Sync card */
.dropdown { display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--stroke); padding-top: 14px; }
.dropdown-toggle {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 12px;
  font: inherit; font-weight: 600; font-size: 14.5px; color: var(--text); text-align: left; cursor: pointer;
  background: var(--seg-bg); border: 1px solid var(--stroke); transition: background .2s;
}
.dropdown-toggle:hover { background: var(--glass-hover); }
.dropdown-toggle .ic { width: 18px; height: 18px; color: var(--accent-2); }
.dropdown-toggle .chev { color: var(--text-2); transition: transform .25s var(--ease); }
.dropdown-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
.dropdown-toggle .caption { font-weight: 500; }
.tl-drop { display: flex; flex-direction: column; gap: 10px; height: min(560px, 70vh); min-height: 320px; }
.tl-drop[hidden] { display: none; }
.tl-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.tool-group { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 99px;
  font: inherit; font-size: 12.5px; font-weight: 500; color: var(--text-2); cursor: pointer;
  background: var(--seg-bg); border: 1px solid var(--stroke); transition: background .2s, color .2s;
}
.chip:hover { background: var(--glass-hover); color: var(--text); }
.chip .ic { width: 16px; height: 16px; }
.chip.active { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.tl-caption, .tl-help { font-size: 12px; }
.sel-bar { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; border-radius: 14px; flex-wrap: wrap; }
.sel-bar .grow { display: flex; flex-direction: column; }
.tl-empty { flex: 1; display: grid; place-items: center; border-radius: 16px; background: var(--glass-inset); border: 1px solid var(--stroke); color: var(--text-2); }
.tl-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; }
.tl-ruler-row { display: flex; height: 24px; flex: none; border-bottom: 1px solid var(--stroke); }
.tl-corner { width: 160px; flex: none; }
.tl-ruler { flex: 1; min-width: 0; height: 24px; cursor: pointer; }
.tl-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.tl-grid { display: flex; }
.tl-labels { width: 160px; flex: none; }
.tl-label { display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 8px 0 14px; font-size: 12px; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.tl-label i { width: 7px; height: 7px; border-radius: 50%; flex: none; box-shadow: 0 0 6px currentColor; }
.tl-label span { overflow: hidden; text-overflow: ellipsis; }
.tl-label em { font-style: normal; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tl-label.selected { background: var(--glass-hover); color: var(--text); }
.tl-track-wrap { flex: 1; min-width: 0; }
.tl-tracks { display: block; width: 100%; cursor: crosshair; touch-action: pan-y; }
.edits-row { display: flex; align-items: center; gap: 10px; }

/* ---------------------------------------------------------------- toast, drop, about */

.toast {
  position: fixed; left: 50%; top: 18px; z-index: 20; display: flex; align-items: center; gap: 6px;
  max-width: min(560px, calc(100vw - 280px)); min-height: 40px; padding: 4px 6px 4px 16px; border-radius: 14px;
  background: var(--glass-strong); font-weight: 500;
  opacity: 0; pointer-events: none; transform: translate(-50%, -6px); transition: opacity .25s, transform .25s var(--ease);
}
.toast.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.toast.error { background: rgba(200, 30, 35, .88); color: #fff; border-color: transparent; }
.toast span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.drop-overlay {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(5, 8, 20, .45);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.drop-overlay.show { opacity: 1; }
.drop-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 40px 56px; border-radius: 26px; border: 2px dashed var(--accent-2); }
.drop-card strong { font-size: 22px; }

.about { width: min(440px, calc(100vw - 32px)); padding: 22px; border-radius: 22px; color: var(--text); background: var(--glass-strong); }
.about::backdrop { background: rgba(0, 0, 0, .35); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.about-head { display: flex; align-items: center; gap: 14px; }
.about-head img { border-radius: 11px; }
.about dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 16px 0; }
.about dt { color: var(--text-2); }
.about dd { margin: 0; }

body.busy { cursor: progress; }

/* ---------------------------------------------------------------- small screens */

@media (max-width: 980px) {
  body { overflow: auto; }
  .layout { position: static; display: flex; flex-direction: column; padding: 76px 12px 12px; }
  .stage { display: flex; flex-direction: column; height: auto; }
  .cars { flex: none; height: min(64vh, 600px); }
  .media { margin: 0 14px 14px; }
  .stage-sync { margin: 0 14px 14px; overflow: visible; }
  .panel { min-height: 70vh; }
  .topbar { position: fixed; }
}
@media (max-width: 560px) {
  .toast { left: 12px; right: 12px; top: auto; bottom: 12px; max-width: none; transform: translateY(6px); }
  .toast.show { transform: none; }
  .stage-head { flex-wrap: wrap; padding: 14px 14px 4px; }
  .stage-head h1 { font-size: 22px; }
  #stage-view { order: 3; width: 100%; }
  .tl-label { padding-left: 8px; gap: 6px; }
  .card { padding: 16px; }
  .tl-corner, .tl-labels { width: 128px; }
  .segmented button { padding: 0 6px; font-size: 12px; }
  .stage-hint { white-space: normal; text-align: center; width: max-content; max-width: 90%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* timeline card: just the dropdown */
.timeline-card { padding: 10px; gap: 0; }
.timeline-card .dropdown { border-top: 0; padding-top: 0; }
.timeline-card .tl-drop { padding: 4px 6px 6px; }
