* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

/* dark-theme form controls everywhere (no default white boxes) */
input[type="text"], input[type="password"], textarea {
  background: var(--bg3, #1c2029);
  color: var(--text, #e8eaf0);
  border: 1px solid var(--border, #2a2f3c);
  border-radius: 6px;
  padding: 6px 9px;
  font: inherit;
  font-size: 12px;
}
textarea { resize: vertical; line-height: 1.45; }
input[type="text"]:focus, input[type="password"]:focus, textarea:focus {
  outline: none;
  border-color: var(--accent, #7c5cff);
}
input[type="file"] { color: var(--muted, #8a90a0); font-size: 11px; }
input[type="file"]::file-selector-button {
  background: var(--bg3, #1c2029);
  color: var(--text, #e8eaf0);
  border: 1px solid var(--border, #2a2f3c);
  border-radius: 6px;
  padding: 5px 10px;
  margin-right: 8px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}
input[type="range"] { accent-color: var(--accent, #7c5cff); }

:root {
  --bg: #0d0f14;
  --bg2: #14171f;
  --bg3: #1c2029;
  --border: #2a2f3c;
  --text: #e8eaf0;
  --muted: #8a90a0;
  --accent: #7c5cff;
  --accent2: #19c8a5;
  --scene: #e0218a;
  --clip: #3f74e0;
  --good: #19c8a5;
  --warn: #e6b93f;
  --bad: #e05252;
}

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- top bar ---------- */
#topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
  flex-wrap: wrap; /* never let buttons overflow off-screen */
  row-gap: 6px;
}
.brand { font-weight: 600; white-space: nowrap; }
.topbar-group { display: flex; align-items: center; gap: 6px; }
.topbar-group.right { margin-left: auto; }
.btn {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { background: #252a36; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.accent2 { background: var(--accent2); border-color: var(--accent2); color: #06281f; font-weight: 600; }
.btn.icon { padding: 6px 10px; }
.btn.small { padding: 3px 8px; font-size: 11px; }
.btn.nav { font-size: 12px; }
.select {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  max-width: 240px;
}
.muted { color: var(--muted); }
.timecode { font-family: Consolas, monospace; font-size: 14px; }

/* ---------- layout ---------- */
#main { flex: 1 1 auto; display: flex; min-height: 0; min-width: 0; }
/* min-width: 0 — a zoomed timeline must scroll inside, never widen the page */
#workArea { flex: 1; display: flex; min-height: 0; min-width: 0; }

#previewCol {
  flex: 0 0 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px;
  gap: 8px;
  border-right: 1px solid var(--border);
  background: var(--bg2);
  overflow-y: auto;
}

#phoneFrame {
  width: 280px;
  border: 2px solid var(--border);
  border-radius: 18px;
  padding: 6px;
  background: #000;
}
#cropViewport {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: 10px;
  background: #000;
  cursor: grab;
}
#cropViewport:active { cursor: grabbing; }
#cropViewport video {
  position: absolute;
  top: 0;
  height: 100%;
  width: auto;
  max-width: none;
  pointer-events: none;
  z-index: 1;
}
#bgCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  filter: blur(8px) brightness(0.85);
  transform: scale(1.12);
  pointer-events: none;
}
.safe-zone {
  position: absolute;
  left: 0; right: 0;
  background: repeating-linear-gradient(45deg, #ff475711 0 8px, #ff475722 8px 16px);
  border-bottom: 1px dashed #ff475766;
  pointer-events: none;
}
#safeTop { top: 0; height: 11%; }
#safeBottom { bottom: 0; height: 14%; border-bottom: none; border-top: 1px dashed #ff475766; }
#reframeHint {
  position: absolute;
  top: 50%;
  left: 0; right: 0;
  text-align: center;
  color: #fff;
  text-shadow: 0 1px 4px #000;
  font-size: 12px;
  pointer-events: none;
}

/* empty-state placeholder shown until a video is opened */
#videoPlaceholder {
  position: absolute;
  inset: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 2px dashed var(--border);
  border-radius: 10px;
  color: var(--muted);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
  z-index: 2;
}
#videoPlaceholder:hover, #phoneFrame.drop-hover #videoPlaceholder {
  border-color: var(--accent);
  background: rgba(124, 92, 255, 0.07);
  color: var(--text);
}
#videoPlaceholder .vp-icon { font-size: 30px; }
#videoPlaceholder .vp-title { font-size: 15px; font-weight: 600; }
#videoPlaceholder .vp-sub { font-size: 11px; line-height: 1.5; }

/* ---------- open-video popup ---------- */
#videoModal, #savesModal {
  position: fixed;
  inset: 0;
  background: #000a;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

/* File menu dropdown */
.menu-wrap { position: relative; }
#fileMenu {
  position: absolute;
  top: 110%;
  left: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  z-index: 50;
  min-width: 220px;
}
#fileMenu button {
  background: none;
  border: none;
  color: var(--text);
  text-align: left;
  padding: 7px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}
#fileMenu button:hover { background: var(--bg3, #1c2029); }

/* AI cut planner */
#planModal, #variantModal, #scriptModal, #settingsModal, #assetsModal, #loginModal, #ytTrimModal {
  position: fixed;
  inset: 0;
  background: #000a;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

/* script view */
#scriptModal .video-modal-box { max-height: 84vh; }
#scriptBody { overflow-y: auto; }
.script-section {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--muted);
  margin: 10px 0 4px;
}
.script-brief { line-height: 1.55; }
.script-beat { padding: 5px 8px; border-left: 2px solid #ffb85c; background: #ffb85c0d; border-radius: 0 5px 5px 0; margin-bottom: 4px; }
.script-beat .sb-desc { font-size: 12px; color: var(--muted); line-height: 1.45; }
.sb-num { color: #ffb85c; font-weight: 700; }
.script-scene { padding: 6px 8px; border-left: 2px solid var(--scene); background: #e0218a0d; border-radius: 0 5px 5px 0; margin-bottom: 5px; }
.script-scene .ss-desc { font-size: 12px; line-height: 1.45; }
.script-scene .sb-num { color: var(--scene); }
.ss-event { font-size: 11px; color: var(--muted); margin-top: 2px; }
.ss-event .ev-t { font-family: Consolas, monospace; color: var(--accent2); }

/* framing toolbar under the transport */
#framingBar { display: flex; gap: 6px; justify-content: center; width: 100%; }

/* zoom bar */
#zoomBar { display: flex; gap: 6px; align-items: center; justify-content: center; width: 100%; flex-wrap: wrap; }
#zoomBar .zb-label { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
#zoomSlider { width: 90px; accent-color: var(--accent); }
#zoomBar .select { padding: 3px 6px; font-size: 11px; max-width: 130px; }

/* custom cut rows in the plan dialog */
.custom-cut-row {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 6px;
}
.custom-cut-row .ccr-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.custom-cut-row .ccr-head b { flex: 0 0 auto; white-space: nowrap; }
.custom-cut-row .ccr-preset { flex: 1 1 auto; min-width: 0; }
.custom-cut-row .ccr-count { flex: 0 0 auto; width: 56px; }
.custom-cut-row .ccr-prompt { width: 100%; }

/* steppers (− n ＋) */
.stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  flex: 0 0 auto;
}
.stepper button {
  background: var(--bg3, #1c2029);
  color: var(--text);
  border: none;
  width: 26px;
  height: 26px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.stepper button:hover { background: #252a36; }
.stepper .st-val {
  min-width: 26px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

/* custom prompt counts as a selected cut once it has text */
#variantPrompt.vt-active { border-color: var(--accent); background: #7c5cff14; }

/* multi-select cut options in the New cuts popup */
.vt-opt { text-align: left; opacity: 0.75; }
.vt-opt.selected {
  opacity: 1;
  border-color: var(--accent);
  background: #7c5cff22;
}
.vt-opt.selected::before { content: '✓ '; color: var(--accent); font-weight: 700; }

/* β scene-snap ⊕ buttons */
.snap-btn {
  position: absolute;
  top: 34px;
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--accent2);
  background: #12332b;
  color: var(--accent2);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  z-index: 6;
}
.snap-btn:hover { background: var(--accent2); color: #06281f; }
.snap-btn:disabled { opacity: 0.3; cursor: default; }

/* thin Premiere-style scrollbars on the timelines */
#srcTimeline::-webkit-scrollbar, #shortTimeline::-webkit-scrollbar { height: 9px; }
#srcTimeline::-webkit-scrollbar-track, #shortTimeline::-webkit-scrollbar-track { background: var(--bg2); }
#srcTimeline::-webkit-scrollbar-thumb, #shortTimeline::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 5px;
  border: 2px solid var(--bg2);
}
#srcTimeline::-webkit-scrollbar-thumb:hover, #shortTimeline::-webkit-scrollbar-thumb:hover { background: var(--accent); }
#srcTimeline.panning, #shortTimeline.panning { cursor: grabbing; }

/* YouTube import trim bar */
#ytTrimBar {
  position: relative;
  height: 26px;
  background: var(--bg3, #1c2029);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-top: 6px;
}
#ytTrimRange {
  position: absolute;
  top: 0;
  bottom: 0;
  background: #19c8a533;
  border-left: 1px solid var(--accent2);
  border-right: 1px solid var(--accent2);
}
.yt-handle {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 12px;
  margin-left: -6px;
  background: var(--accent2);
  border-radius: 4px;
  cursor: ew-resize;
  z-index: 2;
}
.yt-handle:hover { background: #4fe0c2; }

/* − remove button on clips (snap / paint+snap modes) */
.sclip-remove {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 16px;
  height: 16px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid #ff4757;
  background: #3a1218;
  color: #ff8a94;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  z-index: 6;
  display: none;
}
.sclip:hover .sclip-remove, .sclip.selected .sclip-remove { display: block; }
.sclip-remove:hover { background: #ff4757; color: #fff; }

/* β paint mode scenes */
.src-scene.paintable { cursor: pointer; }
.src-scene.paintable:hover { background: #e0218a40; }
.src-scene.painted {
  background: #19c8a555;
  border-color: var(--accent2);
  color: #bff2e4;
}

/* framing keyframe diamonds on short clips */
.kf-diamond {
  position: absolute;
  bottom: 1px;
  width: 9px;
  height: 9px;
  background: #ffb85c;
  transform: rotate(45deg);
  border: 1px solid #10131a;
  cursor: pointer;
  z-index: 5;
}
.kf-diamond:hover { background: #ffd8a3; }
.kf-diamond.eased { background: var(--accent2); border-radius: 50%; }
.plan-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
}
.plan-row .pr-text { flex: 1 1 auto; }
.plan-row .pr-text .muted { font-size: 11px; }
.plan-row .select { min-width: 64px; }
.variant-choices { display: flex; flex-direction: column; gap: 6px; }
.variant-choices .btn { text-align: left; }
#variantNote { font-size: 11px; margin: 2px 0 4px; }

/* saved-files rows */
#savesList { overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.save-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg3, #1c2029);
}
.save-row .sr-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.video-modal-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  width: min(720px, 92vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  text-align: left;
}
.video-modal-box.drop-hover { outline: 2px dashed var(--accent); outline-offset: -6px; }
.video-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.vm-title { font-weight: 600; font-size: 14px; }
#videoGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  /* Fixed row height. An `auto` row min-content-sizes each tile IGNORING
     its aspect-ratio, collapsing rows to the caption height so tiles
     overflow into the next row (the overlap bug). A fixed row height +
     an absolutely-positioned caption avoids that entirely. */
  grid-auto-rows: 116px;
  gap: 10px;
  overflow-y: auto;
  padding-right: 4px;
}
.video-tile {
  position: relative;
  height: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg3, #1c2029);
  overflow: hidden;
  cursor: pointer;
  display: block;
  transition: border-color 0.12s, transform 0.12s;
}
.video-tile:hover { border-color: var(--accent); transform: translateY(-1px); }
.video-tile.current { border-color: var(--accent2); }
.video-tile img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.video-tile.no-thumb::after {
  content: '🎞';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  opacity: 0.5;
}
.video-tile .vt-name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  padding: 14px 7px 5px;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85) 55%);
}
.yt-row { display: flex; gap: 6px; margin-bottom: 10px; }
.video-tile .vt-expiry {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 1;
  background: rgba(255, 71, 87, 0.9);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 8px;
}
.video-tile .vt-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 1;
  background: rgba(25, 200, 165, 0.9);
  color: #05221c;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 8px;
}
.video-tile.upload-tile {
  border-style: dashed;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--muted);
}
.video-tile.upload-tile:hover { color: var(--text); background: rgba(124, 92, 255, 0.07); }
.video-tile.upload-tile .vt-plus { font-size: 28px; line-height: 1; }
.video-tile.upload-tile .vt-name { position: static; background: none; padding: 0; }

#transport { display: flex; align-items: center; gap: 10px; width: 100%; justify-content: center; flex-wrap: wrap; }
.chk { color: var(--muted); font-size: 11px; display: flex; gap: 4px; align-items: center; }
.dur-badge {
  font-family: Consolas, monospace;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.dur-badge.good { color: var(--good); border-color: var(--good); }
.dur-badge.warn { color: var(--warn); border-color: var(--warn); }
.dur-badge.bad { color: var(--bad); border-color: var(--bad); }
#clipInfo { font-size: 11px; text-align: center; min-height: 28px; max-width: 320px; }
#clipInfo .ci-scene {
  margin-top: 4px;
  padding: 5px 8px;
  border-left: 2px solid var(--scene);
  background: #e0218a0d;
  border-radius: 0 5px 5px 0;
  text-align: left;
  line-height: 1.4;
}
#clipInfo .ci-scene b { color: #f0a8cc; }

/* ---------- timelines ---------- */
#timelinesCol {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 10px 12px;
  gap: 6px;
  overflow-y: auto;
}

.variant-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
#variantTabs { display: flex; gap: 4px; flex-wrap: wrap; }
.variant-tab {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 6px 6px 0 0;
  background: var(--bg2);
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
}
.variant-tab.active { background: var(--bg3); color: var(--text); border-bottom-color: var(--accent2); }

.tl-label { font-size: 11px; color: var(--muted); margin-top: 6px; text-transform: uppercase; letter-spacing: 0.5px; }

#srcTimeline {
  position: relative;
  height: 122px; /* +10 for the thin scrollbar when zoomed */
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  cursor: crosshair;
  flex: 0 0 auto;
}
#srcRuler { position: absolute; top: 0; left: 0; right: 0; height: 16px; border-bottom: 1px solid var(--border); cursor: ew-resize; }
.src-tick { position: absolute; top: 0; font-size: 9px; color: var(--muted); border-left: 1px solid var(--border); padding-left: 2px; height: 16px; pointer-events: none; }
#srcBeats { position: absolute; top: 16px; left: 0; right: 0; height: 20px; }
.src-beat {
  position: absolute;
  top: 2px; bottom: 2px;
  border: 1px solid #ffb85c;
  background: #ffb85c1f;
  border-radius: 3px;
  font-size: 9px;
  padding: 1px 3px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #ffd8a3;
  cursor: pointer;
}
.src-beat:hover { background: #ffb85c40; }
#srcScenes { position: absolute; top: 36px; left: 0; right: 0; bottom: 24px; }
.src-scene {
  position: absolute;
  top: 2px; bottom: 2px;
  border: 1px solid var(--scene);
  background: #e0218a18;
  border-radius: 3px;
  font-size: 9px;
  padding: 1px 3px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #f0a8cc;
}
.src-event {
  position: absolute;
  bottom: 2px;
  width: 3px; height: 8px;
  background: var(--accent2);
  border-radius: 1px;
}
#srcUsed { position: absolute; left: 0; right: 0; bottom: 0; height: 22px; }
.used-range {
  position: absolute;
  top: 3px; bottom: 3px;
  background: #3f74e055;
  border: 1px solid var(--clip);
  border-radius: 3px;
}
.used-range.current { background: #19c8a566; border-color: var(--accent2); }
#srcSelection {
  position: absolute;
  top: 16px; bottom: 0;
  background: #7c5cff33;
  border: 1px solid var(--accent);
  pointer-events: none;
}
#srcPlayhead {
  position: absolute;
  top: 0; bottom: 0;
  width: 1px;
  background: #ff9d47;
  pointer-events: none;
}

#shortTimeline {
  position: relative;
  height: 96px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  flex: 0 0 auto;
}
#shortRuler {
  position: relative;
  height: 15px;
  min-width: 100%;
  border-bottom: 1px solid var(--border);
  cursor: ew-resize;
}
.short-tick {
  position: absolute;
  top: 0;
  font-size: 9px;
  color: var(--muted);
  border-left: 1px solid var(--border);
  padding-left: 2px;
  height: 15px;
  pointer-events: none;
}
#shortClips { position: relative; height: calc(100% - 15px); min-width: 100%; }
.sclip {
  position: absolute;
  top: 8px; bottom: 8px;
  background: #3f74e02e;
  border: 1px solid var(--clip);
  border-radius: 5px;
  overflow: hidden;
  cursor: grab;
  user-select: none;
}
.sclip.selected { outline: 2px solid #fff; z-index: 3; }
.sclip .sclip-name {
  font-size: 10px;
  padding: 2px 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  color: #bcd0f7;
}
.sclip .sclip-thumb { position: absolute; inset: 18px 0 0 0; background: #0a0c10; pointer-events: none; }
.sclip .sclip-dur { position: absolute; right: 3px; bottom: 2px; font-size: 9px; color: var(--muted); pointer-events: none; }
.sclip .rf-mark { position: absolute; left: 3px; bottom: 2px; font-size: 9px; color: var(--accent2); pointer-events: none; }
.sclip .handle { position: absolute; top: 0; bottom: 0; width: 7px; cursor: ew-resize; z-index: 2; }
.sclip .handle.left { left: 0; }
.sclip .handle.right { right: 0; }
.sclip .handle:hover { background: #ffffff33; }
.drop-marker {
  position: absolute;
  top: 4px; bottom: 4px;
  width: 3px;
  background: var(--accent2);
  z-index: 5;
  pointer-events: none;
}
#shortPlayhead {
  position: absolute;
  top: 0; bottom: 0;
  width: 1px;
  background: #ff4757;
  pointer-events: none;
  z-index: 4;
}

/* ---------- overlay ---------- */
#overlay {
  position: fixed;
  inset: 0;
  background: #000a;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
#overlayBox {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px 32px;
  min-width: 320px;
  max-width: 460px;
  text-align: center;
}
#overlayTitle { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
#overlayBarWrap {
  position: relative;
  margin-top: 14px;
  height: 18px;
  background: var(--bg3, #1c2029);
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
}
#overlayBarFill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 0.6s ease;
}
#overlayBarText {
  position: absolute;
  inset: 0;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  color: var(--text);
}
.spinner {
  margin: 16px auto 0;
  width: 26px; height: 26px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
