/* fx-lab.css: FX Lab page (2026-11-17). LYRC tokens (cutflux-tokens.css) on the dark theme; glass bar + buttons
 * from cutflux-glass.css. Flat colours on every control (no gradients); one blue accent. The effect layers inside the
 * stage come from beat-timeline-features.css, the same rules the beat timeline preview uses. */

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--cf-canvas, #000); color: var(--cf-text, #fff); color-scheme: dark; }
body { font-family: var(--cf-font, Inter, -apple-system, 'Segoe UI', sans-serif); font-size: var(--cf-fs-base, 13px); min-height: 100vh; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; }
.fxl-hidden { display: none !important; }

/* ---- top bar (glass) ---- */
.fxl-bar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  background: rgba(10, 10, 13, .72);
  -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: inset 0 -.5px 0 var(--gl-rim, rgba(255,255,255,.22));
}
.fxl-back { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: var(--cf-text-2); text-decoration: none; }
.fxl-back:hover { color: var(--cf-text); background: var(--gl-fill, rgba(255,255,255,.08)); }
.fxl-title { font-size: var(--cf-fs-lg, 16px); font-weight: 700; letter-spacing: -.01em; margin: 0; white-space: nowrap; }
.fxl-spacer { flex: 1; }
.fxl-bar .cf-glass-btn { min-height: 40px; padding: 0 14px; font-size: var(--cf-fs-md, 14px); font-weight: 600; border: 0; cursor: pointer; gap: 6px; display: inline-flex; align-items: center; }
.fxl-bar .cf-glass-btn svg { width: 16px; height: 16px; flex: none; }
.cf-glass-btn[disabled] { opacity: .4; cursor: not-allowed; }
.fxl-btn-label { white-space: nowrap; }

/* ---- layout ---- */
.fxl-main { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr); gap: 20px; max-width: 1360px; margin: 0 auto; padding: 16px 20px 40px; align-items: start; }
.fxl-left { display: flex; flex-direction: column; gap: 12px; min-width: 0; position: sticky; top: 72px; }
.fxl-right { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
@media (max-width: 899px) {
  .fxl-main { grid-template-columns: minmax(0, 1fr); padding: 10px 16px 32px; gap: 12px; }
  .fxl-left { position: static; }
  .fxl-bar { padding: 8px 12px; }
  .fxl-bar .cf-glass-btn { padding: 0 11px; }
  .fxl-btn-label--opt { display: none; }
}

/* ---- stage ---- */
.fxl-stage-wrap { position: relative; display: flex; justify-content: center; align-items: center; background: var(--cf-panel, #0D0E13); border-radius: var(--cf-r-panel, 12px); min-height: 280px; padding: 0; overflow: hidden; }
.fxl-stage {
  position: relative; overflow: hidden; background: #000;
  width: 100%; aspect-ratio: 16 / 9; max-height: 64vh;
}
@media (max-width: 899px) { .fxl-stage { max-height: 52vh; } }
.fxl-stage .sb-bt-vlayer { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; z-index: 1; background: transparent; }
.fxl-base { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; z-index: 0; display: none; }
.fxl-stage.fxl-mixing .fxl-base { display: block; }
.fxl-stage.fxl-mixing .sb-bt-vlayer { opacity: var(--fxl-mix, 1); }
.fxl-stage.fxl-mixing .sb-bt-look-canvas { opacity: var(--fxl-mix, 1); }
/* the effect layer levels (intensity) and a beat-true flash / zoom, so the preview matches the export */
.fxl-stage.sb-bt-preview .sb-bt-fx-sub--scanlines { filter: opacity(var(--lv-scan, 1)); }
.fxl-stage.sb-bt-preview .sb-bt-fx-sub--vignette { filter: opacity(var(--lv-vig, 1)); }
.fxl-stage.sb-bt-preview .sb-bt-fx-sub--film-grain { filter: opacity(var(--lv-grain, 1)); }
.fxl-stage.sb-bt-preview.fx-beat-flash .sb-bt-fx-sub--beat-flash { animation: none; opacity: var(--fxl-flash, 0); }
.fxl-stage.sb-bt-preview.fx-zoom-pulse .sb-bt-vlayer,
.fxl-stage.sb-bt-preview.fx-zoom-pulse .fxl-base { animation: none; transform: scale(var(--fxl-zoom, 1)); transform-origin: center; }
.fxl-stage .sb-bt-fx-cctv-hud { font-size: 11px; }

/* empty state: the drop zone fills the stage */
.fxl-drop {
  position: absolute; inset: 0; z-index: 60;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: var(--cf-panel, #0D0E13); border: 1.5px dashed var(--cf-border-strong, #3A3D4A); border-radius: var(--cf-r-panel, 12px);
  cursor: pointer; text-align: center; padding: 20px;
}
.fxl-drop.is-over { border-color: var(--cf-accent, #3B82F6); background: var(--cf-accent-soft, rgba(59,130,246,.14)); }
.fxl-drop-ico { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--gl-fill, rgba(255,255,255,.08)); color: var(--cf-text); }
.fxl-drop-ico svg { width: 26px; height: 26px; }
.fxl-drop-big { font-size: var(--cf-fs-xl, 20px); font-weight: 700; margin: 0; }
.fxl-drop .cf-glass-btn { min-height: 44px; padding: 0 22px; border: 0; cursor: pointer; font-weight: 600; font-size: var(--cf-fs-md, 14px); }
.fxl-stage-wrap.has-video .fxl-drop { display: none; }
.fxl-stage-wrap.has-video { background: #000; min-height: 0; }

/* busy veil */
.fxl-busy { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; z-index: 70; overflow: hidden; display: none; }
.fxl-busy.is-on { display: block; }
.fxl-busy::after { content: ""; position: absolute; top: 0; bottom: 0; width: 30%; background: var(--cf-accent, #3B82F6); animation: fxlBusy 1.1s ease-in-out infinite; }
@keyframes fxlBusy { 0% { left: -30%; } 100% { left: 100%; } }

/* ---- transport + tracks ---- */
.fxl-transport { display: flex; align-items: center; gap: 10px; }
.fxl-play { width: 44px; height: 44px; flex: none; border-radius: 14px; border: 0; cursor: pointer; display: grid; place-items: center; }
.fxl-play svg { width: 18px; height: 18px; }
.fxl-time { font-family: var(--cf-mono, monospace); font-size: var(--cf-fs-sm, 12px); color: var(--cf-text-2); min-width: 86px; text-align: right; white-space: nowrap; }
.fxl-track { position: relative; flex: 1; min-width: 0; height: 44px; cursor: pointer; touch-action: none; }
.fxl-lanes { position: absolute; left: 0; right: 0; top: 2px; height: 26px; }
.fxl-lane-bar { position: absolute; height: 5px; border-radius: 3px; background: var(--cf-text-4, rgba(255,255,255,.3)); cursor: pointer; }
.fxl-lane-bar.is-sel { background: var(--cf-accent, #3B82F6); height: 6px; }
.fxl-lane-tx { position: absolute; top: 0; width: 3px; height: 26px; margin-left: -1px; border-radius: 2px; background: #e53935; cursor: pointer; }
.fxl-lane-tx.is-sel { background: var(--cf-accent, #3B82F6); }
.fxl-rail { position: absolute; left: 0; right: 0; bottom: 8px; height: 6px; border-radius: 3px; background: var(--cf-raised, #1C1E26); }
.fxl-rail-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--cf-text-3, rgba(255,255,255,.5)); width: 0; }
.fxl-head { position: absolute; bottom: 2px; width: 3px; height: 40px; margin-left: -1.5px; border-radius: 2px; background: var(--cf-text, #fff); pointer-events: none; left: 0; }
.fxl-beats { position: absolute; left: 0; right: 0; bottom: 8px; height: 6px; pointer-events: none; }
.fxl-beat { position: absolute; top: 1px; width: 2px; height: 4px; margin-left: -1px; background: rgba(255,255,255,.35); border-radius: 1px; }

/* ---- applied stack ---- */
.fxl-stack { display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain; padding: 2px 0 4px; scrollbar-width: none; min-height: 40px; align-items: center; }
.fxl-stack::-webkit-scrollbar { display: none; }
.fxl-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border: 0; border-radius: 999px; cursor: pointer; font-size: var(--cf-fs-sm, 12px); font-weight: 600; white-space: nowrap; }
.fxl-chip small { font-weight: 500; color: var(--cf-text-3); font-family: var(--cf-mono, monospace); font-size: 11px; }
.fxl-chip[aria-pressed="true"] small { color: rgba(255,255,255,.8); }
.fxl-empty-note { color: var(--cf-text-3); font-size: var(--cf-fs-sm, 12px); }

/* ---- selected item editor ---- */
.fxl-editor { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 12px; border-radius: var(--cf-r-panel, 12px); background: var(--cf-surface, #15161C); box-shadow: inset 0 0 0 .5px var(--cf-border, #2A2C36); }
.fxl-ed-name { font-weight: 700; font-size: var(--cf-fs-md, 14px); min-width: 0; margin-right: auto; }
.fxl-ed-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fxl-ed-row--level { flex: 1 1 220px; }
.fxl-range { -webkit-appearance: none; appearance: none; flex: 1; min-width: 120px; height: 28px; background: transparent; cursor: pointer; }
.fxl-range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--cf-raised, #1C1E26); box-shadow: inset 0 0 0 .5px var(--cf-border-strong, #3A3D4A); }
.fxl-range::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; margin-top: -8px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.5); }
.fxl-range::-moz-range-track { height: 4px; border-radius: 2px; background: var(--cf-raised, #1C1E26); }
.fxl-range::-moz-range-thumb { width: 20px; height: 20px; border: 0; border-radius: 50%; background: #fff; }
.fxl-pct { font-family: var(--cf-mono, monospace); font-size: 12px; color: var(--cf-text-2); width: 38px; text-align: right; }
.fxl-seg { display: inline-flex; gap: 2px; }
.fxl-seg button { min-height: 34px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; cursor: pointer; font-size: var(--cf-fs-sm, 12px); font-weight: 600; color: var(--cf-text-2); }
.fxl-seg button[aria-pressed="true"] { background: var(--gl-primary, rgba(46,110,240,.84)); color: #fff; }
.fxl-small-btn { min-height: 34px; padding: 0 12px; border: 0; border-radius: 10px; cursor: pointer; font-size: var(--cf-fs-sm, 12px); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.fxl-small-btn svg { width: 14px; height: 14px; }
.fxl-mono { font-family: var(--cf-mono, monospace); font-size: 12px; color: var(--cf-text-2); white-space: nowrap; }
.fxl-swatch { width: 28px; height: 28px; border-radius: 50%; border: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); }
.fxl-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--cf-accent, #3B82F6), inset 0 0 0 1px rgba(255,255,255,.35); }

/* ---- grid ---- */
.fxl-gridhead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fxl-tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.fxl-tabs::-webkit-scrollbar { display: none; }
.fxl-mode { margin-left: auto; }
.fxl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
@media (max-width: 899px) { .fxl-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; } }
.fxl-tile { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 0; border: 0; background: transparent; cursor: pointer; text-align: left; min-width: 0; }
.fxl-thumb { position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: var(--cf-r-card, 8px); overflow: hidden; background: var(--cf-card, #1A1B22); box-shadow: inset 0 0 0 .5px var(--cf-border, #2A2C36); transition: transform var(--cf-t-fast, 120ms ease-out); }
.fxl-thumb canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.fxl-tile:hover .fxl-thumb { transform: translateY(-1px); }
.fxl-tile:active .fxl-thumb { transform: scale(.97); }
.fxl-tile.is-on .fxl-thumb { box-shadow: 0 0 0 2px var(--cf-accent, #3B82F6); }
.fxl-tile.is-on .fxl-tile-label { color: var(--cf-text); }
.fxl-tile-label { font-size: var(--cf-fs-sm, 12px); font-weight: 600; color: var(--cf-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
.fxl-tile-dot { position: absolute; top: 6px; right: 6px; width: 18px; height: 18px; border-radius: 50%; background: var(--cf-accent, #3B82F6); display: none; place-items: center; z-index: 2; }
.fxl-tile-dot svg { width: 11px; height: 11px; color: #fff; }
.fxl-tile.is-on .fxl-tile-dot { display: grid; }

/* ---- export sheet ---- */
.fxl-sheet-veil { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.6); display: none; align-items: center; justify-content: center; padding: 16px; }
.fxl-sheet-veil.is-open { display: flex; }
.fxl-sheet { width: min(440px, 100%); padding: 18px; border-radius: 18px; display: flex; flex-direction: column; gap: 14px; }
.fxl-sheet h2 { margin: 0; font-size: var(--cf-fs-lg, 16px); }
.fxl-sheet-preview { width: 100%; max-height: 52vh; border-radius: var(--cf-r-card, 8px); background: #000; display: block; object-fit: contain; }
.fxl-progress { height: 6px; border-radius: 3px; background: var(--cf-raised, #1C1E26); overflow: hidden; }
.fxl-progress span { display: block; height: 100%; width: 0; background: var(--cf-accent, #3B82F6); transition: width 200ms linear; }
.fxl-sheet-row { display: flex; gap: 8px; }
.fxl-sheet-row > * { flex: 1; min-height: 44px; border: 0; cursor: pointer; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.fxl-sheet-msg { color: var(--cf-text-2); font-size: var(--cf-fs-sm, 12px); min-height: 16px; margin: 0; }

.fxl-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 120; padding: 10px 16px; border-radius: 12px; background: var(--gl-sheet-solid, #1C1C1E); box-shadow: var(--cf-shadow-lg); font-size: var(--cf-fs-sm, 12px); max-width: calc(100% - 32px); display: none; }
.fxl-toast.is-on { display: block; }
