@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* ── Theme seed variables (overridden per theme) ── */
  --theme-bg-base:       #06040a;
  --theme-blob-1:        rgba(200, 110, 15, 0.50);
  --theme-blob-2:        rgba(155, 85, 10, 0.34);
  --theme-blob-vignette: rgba(80, 35, 5, 0.55);
  --theme-anim-1:        rgba(251, 146, 60, 0.68);
  --theme-anim-2:        rgba(234, 179, 8, 0.52);
  --theme-shadow-hue:    38deg;
  --theme-accent-l:      255 235 150;
  --theme-accent-m:      255 190 80;
  --theme-accent-d:      200 130 30;
  --theme-glass-dark:    30 18 5;
  --theme-solid-a:       var(--theme-solid-a);
  --theme-solid-b:       var(--theme-solid-b);
  --theme-solid-c:       #f59e0b;
  --theme-text-accent:   var(--theme-text-accent);
  --theme-text-export:   var(--theme-text-export);

  /* ── Base palette ── */
  --bg: #0a0b08;
  --bg-2: #12140e;
  --panel: rgba(18, 14, 6, 0.92);
  --panel-soft: rgba(28, 22, 10, 0.72);
  --panel-border: rgba(120, 100, 60, 0.30);
  --text: #f0ead8;
  --muted: #7a6e58;
  --cyan: var(--theme-solid-c);
  --indigo: var(--theme-solid-a);
  --teal: var(--theme-solid-b);
  --danger: #ef4444;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --glass-bg:          rgb(var(--theme-glass-dark) / 0.55);
  --glass-border:      rgb(var(--theme-accent-m) / 0.14);
  --glass-shadow:      0 4px 24px rgba(0, 0, 0, 0.30);
  --liquid-panel:      rgb(var(--theme-accent-m) / 0.12);
  --liquid-panel-deep: rgb(var(--theme-glass-dark) / 0.46);
  --liquid-card:       rgb(var(--theme-accent-m) / 0.11);
  --liquid-card-deep:  rgb(var(--theme-glass-dark) / 0.34);
  --liquid-border:     rgb(var(--theme-accent-m) / 0.30);
  --liquid-border-soft:rgb(var(--theme-accent-m) / 0.18);
  --liquid-highlight:  rgb(var(--theme-accent-l) / 0.54);
  --liquid-glow:       rgb(var(--theme-accent-m) / 0.24);
  --liquid-shadow:     0 10px 28px rgba(20, 10, 2, 0.30);
  --ui-type-xxs: 10px;
  --ui-type-xs: 11px;
  --ui-type-sm: 12px;
  --ui-type-md: 14px;
  --ui-text-primary: #f5f2ea;
  --ui-text-secondary: #e8edf7;
  --ui-text-muted: #bac8de;
  --ui-text-shadow-soft: 0 1px 0 rgba(3, 6, 14, 0.62);
  --ui-text-shadow-strong:
    0 1px 0 rgba(3, 6, 14, 0.72),
    0 0 14px rgb(var(--theme-accent-l) / 0.14);
  --noise-url: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.26'/%3E%3C/svg%3E");
  --transition-fast: 0.12s ease;
  --transition-med: 0.2s ease;
}

body {
  font-family: 'Inter', sans-serif;
  color: var(--text);
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(ellipse 65% 80% at 78% 48%, var(--theme-blob-1), transparent 70%),
    radial-gradient(ellipse 55% 65% at 22% 52%, var(--theme-blob-2), transparent 70%),
    radial-gradient(ellipse 40% 40% at 50% 100%, var(--theme-blob-vignette), transparent 60%),
    var(--theme-bg-base);
}

/* Option 2 — noise grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background-image: var(--noise-url);
  background-repeat: repeat;
  background-size: 180px 180px;
  opacity: 0.045;
  mix-blend-mode: soft-light;
}

/* Option 3 — animated bloom drift via transform (GPU-accelerated, actually works) */
body::after {
  content: "";
  position: fixed;
  inset: -30%;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(ellipse 38% 48% at 62% 46%, var(--theme-anim-1), transparent 70%),
    radial-gradient(ellipse 32% 42% at 24% 54%, var(--theme-anim-2), transparent 70%);
  animation: blob-drift 20s ease-in-out infinite alternate;
  will-change: transform;
}

@keyframes blob-drift {
  from { transform: translate(0,    0); }
  to   { transform: translate(-7%, 6%); }
}

/* ─── Top Header Bar ─── */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 40px;
  min-height: 40px;
  overflow: visible;
  position: relative;
  z-index: 600;
  background:
    linear-gradient(145deg, rgb(var(--theme-accent-l) / 0.14), rgb(var(--theme-glass-dark) / 0.58)),
    var(--noise-url);
  background-size: auto, 180px 180px;
  background-repeat: no-repeat, repeat;
  background-blend-mode: normal, soft-light;
  backdrop-filter: blur(18px) saturate(145%);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
  border-bottom: 1px solid rgb(var(--theme-accent-m) / 0.28);
  box-shadow:
    inset 0 1px 0 rgb(var(--theme-accent-l) / 0.35),
    0 6px 18px rgba(8, 4, 1, 0.22);
}

.app-header-brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.app-header-brand .stage-title {
  font-size: 15px;
  line-height: 1;
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: -0.3px;
}

.app-header-brand .stage-subtitle {
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.app-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-action-btn {
  height: 28px;
  min-width: 76px;
  border-radius: 8px;
  border: 1px solid rgb(var(--theme-accent-m) / 0.30);
  background: linear-gradient(145deg, rgb(var(--theme-accent-l) / 0.18), rgb(var(--theme-glass-dark) / 0.60));
  color: var(--theme-text-accent);
  padding: 0 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.header-action-btn:hover {
  transform: translateY(-1px);
  border-color: rgb(var(--theme-accent-l) / 0.56);
  background: linear-gradient(145deg, rgb(var(--theme-accent-l) / 0.26), rgb(var(--theme-glass-dark) / 0.72));
}

.header-settings {
  position: relative;
}

.settings-menu {
  display: none;
  position: absolute;
  top: 32px;
  right: 0;
  min-width: 170px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid rgb(var(--theme-accent-m) / 0.28);
  background: linear-gradient(150deg, rgb(var(--theme-glass-dark) / 0.75), rgb(var(--theme-accent-m) / 0.10));
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 800;
  gap: 6px;
}

.header-settings.open .settings-menu {
  display: flex;
  flex-direction: column;
}

.settings-item {
  width: 100%;
  text-align: left;
  border: 1px solid rgb(var(--theme-accent-m) / 0.18);
  background: rgb(var(--theme-glass-dark) / 0.55);
  color: var(--ui-text-primary);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.15px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.settings-item:hover {
  border-color: rgb(var(--theme-accent-l) / 0.34);
  background: linear-gradient(145deg, rgb(var(--theme-accent-l) / 0.18), rgb(var(--theme-glass-dark) / 0.65));
}

/* ─── App Shell ─── */

.app-shell {
  height: calc(100% - 40px);
  width: 100%;
  padding: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 8px;
  transition:
    grid-template-columns 0.38s cubic-bezier(0.25, 1, 0.3, 1),
    gap 0.38s cubic-bezier(0.25, 1, 0.3, 1);
}

.stage-side,
.ui {
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--glass-shadow);
}

.stage-side {
  position: relative;
  isolation: isolate;
  min-width: 0;
  padding: 10px;
  overflow: hidden;
  border-color: rgba(208, 224, 255, 0.18);
  background:
    radial-gradient(118% 78% at 12% -14%, rgb(var(--theme-accent-l) / 0.14), transparent 56%),
    radial-gradient(76% 66% at 90% 6%, rgb(var(--theme-accent-m) / 0.10), transparent 64%),
    linear-gradient(165deg, rgb(var(--theme-accent-m) / 0.08) 0%, rgb(var(--theme-glass-dark) / 0.18) 34%, rgb(var(--theme-glass-dark) / 0.38) 100%);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -1px 0 rgba(173, 201, 245, 0.1),
    0 10px 26px rgba(2, 8, 20, 0.28);
}

.stage-side::before,
.stage-side::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.stage-side::before {
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(148deg, rgba(255, 255, 255, 0.18) 0%, transparent 34%),
    linear-gradient(0deg, rgba(3, 8, 18, 0.16), transparent 48%);
}

.stage-side::after {
  width: 56%;
  height: 32%;
  right: 5%;
  top: -16%;
  filter: blur(30px);
  background: radial-gradient(circle, rgba(140, 194, 255, 0.18) 0%, transparent 72%);
}

.stage-side:fullscreen,
.stage-side:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 10px;
  border: none;
  border-radius: 0;
  background: #030712;
}

.stage-side:fullscreen::before,
.stage-side:fullscreen::after,
.stage-side:-webkit-full-screen::before,
.stage-side:-webkit-full-screen::after {
  display: none;
}

.stage-side:fullscreen .stage-card,
.stage-side:-webkit-full-screen .stage-card {
  height: 100%;
}

.stage-card {
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 6px;
}

.stage-card > * {
  min-width: 0;
}

/* Hidden old title (now in header) */
.stage-title {
  font-size: 15px;
  line-height: 1;
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: -0.3px;
  overflow-wrap: anywhere;
}

.stage-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ─── Info Chips ─── */

.stage-info-row {
  display: none;
  align-items: center;
  gap: 5px;
  min-height: 22px;
}

.info-chip {
  height: 22px;
  border-radius: 6px;
  border: 1px solid rgb(var(--theme-accent-m) / 0.18);
  background: linear-gradient(145deg, rgb(var(--theme-accent-m) / 0.10), rgb(var(--theme-glass-dark) / 0.50));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #e8d5a0;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.info-chip-audio {
  background: linear-gradient(145deg, rgb(var(--theme-accent-m) / 0.14), rgb(var(--theme-glass-dark) / 0.50));
  border-color: rgb(var(--theme-accent-m) / 0.35);
  cursor: pointer;
}

.info-chip-audio:hover {
  transform: translateY(-1px);
  border-color: rgb(var(--theme-accent-m) / 0.55);
  background: linear-gradient(145deg, rgb(var(--theme-accent-l) / 0.22), rgb(var(--theme-glass-dark) / 0.55));
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
}

.info-chip-rec {
  background: rgba(185, 28, 28, 0.55);
  border-color: rgba(248, 113, 113, 0.4);
  color: #fee2e2;
}

.info-chip-song {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.info-chip-time {
  min-width: 42px;
  justify-content: center;
}

/* ─── Canvas / Viz ─── */

#vizWrap {
  grid-row: 1;
  position: relative;
  width: 100%;
  max-width: 100%;
  flex: 0 0 auto;
  min-height: 200px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 0, 0, 0.88);
  background: #000;
  overflow: hidden;
  margin: 0 auto;
  align-self: center;
  justify-self: center;
  z-index: 1;
}

.stage-actions-row {
  grid-row: 2;
}

canvas#viz {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
}

#vizWrap.export-active {
  box-shadow: none;
  background: #000;
}

#vizWrap.preview-transparent-ui:not(.export-active) {
  background:
    radial-gradient(ellipse 80% 70% at 25% 35%, rgb(var(--theme-accent-m) / 0.52), transparent 65%),
    radial-gradient(ellipse 60% 55% at 80% 70%, rgb(var(--theme-accent-l) / 0.32), transparent 60%),
    rgb(var(--theme-glass-dark) / 0.55);
  backdrop-filter: blur(32px) saturate(180%) brightness(1.15);
  -webkit-backdrop-filter: blur(32px) saturate(180%) brightness(1.15);
  border-color: rgb(var(--theme-accent-m) / 0.35);
}

.canvas-player-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 8px 7px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0.22) 58%, transparent);
  pointer-events: auto;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.canvas-player-controls.is-hidden {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

.canvas-transport-row {
  position: relative;
  z-index: 1;
  width: 100%;
  justify-content: center;
  gap: 5px;
}

.canvas-transport-row > .c-btn {
  height: 30px;
}

/* ─── Stage Action Buttons ─── */

.stage-actions-row {
  padding: 4px 6px;
  border-radius: 10px;
  border: 1px solid rgb(var(--theme-accent-m) / 0.16);
  background: linear-gradient(145deg, rgb(var(--theme-accent-l) / 0.10), rgba(18, 12, 3, 0.42));
  backdrop-filter: blur(12px) saturate(135%);
  -webkit-backdrop-filter: blur(12px) saturate(135%);
  gap: 4px;
  flex-wrap: wrap;
  position: relative;
  z-index: 120;
  overflow: visible;
  width: 100%;
  margin: 0 auto;
  justify-content: center;
}

.ctrl-row { display: flex; align-items: center; justify-content: center; }

.stage-actions-row.ctrl-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.c-btn,
.bg-import,
.export-btn {
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid rgb(var(--theme-accent-m) / 0.22);
  background: linear-gradient(145deg, rgb(var(--theme-accent-l) / 0.12), rgb(var(--theme-glass-dark) / 0.52));
  backdrop-filter: blur(10px) saturate(128%);
  -webkit-backdrop-filter: blur(10px) saturate(128%);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.c-btn { min-width: 26px; }
.c-btn:disabled,
.bg-import:disabled,
.export-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.c-btn .btn-icon {
  width: 14px;
  height: 14px;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.c-btn:hover,
.bg-import:hover,
.export-btn:hover {
  transform: translateY(-1px);
  border-color: rgb(var(--theme-accent-m) / 0.48);
  background: linear-gradient(145deg, rgb(var(--theme-accent-l) / 0.20), rgba(40, 26, 6, 0.62));
  box-shadow: 0 4px 14px rgba(20, 10, 2, 0.30);
}

.c-btn.play-btn {
  min-width: 34px;
  background: linear-gradient(145deg, var(--theme-solid-a), var(--theme-solid-b));
  border-color: rgb(var(--theme-accent-l) / 0.5);
}

.c-btn.play-btn:hover {
  border-color: rgb(var(--theme-accent-l) / 0.75);
  box-shadow: 0 2px 10px rgb(var(--theme-accent-d) / 0.35);
}

.c-btn.mute-btn.active,
.fullscreen-btn.active {
  border-color: rgb(var(--theme-accent-l) / 0.4);
  background: rgb(var(--theme-accent-d) / 0.22);
}

.bg-import {
  border-color: rgb(var(--theme-accent-m) / 0.38);
  background: linear-gradient(145deg, rgb(var(--theme-accent-l) / 0.18), rgb(var(--theme-glass-dark) / 0.46));
  color: var(--theme-text-accent);
  backdrop-filter: blur(10px) saturate(130%);
  -webkit-backdrop-filter: blur(10px) saturate(130%);
}

.stage-actions-row .c-btn,
.stage-actions-row .bg-import,
.stage-actions-row .action-select-wrap {
  min-height: 30px;
}

.stage-actions-row .bar-control {
  width: 122px;
  min-width: 122px;
  max-width: 122px;
  height: 30px;
  border-radius: 8px;
  flex: 0 0 122px;
}

.stage-actions-row .action-select-wrap {
  padding: 0 8px;
  justify-content: flex-start;
  gap: 6px;
}

.stage-actions-row .action-select-wrap .action-select {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.15px;
}

.stage-actions-row .action-select-label {
  font-size: 7px;
  opacity: 0.9;
}

.bg-import:hover {
  border-color: rgb(var(--theme-accent-l) / 0.58);
  background: linear-gradient(145deg, rgb(var(--theme-accent-l) / 0.26), rgb(var(--theme-glass-dark) / 0.52));
}

.asset-tag {
  display: none;
  height: 24px;
  border-radius: 999px;
  border: 1px solid rgb(var(--theme-accent-m) / 0.34);
  background: linear-gradient(145deg, rgb(var(--theme-accent-l) / 0.16), rgb(var(--theme-glass-dark) / 0.60));
  color: var(--theme-text-accent);
  padding: 0 10px;
  font-size: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  align-self: center;
  width: auto;
  min-width: 0;
  max-width: none;
  flex: 0 0 auto;
  text-transform: uppercase;
  letter-spacing: 0.35px;
}

.asset-tag.active {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.asset-tag:hover {
  transform: translateY(-1px);
  border-color: rgb(var(--theme-accent-l) / 0.58);
}

.export-btn {
  border-color: rgb(var(--theme-accent-l) / 0.55);
  background: linear-gradient(145deg, rgb(var(--theme-accent-d) / 0.90), rgba(180, 100, 10, 0.92));
  color: var(--theme-text-export);
  font-weight: 700;
}

.export-btn:hover {
  border-color: rgba(255, 210, 80, 0.82);
  box-shadow: 0 4px 14px rgb(var(--theme-accent-d) / 0.32);
}

.export-btn.exporting {
  border-color: rgba(248, 113, 113, 0.4);
  background: linear-gradient(145deg, #7f1d1d, #991b1b);
  color: #fecaca;
}

.bg-thumb {
  width: 22px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid rgba(71, 85, 105, 0.3);
  object-fit: cover;
  display: none;
}
.bg-thumb.active { display: none; }

/* Legacy selector retained intentionally; remove action now uses .asset-tag. */
.bg-remove { display: none !important; }

/* ─── Progress Bars ─── */

.progress,
.export-progress {
  width: 100%;
  height: 2px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.26);
  overflow: hidden;
  cursor: pointer;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgb(var(--theme-accent-l) / 0.98), rgb(var(--theme-accent-d) / 0.98));
  border-radius: 999px;
  transition: width 0.3s ease;
}

.export-progress { display: none; }
.export-progress.active { display: block; }
.export-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(255, 210, 80, 0.96), rgb(var(--theme-accent-d) / 0.96));
  border-radius: 999px;
  transition: width 0.3s ease;
}

.hint-text {
  font-family: 'Inter', sans-serif;
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Right Sidebar ─── */

.ui {
  position: relative;
  isolation: isolate;
  --ui-type-xxs: 9px;
  --ui-type-xs: 10px;
  --ui-type-sm: 11px;
  --ui-type-md: 13px;
  --ui-text-primary: #ffffff;
  --ui-text-secondary: #ffffff;
  --ui-text-muted: #ffffff;
  --muted: var(--ui-text-muted);
  min-height: 0;
  overflow-y: auto;
  overflow-x: visible;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-color: rgb(var(--theme-accent-m) / 0.18);
  background:
    var(--noise-url),
    radial-gradient(140% 86% at 15% -8%, rgb(var(--theme-accent-l) / 0.16), transparent 58%),
    radial-gradient(96% 74% at 92% 8%, rgb(var(--theme-accent-m) / 0.10), transparent 64%),
    linear-gradient(168deg, var(--liquid-panel) 0%, rgb(var(--theme-accent-d) / 0.10) 34%, var(--liquid-panel-deep) 100%);
  background-size: 180px 180px, auto, auto, auto;
  background-repeat: repeat, no-repeat, no-repeat, no-repeat;
  background-blend-mode: soft-light, normal, normal, normal;
  backdrop-filter: blur(30px) saturate(155%);
  -webkit-backdrop-filter: blur(30px) saturate(155%);
  box-shadow:
    0 1px 2px hsl(var(--theme-shadow-hue) 70% 6% / 0.22),
    0 3px 6px hsl(var(--theme-shadow-hue) 65% 6% / 0.20),
    0 8px 16px hsl(var(--theme-shadow-hue) 60% 6% / 0.16),
    0 20px 40px hsl(var(--theme-shadow-hue) 55% 6% / 0.12),
    inset 0 1px 0 rgb(var(--theme-accent-l) / 0.45),
    inset 0 -1px 0 rgb(var(--theme-accent-m) / 0.14);
  transition:
    transform 0.38s cubic-bezier(0.25, 1, 0.3, 1);
  transform: translateX(0);
  will-change: transform;
  color: #ffffff;
  text-rendering: optimizeLegibility;
}

body.ui-right-collapsed .app-shell {
  grid-template-columns: minmax(0, 1fr) 0;
  gap: 0;
}

body.ui-right-collapsed .ui {
  /* Keep a small clickable tab visible so users can reopen the drawer. */
  transform: translateX(calc(100% - 34px));
}

.ui-drawer-handle {
  position: absolute;
  top: 50%;
  left: 0;
  width: 26px;
  height: 86px;
  transform: translate(-72%, -50%);
  border-radius: 999px;
  border: 1px solid rgb(var(--theme-accent-m) / 0.38);
  background: linear-gradient(160deg, rgb(var(--theme-accent-l) / 0.30), rgb(var(--theme-glass-dark) / 0.92));
  color: var(--theme-text-accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  z-index: 20;
  box-shadow:
    0 10px 20px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgb(var(--theme-accent-l) / 0.44);
  backdrop-filter: blur(12px) saturate(130%);
  -webkit-backdrop-filter: blur(12px) saturate(130%);
  transition:
    transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

body.ui-right-collapsed .ui-drawer-handle {
  transform: translate(-84%, -50%);
}

.ui-drawer-handle:hover {
  border-color: rgb(var(--theme-accent-l) / 0.68);
  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgb(var(--theme-accent-l) / 0.60);
}

.ui-drawer-handle:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px rgb(var(--theme-accent-l) / 0.40),
    0 12px 24px rgba(8, 4, 1, 0.5);
}

.ui-drawer-handle:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ui-drawer-handle-grip {
  width: 3px;
  height: 20px;
  border-radius: 999px;
  background: rgb(var(--theme-accent-l) / 0.62);
  box-shadow:
    5px 0 0 rgb(var(--theme-accent-l) / 0.44),
    -5px 0 0 rgb(var(--theme-accent-l) / 0.44);
}

.ui-drawer-handle-chevron {
  font-size: 11px;
  line-height: 1;
  font-weight: 700;
  transform: translateX(1px);
}

.ui-drawer-peek-handle {
  position: fixed;
  top: calc(40px + ((100dvh - 40px) * 0.5));
  right: 6px;
  width: 26px;
  height: 86px;
  transform: translate(16px, -50%);
  border-radius: 999px;
  border: 1px solid rgb(var(--theme-accent-m) / 0.44);
  background: linear-gradient(160deg, rgb(var(--theme-accent-l) / 0.35), rgb(var(--theme-glass-dark) / 0.96));
  color: var(--theme-text-accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  z-index: 45;
  opacity: 0;
  pointer-events: none;
  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgb(var(--theme-accent-l) / 0.50);
  backdrop-filter: blur(12px) saturate(130%);
  -webkit-backdrop-filter: blur(12px) saturate(130%);
  transition:
    transform 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.2s ease,
    border-color 0.16s ease;
}

body.ui-right-collapsed .ui-drawer-peek-handle {
  opacity: 1;
  pointer-events: auto;
  transform: translate(0, -50%);
}

.ui-drawer-peek-handle:hover {
  border-color: rgb(var(--theme-accent-l) / 0.72);
}

.ui-drawer-peek-handle:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px rgb(var(--theme-accent-l) / 0.40),
    0 12px 24px rgba(8, 4, 1, 0.5);
}

.ui::before,
.ui::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: -1;
}

.ui::before {
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.26) 0%, transparent 28%),
    linear-gradient(0deg, rgba(5, 12, 24, 0.13), transparent 50%);
}

.ui::after {
  top: -20%;
  left: 52%;
  width: 54%;
  height: 36%;
  filter: blur(34px);
  background: radial-gradient(circle, rgb(var(--theme-accent-m) / 0.24) 0%, transparent 72%);
}

/* Sleek scrollbar */
.ui::-webkit-scrollbar {
  width: 4px;
}
.ui::-webkit-scrollbar-track {
  background: transparent;
}
.ui::-webkit-scrollbar-thumb {
  background: rgb(var(--theme-accent-m) / 0.30);
  border-radius: 999px;
}
.ui::-webkit-scrollbar-thumb:hover {
  background: rgb(var(--theme-accent-m) / 0.48);
}

.ui-panel-head h2 {
  font-size: var(--ui-type-md);
  line-height: 1;
  font-weight: 750;
  color: var(--ui-text-primary);
  text-transform: uppercase;
  letter-spacing: 1.1px;
  text-shadow: var(--ui-text-shadow-strong);
}

.ui-panel-head p {
  margin-top: 3px;
  color: var(--ui-text-muted);
  font-size: var(--ui-type-xs);
  text-shadow: var(--ui-text-shadow-soft);
}

.ui-card {
  position: relative;
  z-index: 1;
  isolation: isolate;
  border-radius: var(--radius-md);
  border: 1px solid var(--liquid-border-soft);
  --border-gradient: linear-gradient(
    135deg,
    rgb(var(--theme-accent-l) / 0.55) 0%,
    rgb(var(--theme-accent-m) / 0.25) 40%,
    rgb(var(--theme-accent-d) / 0.10) 100%
  );
  background:
    var(--noise-url),
    linear-gradient(160deg, rgb(var(--theme-accent-l) / 0.18) 0%, var(--liquid-card) 32%, var(--liquid-card-deep) 100%);
  background-size: 180px 180px, auto;
  background-repeat: repeat, no-repeat;
  background-blend-mode: soft-light, normal;
  backdrop-filter: blur(18px) saturate(145%);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
  box-shadow:
    0 1px 2px hsl(var(--theme-shadow-hue) 70% 6% / 0.22),
    0 3px 6px hsl(var(--theme-shadow-hue) 65% 6% / 0.20),
    0 8px 16px hsl(var(--theme-shadow-hue) 60% 6% / 0.16),
    0 20px 40px hsl(var(--theme-shadow-hue) 55% 6% / 0.10),
    inset 0 1px 0 rgb(var(--theme-accent-l) / 0.48);
  padding: 10px;
  overflow: visible;
  transition:
    transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.22s ease,
    border-color 0.22s ease,
    background 0.22s ease;
}

.ui-card > * {
  position: relative;
  z-index: 3;
}

.ui-card::before {
  content: "";
  position: absolute;
  inset: 1px;
  z-index: 1;
  pointer-events: none;
  border-radius: inherit;
  background: radial-gradient(
    ellipse 55% 30% at 18% 12%,
    rgba(255, 255, 255, 0.38) 0%,
    rgba(255, 255, 255, 0.18) 36%,
    transparent 100%
  );
}

.ui-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  border-radius: inherit;
}

.ui-card:hover {
  border-color: var(--liquid-border);
  transform: translateY(-2px) scale(1.002);
  box-shadow:
    0 1px 2px hsl(var(--theme-shadow-hue) 70% 6% / 0.24),
    0 4px 8px hsl(var(--theme-shadow-hue) 65% 6% / 0.22),
    0 12px 24px hsl(var(--theme-shadow-hue) 60% 6% / 0.18),
    0 28px 52px hsl(var(--theme-shadow-hue) 55% 6% / 0.12),
    inset 0 1px 0 rgb(var(--theme-accent-l) / 0.60);
}

@supports ((-webkit-mask-composite: xor) or (mask-composite: exclude)) {
  .ui-card {
    border: none;
  }

  .ui-card::after {
    padding: 1px;
    background: var(--border-gradient);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;
  }
}

.card-label,
.card-title {
  color: var(--ui-text-primary);
  font-size: var(--ui-type-sm);
  font-weight: 700;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-shadow: var(--ui-text-shadow-strong);
}

/* ─── Common Dropdown System ─── */

.dropdown-wrap {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--liquid-border-soft);
  background: linear-gradient(150deg, rgb(var(--theme-accent-l) / 0.14), rgb(var(--theme-glass-dark) / 0.34));
  backdrop-filter: blur(14px) saturate(136%);
  -webkit-backdrop-filter: blur(14px) saturate(136%);
  transition:
    border-color var(--transition-fast),
    background var(--transition-fast),
    box-shadow var(--transition-fast),
    transform 0.15s ease,
    backdrop-filter 0.15s ease,
    -webkit-backdrop-filter 0.15s ease;
}

.dropdown-wrap::after {
  content: "▼";
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  color: var(--ui-text-primary);
  pointer-events: none;
}

.dropdown-wrap:focus-within {
  border-color: rgb(var(--theme-accent-m) / 0.58);
  background: linear-gradient(145deg, rgb(var(--theme-accent-l) / 0.20), rgb(var(--theme-glass-dark) / 0.44));
  box-shadow: 0 0 0 1px rgb(var(--theme-accent-m) / 0.24);
}

.dropdown-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ui-text-primary);
  font-size: var(--ui-type-sm);
  font-weight: 650;
  line-height: 1;
  height: 100%;
  width: 100%;
  padding: 0 20px 0 8px;
  cursor: pointer;
  text-shadow: var(--ui-text-shadow-soft);
}

.dropdown-select:focus {
  outline: none;
}

.dropdown-native-hidden {
  position: absolute !important;
  pointer-events: none !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

.dropdown-trigger {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  color: var(--ui-text-primary);
  padding: 0 20px 0 8px;
  font-size: var(--ui-type-sm);
  font-weight: 650;
  line-height: 1;
  text-align: left;
  cursor: pointer;
  text-shadow: var(--ui-text-shadow-soft);
}

.dropdown-trigger-text {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-wrap.is-disabled {
  opacity: 0.5;
}

.dropdown-wrap.is-disabled .dropdown-trigger {
  cursor: not-allowed;
}

.dropdown-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  bottom: auto;
  isolation: isolate;
  z-index: 520;
  border-radius: var(--radius-sm);
  border: 1px solid rgb(var(--theme-accent-m) / 0.40);
  background: linear-gradient(168deg, rgb(var(--theme-glass-dark) / 0.97), rgb(var(--theme-glass-dark) / 0.99));
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  box-shadow:
    inset 0 1px 0 rgb(var(--theme-accent-l) / 0.18),
    0 14px 30px rgba(0, 0, 0, 0.55);
  padding: 4px;
  display: none;
  max-height: 210px;
  overflow: auto;
}

.dropdown-wrap.dropdown-open-up .dropdown-menu,
.dropdown-wrap.dropdown-force-up .dropdown-menu {
  top: auto;
  bottom: calc(100% + 6px);
}

.dropdown-wrap.dropdown-open-down .dropdown-menu,
.dropdown-wrap.dropdown-force-down .dropdown-menu {
  top: calc(100% + 6px);
  bottom: auto;
}

.dropdown-wrap.is-open .dropdown-menu {
  display: block;
}

.dropdown-wrap.is-open {
  z-index: 2000;
}

.dropdown-item {
  width: 100%;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--ui-text-secondary);
  transition: background var(--transition-fast), transform var(--transition-fast);
  text-align: left;
  font-size: var(--ui-type-xs);
  font-weight: 600;
  padding: 7px 9px;
  cursor: pointer;
}

.dropdown-item:hover {
  background: rgb(var(--theme-accent-m) / 0.22);
  transform: translateX(2px);
}

.dropdown-item.is-selected {
  background: linear-gradient(140deg, rgb(var(--theme-accent-m) / 0.45), rgb(var(--theme-accent-d) / 0.50));
  color: var(--ui-text-primary);
}

.dropdown-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.card-label {
  font-size: var(--ui-type-xs);
  font-weight: 600;
}

/* ─── Visualizer Selector ─── */

.group-pills {
  display: flex;
  gap: 2px;
  padding: 2px;
  border-radius: var(--radius-sm);
  border: 1px solid rgb(var(--theme-accent-m) / 0.18);
  background: linear-gradient(150deg, rgb(var(--theme-accent-l) / 0.16), rgb(var(--theme-glass-dark) / 0.30));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.group-pill {
  border: none;
  border-radius: 5px;
  padding: 4px 8px;
  background: transparent;
  color: var(--ui-text-secondary);
  font-size: var(--ui-type-sm);
  font-weight: 650;
  cursor: pointer;
  text-shadow: var(--ui-text-shadow-soft);
  transition:
    border-color var(--transition-fast),
    background var(--transition-fast),
    box-shadow var(--transition-fast),
    transform 0.15s ease;
}

.group-pill:hover {
  transform: translateY(-1px);
}

.ui-card-viz .group-pills {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.ui-card-viz .group-pill {
  width: 100%;
  text-align: center;
}

.group-pill.active {
  background: linear-gradient(140deg, rgb(var(--theme-accent-m) / 0.45), rgb(var(--theme-accent-d) / 0.54));
  color: var(--ui-text-primary);
  box-shadow: inset 0 1px 0 rgb(var(--theme-accent-l) / 0.35), 0 1px 6px rgba(30, 15, 2, 0.28);
}

.viz-select-wrap {
  width: 100%;
  margin-top: 6px;
}

.ui-card-viz .viz-select-wrap {
  padding: 0 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgb(var(--theme-accent-m) / 0.26);
  background: linear-gradient(140deg, rgb(var(--theme-accent-l) / 0.22), rgba(45, 28, 6, 0.32));
  position: relative;
}

.ui-card-viz {
  z-index: 6;
}

.ui-card-viz .viz-select-wrap .strip-select {
  min-width: 0;
  width: 100%;
  color: var(--ui-text-primary);
  font-size: var(--ui-type-sm);
  font-weight: 650;
}

.ui-card-viz .viz-select-wrap::after {
  color: var(--ui-text-primary);
}

.select-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid rgb(var(--theme-accent-m) / 0.22);
  background: linear-gradient(145deg, rgb(var(--theme-accent-l) / 0.10), rgb(var(--theme-glass-dark) / 0.50));
}

.setting-label {
  font-family: 'Inter', sans-serif;
  font-size: var(--ui-type-xxs);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--ui-text-primary);
  text-shadow: var(--ui-text-shadow-soft);
}

.strip-select,
.smart-color-select {
  min-width: 60px;
  height: 100%;
  border: none;
  background: transparent;
  padding: 0;
}

.strip-select:focus,
.smart-color-select:focus {
  outline: none;
}

.strip-settings {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

/* ─── Export Grid (symmetric 3x2) ─── */

.ui-card-export .card-title {
  margin-bottom: 4px;
}

.ui-card-export {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ui-card-status .status-body {
  min-height: 28px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgb(var(--theme-accent-m) / 0.18);
  background: linear-gradient(145deg, rgb(var(--theme-accent-l) / 0.10), rgb(var(--theme-glass-dark) / 0.32));
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1px;
  color: var(--ui-text-primary);
  display: flex;
  align-items: center;
}

.export-grid {
  display: grid;
  gap: 0;
}

.export-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
}

.export-row-top {
  grid-template-columns: repeat(4, 1fr);
}

.export-row-direct {
  margin-top: 4px;
  grid-template-columns: 1fr;
}

.export-direct-toggle {
  width: 100%;
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgb(var(--theme-accent-m) / 0.22);
  background: linear-gradient(145deg, rgb(var(--theme-accent-l) / 0.10), rgb(var(--theme-glass-dark) / 0.42));
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.export-audio-toggle {
  padding: 3px 6px;
  cursor: default;
  min-height: 26px;
  border-radius: var(--radius-sm);
  border: 1px solid rgb(var(--theme-accent-m) / 0.18);
  background: linear-gradient(145deg, rgb(var(--theme-accent-l) / 0.12), rgb(var(--theme-glass-dark) / 0.42));
  backdrop-filter: blur(12px) saturate(130%);
  -webkit-backdrop-filter: blur(12px) saturate(130%);
  transition: all var(--transition-fast);
}
.export-audio-toggle-inner {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 12px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: none;
}
.export-audio-toggle:hover {
  transform: translateY(-1px);
  border-color: rgb(var(--theme-accent-m) / 0.42);
  box-shadow: 0 4px 12px rgba(20, 10, 2, 0.22);
}
.export-audio-toggle-inner .setting-label {
  margin: 0;
  font-size: var(--ui-type-sm);
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: 0.1px;
  text-transform: none;
}
#exportAudioToggle {
  width: 12px;
  height: 12px;
  margin: 0;
  accent-color: rgb(var(--theme-accent-m));
}

.export-direct-toggle:hover {
  border-color: rgb(var(--theme-accent-m) / 0.42);
}

.export-direct-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.export-direct-title {
  font-size: var(--ui-type-sm);
  font-weight: 700;
  color: var(--ui-text-primary);
  text-shadow: var(--ui-text-shadow-soft);
}

.export-direct-sub {
  font-size: var(--ui-type-xxs);
  color: var(--ui-text-muted);
  text-shadow: var(--ui-text-shadow-soft);
}

.export-direct-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.export-direct-track {
  flex: 0 0 auto;
  width: 28px;
  height: 15px;
  border-radius: 999px;
  background: rgba(80, 55, 15, 0.70);
  border: 1px solid rgb(var(--theme-accent-m) / 0.22);
  display: inline-flex;
  align-items: center;
  padding: 2px;
  transition: background var(--transition-fast);
}

.export-direct-thumb {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--theme-text-accent);
  transform: translateX(0);
  transition: transform 0.15s ease;
}

.export-direct-input:checked + .export-direct-track {
  background: linear-gradient(140deg, rgb(var(--theme-accent-l) / 0.90), rgb(var(--theme-accent-d) / 0.95));
}

.export-direct-input:checked + .export-direct-track .export-direct-thumb {
  transform: translateX(13px);
}

.export-direct-input:disabled + .export-direct-track {
  opacity: 0.4;
}

.export-direct-input:disabled + .export-direct-track .export-direct-thumb {
  transform: translateX(0);
}

.export-btn-panel {
  width: 100%;
  min-height: 38px;
  border-width: 1px;
  border-color: rgb(var(--theme-accent-l) / 0.75);
  background: linear-gradient(145deg, rgb(var(--theme-accent-d) / 0.96), rgba(170, 92, 10, 0.98));
  color: var(--ui-text-primary);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.export-cell {
  position: relative;
  min-height: 26px;
  border-radius: var(--radius-sm);
  border: 1px solid rgb(var(--theme-accent-m) / 0.18);
  background: linear-gradient(145deg, rgb(var(--theme-accent-l) / 0.12), rgb(var(--theme-glass-dark) / 0.42));
  backdrop-filter: blur(12px) saturate(130%);
  -webkit-backdrop-filter: blur(12px) saturate(130%);
  padding: 3px 6px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.export-cell:hover {
  transform: translateY(-1px);
  border-color: rgb(var(--theme-accent-m) / 0.42);
  box-shadow: 0 4px 12px rgba(20, 10, 2, 0.22);
}

.export-cell:focus-within {
  border-color: rgb(var(--theme-accent-m) / 0.56);
  box-shadow: 0 0 0 1px rgb(var(--theme-accent-m) / 0.22);
}

.ui-card-export .setting-label {
  font-size: var(--ui-type-xxs);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--ui-text-primary);
  margin-bottom: 0;
}

.export-cell.dropdown-wrap {
  padding: 3px 6px;
}

.export-cell.dropdown-wrap::after {
  right: 6px;
  top: auto;
  bottom: 6px;
  transform: none;
  font-size: 9px;
  color: var(--ui-text-primary);
}

.export-cell .dropdown-select,
.export-cell .dropdown-trigger {
  min-height: 12px;
  height: auto;
  padding: 0 12px 0 0;
  color: var(--ui-text-primary);
  font-size: var(--ui-type-xs);
  line-height: 1.2;
  font-weight: 650;
  text-shadow: var(--ui-text-shadow-soft);
}

.export-cell .dropdown-trigger-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.export-value-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
}

.export-value {
  color: var(--ui-text-primary);
  font-size: var(--ui-type-sm);
  line-height: 1;
  font-weight: 650;
  letter-spacing: 0.1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: var(--ui-text-shadow-soft);
}

.export-row-top .export-cell:nth-child(3) .export-value {
  font-size: var(--ui-type-sm);
}

.export-chevron {
  color: var(--ui-text-primary);
  font-size: 9px;
  line-height: 1;
  font-weight: 600;
  flex: 0 0 auto;
}

.export-native-select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.export-native-select:focus {
  outline: none;
}

/* ─── Color Tools ─── */

.color-tools {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

.visually-hidden-control {
  display: none !important;
}

.smart-color-btn {
  height: 24px;
  width: fit-content;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgb(var(--theme-accent-m) / 0.40);
  background: linear-gradient(140deg, rgb(var(--theme-accent-l) / 0.20), rgba(120, 70, 10, 0.32));
  backdrop-filter: blur(10px) saturate(130%);
  -webkit-backdrop-filter: blur(10px) saturate(130%);
  color: var(--ui-text-primary);
  font-size: var(--ui-type-xs);
  font-weight: 650;
  cursor: pointer;
  margin-bottom: 8px;
  transition: all var(--transition-fast);
}

.smart-color-btn:hover {
  border-color: rgb(var(--theme-accent-m) / 0.60);
  background: linear-gradient(140deg, rgb(var(--theme-accent-l) / 0.28), rgba(150, 90, 15, 0.38));
}

.smart-color-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.color-popup {
  display: none;
  width: 100%;
  padding: 0;
  border: none;
  box-shadow: none;
  background: transparent;
  position: static;
}

.color-popup.open,
.color-popup.docked {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.color-popup-divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgb(var(--theme-accent-m) / 0.42), transparent);
}

.color-popup-presets {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
  align-items: center;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.color-popup-presets::-webkit-scrollbar { height: 4px; }
.color-popup-presets::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.45);
  border-radius: 999px;
}

.color-pill {
  width: 30px;
  height: 20px;
  box-sizing: border-box;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  border: 1px solid rgba(196, 215, 248, 0.24);
  font-size: var(--ui-type-xxs);
  font-weight: 700;
  line-height: 1;
  color: #ffffff !important;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.7);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.color-pill:hover {
  border-color: rgb(var(--theme-accent-m) / 0.55);
  transform: translateY(-1px) scale(1.06);
  box-shadow: 0 3px 8px rgba(20, 10, 2, 0.25);
}

.color-pill.active {
  border-color: rgba(207, 229, 255, 0.65);
  box-shadow: 0 0 0 1px rgba(173, 212, 255, 0.28);
}

.color-pill-own {
  background: linear-gradient(145deg, rgba(255, 235, 190, 0.24), rgba(56, 34, 8, 0.58));
  color: var(--ui-text-primary);
}

.color-pill-custom {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.color-pill-custom::-webkit-color-swatch-wrapper { width: 100%; height: 100%; padding: 0; }
.color-pill-custom::-webkit-color-swatch { width: 100%; height: 100%; border: none; border-radius: 3px; }
.color-pill-custom::-moz-color-swatch { width: 100%; height: 100%; border: none; border-radius: 3px; }

/* ─── Glow ─── */

.glow-panel { display: flex; flex-direction: column; gap: 6px; }

.glow-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  background: linear-gradient(145deg, rgb(var(--theme-accent-l) / 0.10), rgb(var(--theme-glass-dark) / 0.40));
  border: 1px solid rgb(var(--theme-accent-m) / 0.22);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.glow-toggle:hover {
  border-color: rgb(var(--theme-accent-m) / 0.44);
}

.glow-toggle-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.glow-toggle-title {
  font-size: var(--ui-type-sm);
  font-weight: 700;
  color: var(--ui-text-primary);
  text-shadow: var(--ui-text-shadow-soft);
}
.glow-toggle-sub {
  font-size: var(--ui-type-xxs);
  color: var(--ui-text-muted);
  text-shadow: var(--ui-text-shadow-soft);
}

.glow-toggle-input { position: absolute; opacity: 0; pointer-events: none; }

.glow-toggle-track {
  width: 28px;
  height: 15px;
  border-radius: 999px;
  background: rgba(80, 55, 15, 0.70);
  border: 1px solid rgb(var(--theme-accent-m) / 0.22);
  display: inline-flex;
  align-items: center;
  padding: 2px;
  transition: background var(--transition-fast);
}

.glow-toggle-thumb {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--theme-text-accent);
  transform: translateX(0);
  transition: transform 0.15s ease;
}

.glow-toggle-input:checked + .glow-toggle-track {
  background: linear-gradient(140deg, rgb(var(--theme-accent-l) / 0.90), rgb(var(--theme-accent-d) / 0.95));
}

.glow-toggle-input:checked + .glow-toggle-track .glow-toggle-thumb {
  transform: translateX(13px);
}

.glow-strength {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 6px;
  opacity: 0.45;
}

.glow-strength.active { opacity: 1; }
.glow-strength-label,
.glow-strength-value {
  font-size: var(--ui-type-xs);
  color: var(--ui-text-secondary);
  text-shadow: var(--ui-text-shadow-soft);
}
.glow-strength-value { font-family: 'JetBrains Mono', monospace; }

/* ─── Smart Palette ─── */

.smart-color-panel { display: flex; flex-direction: column; gap: 6px; }
.smart-color-header { display: flex; align-items: center; gap: 6px; min-height: 24px; }
.smart-color-title {
  font-size: var(--ui-type-sm);
  font-weight: 700;
  color: var(--ui-text-primary);
  text-shadow: var(--ui-text-shadow-soft);
}
.smart-color-status {
  font-size: var(--ui-type-xs);
  line-height: 1.35;
  color: var(--ui-text-muted);
  text-shadow: var(--ui-text-shadow-soft);
}
.smart-color-status-inline {
  margin-left: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: var(--ui-type-xs);
  color: var(--ui-text-muted);
}
.smart-color-meta { display: flex; flex-wrap: wrap; gap: 4px; }
.smart-color-mood-wrap {
  margin-left: auto;
  min-width: 90px;
}
.smart-color-mood-wrap .smart-color-select {
  color: var(--ui-text-primary);
  font-size: var(--ui-type-sm);
}
.smart-color-mood-wrap.is-hidden,
.smart-color-status.is-hidden {
  display: none;
}

.regular-palette-title {
  font-size: var(--ui-type-sm);
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--ui-text-primary);
  text-shadow: var(--ui-text-shadow-soft);
}

.action-select-wrap {
  min-width: 82px;
  padding: 0 6px 0 7px;
  gap: 5px;
}
.action-select-wrap:hover {
  transform: translateY(-1px);
  border-color: rgb(var(--theme-accent-m) / 0.48);
  background: linear-gradient(145deg, rgb(var(--theme-accent-l) / 0.20), rgba(40, 26, 6, 0.62));
  box-shadow: 0 4px 14px rgba(20, 10, 2, 0.30);
}
.action-select-label {
  font-family: 'Inter', sans-serif;
  font-size: var(--ui-type-xxs);
  letter-spacing: 0.35px;
  text-transform: uppercase;
  color: var(--ui-text-primary);
  flex: 0 0 auto;
  text-shadow: var(--ui-text-shadow-soft);
}
.action-select-wrap .action-select {
  padding-left: 0;
  padding-right: 14px;
  font-size: var(--ui-type-xs);
  min-width: 0;
}
.smart-color-meta:empty,
.smart-color-swatches:empty,
.smart-color-gradients:empty { display: none; }

.smart-color-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 999px;
  background: linear-gradient(140deg, rgb(var(--theme-accent-l) / 0.12), rgba(40, 22, 4, 0.46));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgb(var(--theme-accent-m) / 0.20);
  font-size: 9px;
  color: var(--ui-text-primary);
}

.smart-color-chip strong { color: var(--ui-text-primary); }

.smart-color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.smart-swatch-card {
  border: 1px solid rgb(var(--theme-accent-m) / 0.18);
  border-radius: var(--radius-sm);
  background: linear-gradient(145deg, rgb(var(--theme-accent-l) / 0.10), rgb(var(--theme-glass-dark) / 0.54));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ui-text-primary);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
}

.smart-swatch-card:hover {
  border-color: rgb(var(--theme-accent-m) / 0.44);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(20, 10, 2, 0.22);
}

.smart-swatch-card--multi { grid-column: 1 / -1; }

.smart-swatch-preview {
  width: 100%;
  height: 22px;
  border-radius: 5px;
  background: var(--swatch-color, #fff);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.15);
}

.smart-swatch-card--multi .smart-swatch-preview { height: 26px; }
.smart-swatch-role {
  font-size: var(--ui-type-xxs);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--ui-text-muted);
  text-shadow: var(--ui-text-shadow-soft);
}
.smart-swatch-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--ui-type-xs);
  color: var(--ui-text-secondary);
  text-shadow: var(--ui-text-shadow-soft);
}

.smart-swatch-pill {
  width: 30px;
  height: 20px;
  min-width: 30px;
  border-radius: 4px;
  padding: 0;
  font-size: 7px;
  font-weight: 700;
  line-height: 1;
}

.smart-color-gradients {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.smart-gradient-card {
  border: 1px solid rgb(var(--theme-accent-m) / 0.18);
  border-radius: var(--radius-sm);
  background: linear-gradient(145deg, rgb(var(--theme-accent-l) / 0.10), rgb(var(--theme-glass-dark) / 0.54));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ui-text-primary);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  transition: all var(--transition-fast);
}

.smart-gradient-card:hover {
  border-color: rgb(var(--theme-accent-m) / 0.44);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(20, 10, 2, 0.22);
}

.smart-gradient-preview {
  width: 100%;
  height: 22px;
  border-radius: 5px;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.15);
}

.smart-gradient-name {
  font-size: var(--ui-type-xxs);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--ui-text-muted);
  white-space: nowrap;
  text-shadow: var(--ui-text-shadow-soft);
}

/* ─── Tune Panel ─── */

.ui-card-tune .viz-tune {
  max-height: none;
  overflow: visible;
}

.viz-tune-title {
  font-size: var(--ui-type-sm);
  color: var(--ui-text-primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
  text-shadow: var(--ui-text-shadow-strong);
}

.viz-tune-subtitle {
  font-size: var(--ui-type-xs);
  color: var(--ui-text-muted);
  margin-bottom: 6px;
  line-height: 1.3;
  text-shadow: var(--ui-text-shadow-soft);
}

.viz-tune-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 8px;
}

.viz-control-group {
  display: none;
}

.viz-control-group-title {
  display: none;
}

.viz-control-group-grid {
  display: block;
}

.viz-control {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0;
  border: none;
  background: transparent;
}

.viz-control-row { display: flex; justify-content: flex-start; align-items: center; }
.viz-control-label {
  font-size: var(--ui-type-sm);
  font-weight: 600;
  color: var(--ui-text-secondary);
  text-shadow: var(--ui-text-shadow-soft);
}
.viz-control-value { display: none; }

/* ─── Sleek thin sliders ─── */

.viz-control input[type="range"],
.glow-strength input[type="range"] {
  width: 100%;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  height: 14px;
}

.viz-control input[type="range"]::-webkit-slider-runnable-track,
.glow-strength input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: 999px;
  background: rgb(var(--theme-accent-d) / 0.35);
}

.viz-control input[type="range"]::-webkit-slider-thumb,
.glow-strength input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--theme-text-accent);
  border: 1.5px solid rgb(var(--theme-accent-d) / 0.75);
  margin-top: -4px;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.viz-control input[type="range"]::-webkit-slider-thumb:hover,
.glow-strength input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Firefox */
.viz-control input[type="range"]::-moz-range-track,
.glow-strength input[type="range"]::-moz-range-track {
  height: 2px;
  border-radius: 999px;
  background: rgba(184, 204, 238, 0.38);
  border: none;
}

.viz-control input[type="range"]::-moz-range-thumb,
.glow-strength input[type="range"]::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e4f0ff;
  border: 1.5px solid rgba(74, 120, 195, 0.72);
  cursor: pointer;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .ui {
    background: rgba(22, 31, 52, 0.94);
    background-image: none;
    box-shadow:
      0 8px 20px rgba(2, 8, 20, 0.30),
      inset 0 1px 0 rgba(255, 255, 255, 0.10);
  }

  .ui-card,
  .dropdown-wrap,
  .group-pills,
  .smart-color-btn {
    background: rgba(25, 36, 60, 0.94);
    background-image: none;
  }

  .ui-card {
    box-shadow:
      0 8px 20px rgba(2, 8, 20, 0.30),
      inset 0 1px 0 rgba(255, 255, 255, 0.10);
  }

  .ui-card:hover {
    transform: translateY(-1px);
  }
}

.viz-control input[type="range"]:focus,
.glow-strength input[type="range"]:focus {
  outline: none;
}

/* ─── Drop Overlay ─── */

.drop-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 5;
  color: #e2e8f0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  cursor: pointer;
  transition: opacity 0.3s;
  border-radius: inherit;
}

.drop-overlay.hidden { opacity: 0; pointer-events: none; }

.drop-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: transparent;
  border: 1.5px dashed transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #94a3b8;
  margin-bottom: 10px;
}

.drop-title { font-size: 13px; font-weight: 700; margin-bottom: 3px; color: #94a3b8; }
.drop-sub { font-size: 10px; color: #94a3b8; }
input[type="file"] { display: none; }

/* ─── Rec Badge ─── */

.rec-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 6;
  display: none;
  align-items: center;
  gap: 5px;
  background: rgba(127, 29, 29, 0.8);
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: #fee2e2;
}

.rec-badge.active { display: flex; }

.rec-badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fecaca;
  animation: blink 1s step-end infinite;
}

@keyframes blink { 50% { opacity: 0; } }

/* ─── Toast ─── */

.toast {
  position: fixed;
  bottom: 24px;
  right: 22px;
  transform: translateY(50px);
  z-index: 50;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: var(--radius-md);
  padding: 8px 16px;
  font-size: 11px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  max-width: 360px;
  white-space: normal;
}

.toast.show { opacity: 1; transform: translateY(0); }

/* ─── Bounding Box Overlay ─── */

#vizOverlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}

.sel-box {
  position: absolute;
  display: none;
  pointer-events: auto;
  cursor: move;
}

.sel-box.active { display: block; }
#vizBBox { border: 1px dashed rgba(129, 140, 248, 0.7); }
#bgBBox { border: 1px dashed rgba(56, 189, 248, 0.65); }

.sel-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  pointer-events: auto;
}

#vizBBox .sel-handle { background: rgba(129, 140, 248, 0.8); border: 1px solid rgba(2, 6, 23, 0.6); }
#bgBBox .sel-handle { background: rgba(56, 189, 248, 0.8); border: 1px solid rgba(2, 6, 23, 0.6); }

.sel-handle[data-pos="tl"] { top: -5px; left: -5px; cursor: nwse-resize; }
.sel-handle[data-pos="tc"] { top: -5px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.sel-handle[data-pos="tr"] { top: -5px; right: -5px; cursor: nesw-resize; }
.sel-handle[data-pos="ml"] { top: 50%; left: -5px; transform: translateY(-50%); cursor: ew-resize; }
.sel-handle[data-pos="mr"] { top: 50%; right: -5px; transform: translateY(-50%); cursor: ew-resize; }
.sel-handle[data-pos="bl"] { bottom: -5px; left: -5px; cursor: nesw-resize; }
.sel-handle[data-pos="bc"] { bottom: -5px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.sel-handle[data-pos="br"] { bottom: -5px; right: -5px; cursor: nwse-resize; }

/* ─── Responsive ─── */

@media (max-width: 1300px) {
  .viz-tune-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: minmax(0, 1fr) 340px; }
  .viz-tune-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }

  .ui-drawer-handle {
    display: none;
  }

  .ui-drawer-peek-handle {
    display: none;
  }

  body.ui-right-collapsed .app-shell {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  body.ui-right-collapsed .ui {
    transform: none;
    opacity: 1;
    pointer-events: auto;
  }

  .stage-actions-row .bar-control {
    width: 132px;
    min-width: 132px;
    max-width: 132px;
    flex-basis: 132px;
  }

  .asset-tag {
    font-size: 8px;
  }
}

/* ─────────────── THEME BLOCKS ─────────────── */

[data-theme="stage"] { /* default — :root already has Stage values */ }

[data-theme="studio"] {
  --theme-bg-base:       #04080a;
  --theme-blob-1:        rgba(0, 180, 200, 0.38);
  --theme-blob-2:        rgba(0, 130, 150, 0.24);
  --theme-blob-vignette: rgba(0, 40, 50, 0.52);
  --theme-anim-1:        rgba(0, 220, 255, 0.62);
  --theme-anim-2:        rgba(0, 180, 200, 0.48);
  --theme-shadow-hue:    190deg;
  --theme-accent-l:      150 240 255;
  --theme-accent-m:      0 200 220;
  --theme-accent-d:      0 150 180;
  --theme-glass-dark:    4 20 25;
  --theme-solid-a:       #0891b2;
  --theme-solid-b:       #0e7490;
  --theme-solid-c:       #06b6d4;
  --theme-text-accent:   #cffafe;
  --theme-text-export:   #001a1e;
  --liquid-panel:        rgba(0, 200, 220, 0.10);
  --liquid-panel-deep:   rgba(0, 30, 38, 0.46);
  --liquid-card:         rgba(0, 210, 230, 0.09);
  --liquid-card-deep:    rgba(0, 24, 30, 0.34);
  --liquid-border:       rgba(0, 210, 230, 0.28);
  --liquid-border-soft:  rgba(0, 190, 210, 0.16);
  --liquid-glow:         rgba(0, 200, 230, 0.22);
  --liquid-highlight:    rgba(150, 240, 255, 0.54);
}

[data-theme="ocean"] {
  --theme-bg-base:       #020408;
  --theme-blob-1:        rgba(20, 80, 160, 0.44);
  --theme-blob-2:        rgba(10, 120, 120, 0.28);
  --theme-blob-vignette: rgba(5, 15, 40, 0.55);
  --theme-anim-1:        rgba(56, 140, 255, 0.64);
  --theme-anim-2:        rgba(20, 180, 180, 0.50);
  --theme-shadow-hue:    210deg;
  --theme-accent-l:      180 220 255;
  --theme-accent-m:      80 160 240;
  --theme-accent-d:      30 100 200;
  --theme-glass-dark:    4 12 28;
  --theme-solid-a:       #1d4ed8;
  --theme-solid-b:       #1e40af;
  --theme-solid-c:       #3b82f6;
  --theme-text-accent:   #dbeafe;
  --theme-text-export:   #000818;
  --liquid-panel:        rgba(80, 160, 240, 0.10);
  --liquid-panel-deep:   rgba(4, 12, 30, 0.46);
  --liquid-card:         rgba(80, 160, 240, 0.09);
  --liquid-card-deep:    rgba(4, 10, 24, 0.34);
  --liquid-border:       rgba(80, 160, 240, 0.28);
  --liquid-border-soft:  rgba(60, 140, 220, 0.16);
  --liquid-glow:         rgba(60, 140, 255, 0.22);
  --liquid-highlight:    rgba(180, 220, 255, 0.54);
}

[data-theme="dusk"] {
  --theme-bg-base:       #080308;
  --theme-blob-1:        rgba(200, 60, 80, 0.40);
  --theme-blob-2:        rgba(140, 40, 100, 0.26);
  --theme-blob-vignette: rgba(60, 15, 30, 0.55);
  --theme-anim-1:        rgba(255, 80, 110, 0.64);
  --theme-anim-2:        rgba(200, 60, 140, 0.50);
  --theme-shadow-hue:    345deg;
  --theme-accent-l:      255 200 210;
  --theme-accent-m:      255 100 130;
  --theme-accent-d:      200 60 90;
  --theme-glass-dark:    28 8 15;
  --theme-solid-a:       #be185d;
  --theme-solid-b:       #9d174d;
  --theme-solid-c:       #ec4899;
  --theme-text-accent:   #fce7f3;
  --theme-text-export:   #1a0008;
  --liquid-panel:        rgba(220, 60, 100, 0.10);
  --liquid-panel-deep:   rgba(30, 6, 16, 0.46);
  --liquid-card:         rgba(220, 60, 100, 0.09);
  --liquid-card-deep:    rgba(24, 4, 12, 0.34);
  --liquid-border:       rgba(255, 100, 130, 0.28);
  --liquid-border-soft:  rgba(220, 80, 110, 0.16);
  --liquid-glow:         rgba(255, 80, 120, 0.22);
  --liquid-highlight:    rgba(255, 200, 210, 0.54);
}

[data-theme="adaptive"] {
  --theme-shadow-hue:    0deg;
  --theme-accent-l:      240 230 210;
  --theme-accent-m:      200 185 160;
  --theme-accent-d:      150 135 110;
  --theme-glass-dark:    10 8 6;
  --theme-solid-a:       #6b6052;
  --theme-solid-b:       #524a40;
  --theme-solid-c:       #9a8c7a;
  --theme-text-accent:   #f5f0e8;
  --theme-text-export:   #100e0a;
  --liquid-panel:        rgba(240, 225, 200, 0.10);
  --liquid-panel-deep:   rgba(12, 10, 7, 0.46);
  --liquid-card:         rgba(240, 225, 200, 0.09);
  --liquid-card-deep:    rgba(10, 8, 5, 0.34);
  --liquid-border:       rgba(240, 220, 180, 0.24);
  --liquid-border-soft:  rgba(220, 200, 160, 0.14);
  --liquid-glow:         rgba(240, 210, 160, 0.18);
  --liquid-highlight:    rgba(240, 230, 210, 0.50);
}

/* ─────────────── ADAPTIVE BACKGROUND ─────────────── */

#adaptive-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  filter: blur(3px) brightness(0.80) saturate(1.15);
  transform: scale(1.15);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

body[data-theme="adaptive"] #adaptive-bg {
  opacity: 1;
}

body[data-theme="adaptive"] {
  background: #050505 !important;
}

body[data-theme="adaptive"]::before,
body[data-theme="adaptive"]::after {
  display: none !important;
}

body[data-theme="adaptive"] .app-header,
body[data-theme="adaptive"] .app-shell {
  position: relative;
  z-index: 1;
}

/* Make panels translucent so the adaptive image bleeds through backdrop-filter */
body[data-theme="adaptive"] .stage-side {
  background:
    radial-gradient(118% 78% at 12% -14%, rgb(var(--theme-accent-l) / 0.06), transparent 56%),
    rgba(10, 10, 10, 0.08) !important;
}

body[data-theme="adaptive"] .ui {
  background:
    var(--noise-url),
    rgba(10, 10, 10, 0.10) !important;
  background-size: 180px 180px, auto !important;
  background-repeat: repeat, no-repeat !important;
  background-blend-mode: soft-light, normal !important;
}

body[data-theme="adaptive"] .ui-card {
  background:
    var(--noise-url),
    rgba(10, 10, 10, 0.12) !important;
  background-size: 180px 180px, auto !important;
  background-repeat: repeat, no-repeat !important;
  background-blend-mode: soft-light, normal !important;
}

body[data-theme="adaptive"] .ui-drawer-handle,
body[data-theme="adaptive"] .ui-drawer-peek-handle {
  background: rgba(10, 10, 10, 0.55) !important;
}

/* ─────────────── THEME PICKER DOTS ─────────────── */

.theme-picker {
  display: flex;
  gap: 7px;
  align-items: center;
}

.theme-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  padding: 0;
  flex-shrink: 0;
}

.theme-dot:hover {
  transform: scale(1.3);
  border-color: rgba(255, 255, 255, 0.50);
}

.theme-dot.active {
  transform: scale(1.2);
  border-color: rgba(255, 255, 255, 0.75);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.20);
}
