:root {
  --bg: #0b0d12;
  --bg-2: #10131a;
  --surface: #151923;
  --surface-2: #1b2030;
  --surface-3: #232a3d;
  --border: #252c3e;
  --border-2: #313a52;
  --text: #eceef4;
  --text-2: #b9bfd0;
  --muted: #7f879e;
  --accent: #ff7a1a;        /* ball orange */
  --accent-2: #ffa95e;
  --accent-soft: rgba(255, 122, 26, .14);
  --blue: #4f86ff;          /* table blue */
  --blue-soft: rgba(79, 134, 255, .16);
  --heart: #ff4f7d;
  --heart-soft: rgba(255, 79, 125, .16);
  --ok: #3fd69b;
  --danger: #ff5a5a;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35), 0 2px 6px rgba(0, 0, 0, .25);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --topbar: 56px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 75% -10%, rgba(79, 134, 255, .08), transparent 60%),
              radial-gradient(900px 500px at -10% 110%, rgba(255, 122, 26, .06), transparent 60%),
              var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.menu-sep { padding: 8px 12px 4px; margin-top: 4px; border-top: 1px solid var(--border); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.grow { flex: 1; }

/* ---------- top bar */
.topbar {
  height: var(--topbar); display: flex; align-items: center; gap: 16px;
  padding: 0 18px; border-bottom: 1px solid var(--border);
  background: rgba(11, 13, 18, .82); backdrop-filter: blur(14px);
  position: relative; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.01em; font-size: 16px; color: var(--text); text-decoration: none; }
.brand-ball {
  width: 20px; height: 20px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffd2ad 0 12%, var(--accent) 45%, #c94e00 100%);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 0 18px rgba(255, 122, 26, .45);
}
.crumb { color: var(--text-2); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.crumb .sep-dot { color: var(--muted); margin: 0 8px; }
.top-actions { display: flex; gap: 8px; align-items: center; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--border-2); background: var(--surface-2);
  font-weight: 600; font-size: 13px; transition: background .15s, border-color .15s, transform .08s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, #ff8a33, #f06a0a); border-color: transparent; color: #1b0d00; box-shadow: 0 4px 14px rgba(255, 122, 26, .3); }
.btn.primary:hover { background: linear-gradient(180deg, #ff9850, #ff7a1a); }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn:disabled { opacity: .45; pointer-events: none; }

.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 250px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 12px; box-shadow: var(--shadow);
}
.menu button { display: flex; justify-content: space-between; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 8px; text-align: left; }
.menu button:hover { background: var(--surface-2); }
.menu button span { color: var(--muted); }

/* ---------- home */
.home { height: calc(100% - var(--topbar)); overflow: auto; padding: 48px 24px 80px; }
.hero { max-width: 760px; margin: 0 auto; text-align: center; }
.hero h1 { font-size: clamp(30px, 4.4vw, 46px); letter-spacing: -.03em; line-height: 1.08; margin: 8px 0 14px; }
.lede { color: var(--text-2); font-size: 16px; max-width: 600px; margin: 0 auto 28px; }
.drop {
  border: 1.5px dashed var(--border-2); border-radius: 20px; padding: 36px 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .02), rgba(255, 255, 255, .005));
  transition: border-color .2s, background .2s;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-inner { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.drop-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.drop-icon svg { width: 26px; height: 26px; }
.fine { color: var(--muted); font-size: 12.5px; }
.drop-progress { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; align-items: center; color: var(--text-2); }

.bar { width: min(420px, 100%); height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 99px; transition: width .3s; }
.bar.big { height: 8px; width: 100%; }

.library { max-width: 920px; margin: 48px auto 0; }
.library h2 { font-size: 15px; color: var(--text-2); font-weight: 600; margin: 0; }
.lib-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.lib-actions { display: flex; justify-content: space-between; align-items: center; margin: -6px 10px 10px 8px; }
.lib-actions .lib-del { margin: 0; }
.lib-re { border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text); font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: 8px; }
.lib-re:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.lib-re:disabled { opacity: .5; }
.lib-card.busy .lib-meta span:last-child { color: var(--accent); }
.lib-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.lib-card {
  display: flex; flex-direction: column; gap: 0; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); overflow: hidden; text-align: left; padding: 0; transition: border-color .15s, transform .15s;
}
.lib-card:hover { border-color: var(--border-2); transform: translateY(-2px); }
.lib-card .lib-thumb { aspect-ratio: 16/9; background: var(--surface-2) center/cover no-repeat; }
.lib-card .lib-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; }
.lib-card .lib-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-card .lib-meta { color: var(--muted); font-size: 12.5px; display: flex; gap: 10px; flex-wrap: wrap; }
.lib-card .lib-meta b { color: var(--text-2); font-weight: 600; }
.lib-empty { color: var(--muted); padding: 18px; border: 1px dashed var(--border); border-radius: var(--radius); text-align: center; grid-column: 1 / -1; }
.lib-del { align-self: flex-end; margin: -6px 10px 10px 0; border: 0; background: none; color: var(--muted); font-size: 12px; padding: 4px 6px; border-radius: 6px; }
.lib-del:hover { color: var(--danger); background: rgba(255, 90, 90, .08); }

/* ---------- analyzing */
.analyzing { height: calc(100% - var(--topbar)); display: grid; place-items: center; padding: 24px; }
.an-card { width: min(480px, 100%); text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 34px 28px 26px; box-shadow: var(--shadow); }
.an-card h2 { margin: 18px 0 4px; letter-spacing: -.02em; }
.an-card .bar { margin: 20px auto 10px; }
.an-ball { height: 64px; position: relative; }
.an-ball span {
  position: absolute; left: 50%; bottom: 0; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffd2ad 0 12%, var(--accent) 45%, #c94e00 100%);
  animation: bounce .9s cubic-bezier(.3, 0, .7, 1) infinite alternate;
}
@keyframes bounce { from { transform: translate(-60px, 0); } 50% { transform: translate(0, -44px); } to { transform: translate(60px, 0); } }

/* ---------- workspace */
.work {
  height: calc(100% - var(--topbar)); display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(330px, 30vw, 420px);
  gap: 0;
}
.stage { min-width: 0; overflow: auto; padding: 16px 18px 24px; display: flex; flex-direction: column; gap: 12px; container-type: inline-size; }
.stage > * { flex: none; }
/* The player takes whatever height the controls leave, but never more than
   the video's own shape needs (--ar = width / height, set from the video).
   The video is positioned to fill it and letterboxed, so it is never cropped. */
.stage > .player {
  flex: 1 1 0; min-height: 180px; max-height: calc(100cqw / var(--ar, 1.7778));
  position: relative; background: #000; border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid var(--border);
  display: grid; place-items: center;
}
.player video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; cursor: pointer; }
.player:fullscreen { max-height: none; border-radius: 0; border: 0; }
.player:-webkit-full-screen { max-height: none; border-radius: 0; border: 0; width: 100%; height: 100%; }
.buffering { position: absolute; z-index: 2; width: 46px; height: 46px; pointer-events: none; }
.buffering i { display: block; width: 100%; height: 100%; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .18); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.big-play {
  position: absolute; width: 74px; height: 74px; border-radius: 50%; border: 0;
  background: rgba(255, 122, 26, .92); color: #1b0d00; display: grid; place-items: center;
  box-shadow: 0 10px 40px rgba(255, 122, 26, .45); transition: transform .15s, opacity .2s;
}
.big-play svg { width: 30px; height: 30px; fill: currentColor; stroke: none; margin-left: 4px; }
.big-play:hover { transform: scale(1.06); }
.player.playing .big-play { opacity: 0; pointer-events: none; }
.player.ended .big-play { display: none; }
.vid-overlay { z-index: 3; }

.vid-banner { position: absolute; left: 12px; right: 12px; top: 12px; display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 12px; border-radius: 10px; background: rgba(20, 22, 30, .92); border: 1px solid var(--border-2); }
.vid-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: radial-gradient(closest-side, rgba(0, 0, 0, .55), rgba(0, 0, 0, .25)); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.end-card { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px 26px; border-radius: 18px; background: rgba(16, 19, 26, .86); border: 1px solid var(--border-2); backdrop-filter: blur(8px); min-width: 240px; }
.end-title { font-weight: 700; font-size: 16px; }
.end-next { color: var(--muted); font-size: 12.5px; }
.end-next .count { display: inline-block; width: 60px; height: 3px; border-radius: 3px; background: var(--surface-3); vertical-align: middle; margin-left: 6px; overflow: hidden; }
.end-next .count i { display: block; height: 100%; background: var(--accent); animation: count linear forwards; }
@keyframes count { from { width: 100%; } to { width: 0; } }
.end-actions { display: flex; gap: 8px; }
.like-big { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 20px; border-radius: 99px; border: 1px solid var(--heart); background: transparent; color: var(--heart); font-weight: 700; font-size: 15px; transition: background .15s, transform .15s; }
.like-big svg { width: 22px; height: 22px; }
.like-big:hover { background: var(--heart-soft); }
.like-big.on { background: var(--heart); color: #fff; }
.like-big.on svg { fill: currentColor; }

.controls { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent; display: grid; place-items: center; color: var(--text-2); transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.play { width: 42px; height: 42px; background: var(--text); color: var(--bg); border-radius: 50%; }
.icon-btn.play:hover { background: #fff; }
.icon-btn.play svg { fill: currentColor; stroke: none; }
.icon-btn .i-pause, .icon-btn .i-mute { display: none; }
.playing .icon-btn .i-play { display: none; }
.playing .icon-btn .i-pause { display: block; }
.muted-on .i-vol { display: none; }
.muted-on .i-mute { display: block; }
.now { flex: 1; min-width: 0; padding: 0 6px; }
.now-title { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-sub { color: var(--muted); font-size: 12.5px; font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sep { width: 1px; height: 22px; background: var(--border); margin: 0 2px; }
.heart-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border-2); background: transparent; color: var(--text-2); display: grid; place-items: center; transition: all .15s; }
.heart-btn svg { width: 19px; height: 19px; }
.heart-btn:hover { color: var(--heart); border-color: var(--heart); }
.heart-btn[aria-pressed="true"] { color: #fff; background: var(--heart); border-color: var(--heart); box-shadow: 0 4px 16px rgba(255, 79, 125, .35); }
.heart-btn[aria-pressed="true"] svg { fill: currentColor; }
.pop { animation: pop .35s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { 0% { transform: scale(.8); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }
.chip-btn { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 11px; border-radius: 99px; border: 1px solid var(--border-2); background: transparent; color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.chip-btn:hover { background: var(--surface-2); color: var(--text); }
.chip-btn.on { background: rgba(63, 214, 155, .12); border-color: rgba(63, 214, 155, .5); color: var(--ok); }
.chip-btn svg { width: 15px; height: 15px; }
#rateBtn { font-family: var(--mono); min-width: 46px; justify-content: center; }

.strip-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; min-height: 28px; flex-wrap: wrap; }
.strip-head .label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.edit-tools { display: flex; gap: 4px; flex-wrap: wrap; }
.tool { height: 26px; padding: 0 9px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 12px; font-weight: 600; }
.tool:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-2); }
.tool.danger:hover { color: var(--danger); border-color: rgba(255, 90, 90, .5); }
.tool:disabled { opacity: .4; pointer-events: none; }
.clipstrip-wrap, .overview-wrap { padding: 10px 12px 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.clipstrip { position: relative; height: 64px; border-radius: 10px; overflow: hidden; background: var(--bg-2); cursor: pointer; touch-action: none; }
.overview { position: relative; height: 40px; border-radius: 8px; overflow: hidden; background: var(--bg-2); cursor: pointer; }
.clipstrip canvas, .overview canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ov-tip { position: absolute; top: 4px; transform: translateX(-50%); font: 11px var(--mono); padding: 2px 6px; border-radius: 5px; background: rgba(0, 0, 0, .75); pointer-events: none; white-space: nowrap; }

/* ---------- side list */
.side { border-left: 1px solid var(--border); background: rgba(16, 19, 26, .7); display: flex; flex-direction: column; min-height: 0; }
.side-head { padding: 14px 14px 10px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--border); }
.side-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.side-title h2 { margin: 0; font-size: 17px; letter-spacing: -.01em; }
.stats { color: var(--muted); font-size: 12.5px; display: flex; gap: 10px; }
.stats b { color: var(--text-2); }
.stats .h { color: var(--heart); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); padding: 3px; border-radius: 11px; background: var(--bg-2); border: 1px solid var(--border); }
.seg button { border: 0; background: transparent; height: 30px; border-radius: 8px; font-weight: 600; font-size: 12.5px; color: var(--muted); transition: all .15s; }
.seg button.on { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.filters { display: flex; flex-direction: column; gap: 6px; }
.chips { display: flex; gap: 5px; flex-wrap: wrap; }
.chips button { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px; border-radius: 99px; border: 1px solid var(--border); background: transparent; font-size: 12px; font-weight: 600; color: var(--muted); }
.chips button svg { width: 13px; height: 13px; }
.chips button:hover { color: var(--text); border-color: var(--border-2); }
.chips button.on { color: var(--text); background: var(--surface-2); border-color: var(--border-2); }
.chips button[data-show="liked"].on { color: var(--heart); border-color: rgba(255, 79, 125, .5); background: var(--heart-soft); }
.chips button[data-show="liked"].on svg { fill: currentColor; }
.toggles { display: flex; gap: 14px; flex-wrap: wrap; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch i { width: 30px; height: 18px; border-radius: 99px; background: var(--surface-3); position: relative; transition: background .15s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-2); transition: transform .15s, background .15s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(12px); background: #fff; }

.rally-list { list-style: none; margin: 0; padding: 8px 8px 40px; overflow-y: auto; flex: 1; min-height: 0; scroll-behavior: smooth; }
.rally-list::-webkit-scrollbar { width: 10px; }
.rally-list::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
.list-empty { padding: 30px 20px; text-align: center; color: var(--muted); }

.card {
  display: grid; grid-template-columns: 112px 1fr auto; gap: 11px; align-items: center;
  padding: 7px; border-radius: 12px; cursor: pointer; position: relative;
  border: 1px solid transparent; transition: background .15s, border-color .15s, opacity .2s;
  will-change: transform;
}
.card:hover { background: var(--surface); }
.card.current { background: linear-gradient(90deg, var(--accent-soft), rgba(255, 122, 26, .04)); border-color: rgba(255, 122, 26, .45); }
.card .thumb { width: 112px; aspect-ratio: 16/9; border-radius: 8px; background: var(--surface-2) center/cover no-repeat; position: relative; overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .25s; }
.card .thumb img.loaded { opacity: 1; }
.card .dur { position: absolute; right: 5px; bottom: 5px; font: 600 11px var(--mono); padding: 1px 5px; border-radius: 5px; background: rgba(0, 0, 0, .72); }
.card .playing-ind { position: absolute; left: 6px; bottom: 6px; display: none; gap: 2px; align-items: flex-end; height: 12px; }
.card.current.is-playing .playing-ind { display: flex; }
.playing-ind i { width: 3px; background: var(--accent); border-radius: 2px; animation: eq .8s ease-in-out infinite alternate; }
.playing-ind i:nth-child(2) { animation-delay: .2s; } .playing-ind i:nth-child(3) { animation-delay: .4s; }
@keyframes eq { from { height: 3px; } to { height: 12px; } }
.card .meta { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.card .title { font-weight: 650; display: flex; align-items: center; gap: 7px; }
.card .title .num { font-family: var(--mono); color: var(--muted); font-weight: 600; font-size: 12px; }
.card .sub { color: var(--muted); font-size: 12px; font-family: var(--mono); }
.card .badges { display: flex; gap: 5px; align-items: center; min-height: 18px; }
.badge { font-size: 10.5px; font-weight: 700; letter-spacing: .02em; padding: 1px 7px; border-radius: 99px; display: inline-flex; align-items: center; gap: 3px; }
.badge.seen { color: var(--ok); background: rgba(63, 214, 155, .12); }
.badge.seen svg { width: 11px; height: 11px; stroke-width: 2.6; }
.badge.new { color: var(--accent-2); background: var(--accent-soft); }
.badge.edit { color: #9db8ff; background: var(--blue-soft); }
.card .side-btns { display: flex; flex-direction: column; gap: 2px; align-items: center; }
.card .mini { width: 32px; height: 32px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; transition: color .15s, background .15s; }
.card .mini:hover { background: var(--surface-2); color: var(--text); }
.card .mini.heart:hover { color: var(--heart); }
.card .mini.heart.on { color: var(--heart); }
.card .mini.heart.on svg { fill: currentColor; }
.card .mini.dl { opacity: 0; }
.card:hover .mini.dl, .card.current .mini.dl { opacity: 1; }
.card.seen:not(.current) .thumb { filter: saturate(.35) brightness(.75); }
.card.seen:not(.current) .title { color: var(--text-2); }

/* ---------- modals */
.modal { border: 1px solid var(--border-2); border-radius: 18px; background: var(--surface); color: var(--text); padding: 0; box-shadow: var(--shadow); width: min(980px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
.modal::backdrop { background: rgba(4, 6, 10, .7); backdrop-filter: blur(3px); }
.small-modal { width: min(440px, calc(100vw - 32px)); }
.modal-head { padding: 18px 20px 8px; }
.modal-head h3 { margin: 0 0 4px; }
.modal-head p { margin: 0; }
.modal-foot { display: flex; gap: 8px; align-items: center; padding: 14px 20px 18px; }
.modal-foot input[type=range] { width: 200px; vertical-align: middle; }
.pad-row { display: grid; grid-template-columns: 1fr 160px 50px; gap: 12px; align-items: center; padding: 8px 20px; }
.pad-row output { font-family: var(--mono); color: var(--text-2); text-align: right; }
input[type=range] { accent-color: var(--accent); }
.keys { display: grid; grid-template-columns: 110px 1fr; gap: 8px 14px; margin: 6px 20px; }
.keys dt { font-family: var(--mono); font-size: 12px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 6px; padding: 2px 8px; justify-self: start; }
.keys dd { margin: 0; color: var(--text-2); }

.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 50; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border-2); box-shadow: var(--shadow); animation: up .25s; min-width: 260px; }
.toast .bar { width: 140px; }
@keyframes up { from { transform: translateY(12px); opacity: 0; } }
.help-fab { position: fixed; right: 16px; bottom: 16px; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border-2); background: var(--surface); color: var(--muted); font-weight: 700; z-index: 30; }
.help-fab:hover { color: var(--text); }

/* ---------- narrow screens: video pinned on top, list scrolls beneath it */
@media (max-width: 980px) {
  body { overflow: auto; }
  .work { display: block; height: auto; }
  .stage { position: sticky; top: 0; z-index: 10; overflow: visible; padding: 8px 8px 8px; gap: 8px; background: var(--bg); border-bottom: 1px solid var(--border); }
  .stage > .player { flex: none; height: min(40vh, calc(100cqw / var(--ar, 1.7778))); max-height: none; min-height: 0; border-radius: 10px; }
  .controls { padding: 6px; gap: 4px; }
  .controls .sep, #fsBtn, #muteBtn { display: none; }
  .clipstrip-wrap { padding: 8px; }
  .clipstrip { height: 46px; }
  .edit-tools { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 2px; }
  .tool { flex: none; }
  .overview-wrap { display: none; }
  .side { border-left: 0; background: transparent; }
  .rally-list { overflow: visible; }
  .help-fab { display: none; }
  .top-actions .btn { padding: 0 10px; }
  .top-actions .btn svg + * { display: none; }
}
@media (max-width: 560px) {
  .topbar { padding: 0 10px; gap: 8px; }
  .crumb { display: none; }
  .top-actions { margin-left: auto; }
  #settingsBtn { font-size: 0; gap: 0; padding: 0 9px; }
  .now { display: none; }
  .controls { justify-content: space-between; }
  .stage > .player { height: min(32vh, calc(100cqw / var(--ar, 1.7778))); }
  .clipstrip-wrap .strip-head .label, #clipRange { display: none; }
  .clipstrip-wrap .strip-head { margin-bottom: 4px; min-height: 0; }
  .card { grid-template-columns: 96px 1fr auto; }
  .card .thumb { width: 96px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
