/* ==========================================================================
   Video Creator: "creative studio" look.
   Tokens first; dark mode follows the system unless the user picks a theme
   (html[data-theme="light" | "dark"]).
   ========================================================================== */

:root {
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Bricolage Grotesque", "Inter", system-ui, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", Consolas, monospace;

  --bg: #f6f4fb;
  --glow-1: rgba(118, 84, 255, 0.16);
  --glow-2: rgba(255, 95, 126, 0.12);
  --surface: #ffffff;
  --surface-2: #f5f3fa;
  --surface-3: #ece8f5;
  --border: #e8e4f1;
  --border-strong: #d6d0e4;
  --text: #19152a;
  --muted: #6b6582;
  --accent: #6a46f5;
  --accent-strong: #5631e8;
  --accent-soft: rgba(106, 70, 245, 0.1);
  --accent-ring: rgba(106, 70, 245, 0.28);
  --accent-text: #ffffff;
  --grad: linear-gradient(135deg, #6a46f5 0%, #a744e0 55%, #e2457c 100%);
  --error: #d6304f;
  --shadow-sm: 0 1px 2px rgba(25, 21, 42, 0.05);
  --shadow: 0 1px 2px rgba(25, 21, 42, 0.04), 0 12px 32px -16px rgba(40, 24, 90, 0.18);
  --shadow-lg: 0 24px 60px -20px rgba(40, 24, 90, 0.35);
  --radius: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --card-pad: 24px;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a84a0' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0b14;
    --glow-1: rgba(124, 92, 255, 0.22);
    --glow-2: rgba(255, 95, 126, 0.12);
    --surface: #16131f;
    --surface-2: #1c1827;
    --surface-3: #262133;
    --border: #2a2538;
    --border-strong: #3a334b;
    --text: #f0edf7;
    --muted: #a39cb8;
    --accent: #9d86ff;
    --accent-strong: #b3a1ff;
    --accent-soft: rgba(157, 134, 255, 0.14);
    --accent-ring: rgba(157, 134, 255, 0.35);
    --error: #ff6d86;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px -20px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 30px 70px -20px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d0b14;
  --glow-1: rgba(124, 92, 255, 0.22);
  --glow-2: rgba(255, 95, 126, 0.12);
  --surface: #16131f;
  --surface-2: #1c1827;
  --surface-3: #262133;
  --border: #2a2538;
  --border-strong: #3a334b;
  --text: #f0edf7;
  --muted: #a39cb8;
  --accent: #9d86ff;
  --accent-strong: #b3a1ff;
  --accent-soft: rgba(157, 134, 255, 0.14);
  --accent-ring: rgba(157, 134, 255, 0.35);
  --error: #ff6d86;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px -20px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 30px 70px -20px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

/* ---------- Base ---------- */

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 520px at 12% -8%, var(--glow-1), transparent 70%),
    radial-gradient(800px 480px at 95% 0%, var(--glow-2), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.55 var(--font-ui);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent-ring); }
.no-transitions *, .no-transitions *::before { transition: none !important; }
a { color: var(--accent); }
u { text-decoration-color: var(--accent); text-underline-offset: 3px; }

.top, main, footer { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap;
  padding-top: 36px; padding-bottom: 8px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { flex: none; width: 48px; height: 48px; filter: drop-shadow(0 8px 18px rgba(106, 70, 245, 0.35)); }
.top h1 {
  margin: 0; font: 800 30px/1.05 var(--font-display); letter-spacing: -0.035em;
}
.top h1 .grad-text {
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 16px 0 24px; padding: 0; width: 100%; }
.badges li {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px 5px 9px; font-size: 13px; font-weight: 500; color: var(--muted);
  background: color-mix(in srgb, var(--surface) 75%, transparent);
  border: 1px solid var(--border); border-radius: 999px;
  backdrop-filter: blur(8px);
}
.badges svg { color: var(--accent); }

footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px;
  padding-top: 8px; padding-bottom: 40px; color: var(--muted); font-size: 13px;
}

/* ---------- Cards & headings ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--card-pad);
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  /* "backwards", not "both": a lingering transform would trap the
     fill-the-window preview inside the card. */
  animation: rise 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .card, .font-menu { animation: none !important; } * { transition: none !important; } }

h2 {
  display: flex; align-items: center; gap: 10px; margin: 0 0 14px;
  font: 700 18px/1.2 var(--font-display); letter-spacing: -0.015em;
}
h3, h4 { font-family: var(--font-display); letter-spacing: -0.01em; }
.num {
  display: inline-grid; place-items: center; flex: none;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--grad); color: #fff; font: 700 13px var(--font-ui);
  box-shadow: 0 4px 12px -4px rgba(106, 70, 245, 0.6);
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; gap: 22px; } }

/* ---------- Drop zones ---------- */

.drop {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 196px; padding: 20px; text-align: center; cursor: pointer;
  background: var(--surface-2);
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-md);
  transition: border-color 0.15s, background-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.drop:hover, .drop.over {
  border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px);
}
.drop:focus-within { box-shadow: 0 0 0 4px var(--accent-ring); }
.drop.has-file { border-style: solid; border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.drop-icon {
  display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 8px;
  border-radius: 14px; background: var(--surface); color: var(--accent);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border);
}
.drop.has-file .drop-icon { background: var(--grad); color: #fff; box-shadow: 0 6px 16px -6px rgba(106, 70, 245, 0.6); }
.drop-main { font-weight: 600; word-break: break-word; }
.drop-main u { color: var(--accent); }
.drop-sub { color: var(--muted); font-size: 13px; }
.drop-small { min-height: 0; flex-direction: row; gap: 12px; padding: 14px 16px; text-align: left; justify-content: flex-start; }
.drop-small .drop-icon { width: 40px; height: 40px; margin: 0; border-radius: 12px; }
.drop-small .drop-text { display: flex; flex-direction: column; min-width: 0; }

.or { display: flex; align-items: center; gap: 12px; margin: 12px 0; color: var(--muted); font-size: 12px; font-weight: 500; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

/* ---------- Form controls ---------- */

textarea, select, button, .t-time, .font-search, .button-like {
  font: inherit; color: inherit;
}
textarea {
  display: block; width: 100%; resize: vertical; padding: 12px 14px; line-height: 1.6;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea::placeholder { color: var(--muted); opacity: 0.8; }
textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
textarea.over { border-color: var(--accent); background: var(--accent-soft); }

select {
  appearance: none; -webkit-appearance: none;
  height: 40px; padding: 0 36px 0 12px;
  background: var(--surface) var(--chevron) no-repeat right 10px center / 16px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s;
}
select:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border-strong)); }
select:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
option, optgroup { background: var(--surface); color: var(--text); }

button, .button-like {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; cursor: pointer;
  font-weight: 600; font-size: 14px; white-space: nowrap;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 12px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, color 0.15s, background-color 0.15s, box-shadow 0.15s, transform 0.1s, filter 0.15s;
}
button:hover:not(:disabled), .button-like:hover { border-color: var(--accent); color: var(--accent); }
button:active:not(:disabled) { transform: translateY(1px); }
button:focus-visible, .button-like:focus-within { outline: none; box-shadow: 0 0 0 4px var(--accent-ring); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary {
  color: #fff; background: var(--grad); border: none;
  box-shadow: 0 10px 24px -10px rgba(106, 70, 245, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
button.primary:hover:not(:disabled) { color: #fff; filter: brightness(1.08) saturate(1.05); }
button.primary-outline { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); background: var(--accent-soft); }
button.small { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
#alignBtn { height: 44px; padding: 0 28px; font-size: 15px; border-radius: 14px; }

input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }

input[type="color"] {
  width: 44px; height: 32px; padding: 3px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 7px; }
input[type="color"]::-moz-color-swatch { border: none; border-radius: 7px; }
input[type="color"]:disabled { opacity: 0.4; cursor: not-allowed; }

/* Range sliders */
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 22px; margin: 0; background: transparent; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: var(--surface-3); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 999px; background: var(--surface-3); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6px; border-radius: 50%;
  background: #fff; border: 3px solid var(--accent); box-shadow: 0 2px 6px rgba(20, 10, 60, 0.3);
  transition: transform 0.12s;
}
input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  background: #fff; border: 3px solid var(--accent); box-shadow: 0 2px 6px rgba(20, 10, 60, 0.3);
}
input[type="range"]:hover::-webkit-slider-thumb, input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.15); }
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 5px var(--accent-ring); }
input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 5px var(--accent-ring); }

.row { display: flex; align-items: end; gap: 14px; margin-top: 22px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.field output { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 600; }
.field input[type="range"], .field select { width: 100%; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.link-btn { color: var(--accent); cursor: pointer; font-size: 13.5px; font-weight: 600; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.inline { display: flex; gap: 16px; }

/* Text box + full-screen editor button */
.text-wrap { position: relative; }
.text-wrap textarea { padding-right: 52px; }
.icon-btn {
  position: absolute; top: 8px; right: 8px;
  width: 34px; height: 34px; padding: 0; border-radius: 10px;
  color: var(--muted); background: var(--surface-2);
}

/* ---------- Status & messages ---------- */

.status { display: flex; align-items: center; gap: 14px; margin-top: 16px; font-size: 14px; color: var(--muted); }
.bar { flex: 0 0 220px; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar > div {
  height: 100%; width: 0; border-radius: inherit; background: var(--grad); background-size: 200% 100%;
  transition: width 0.25s; animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.error {
  margin: 14px 0 0; padding: 10px 14px; font-size: 14px; color: var(--error);
  background: color-mix(in srgb, var(--error) 10%, transparent); border-radius: var(--radius-sm);
}
.note { color: var(--muted); font-size: 13px; }

/* ---------- Results: preview ---------- */

.results-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.results-head h2 { margin: 0; }
.pin-btn { color: var(--muted); }
.pin-btn[aria-pressed="true"] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); background: var(--accent-soft); }

.stage {
  position: relative; overflow: hidden; background: #000;
  border-radius: 16px; box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}
/* The preview is sized to the video itself (no black bars) and is the same
   size whether or not it's pinned. */
.stage { width: fit-content; max-width: 100%; margin: 0 auto; }
.stage video,
.stage:not(.video) canvas { display: block; width: auto; max-width: 100%; max-height: 60vh; margin: 0 auto; }
.stage.video canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; object-fit: contain; }
@media (max-width: 760px) {
  .stage video,
  .stage:not(.video) canvas { max-height: 50vh; }
}
#audio { display: block; width: 100%; margin-top: 12px; border-radius: 999px; }
#overlay.viz-editable { touch-action: none; } /* lets touch drag the visualizer instead of scrolling */

.controls-pane { container: settings / inline-size; min-width: 0; }
.preview-pane { min-width: 0; }

/* Pinned preview: stays stuck to the top of the window while the settings
   below it scroll. Only its backdrop changes when pinned, never its size. */
.preview-pane { margin: 0 calc(-1 * var(--card-pad)) 18px; padding: 12px var(--card-pad); }
.results-layout.pinned .preview-pane {
  position: sticky; top: 0; z-index: 15;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}

/* Full-screen preview (captions included): the button sits on the video's corner. */
.fs-btn {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 36px; height: 36px; padding: 0; border-radius: 10px;
  color: #fff; background: rgba(15, 10, 30, 0.55); border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(6px); box-shadow: none; opacity: 0.75;
}
.stage:hover .fs-btn, .fs-btn:focus-visible { opacity: 1; }
.fs-btn:hover:not(:disabled) { color: #fff; border-color: rgba(255, 255, 255, 0.5); background: rgba(15, 10, 30, 0.75); }
.fs-btn .fs-exit, .fs-btn.on .fs-enter { display: none; }
.fs-btn.on .fs-exit { display: block; }
/* Real full screen, or the fill-the-window fallback where that isn't allowed. */
.preview-pane:fullscreen, .results-layout .preview-pane.fs-fallback {
  display: flex; flex-direction: column; justify-content: center; gap: 12px;
  margin: 0; padding: 20px; background: #000; border: none;
}
.preview-pane.fs-fallback { position: fixed !important; inset: 0; z-index: 1000; backdrop-filter: none; }
.fs-lock, .fs-lock body { overflow: hidden; }
:is(.preview-pane:fullscreen, .preview-pane.fs-fallback) .stage { width: fit-content; max-width: 100%; margin: 0 auto; border-radius: 0; box-shadow: none; }
:is(.preview-pane:fullscreen, .preview-pane.fs-fallback) .stage video,
:is(.preview-pane:fullscreen, .preview-pane.fs-fallback) .stage:not(.video) canvas { width: auto; max-width: 100%; max-height: calc(100vh - 100px); margin: 0 auto; }
:is(.preview-pane:fullscreen, .preview-pane.fs-fallback) .stage.video video { max-height: calc(100vh - 40px); }
:is(.preview-pane:fullscreen, .preview-pane.fs-fallback) #audio { width: min(900px, 100%); height: 44px; margin: 0 auto; color-scheme: dark; }

/* ---------- Results: settings ---------- */

.basic {
  display: grid; grid-template-columns: 2fr 1.2fr 1fr 1fr auto auto; gap: 16px 18px;
  align-items: end; margin: 20px 0 16px; padding: 16px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-md);
}
.basic > .field:has(.check) { gap: 8px; }
/* Sized by the settings column, not the window, so it also fits beside the pinned preview. */
@container settings (max-width: 720px) { .basic { grid-template-columns: 1fr 1fr; } .font-field { grid-column: 1 / -1; } }

details > summary {
  display: flex; align-items: center; gap: 8px; width: max-content; padding: 6px 2px;
  list-style: none; cursor: pointer; user-select: none;
  font: 700 14.5px var(--font-display); color: var(--text);
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
  content: ""; width: 20px; height: 20px; flex: none; border-radius: 6px;
  background: var(--accent-soft) var(--chevron) no-repeat center / 14px;
  transform: rotate(-90deg); transition: transform 0.2s;
}
details[open] > summary::before { transform: none; }
details > summary:hover { color: var(--accent); }
.advanced { margin-bottom: 18px; }
.advanced[open] > summary { margin-bottom: 8px; }

.panels { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin: 8px 0 0; }
fieldset {
  display: flex; flex-direction: column; gap: 12px; margin: 0; min-width: 0;
  padding: 12px 16px 16px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-md);
}
legend {
  padding: 3px 10px; font: 700 12px var(--font-ui); letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
}
legend .check { color: var(--text); font-size: 12px; }
fieldset.off > :not(legend) { opacity: 0.4; pointer-events: none; }

/* Segmented control (background type, theme) */
.segmented {
  display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 4px;
  background: var(--surface-3); border-radius: 13px;
}
.segmented label {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 10px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--muted);
  transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.segmented label:hover { color: var(--text); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label:has(input:checked) { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm), 0 2px 8px -4px rgba(40, 24, 90, 0.3); }
.segmented label:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--accent-ring); }

/* Background panel (audio files) */
.bg-panel {
  margin: 0 0 18px; padding: 18px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-md);
}
.bg-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; margin-bottom: 16px; }
.bg-head h3 { margin: 0; font-size: 16px; }
.bg-panel .segmented { background: var(--surface-3); }
.bg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 18px; align-items: end; }
.bg-grid .wide { grid-column: span 2; }
@media (max-width: 500px) { .bg-grid .wide { grid-column: auto; } }
.file-pick { display: flex; flex-direction: column; gap: 6px; }
.button-like { width: max-content; height: 38px; }
.file-name { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.bg-effects { margin: 18px 0 0; padding-top: 12px; border-top: 1px solid var(--border); }
.bg-effects[open] > summary { margin-bottom: 12px; }
.sub-head { margin: 20px 0 10px; font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.span-all { grid-column: 1 / -1; margin: 0; }
.bg-output { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }

/* ---------- Subtitle timing editor ---------- */

.timing { margin: 18px 0 0; }
.timing[open] > summary { margin-bottom: 12px; }
.timing-bar { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.timing .note { margin: 10px 0; }
.timing-list {
  position: relative; max-height: 440px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
}
.t-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  transition: background-color 0.15s, box-shadow 0.15s;
}
.t-row:last-child { border-bottom: none; }
.t-row:hover { background: var(--surface-2); }
.t-row.playing { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.t-num { width: 24px; text-align: right; color: var(--muted); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.t-pair { display: inline-flex; align-items: center; gap: 2px; }
.t-arrow { color: var(--muted); }
.t-time {
  width: 96px; height: 30px; padding: 0 8px; font: 500 13px var(--font-mono); color: inherit;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.t-time.small { width: 86px; font-size: 12px; }
.t-time:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.t-time.invalid { border-color: var(--error); box-shadow: 0 0 0 3px color-mix(in srgb, var(--error) 30%, transparent); }
.t-row button { height: 28px; padding: 0 9px; font-size: 12.5px; border-radius: 8px; box-shadow: none; }
.t-play { width: 28px; padding: 0 !important; color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.t-row button.t-now { width: 26px; padding: 0; border: none; background: none; font-size: 14px; }
.t-text { flex: 1; min-width: 160px; font-size: 14px; }
.t-words { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 8px 14px; padding: 8px 0 2px 34px; }
.t-word { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; padding: 3px 4px 3px 10px; background: var(--surface-2); border-radius: 10px; }

/* ---------- Downloads ---------- */

.downloads { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; padding-top: 20px; border-top: 1px solid var(--border); }
.dl-group { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: end; }
.dl-group.main button { height: 44px; padding: 0 20px; border-radius: 14px; }
.dl-label { width: 76px; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.more { margin-top: 2px; }
.more[open] > summary { margin-bottom: 12px; }
.more .dl-group + .dl-group { margin-top: 10px; }

/* ---------- Font picker ---------- */

.font-picker { position: relative; }
.font-btn { width: 100%; justify-content: space-between; font-weight: 400; text-align: left; color: var(--text); }
.font-btn svg { color: var(--muted); flex: none; }
.font-btn-label { font-size: 17px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.font-menu {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0;
  width: max(100%, 320px); max-width: calc(100vw - 32px); overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  animation: pop 0.14s ease-out both;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
.font-menu.up { top: auto; bottom: calc(100% + 6px); }
.font-search {
  display: block; width: 100%; padding: 12px 14px;
  background: var(--surface-2); border: none; border-bottom: 1px solid var(--border); outline: none;
}
.font-list { max-height: min(420px, 55vh); overflow-y: auto; padding: 4px 6px 6px; }
.font-group {
  position: sticky; top: -4px; z-index: 1; padding: 10px 8px 4px; background: var(--surface);
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.font-option { padding: 6px 10px; border-radius: 9px; font-size: 20px; line-height: 1.3; color: var(--text); cursor: pointer; white-space: nowrap; }
.font-option.active { background: var(--accent-soft); }
.font-option[aria-selected="true"] { color: var(--accent); }
.font-empty { padding: 12px; color: var(--muted); font-size: 14px; }

/* ---------- Full-screen text editor ---------- */

dialog.editor-dialog {
  width: 100vw; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: none;
  background: var(--bg); color: var(--text);
}
dialog.editor-dialog::backdrop { background: rgba(10, 6, 25, 0.55); backdrop-filter: blur(4px); }
.editor-inner { display: flex; flex-direction: column; height: 100%; }
.editor-bar {
  display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap;
  padding: 14px 24px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.editor-bar h3 { margin: 0; font-size: 17px; }
.editor-stats, .editor-hint { color: var(--muted); font-size: 13px; }
.editor-stats { padding: 3px 10px; background: var(--surface-2); border-radius: 999px; font-weight: 600; }
.editor-actions { margin-left: auto; display: flex; gap: 8px; }
@media (max-width: 700px) { .editor-hint { display: none; } }
#dialogText {
  flex: 1; width: 100%; max-width: 960px; margin: 0 auto; resize: none;
  border: none; border-radius: 0; padding: 32px 24px; background: transparent; box-shadow: none;
  font-size: 18px; line-height: 1.8;
}

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

.theme-switch { padding: 3px; background: color-mix(in srgb, var(--surface-3) 80%, transparent); }
.theme-switch label { padding: 6px 8px; }
.theme-switch svg { display: block; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Small screens ---------- */

@media (max-width: 600px) {
  :root { --card-pad: 18px; --radius: 18px; }
  .top { padding-top: 24px; }
  .top h1 { font-size: 26px; }
  .brand-mark { width: 42px; height: 42px; }
  .drop:not(.drop-small) { min-height: 160px; }
  .bar { flex-basis: 120px; }
  #alignBtn { flex: 1; }
}

/* ==========================================================================
   Video Creator additions
   ========================================================================== */

.head-actions { display: flex; align-items: center; gap: 8px; }
.video-length { margin-left: 4px; font: 600 13px var(--font-ui); color: var(--muted); }
button.ghost { box-shadow: none; background: transparent; }
.primary-like, button.big { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 14px; }
.button-like.primary-like {
  color: #fff; background: var(--grad); border: none;
  box-shadow: 0 10px 24px -10px rgba(106, 70, 245, 0.75);
}
.button-like.primary-like:hover { color: #fff; filter: brightness(1.08); }
.note.warn { color: color-mix(in srgb, var(--error) 80%, var(--muted)); }
.note.lead { font-size: 14px; color: var(--text); margin: 0 0 14px; }

/* Preview: empty state and drop overlay */
.stage canvas { background: #0c0a12; }
.empty-hint {
  position: absolute; inset: 0; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: 20px; text-align: center; color: #e9e6f2;
  background: radial-gradient(circle at 50% 40%, rgba(106, 70, 245, 0.25), transparent 70%);
}
.empty-hint p { margin: 0; font: 700 18px var(--font-display); }
.empty-hint .drop-hint { font: 400 13px var(--font-ui); color: #b7b1c9; }
.empty-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.empty-hint .button-like:not(.primary-like) { color: #fff; background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.25); }

.drop-overlay {
  position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center;
  background: rgba(20, 10, 50, 0.55); backdrop-filter: blur(4px); pointer-events: none;
}
.drop-overlay p {
  margin: 0; padding: 28px 40px; border: 2px dashed #fff; border-radius: 20px;
  color: #fff; font: 700 20px var(--font-display); background: rgba(106, 70, 245, 0.35);
}

/* Playback bar */
.transport {
  display: flex; align-items: center; gap: 12px; margin: 12px auto 0; max-width: 100%;
  padding: 6px 14px 6px 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
}
.play-btn { width: 40px; height: 40px; padding: 0; border-radius: 50%; color: #fff; background: var(--grad); border: none; flex: none; }
.play-btn:hover:not(:disabled) { color: #fff; filter: brightness(1.1); }
.play-btn .icon-pause, .play-btn.playing .icon-play { display: none; }
.play-btn.playing .icon-pause { display: block; }
.transport .time { font: 600 13px var(--font-mono); color: var(--muted); min-width: 40px; text-align: center; }
.transport #seek { flex: 1; min-width: 80px; }
.volume { display: flex; align-items: center; gap: 4px; flex: none; }
.volume input[type="range"] { width: 90px; }
.mute-btn { width: 34px; height: 34px; padding: 0; border: none; border-radius: 50%; background: transparent; box-shadow: none; color: var(--muted); }
.mute-btn:hover:not(:disabled) { color: var(--accent); background: var(--accent-soft); }
.mute-btn .icon-muted, .mute-btn.muted .icon-vol { display: none; }
.mute-btn.muted .icon-muted { display: block; }
.volume.no-audio { opacity: 0.4; }
@media (max-width: 520px) { .volume input[type="range"] { display: none; } } /* phones use their own volume buttons */
:is(.preview-pane:fullscreen, .preview-pane.fs-fallback) .mute-btn { color: #cfc9de; }
:is(.preview-pane:fullscreen, .preview-pane.fs-fallback) .transport { width: min(900px, 100%); background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.15); color-scheme: dark; }
:is(.preview-pane:fullscreen, .preview-pane.fs-fallback) .transport .time { color: #cfc9de; }

/* Tabs */
.tabs {
  display: flex; gap: 4px; padding: 4px; margin: 4px 0 18px; overflow-x: auto;
  background: var(--surface-3); border-radius: 14px; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs [role="tab"] {
  flex: 1 0 auto; height: 38px; padding: 0 14px; border: none; border-radius: 10px;
  background: transparent; box-shadow: none; color: var(--muted); font-weight: 600;
}
.tabs [role="tab"]:hover:not(:disabled) { color: var(--text); }
.tabs [role="tab"][aria-selected="true"] { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm), 0 2px 8px -4px rgba(40, 24, 90, 0.3); }
.tab-panel { animation: rise 0.25s ease-out backwards; }
.panel-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 12px; margin-bottom: 12px; }
.inline-field { min-width: 210px; }

/* Media grid */
.media-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px;
  margin-top: 12px;
}
.media-grid:empty { display: none; }
.tile {
  position: relative; overflow: hidden; cursor: grab;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  transition: transform 0.12s, box-shadow 0.12s, opacity 0.15s;
}
.tile:hover { box-shadow: var(--shadow); }
.tile:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.tile canvas { display: block; width: 100%; aspect-ratio: 16 / 9; background: #0c0a12; }
.tile.excluded canvas { opacity: 0.3; filter: grayscale(1); }
.tile.dragging { opacity: 0.4; }
.tile.drop-before { box-shadow: -4px 0 0 0 var(--accent); }
.tile.drop-after { box-shadow: 4px 0 0 0 var(--accent); }
.tile-num, .tile-badge {
  position: absolute; top: 6px; padding: 1px 7px; border-radius: 999px;
  font: 700 11px var(--font-ui); color: #fff; background: rgba(10, 6, 25, 0.65);
}
.tile-num { left: 6px; }
.tile-badge { left: 50%; transform: translateX(-50%); font-weight: 600; white-space: nowrap; }
.tile-include { position: absolute; top: 5px; right: 34px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: rgba(10, 6, 25, 0.55); cursor: pointer; }
.tile-remove {
  position: absolute; top: 5px; right: 5px; width: 24px; height: 24px; padding: 0;
  border-radius: 7px; border: none; color: #fff; background: rgba(10, 6, 25, 0.55); box-shadow: none; font-size: 16px; line-height: 1;
}
.tile-remove:hover:not(:disabled) { color: #fff; background: var(--error); }
.tile-name { display: block; padding: 6px 9px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid-help { margin-top: 10px; }

/* Create button bar */
.create-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border);
}
/* Progress while a video is being created, right beside the button */
.create-bar .status { flex: 1; min-width: 260px; margin-top: 0; }
.create-bar .status .bar { flex: 1 1 160px; max-width: 320px; height: 10px; }
.create-bar .status #exportText { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.create-bar .error { flex-basis: 100%; margin: 0; }
#createHint[hidden] { display: none; }
.caption-input { margin-bottom: 18px; }
#captionTools { padding-top: 6px; border-top: 1px solid var(--border); }

/* Link back to the Toolerr home page, above the app's title */
.toolerr-bar { flex-basis: 100%; margin-bottom: -4px; }
.toolerr-link {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px 5px 8px;
  font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border: 1px solid var(--border); border-radius: 999px; backdrop-filter: blur(8px);
  transition: color 0.15s, border-color 0.15s;
}
.toolerr-link svg { display: block; flex: none; }
.toolerr-link .chev { transition: transform 0.15s; }
.toolerr-link:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.toolerr-link:hover .chev { transform: translateX(-2px); }
.toolerr-name { font: 800 14px var(--font-display); letter-spacing: -0.01em; color: var(--text); }
.toolerr-sub { padding-left: 7px; border-left: 1px solid var(--border-strong); }

/* ---------- Format bar (shape + quality), above the preview ---------- */
.format-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 14px; margin: -4px 0 14px; }
.aspect-seg label { gap: 8px; padding: 7px 12px; }
.aspect-seg small { font-weight: 500; opacity: 0.7; }
.ar { display: inline-block; width: var(--w); height: var(--h); border: 2px solid currentColor; border-radius: 3px; }
.quality-field select { height: 38px; }

/* ---------- Media: scroll box ---------- */
.media-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.media-toolbar .note { margin: 0; flex: 1; min-width: 200px; }
.segmented.small-seg { padding: 3px; }
.segmented.small-seg label { padding: 4px 10px; font-size: 12px; }
.media-box {
  margin-top: 10px; max-height: min(440px, 55vh); overflow-y: auto; overscroll-behavior: contain;
  padding: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-md);
}
.media-box:has(.media-grid:empty) { display: none; }
.media-box .media-grid { margin-top: 0; }
.media-box.small .media-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.media-box.small .tile-name { font-size: 11px; padding: 4px 6px; }
.media-box.small .tile-badge { display: none; }
.tile { background: var(--surface); }
.tile-edit {
  position: absolute; top: 5px; right: 63px; width: 24px; height: 24px; padding: 0; border-radius: 7px; border: none;
  color: #fff; background: rgba(10, 6, 25, 0.55); box-shadow: none; font-size: 13px;
}
.tile-edit:hover:not(:disabled) { color: #fff; background: var(--accent); }
.media-box.small .tile-edit { right: 59px; }
.tile-edited {
  position: absolute; left: 6px; bottom: 34px; padding: 1px 7px; border-radius: 999px;
  font: 700 10.5px var(--font-ui); color: #fff; background: var(--accent);
}

/* Section headings inside tabs */
.sub-head.first { margin-top: 0; }
.sub-head { display: flex; align-items: center; gap: 10px; }
.reset-link { font: 600 12px var(--font-ui); text-transform: none; letter-spacing: 0; background: none; border: none; box-shadow: none; height: auto; padding: 0; }
.text-field {
  height: 40px; padding: 0 12px; font: inherit; font-size: 14px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
.text-field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.logo-pick { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
code { padding: 1px 6px; border-radius: 6px; background: var(--surface-3); font-size: 0.9em; }

/* ---------- Bulk create ---------- */
.bulk-list {
  max-height: 320px; overflow: auto; margin: 6px 0 10px;
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface);
}
.bulk-list table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.bulk-list th { position: sticky; top: 0; z-index: 1; text-align: left; padding: 8px 12px; font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); }
.bulk-list td { padding: 8px 12px; border-top: 1px solid var(--border); vertical-align: middle; }
.bulk-list td:first-child { font-weight: 600; word-break: break-word; }
.bulk-list .muted { color: var(--muted); }
.bulk-status { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.bulk-status .mini-bar { width: 80px; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bulk-status .mini-bar i { display: block; height: 100%; background: var(--grad); }
.bulk-status.done { color: #16a34a; font-weight: 600; }
.bulk-status.failed { color: var(--error); }
.bulk-options { margin: 12px 0 4px; }

/* ---------- Clip edit dialog ---------- */
.clip-dialog {
  width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0;
  color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-lg);
}
.clip-dialog::backdrop { background: rgba(10, 6, 25, 0.55); backdrop-filter: blur(4px); }
.clip-dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 34px); }
.clip-head { display: flex; align-items: baseline; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.clip-head h3 { margin: 0; font-size: 17px; }
.clip-body { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; padding: 20px; overflow: auto; }
@media (max-width: 680px) { .clip-body { grid-template-columns: 1fr; } }
.clip-preview {
  display: grid; place-items: center; aspect-ratio: 1; overflow: hidden;
  background: #0c0a12; border-radius: 14px;
}
.clip-preview video, .clip-preview img { max-width: 100%; max-height: 100%; transition: transform 0.2s; }
.clip-fields { display: flex; flex-direction: column; gap: 14px; }
.rotate-btns { display: flex; align-items: center; gap: 8px; }
.clip-foot { display: flex; align-items: center; gap: 8px; width: auto; max-width: none; margin: 0; padding: 14px 20px; border-top: 1px solid var(--border); }
.clip-foot .spacer { flex: 1; }
/* Duration label at the bottom of the thumbnail, clear of the buttons */
.tile-badge { top: auto; bottom: 34px; left: auto; right: 6px; transform: none; }

/* Title style cards (Text tab) */
.title-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 14px; }
.title-card { gap: 12px; }
.title-card .text-field { width: 100%; font-weight: 600; }
.title-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; align-items: end; }
.title-row.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.title-row .color-field input { width: 100%; }

/* Text tab: Titles and Watermark as click-to-open sections */
.text-option {
  margin-top: 14px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-md);
}
.text-option > summary { width: 100%; padding: 14px 16px; gap: 10px; }
.text-option > summary .option-name { flex: 1; }
.option-status {
  padding: 2px 10px; border-radius: 999px; font: 600 12px var(--font-ui);
  color: var(--muted); background: var(--surface-3);
}
.option-status.on { color: var(--accent); background: var(--accent-soft); }
.text-option .option-body { padding: 0 16px 16px; }
.text-option .option-body > .note:first-child { margin-top: 0; }
.text-option .title-card { background: var(--surface); }

/* Back to top (same as the Toolerr site pages) */
.to-top {
  position: fixed; right: 24px; bottom: 24px; z-index: 60;
  display: grid; place-items: center; width: 46px; height: 46px; padding: 0; border: none; border-radius: 14px;
  color: #fff; background: var(--grad); box-shadow: 0 12px 26px -10px rgba(106, 70, 245, 0.75);
  opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
}
.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { transform: translateY(-2px); }
@media (max-width: 600px) { .to-top { right: 16px; bottom: 16px; width: 42px; height: 42px; } }

/* Audio tab: the audio file drop box and its Remove button */
.music-pick { display: flex; align-items: center; gap: 10px 12px; margin-bottom: 10px; }
.music-pick .drop { flex: 1; min-width: 0; }

/* Bulk create: per-video titles */
.bulk-list td select { width: 100%; min-width: 150px; height: 32px; font-size: 13px; }
.bulk-title {
  max-width: 100%; height: auto; min-height: 32px; padding: 4px 10px; justify-content: flex-start; text-align: left;
  font-size: 13px; font-weight: 600; white-space: normal; box-shadow: none;
}
.bulk-title .muted { font-weight: 500; }
.bulk-edited { margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 700; color: var(--accent); background: var(--accent-soft); }
.title-dialog { width: min(1100px, calc(100vw - 32px)); }
.title-dialog-body { display: grid; grid-template-columns: minmax(200px, 340px) 1fr; gap: 20px; padding: 20px; overflow: auto; }
@media (max-width: 760px) { .title-dialog-body { grid-template-columns: 1fr; } }
.title-preview { position: sticky; top: 0; align-self: start; }
.title-preview canvas { display: block; width: 100%; max-height: 60vh; object-fit: contain; border-radius: 14px; background: #0f0c18; }
.title-preview .note { margin: 8px 0 0; }
.title-dialog .title-cards { grid-template-columns: 1fr; }

/* One "Add" button (files or a folder) in a drop area: Media and Bulk create */
.add-drop {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 12px; padding: 14px 16px;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-md); background: var(--surface-2);
  transition: border-color 0.15s, background-color 0.15s;
}
.add-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.add-drop .note { margin: 0; }
.add-drop #bulkClear { margin-left: auto; }
.add-menu { position: relative; }
.add-menu-btn { gap: 8px; }
.add-menu-btn .add-chev { transition: transform 0.15s; }
.add-menu-btn[aria-expanded="true"] .add-chev { transform: rotate(180deg); }
.add-menu-list {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 200px; padding: 6px; text-align: left;
  color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
}
.empty-hint .add-menu-list { left: 50%; transform: translateX(-50%); }
.add-menu-list label {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  font-size: 14px; font-weight: 500; cursor: pointer;
}
.add-menu-list label:hover, .add-menu-list label:focus-within { background: var(--accent-soft); color: var(--accent); }

/* Audio and text files added with the clips: where they went */
.empty-hint .empty-sub { margin: -4px 0 14px; font-size: 13px; color: rgba(255, 255, 255, 0.7); font-weight: 500; }
.assigned { padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--text); }
.assigned button.link { padding: 0; height: auto; border: none; background: none; box-shadow: none; color: var(--accent); font: inherit; font-weight: 600; text-decoration: underline; }

/* Audio tab: trimmer */
.audio-trim { margin: 14px 0 6px; padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-md); }
.trim-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 14px; margin-bottom: 10px; }
.trim-head .sub-head { margin: 0; }
.trim-head .note { margin: 0; font-variant-numeric: tabular-nums; }
.trim-canvas { display: block; width: 100%; height: 110px; border-radius: 10px; background: var(--surface); cursor: pointer; touch-action: none; }
.trim-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 10px; }
.trim-controls .spacer { flex: 1; }
.trim-field { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.trim-field .t-time { width: 88px; }
.audio-trim > .note { margin: 10px 0 0; }
#trimReset { margin-top: 8px; }
