/* Audio Visualizer Studio — premium workstation theme.
 * UI chrome uses stable --color-* tokens. Visualization colors live in JS
 * visual state (S.visual) and never drive UI text contrast.
 * Legacy --accent/--accent2/--bg* aliases map onto stable tokens.
 */
:root {
  --color-bg: #090B10;
  --color-surface: #10141C;
  --color-surface-elevated: #171D28;
  --color-control: #202938;
  --color-control-hover: #28324A;
  --color-text: #F4F6FB;
  --color-text-secondary: #A0AABC;
  --color-text-muted: #7C879A;
  --color-border: #2A3343;
  --color-border-soft: #1C2330;
  --color-border-strong: #3D4A61;
  --color-accent: #8B7CFF;
  --color-accent-hover: #A79DFF;
  --color-accent-ink: #0E0B26;
  --color-success: #4ADE80;
  --color-warning: #FBBF24;
  --color-danger: #FB7185;
  --color-info: #50D6C7;
  --viz-spectrum-start: #8B7CFF;
  --viz-spectrum-end: #50D6C7;

  --bg0: var(--color-bg);
  --bg1: var(--color-surface);
  --bg2: var(--color-control);
  --panel: var(--color-surface);
  --border: var(--color-border);
  --border-soft: var(--color-border-soft);
  --text: var(--color-text);
  --muted: var(--color-text-secondary);
  --faint: var(--color-text-muted);
  --accent: var(--color-accent);
  --accent2: var(--color-info);
  --violet: #8B7CFF;
  --danger: var(--color-danger);
  --warn: var(--color-warning);
  --ok: var(--color-success);
  --radius: 12px;
  --radius-s: 8px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
  --topbar-h: 60px;
}
[data-theme="light"] {
  --color-bg: #F2F4F8;
  --color-surface: #FFFFFF;
  --color-surface-elevated: #EBEFF5;
  --color-control: #E7ECF3;
  --color-control-hover: #D9E1ED;
  --color-text: #131B2C;
  --color-text-secondary: #46536B;
  --color-text-muted: #5D6B82;
  --color-border: #D3DBE7;
  --color-border-soft: #E4E9F1;
  --color-border-strong: #A9B6CB;
  --color-accent: #4F46E5;
  --color-accent-hover: #4338CA;
  --color-accent-ink: #FFFFFF;
  --color-success: #15803D;
  --color-warning: #92400E;
  --color-danger: #BE123C;
  --color-info: #0E7490;
  --shadow: 0 10px 28px rgba(19, 27, 44, 0.12);
}
[data-theme="light"] body { background: var(--color-bg); }
[data-theme="light"] .topbar { background: rgba(255, 255, 255, 0.96); }
[data-theme="light"] .hud .tag { background: rgba(255, 255, 255, 0.9); }
[data-theme="light"] .stage { background: #000; }

.skip-link {
  position: absolute; left: 12px; top: -52px; z-index: 200;
  background: var(--color-accent); color: var(--color-accent-ink); font-weight: 700;
  padding: 9px 15px; border-radius: 0 0 10px 10px; text-decoration: none;
  transition: top 0.15s;
}
.skip-link:focus { top: 0; }
.meters, .time, .mono, .pill, output, .tl-row .hint, #abLabel {
  font-variant-numeric: tabular-nums;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(1100px 480px at 75% -8%, rgba(139, 124, 255, 0.09), transparent 60%);
}
[data-theme="light"] body::before { background: radial-gradient(1100px 480px at 75% -8%, rgba(79, 70, 229, 0.08), transparent 60%); }
button, input, select { font: inherit; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; border-radius: 6px; }
kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: var(--bg1); }

.app { min-height: 100vh; display: flex; flex-direction: column; position: relative; z-index: 1; }

/* ── Top bar ─────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 12px;
  min-height: var(--topbar-h); padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(16, 20, 28, 0.92);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 40;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 32px; height: 32px; flex: none; }
.brand-mark img { display: block; width: 32px; height: 32px; border-radius: 9px; }
.brand-text h1 { font-size: 14px; margin: 0; letter-spacing: 0.01em; font-weight: 700; line-height: 1.2; }
.brand-text small { display: block; color: var(--muted); font-size: 11px; line-height: 1.3; }
.status-cluster { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 11px; background: var(--bg1);
  font-family: var(--mono); white-space: nowrap;
}
.pill strong { color: var(--text); font-weight: 700; letter-spacing: 0.04em; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.live { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.rec { background: var(--danger); box-shadow: 0 0 8px var(--danger); animation: blink 1s infinite; }
.dot.err { background: var(--danger); }
@keyframes blink { 50% { opacity: 0.35; } }
.topbar .spacer { flex: 1; }
.top-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.vdiv { width: 1px; height: 22px; background: var(--border); margin: 0 3px; flex: none; }
.seg { display: flex; background: var(--bg1); border: 1px solid var(--border); border-radius: 10px; padding: 2px; gap: 2px; }
.seg-btn { border: 0; background: transparent; border-radius: 8px; }
.seg-btn[aria-pressed="true"] { background: var(--color-control); color: var(--text); box-shadow: 0 0 0 1px var(--color-accent) inset; }

.btn {
  appearance: none; border: 1px solid var(--border); background: var(--color-control);
  color: var(--text); border-radius: var(--radius-s);
  padding: 8px 13px; cursor: pointer; font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  min-height: 38px; line-height: 1.2;
}
.btn svg { flex: none; }
.btn:hover { border-color: var(--color-border-strong); background: var(--color-control-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-accent-ink); }
.btn.primary:hover { background: var(--color-accent-hover); border-color: var(--color-accent-hover); filter: none; }
.btn.danger { border-color: color-mix(in srgb, var(--color-danger) 55%, transparent); }
.btn.danger:hover { border-color: var(--color-danger); }
.btn.danger.armed, .rec-btn[aria-pressed="true"] { border-color: var(--danger); color: #fff; background: color-mix(in srgb, var(--color-danger) 22%, var(--color-control)); }
.rec-btn svg { color: var(--danger); }
.btn.ghost, .btn.icon { background: transparent; }
.btn.icon { border-color: transparent; color: var(--text); }
.btn.icon:hover { background: var(--color-control); border-color: var(--border); }
.btn.icon:disabled { background: transparent; }
.btn.small { min-height: 32px; padding: 5px 10px; font-size: 12.5px; }
.btn.toggle[aria-pressed="true"] { border-color: var(--color-accent); background: color-mix(in srgb, var(--color-accent) 16%, transparent); color: var(--text); box-shadow: 0 0 0 1px var(--color-accent) inset; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.save-row { display: flex; gap: 8px; }
.save-row input { flex: 1; min-width: 0; }

/* ── Workspace ───────────────────────────── */
.workspace {
  display: grid; gap: 14px; padding: 14px 18px;
  grid-template-columns: minmax(0, 1fr) 348px;
  align-items: start; max-width: 1560px; width: 100%; margin: 0 auto;
  flex: 1;
}
.stage-col { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.card {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel); box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.card-head h2 { font-size: 12px; letter-spacing: 0.09em; margin: 0; color: var(--muted); text-transform: uppercase; }

.stage {
  position: relative; border: 1px solid var(--border); border-radius: 16px;
  overflow: hidden; background: #000; box-shadow: var(--shadow);
  aspect-ratio: 16 / 9;
}
.stage[data-ar="9:16"] { aspect-ratio: 9 / 16; max-height: 76vh; margin: 0 auto; width: min(100%, 54vh); }
.stage[data-ar="1:1"] { aspect-ratio: 1 / 1; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage .hud { position: absolute; top: 12px; left: 12px; display: flex; gap: 8px; font-family: var(--mono); font-size: 11.5px; }
.hud .tag { background: rgba(9, 11, 16, 0.78); border: 1px solid var(--border); padding: 4px 10px; border-radius: 999px; color: var(--muted); }
.hud .tag b { color: var(--text); font-weight: 600; }
.empty {
  position: absolute; inset: 0; display: grid; place-items: center;
  text-align: center; padding: 28px;
  background: radial-gradient(640px 320px at 50% 42%, rgba(139, 124, 255, 0.12), transparent 70%);
}
.empty.hidden { display: none; }
.empty-card { max-width: 440px; background: rgba(16, 20, 28, 0.72); border: 1px solid var(--border); border-radius: 14px; padding: 22px 24px; backdrop-filter: blur(6px); }
[data-theme="light"] .empty-card { background: rgba(255,255,255,0.9); }
.eyebrow { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--color-info); margin: 0 0 4px; font-weight: 700; }
.empty-card h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: -0.01em; }
.empty-card p { margin: 0 0 14px; color: var(--muted); font-size: 13.5px; }
.empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
.empty-actions .btn { min-height: 42px; padding: 10px 18px; }
.drop-hint {
  position: absolute; inset: 0; display: none; place-items: center;
  background: color-mix(in srgb, var(--color-accent) 10%, transparent);
  border: 2px dashed var(--color-accent);
  border-radius: 16px; font-weight: 700; z-index: 5; font-size: 16px;
}
.stage.dragover .drop-hint { display: grid; }

/* transport */
.transport { padding: 12px 14px; display: grid; gap: 10px; }
.transport-main { display: flex; align-items: center; gap: 14px; }
.t-buttons { display: flex; gap: 8px; align-items: center; }
.track-title { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.track-title span { color: var(--faint); font-weight: 400; }
.t-meta { flex: 1; min-width: 0; }
.t-sub { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.time { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.t-toggles { display: flex; gap: 6px; flex-wrap: wrap; }
.seek-wrap { display: block; }
input[type="range"].seek { width: 100%; accent-color: var(--color-accent); min-height: 28px; }
.transport select { background: var(--color-control); color: var(--text); border: 1px solid var(--border); border-radius: 7px; padding: 7px 9px; max-width: 220px; }
.transport-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.icon-btn {
  border: 1px solid var(--border); background: var(--color-control); color: var(--text);
  width: 40px; height: 40px; border-radius: 11px; cursor: pointer; font-size: 15px;
  display: inline-grid; place-items: center; flex: none;
}
.icon-btn:hover { border-color: var(--color-border-strong); background: var(--color-control-hover); }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.icon-btn.play { width: 50px; height: 50px; border-radius: 14px; background: var(--color-accent); border-color: var(--color-accent); color: var(--color-accent-ink); }
.icon-btn.play:hover { background: var(--color-accent-hover); }
.icon-btn[aria-pressed="true"] { border-color: var(--color-accent); box-shadow: 0 0 0 1px var(--color-accent) inset; }
.vol { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; margin-left: auto; }
.vol input { width: 110px; accent-color: var(--color-accent); }
.meters { display: flex; gap: 14px; flex-wrap: wrap; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.meters.inline { font-size: 11.5px; }
.meters b { color: var(--text); font-weight: 700; }
.bandbar { display: inline-flex; align-items: center; gap: 7px; }
.bandbar i { display: inline-block; width: 56px; height: 7px; border-radius: 4px; background: var(--color-control); overflow: hidden; position: relative; border: 1px solid var(--border-soft); }
.bandbar i::after { content: ""; position: absolute; inset: 0; width: var(--v, 0%); background: linear-gradient(90deg, var(--color-accent), var(--color-info)); border-radius: 4px; }

/* ── Side panel ──────────────────────────── */
.panel { overflow: hidden; position: sticky; top: calc(var(--topbar-h) + 14px); max-height: calc(100vh - var(--topbar-h) - 28px); display: flex; flex-direction: column; }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.tabs { display: flex; gap: 4px; background: var(--bg1); border: 1px solid var(--border); border-radius: 10px; padding: 3px; flex: 1; }
.tab { flex: 1; border: 0; background: transparent; color: var(--muted); font-weight: 700; font-size: 12.5px; border-radius: 7px; padding: 7px 4px; cursor: pointer; min-height: 34px; }
.tab[aria-selected="true"] { background: var(--color-control); color: var(--text); box-shadow: 0 0 0 1px var(--color-accent) inset; }
.panel-body { overflow: auto; padding: 4px 14px 16px; }
.panel-body.tab-visual [data-group]:not([data-group="visual"]) { display: none; }
.panel-body.tab-audio [data-group]:not([data-group="audio"]) { display: none; }
.panel-body.tab-create [data-group]:not([data-group="create"]) { display: none; }
details.group { border-bottom: 1px solid var(--border-soft); padding: 4px 0 10px; }
details.group:last-child { border-bottom: 0; }
details.group summary {
  cursor: pointer; font-weight: 700; font-size: 13.5px; padding: 10px 2px;
  list-style: none; display: flex; align-items: center; gap: 8px;
}
details.group summary::-webkit-details-marker { display: none; }
details.group summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint); transform: rotate(-45deg); flex: none; transition: transform 0.15s; }
details.group[open] summary::before { transform: rotate(45deg); }
.grp-hint { font-weight: 400; font-size: 11.5px; color: var(--faint); margin-left: auto; }
.field { margin: 10px 0; }
.field label, .field .lbl { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.field label output, .field .lbl output { font-family: var(--mono); color: var(--text); }
.hint-inline { font-weight: 400; color: var(--faint); font-size: 11.5px; }
.field input[type="range"] { width: 100%; accent-color: var(--color-accent); min-height: 28px; }
.field select, .field input[type="text"], .field input[type="number"] {
  width: 100%; background: var(--color-control); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 10px; min-height: 38px;
}
.field input[type="file"] { width: 100%; font-size: 12.5px; color: var(--muted); }
.prev { margin-top: 8px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check-field { display: flex; align-items: end; }
.check { display: flex; align-items: center; gap: 9px; font-size: 13px; margin: 10px 0; cursor: pointer; min-height: 28px; }
.check input { accent-color: var(--color-accent); width: 17px; height: 17px; flex: none; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--color-border-strong); cursor: pointer; padding: 0; min-height: 30px; }
.swatch[aria-pressed="true"] { outline: 2px solid var(--color-text); outline-offset: 2px; }
.swatch:hover { transform: translateY(-1px); }
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-btn {
  border: 1px solid var(--border); background: var(--color-control); color: var(--text);
  border-radius: 10px; padding: 10px; cursor: pointer; text-align: left; font-size: 12.5px; font-weight: 650; min-height: 56px;
}
.mode-btn small { display: block; color: var(--faint); font-family: var(--mono); font-size: 10.5px; font-weight: 400; margin-top: 2px; }
.mode-btn:hover { border-color: var(--color-border-strong); }
.mode-btn[aria-pressed="true"] { border-color: var(--color-accent); background: color-mix(in srgb, var(--color-accent) 14%, var(--color-control)); box-shadow: 0 0 0 1px var(--color-accent) inset; }
.mode-btn[aria-pressed="true"] small { color: var(--muted); }
.preset { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border: 1px solid var(--border-soft); border-radius: 10px; margin: 6px 0; background: var(--bg1); }
.preset .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.preset .nm button { background: none; border: 0; color: var(--text); cursor: pointer; padding: 4px 2px; font-size: 13px; font-weight: 600; text-align: left; }
.preset .nm button:hover { color: var(--color-accent-hover); }
.preset-dot { width: 14px; height: 14px; border-radius: 50%; flex: none; border: 1px solid rgba(255,255,255,0.25); }
.hint { font-size: 12.5px; color: var(--faint); }
.error-text { color: var(--color-danger); font-size: 12.5px; }
.note { font-size: 12.5px; color: var(--muted); background: var(--bg1); border: 1px solid var(--border-soft); border-radius: 9px; padding: 9px 11px; }
.a11y-wrap { margin-top: 8px; }
.a11y-box { font-size: 13px; color: var(--text); background: var(--bg1); border: 1px solid var(--border-soft); border-radius: 9px; padding: 9px 11px; min-height: 54px; }

/* toasts */
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; width: min(500px, calc(100vw - 32px)); }
.toast { background: var(--color-surface-elevated); color: var(--text); border: 1px solid var(--border); border-left: 3px solid var(--color-info); border-radius: 10px; padding: 10px 13px; font-size: 13px; box-shadow: var(--shadow); }
.toast.err { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--ok); }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,0.62); display: none; place-items: center; z-index: 90; padding: 16px; }
.modal-back.open { display: grid; }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; max-width: 540px; width: 100%; padding: 18px; max-height: 82vh; overflow: auto; box-shadow: var(--shadow); }
.modal h2 { margin: 0 0 8px; font-size: 17px; }
.modal table { width: 100%; border-collapse: collapse; font-size: 13px; }
.modal td { border-top: 1px solid var(--border-soft); padding: 7px 4px; color: var(--muted); }
.modal td:first-child { font-family: var(--mono); color: var(--text); white-space: nowrap; width: 150px; }

/* footer */
.footer { padding: 12px 18px 24px; color: var(--faint); font-size: 11.5px; text-align: center; font-family: var(--mono); }

/* ── Timeline ──────────────────────────────── */
.timeline { padding: 12px 14px; display: grid; gap: 9px; }
#waveCanvas { width: 100%; height: 124px; display: block; border-radius: 10px; background: #000; border: 1px solid var(--border-soft); cursor: crosshair; touch-action: none; }
.tl-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ── Playlist / markers / notes ──────────────── */
.prow, .mrow, .nrow, .srow {
  display: flex; align-items: center; gap: 6px; padding: 7px 9px;
  border: 1px solid var(--border-soft); border-radius: 10px; margin: 6px 0; background: var(--bg1);
  font-size: 12.5px;
}
.prow .nm, .mrow .nm, .nrow .nm, .srow .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .art { width: 30px; height: 30px; border-radius: 7px; object-fit: cover; background: var(--color-control); flex: none; }
.prow[aria-current="true"] { border-color: var(--color-accent); box-shadow: 0 0 0 1px var(--color-accent) inset; }
.prow .meta { display: block; color: var(--faint); font-size: 11px; font-family: var(--mono); }
.mono { font-family: var(--mono); font-size: 12.5px; color: var(--text); }
#clipInd { font-weight: 700; border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; }
#clipInd.clipped { color: var(--danger); border-color: var(--danger); }

/* ── Analysis canvases / tuner ───────────────── */
#logSpec { width: 100%; height: 150px; display: block; border-radius: 10px; background: #000; border: 1px solid var(--border-soft); touch-action: none; }
#spectroCanvas { width: 100%; height: 92px; display: block; border-radius: 10px; background: #000; border: 1px solid var(--border-soft); }
.tunebar { position: relative; height: 12px; border-radius: 6px; background: var(--color-control); border: 1px solid var(--border-soft); overflow: hidden; margin-top: 8px; }
.tunebar::after { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: var(--faint); }
#tuneNeedle { position: absolute; top: 0; bottom: 0; width: 4px; left: 50%; background: var(--color-accent); border-radius: 2px; }
#metroFlash.live { background: var(--color-accent); }

/* ── Listen / musician modes ─────────────────── */
body[data-mode="listen"] .musician-only { display: none; }

/* ── About / FAQ (SEO content, below workspace) ── */
.about { max-width: 1560px; width: calc(100% - 36px); margin: 2px auto 0; padding: 20px 22px; }
.about-head { display: flex; gap: 14px; align-items: flex-start; }
.about-head img { flex: none; border-radius: 10px; margin-top: 2px; }
.about h2 { font-size: 17px; margin: 0 0 8px; letter-spacing: -0.01em; }
.about-lede { color: var(--muted); font-size: 13.5px; margin: 0; max-width: 90ch; }
.about-lede strong { color: var(--text); font-weight: 650; }
.about-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 14px; }
.about-grid h3 { font-size: 13px; margin: 0 0 4px; }
.about-grid p { font-size: 12.5px; color: var(--muted); margin: 0; }
.faq-title { margin-top: 18px; }
.faq { display: grid; gap: 8px; margin-top: 8px; }
.faq details { border: 1px solid var(--border-soft); border-radius: 10px; background: var(--bg1); padding: 4px 12px; }
.faq summary { cursor: pointer; font-weight: 650; font-size: 13.5px; padding: 10px 0; }
.faq p { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
.footer { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.footer-credit { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; color: var(--muted); }
.footer-credit img { border-radius: 4px; }
.footer a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }
.footer a:hover { color: var(--color-accent-hover); }
.footer-legal, .footer-tech { text-align: center; }
.footer-links { display: inline-flex; gap: 6px; }
.social-btn {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  color: var(--muted); border: 1px solid transparent;
}
.social-btn:hover { color: var(--text); background: var(--color-control); border-color: var(--border); }
@media (max-width: 980px) {
  .about-grid { grid-template-columns: 1fr 1fr; }
  .about { width: calc(100% - 24px); }
}
@media (max-width: 640px) {
  .about-grid { grid-template-columns: 1fr; }
  .about { padding: 16px; }
}

/* ── Legal pages ─────────────────────────────── */
.legal { max-width: 860px; width: calc(100% - 36px); margin: 14px auto; padding: 22px 24px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
.legal h1 { font-size: 24px; margin: 0 0 6px; letter-spacing: -0.01em; }
.legal h2 { font-size: 15px; margin: 18px 0 6px; }
.legal p, .legal li { font-size: 13.5px; color: var(--muted); }
.legal p strong, .legal li strong { color: var(--text); }
.legal a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }
.legal ul { padding-left: 20px; display: grid; gap: 6px; }
@media (max-width: 640px) { .legal { width: calc(100% - 20px); padding: 16px; } }

/* drawer toggle (mobile) */
.drawer-fab { display: none; }

/* responsive */
@media (max-width: 1100px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 310px; padding: 12px; }
}
@media (max-width: 980px) {
  .workspace { grid-template-columns: 1fr; }
  .panel { position: fixed; inset: auto 0 0 0; max-height: 74vh; z-index: 60; border-radius: 16px 16px 0 0; transform: translateY(102%); transition: transform 0.22s ease; }
  body.drawer-open .panel { transform: none; }
  .drawer-fab { display: inline-flex; position: fixed; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 61; min-height: 46px; }
  .stage[data-ar="9:16"] { width: min(100%, 46vh); }
  .topbar { gap: 8px; }
  .transport-main { flex-wrap: wrap; }
  .t-toggles { width: 100%; }
  .vol { margin-left: 0; }
}
@media (max-width: 640px) {
  body { font-size: 13.5px; }
  .workspace { padding: 10px; gap: 10px; }
  .stage { min-height: 300px; aspect-ratio: 4 / 3; }
  .empty { padding: 12px; overflow: auto; }
  .empty-card { padding: 16px; max-width: 100%; width: 100%; }
  .transport-main, .t-meta { min-width: 0; overflow: hidden; }
  .t-sub { min-width: 0; }
  html, body { overflow-x: hidden; }
  .empty-card h2 { font-size: 17px; }
  .empty-actions .btn { flex: 1; min-width: 140px; }
  .stage .hud { top: 8px; left: 8px; right: 8px; flex-wrap: wrap; }
  .status-cluster { min-width: 0; }
  .status-pill { max-width: 60vw; overflow: hidden; text-overflow: ellipsis; }
  .topbar { padding: 8px 10px; }
  .brand-text small { display: none; }
  .pill.source-pill { display: none; }
  .top-actions .btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .top-actions .btn { min-width: 38px; padding: 5px 8px; }
  .seg-btn span, .top-actions .seg-btn { position: static; width: auto; height: auto; clip: auto; }
  .seg { flex: 1; }
  .seg-btn { flex: 1; }
  .icon-btn { width: 44px; height: 44px; }
  .icon-btn.play { width: 56px; height: 56px; }
  .field-row { grid-template-columns: 1fr; }
  .mode-grid { grid-template-columns: 1fr 1fr; }
  #waveCanvas { height: 100px; }
  .transport select { max-width: 100%; flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
