/* ============================================
   Audio Enhancer Pro — Uber-Inspired Design
   Strictly follows DESIGN.md: black & white,
   pill buttons, whisper shadows, no gradients,
   no glass, no color accent.
   ============================================ */

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

/* ====== DESIGN TOKENS ====== */
:root {
  /* Core — Uber Black & Pure White */
  --uber-black: #000000;
  --pure-white: #ffffff;
  
  /* Surfaces (Dark Mode) */
  --surface: #000000;
  --surface-dim: #000000;
  --surface-bright: #1a1a1a;
  --surface-container-lowest: #0d0d0d;
  --surface-container-low: #141414;
  --surface-container: #1a1a1a;
  --surface-container-high: #222222;
  --surface-container-highest: #2a2a2a;
  --on-surface: #ffffff;
  --on-surface-muted: #afafaf;

  /* Borders */
  --border: #333333;
  --border-light: rgba(255, 255, 255, 0.08);

  /* Pill buttons & chips */
  --chip-bg: #2a2a2a;
  --hover-gray: #e2e2e2;
  --hover-light: #f3f3f3;

  /* Feedback (keep minimal for meters/indicators only) */
  --error: #ff453a;
  --green: #30d158;
  --orange: #ff9f0a;
  --red: #ff453a;
  --yellow: #ffd60a;

  /* Typography */
  --font-display: UberMove, UberMoveText, system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-body: UberMoveText, system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 48px;

  /* Radius — strict Uber scale */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 999px;
  --radius-circle: 50%;

  /* Shadows — whisper only */
  --shadow-card: rgba(0, 0, 0, 0.5) 0px 4px 16px 0px;
  --shadow-elevated: rgba(0, 0, 0, 0.6) 0px 4px 16px 0px;
  --shadow-floating: rgba(0, 0, 0, 0.6) 0px 2px 8px 0px;
  --shadow-pressed: rgba(0, 0, 0, 0.08) inset;
}

/* ====== LIGHT THEME ====== */
:root[data-theme="light"] {
  --surface: #ffffff;
  --surface-dim: #f5f5f5;
  --surface-bright: #ffffff;
  --surface-container-lowest: #ffffff;
  --surface-container-low: #fafafa;
  --surface-container: #ffffff;
  --surface-container-high: #f0f0f0;
  --surface-container-highest: #e8e8e8;
  --on-surface: #000000;
  --on-surface-muted: #afafaf;

  --border: #000000;
  --border-light: rgba(0, 0, 0, 0.08);

  --chip-bg: #efefef;

  --shadow-card: rgba(0, 0, 0, 0.12) 0px 4px 16px 0px;
  --shadow-elevated: rgba(0, 0, 0, 0.16) 0px 4px 16px 0px;
  --shadow-floating: rgba(0, 0, 0, 0.16) 0px 2px 8px 0px;
}

/* ====== BASE ====== */
html { font-size: 14px; }
body {
  font-family: var(--font-body);
  background: var(--surface-dim);
  color: var(--on-surface);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ====== SCROLLBAR ====== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--on-surface-muted); }

/* ====== NAVBAR (FIXED TOP) ====== */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-xl);
  background: rgba(0, 0, 0, 0.95);
  border-bottom: 1px solid var(--border-light);
  z-index: 100;
  user-select: none;
}
:root[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--border-light);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}
.logo { font-size: 1.3rem; }
.topbar-left h1 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--on-surface);
}
.pro-badge {
  font-size: 0.55rem;
  font-weight: 700;
  background: var(--uber-black);
  color: var(--pure-white);
  padding: 2px 6px;
  border-radius: var(--radius-full);
  vertical-align: middle;
  border: 1px solid rgba(255,255,255,0.1);
}

.topbar-center { display: flex; align-items: center; }
.tagline {
  font-size: 0.75rem;
  color: var(--on-surface-muted);
  opacity: 0.7;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* ====== BUTTONS — Uber Pill Style ====== */
.btn {
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 10px 12px;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  transition: all 0.12s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  line-height: 1.25;
}

/* Primary Black — Uber's signature CTA */
.btn-primary {
  background: var(--uber-black);
  color: var(--pure-white);
  border: 1px solid rgba(255,255,255,0.1);
}
.btn-primary:hover:not(:disabled) {
  background: #1a1a1a;
}
.btn-primary:active:not(:disabled) {
  box-shadow: var(--shadow-pressed);
}

/* Secondary White — on dark surfaces */
.btn-secondary {
  background: var(--pure-white);
  color: var(--uber-black);
  border: 1px solid var(--uber-black);
}
.btn-secondary:hover {
  background: var(--hover-gray);
}
.btn-secondary:active {
  box-shadow: var(--shadow-pressed);
}
:root[data-theme="light"] .btn-secondary {
  background: var(--pure-white);
}

/* Ghost — minimal */
.btn-ghost {
  background: transparent;
  color: var(--on-surface-muted);
  padding: 6px 12px;
}
.btn-ghost:hover {
  background: var(--chip-bg);
  color: var(--on-surface);
}

/* Small variant */
.btn-sm {
  padding: 8px 10px;
  font-size: 0.75rem;
}

/* Icon button */
.btn-icon {
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-circle);
  transition: all 0.12s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--on-surface);
}
.btn-icon:hover { background: var(--surface-container-high); }
.btn:disabled { opacity: 0.3; cursor: not-allowed; transform: none !important; }

/* Navbar pill buttons */
.nav-btn {
  background: transparent;
  border: none;
  color: var(--on-surface-muted);
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-family: var(--font-body);
  font-weight: 500;
  transition: all 0.12s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.nav-btn:hover {
  background: var(--chip-bg);
  color: var(--on-surface);
}
.nav-btn .nav-icon { font-size: 1rem; }

/* ====== MAIN LAYOUT ====== */
.main-wrapper {
  padding-top: 56px;
  padding-bottom: 120px;
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.top-row {
  display: flex;
  gap: var(--space-lg);
  padding: var(--space-lg) var(--space-xl) 0;
}

.btn-icon-secondary {
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-full);
  transition: all 0.12s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--on-surface-muted);
}
.btn-icon-secondary:hover { background: var(--surface-container-high); color: var(--on-surface); }

/* ====== PLAYLIST SIDEBAR ====== */
.playlist-panel {
  width: 220px;
  min-width: 180px;
  background: var(--surface-container);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.playlist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-md);
  background: var(--surface-container-high);
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 600;
}
.playlist-list, .playlist-songs {
  padding: var(--space-xs);
  overflow-y: auto;
  max-height: 160px;
}
.playlist-empty {
  font-size: 0.7rem;
  color: var(--on-surface-muted);
  padding: var(--space-md) var(--space-sm);
  text-align: center;
  opacity: 0.7;
}
.playlist-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.12s;
  font-size: 0.75rem;
}
.playlist-item:hover { background: var(--surface-container-high); }
.playlist-item.active { background: var(--uber-black); color: var(--pure-white); }
.playlist-item .pl-icon { font-size: 0.85rem; }
.playlist-item .pl-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.playlist-item .pl-count { font-size: 0.62rem; color: var(--on-surface-muted); opacity: 0.7; }

.playlist-songs-header {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 5px 8px;
  border-top: 1px solid var(--border);
  margin-top: var(--space-xs);
  font-size: 0.75rem;
  font-weight: 600;
}
.playlist-current-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-del-playlist { color: var(--on-surface-muted); font-size: 0.65rem; background: none; border: none; cursor: pointer; padding: 2px 4px; border-radius: 3px; }
.btn-del-playlist:hover { color: var(--error); background: rgba(255, 69, 58, 0.1); }

.playlist-song-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.12s;
  font-size: 0.7rem;
}
.playlist-song-item:hover { background: var(--surface-container-high); }
.playlist-song-item.active { background: var(--uber-black); color: var(--pure-white); }
.playlist-song-item .ps-icon { font-size: 0.78rem; }
.playlist-song-item .ps-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.playlist-song-item .ps-menu {
  background: none; border: none; color: var(--on-surface-muted);
  cursor: pointer; font-size: 0.65rem; padding: 2px 4px; border-radius: 3px;
}
.playlist-song-item .ps-menu:hover { background: var(--surface-container-highest); color: var(--on-surface); }

.history-panel {
  border-top: 1px solid var(--border);
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  background: var(--surface-container-high);
  font-size: 0.72rem;
  font-weight: 600;
}
.history-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-xs);
  max-height: 180px;
}
.history-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 3px 6px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.65rem;
  color: var(--on-surface-muted);
  transition: background 0.1s;
}
.history-item:hover { background: var(--surface-container-high); }
.history-item .h-time { font-family: var(--font-mono); font-size: 0.6rem; color: var(--on-surface-muted); opacity: 0.6; min-width: 50px; }
.history-item .h-desc { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-item .h-restore { color: var(--on-surface); font-size: 0.62rem; opacity: 0.5; background: none; border: none; cursor: pointer; font-family: var(--font-mono); }
.history-item .h-restore:hover { opacity: 1; }

/* ====== DROP ZONE ====== */
.drop-zone {
  flex: 1;
  padding: var(--space-xl);
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-container);
  text-align: center;
  transition: all 0.2s ease;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  position: relative;
}
.drop-zone:hover {
  border-color: var(--on-surface);
  background: var(--surface-container-high);
}
.drop-zone.dragover {
  border-color: var(--on-surface);
  background: var(--uber-black);
  transform: scale(1.01);
}
:root[data-theme="light"] .drop-zone.dragover {
  background: #f0f0f0;
}
.drop-zone.loaded {
  border-style: solid;
  border-color: var(--green);
  padding: var(--space-md) var(--space-xl);
  min-height: auto;
}
.drop-content { display: flex; flex-direction: column; align-items: center; gap: var(--space-sm); }
.drop-icon {
  font-size: 2.2rem;
  opacity: 0.5;
  transition: transform 0.2s ease;
}
.drop-zone:hover .drop-icon { transform: scale(1.1); opacity: 0.8; }
.drop-text {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--on-surface-muted);
}
.drop-hint { font-size: 0.72rem; color: var(--on-surface-muted); opacity: 0.6; }
.linky {
  color: var(--on-surface);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.12s;
}
.linky:hover { opacity: 0.7; }

.drop-loaded {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  width: 100%;
}
.file-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}
.file-icon { font-size: 1.2rem; }
.file-size { font-size: 0.7rem; color: var(--on-surface-muted); opacity: 0.7; }
.file-actions { display: flex; align-items: center; gap: var(--space-xs); }

/* ====== MAIN GRID ====== */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: var(--space-lg);
  padding: var(--space-lg) var(--space-xl);
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ====== PANELS ====== */
.panel {
  background: var(--surface-container);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
}
.panel-visual { min-height: 0; }
.panel-effects { min-height: 0; overflow: hidden; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--surface-container-high);
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 600;
}
.panel-body {
  flex: 1;
  padding: var(--space-lg);
  overflow-y: auto;
}
.panel-effects .panel-body { padding: var(--space-md); }

/* ====== VISUALIZER ====== */
.panel-visual .panel-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}
.visual-canvas {
  width: 100%;
  height: 200px;
  border-radius: var(--radius-md);
  background: var(--uber-black);
  display: block;
  cursor: pointer;
  transition: opacity 0.2s;
}
.visual-canvas:hover { opacity: 0.9; }
.visual-canvas:active { cursor: grabbing; }

/* Analyzer Tabs — pill style */
.analyzer-tabs {
  display: flex;
  background: var(--chip-bg);
  border-radius: var(--radius-full);
  padding: 2px;
}
.tab-btn {
  background: transparent;
  border: none;
  color: var(--on-surface-muted);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.12s ease;
  font-family: var(--font-body);
}
.tab-btn:hover { color: var(--on-surface); }
.tab-btn.active {
  color: var(--pure-white);
  background: var(--uber-black);
}
:root[data-theme="light"] .tab-btn.active {
  color: var(--pure-white);
  background: var(--uber-black);
}

/* ====== EFFECTS CHAIN ====== */
.effects-chain {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.effect-card {
  background: var(--surface-container);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: all 0.12s ease;
}
.effect-card:hover {
  box-shadow: var(--shadow-elevated);
}
.effect-card:focus-within {
  box-shadow: var(--shadow-elevated);
}
.effect-card.bypassed {
  opacity: 0.4;
}

.effect-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  cursor: pointer;
  user-select: none;
  background: var(--surface-container-high);
}
.effect-icon { font-size: 0.9rem; }
.effect-name {
  font-size: 0.78rem;
  font-weight: 600;
  flex: 1;
  color: var(--on-surface);
}
.effect-dropdown { margin-right: auto; }
.effect-dropdown select {
  background: var(--uber-black);
  color: var(--pure-white);
  border: none;
  border-radius: var(--radius-full);
  padding: 4px 10px;
  font-size: 0.68rem;
  font-family: var(--font-body);
  cursor: pointer;
  outline: none;
  transition: opacity 0.12s;
}
.effect-dropdown select:hover { opacity: 0.85; }
.effect-dropdown select option { background: var(--uber-black); color: var(--pure-white); }

.effect-body {
  padding: var(--space-md) var(--space-lg) var(--space-lg);
  border-top: 1px solid var(--border-light);
}
.effect-card.collapsed .effect-body { display: none; }

/* ====== BYPASS TOGGLE — Uber minimal ====== */
.bypass-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.bypass-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.bypass-slider {
  width: 34px;
  height: 18px;
  background: var(--uber-black);
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  transition: all 0.12s ease;
  position: relative;
}
.bypass-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: var(--on-surface-muted);
  border-radius: 50%;
  transition: all 0.12s ease;
}
.bypass-toggle input:checked + .bypass-slider {
  background: var(--uber-black);
  border-color: var(--on-surface);
}
.bypass-toggle input:checked + .bypass-slider::after {
  background: var(--pure-white);
  transform: translateX(16px);
}

/* ====== PARAMETER SLIDERS ====== */
.param-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}
.param-row.four-col { grid-template-columns: repeat(4, 1fr); }
.param-row.three-col { grid-template-columns: repeat(3, 1fr); }
.param-row.nr-grid { grid-template-columns: repeat(3, 1fr); }

.param {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.param label {
  font-size: 0.62rem;
  color: var(--on-surface-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.param-val {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--on-surface);
  text-align: center;
  margin-top: 2px;
}

/* Range Slider — black thumb, white track */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  background: var(--surface-container-lowest);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
  border: 1px solid var(--border);
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: var(--radius-full);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--on-surface);
  border: 2px solid var(--uber-black);
  cursor: pointer;
  transition: all 0.1s ease;
  margin-top: -5px;
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--on-surface);
  border: 2px solid var(--uber-black);
  cursor: pointer;
}
input[type="range"]::-moz-range-track {
  height: 3px;
  background: var(--surface-container-lowest);
  border-radius: var(--radius-full);
}

/* ====== EQ BANDS ====== */
.eq-bands {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
}
.eq-band {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.eq-band label {
  font-size: 0.6rem;
  color: var(--on-surface-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.eq-val {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--on-surface);
}
.eq-band input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 60px;
  background: transparent;
  writing-mode: vertical-lr;
  direction: rtl;
  border: none;
}
.eq-band input[type="range"]::-webkit-slider-runnable-track {
  width: 3px;
  height: 100%;
  background: var(--surface-container-lowest);
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
}
.eq-band input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--on-surface);
  border: 2px solid var(--uber-black);
  margin-left: -6px;
}
.eq-curve-container {
  height: 70px;
  width: 100%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--uber-black);
  border: 1px solid var(--border);
  cursor: crosshair;
  position: relative;
  touch-action: none;
}
.eq-curve-container:hover {
  border-color: var(--on-surface);
}
.eq-curve-canvas { width: 100%; height: 100%; display: block; touch-action: none; }

/* ====== A/B TOGGLE ====== */
.ab-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
}
.ab-toggle input { position: absolute; opacity: 0; }
.ab-slider {
  display: flex;
  align-items: center;
  width: 48px;
  height: 24px;
  background: var(--uber-black);
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  position: relative;
  transition: all 0.12s;
  overflow: hidden;
}
.ab-label-a, .ab-label-b {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--on-surface-muted);
  flex: 1;
  text-align: center;
  transition: color 0.12s;
  z-index: 1;
}
.ab-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 18px;
  background: var(--pure-white);
  border-radius: var(--radius-full);
  transition: transform 0.12s ease;
}
.ab-toggle input:checked + .ab-slider::after { transform: translateX(24px); }
.ab-toggle input:checked + .ab-slider .ab-label-a { color: var(--on-surface-muted); }
.ab-toggle input:checked + .ab-slider .ab-label-b { color: var(--pure-white); }
.ab-toggle input:not(:checked) + .ab-slider .ab-label-a { color: var(--pure-white); }
.ab-toggle input:not(:checked) + .ab-slider .ab-label-b { color: var(--on-surface-muted); }
.ab-text {
  font-size: 0.7rem;
  color: var(--on-surface-muted);
  font-weight: 500;
}

/* ====== GR METER ====== */
.gr-meter-container {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  background: var(--uber-black);
  border-radius: var(--radius-sm);
}
.gr-label {
  font-size: 0.6rem;
  color: var(--on-surface-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-width: 75px;
}
.gr-track {
  flex: 1;
  height: 4px;
  background: var(--surface-container);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.gr-fill {
  height: 100%;
  background: var(--green);
  border-radius: var(--radius-full);
  transition: width 0.05s;
}
.gr-val {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--green);
  min-width: 38px;
  text-align: right;
}

/* ====== BOTTOM BAR ====== */
.bottombar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  padding: 6px var(--space-xl);
  gap: 4px;
  background: rgba(0, 0, 0, 0.95);
  border-top: 1px solid var(--border-light);
  z-index: 100;
  user-select: none;
}
:root[data-theme="light"] .bottombar {
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid var(--border-light);
}

.bottombar-row { display: flex; align-items: center; }

.bottombar-status {
  justify-content: space-between;
  height: 22px;
}
.bottombar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

#statusText {
  font-size: 0.7rem;
  color: #4b4b4b;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 340px;
}
:root[data-theme="dark"] #statusText,
:root:not([data-theme="light"]) #statusText {
  color: var(--on-surface-muted);
}

/* Loading bar */
.bottombar-actions .loading-bar {
  height: 3px;
  width: 64px;
  background: var(--uber-black);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.bottombar-actions .loading-fill {
  height: 100%;
  width: 0%;
  background: var(--on-surface);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.bottombar-player {
  height: 36px;
  gap: var(--space-sm);
}

/* Play button in footer — Uber black pill */
.bottombar-player .btn-icon {
  width: 30px;
  height: 30px;
  font-size: 1rem;
  background: var(--uber-black);
  color: var(--pure-white);
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  flex-shrink: 0;
}
.bottombar-player .btn-icon:hover {
  background: #1a1a1a;
}
.bottombar-player .btn-icon-secondary {
  width: 28px;
  height: 28px;
  font-size: 0.9rem;
  flex-shrink: 0;
  color: var(--on-surface-muted);
}

.player-time {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--on-surface-muted);
  min-width: 68px;
  white-space: nowrap;
  flex-shrink: 0;
}

.player-seek {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 80px;
}

.bottombar-player .seek-bar {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--uber-black);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
  border: none;
}
.bottombar-player .seek-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--on-surface);
  border: 2px solid var(--uber-black);
  cursor: pointer;
  transition: all 0.1s;
}
.bottombar-player .seek-bar::-webkit-slider-thumb:hover {
  transform: scale(1.3);
}
.bottombar-player .seek-bar::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--on-surface);
  border: 2px solid var(--uber-black);
  cursor: pointer;
}
.bottombar-player .seek-bar::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: var(--radius-full);
}
.bottombar-player .seek-time {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--on-surface-muted);
  opacity: 0.55;
}

/* Master meter */
.bottombar-player .master-meter {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  max-width: 150px;
  min-width: 100px;
  flex-shrink: 0;
}
.bottombar-player .meter-track {
  flex: 1;
  height: 4px;
  background: var(--uber-black);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.bottombar-player .meter-fill {
  height: 100%;
  background: var(--on-surface);
  border-radius: var(--radius-full);
  transition: width 0.05s;
}
.bottombar-player .meter-label {
  font-size: 0.6rem;
  color: var(--on-surface-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.bottombar-player .meter-db {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--on-surface-muted);
  min-width: 38px;
  text-align: right;
}

/* ====== PER-GROUP RESET ====== */
.btn-reset-group {
  background: transparent;
  border: none;
  color: var(--on-surface-muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: all 0.12s ease;
  line-height: 1;
  opacity: 0.35;
}
.btn-reset-group:hover {
  color: var(--on-surface);
  background: var(--surface-container);
  opacity: 1;
  transform: rotate(-30deg);
}
.effect-card.bypassed .btn-reset-group { opacity: 0.15; }

/* ====== INFO BUTTON ====== */
.btn-info {
  background: transparent;
  border: none;
  color: var(--on-surface-muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: all 0.12s ease;
  line-height: 1;
  opacity: 0.5;
}
.btn-info:hover {
  color: var(--on-surface);
  background: var(--surface-container);
  opacity: 1;
}

/* ====== TOOLTIP ====== */
.custom-tooltip {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  max-width: 340px;
  background: var(--uber-black);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  box-shadow: var(--shadow-elevated);
  opacity: 0;
  transition: opacity 0.12s ease;
  font-size: 0.75rem;
  line-height: 1.5;
}
.custom-tooltip.visible { opacity: 1; }
:root[data-theme="light"] .custom-tooltip {
  background: var(--pure-white);
  border-color: var(--uber-black);
}
.custom-tooltip .tip-title {
  font-weight: 700;
  color: var(--on-surface);
  font-size: 0.8rem;
  margin-bottom: var(--space-xs);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.custom-tooltip .tip-title .tip-effect {
  font-weight: 400;
  color: var(--on-surface-muted);
  font-size: 0.68rem;
}
.custom-tooltip .tip-desc { color: var(--on-surface); opacity: 0.85; }

/* Tip Panel */
.tip-panel-overlay {
  position: fixed;
  inset: 0;
  z-index: 998;
  background: rgba(0, 0, 0, 0.5);
  display: none;
}
.tip-panel-overlay:not([hidden]) { display: block; }

.tip-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 999;
  max-width: 460px;
  width: 90%;
  background: var(--uber-black);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-elevated);
  padding: var(--space-xl) var(--space-xl);
  display: none;
}
.tip-panel:not([hidden]) { display: block; }
:root[data-theme="light"] .tip-panel {
  background: var(--pure-white);
  border-color: var(--uber-black);
}
.tip-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--on-surface);
}
.tip-panel-close {
  background: transparent;
  border: none;
  color: var(--on-surface-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.12s;
}
.tip-panel-close:hover { background: var(--surface-container-high); color: var(--on-surface); }
.tip-panel-body { font-size: 0.8rem; color: var(--on-surface-muted); line-height: 1.7; }
.tip-panel-body p { margin-bottom: var(--space-sm); }
.tip-panel-body ul { padding-left: 18px; margin-bottom: var(--space-sm); }
.tip-panel-body li { margin-bottom: var(--space-xs); }
.tip-panel-body strong { color: var(--on-surface); }

/* ====== MODAL (Presets) ====== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  display: none;
}
.modal-overlay:not([hidden]) { display: flex; }

.modal {
  background: var(--uber-black);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  width: 90%;
  max-width: 580px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-elevated);
}
:root[data-theme="light"] .modal {
  background: var(--pure-white);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--on-surface);
}
.modal-body { padding: var(--space-xl); }

.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}
.preset-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-md);
  background: var(--surface-container);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.12s ease;
  font-family: var(--font-body);
  color: var(--on-surface);
}
.preset-card:hover {
  border-color: var(--on-surface);
  background: var(--surface-container-high);
  transform: translateY(-1px);
}
.preset-icon { font-size: 1.4rem; }
.preset-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--on-surface);
}
.preset-desc {
  font-size: 0.65rem;
  color: var(--on-surface-muted);
  text-align: center;
  opacity: 0.7;
}

.save-preset-section {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border);
}
.save-preset-input {
  flex: 1;
  background: var(--surface-container);
  color: var(--on-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 0.8rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.12s;
}
.save-preset-input:focus {
  border-color: var(--on-surface);
}
.save-preset-input::placeholder {
  color: var(--on-surface-muted);
  opacity: 0.5;
}

.preset-section-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--on-surface-muted);
  margin: var(--space-lg) 0 var(--space-sm);
  padding: 0 2px;
}
.preset-section-label:first-of-type { margin-top: 0; }

.custom-presets-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.custom-preset-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}
.custom-preset-item .preset-card {
  flex: 1;
  flex-direction: row;
  padding: var(--space-sm) var(--space-md);
}
.custom-preset-item .preset-icon { font-size: 0.95rem; }
.custom-preset-item .preset-name { font-size: 0.75rem; }

.btn-delete-preset {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--on-surface-muted);
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}
.btn-delete-preset:hover {
  color: var(--error);
  border-color: var(--error);
  background: rgba(255, 69, 58, 0.08);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--on-surface-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.12s;
  font-family: var(--font-body);
}
.modal-close:hover { background: var(--surface-container); color: var(--on-surface); }

/* ====== TRY DEMO BUTTON ====== */
.btn-demo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 12px 24px;
  background: var(--uber-black);
  color: var(--pure-white);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-floating);
  margin-top: var(--space-md);
}
.btn-demo:hover {
  background: #1a1a1a;
  transform: translateY(-1px);
}
.btn-demo:active {
  transform: translateY(0);
  box-shadow: var(--shadow-pressed);
}

.demo-btn-icon { font-size: 1.3rem; line-height: 1; }
.demo-btn-text { font-size: 0.95rem; }
.demo-btn-hint {
  display: block;
  font-size: 0.6rem;
  font-weight: 500;
  opacity: 0.7;
  font-family: var(--font-body);
}

/* ====== AI ONBOARDING ====== */
.ai-boarding {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.ai-boarding.visible { opacity: 1; }

.ai-boarding-content {
  position: relative;
  background: var(--uber-black);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-2xl) var(--space-xl) var(--space-xl);
  max-width: 460px;
  width: 90%;
  box-shadow: var(--shadow-elevated);
  text-align: center;
  transform: translateY(20px);
  transition: transform 0.2s ease;
}
:root[data-theme="light"] .ai-boarding-content {
  background: var(--pure-white);
}
.ai-boarding.visible .ai-boarding-content { transform: translateY(0); }

.ai-boarding-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  background: transparent;
  border: none;
  color: var(--on-surface-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.12s;
}
.ai-boarding-close:hover { background: var(--surface-container); color: var(--on-surface); }

.ai-boarding-icon { font-size: 2.5rem; margin-bottom: var(--space-md); }
.ai-boarding-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--on-surface);
  margin-bottom: var(--space-lg);
}
.ai-boarding-steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  text-align: left;
}
.ai-boarding-step {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--surface-container);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--on-surface);
}
.ai-boarding-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--pure-white);
  color: var(--uber-black);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ====== BOTTOMBAR CREATOR FOOTER ====== */
.bottombar-creator {
  height: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-body);
  font-size: 0.62rem;
  letter-spacing: 0.03em;
  color: var(--on-surface-muted);
  border-top: 1px solid var(--border-light);
  padding-top: 2px;
  margin-top: -1px;
  user-select: none;
}
.footer-left {
  display: flex;
  align-items: center;
  gap: 6px;
}
.footer-brand {
  font-weight: 700;
  color: var(--on-surface);
  font-family: var(--font-display);
  font-size: 0.65rem;
}
.footer-separator { color: var(--on-surface-muted); opacity: 0.3; }
.footer-dev {
  color: var(--on-surface-muted);
  font-size: 0.6rem;
}
.footer-dev strong {
  color: var(--on-surface);
}
.footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.footer-contact-title {
  font-weight: 600;
  color: var(--on-surface-muted);
  font-size: 0.55rem;
  opacity: 0.75;
}
.footer-link {
  color: var(--on-surface-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  cursor: pointer;
  border-radius: 4px;
  padding: 2px;
}
.footer-link:hover {
  color: var(--on-surface);
  transform: translateY(-1px);
}
.footer-icon-svg {
  display: block;
  pointer-events: none;
}

/* ====== MODE SELECTOR (Topbar) ====== */
.mode-select-topbar {
  display: flex;
  gap: 1px;
  background: var(--uber-black);
  border-radius: var(--radius-full);
  padding: 2px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.mode-btn {
  background: transparent;
  border: none;
  color: var(--on-surface-muted);
  font-size: 0.75rem;
  min-width: 28px;
  height: 24px;
  padding: 0 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.12s ease;
  line-height: 1;
  font-family: var(--font-mono);
  font-weight: 600;
}
.mode-btn:hover {
  color: var(--on-surface);
}
.mode-btn.active {
  color: var(--pure-white);
  background: var(--uber-black);
  border: 1px solid rgba(255,255,255,0.15);
}

/* ====== KNOB CONTROL ====== */
.knob-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.knob-canvas {
  width: 48px;
  height: 48px;
  cursor: ns-resize;
  display: block;
}
.knob-val {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--on-surface);
  line-height: 1;
  white-space: nowrap;
}

/* ====== NUMBER INPUT ====== */
.param-number-input {
  width: 100%;
  background: var(--uber-black);
  color: var(--on-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-size: 0.68rem;
  font-family: var(--font-mono);
  text-align: center;
  outline: none;
  transition: border-color 0.12s;
}
.param-number-input:focus {
  border-color: var(--on-surface);
}
.param-number-input::-webkit-inner-spin-button,
.param-number-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.param-number-input[type=number] {
  -moz-appearance: textfield;
}

/* ====== ANIMATIONS ====== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.panel { animation: fadeIn 0.25s ease-out; }
.effect-card { animation: slideUp 0.2s ease-out; }
.effect-card:nth-child(2) { animation-delay: 0.03s; }
.effect-card:nth-child(3) { animation-delay: 0.06s; }
.effect-card:nth-child(4) { animation-delay: 0.09s; }
.effect-card:nth-child(5) { animation-delay: 0.12s; }
.effect-card:nth-child(6) { animation-delay: 0.15s; }
.effect-card:nth-child(7) { animation-delay: 0.18s; }
.effect-card:nth-child(8) { animation-delay: 0.21s; }

/* ====== RESPONSIVE ====== */
@media (max-width: 1024px) {
  .main-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
  }
  .top-row { padding: var(--space-md) var(--space-lg) 0; }
  .param-row.four-col { grid-template-columns: repeat(2, 1fr); }
  .tagline { display: none; }
  .bottombar-player .master-meter { max-width: 110px; min-width: 80px; }
  .player-time { min-width: 56px; font-size: 0.65rem; }
  #statusText { max-width: 200px; }
}

@media (max-width: 768px) {
  .top-row { flex-direction: column; gap: var(--space-md); padding: var(--space-md) var(--space-md) 0; }
  .playlist-panel { width: 100%; max-height: 200px; }
  .main-grid { padding: var(--space-md); gap: var(--space-md); }
  .topbar { padding: 0 var(--space-md); }
  .topbar-left h1 { font-size: 0.9rem; }
  .nav-btn { padding: 4px 8px; font-size: 0.72rem; }
  .bottombar { padding: 5px var(--space-md); gap: 3px; }
  .main-wrapper { padding-bottom: 110px; }
  .bottombar-status { height: 20px; }
  .bottombar-player { height: 32px; gap: 6px; }
  .bottombar-player .btn-icon { width: 26px; height: 26px; font-size: 0.9rem; }
  .bottombar-player .btn-icon-secondary { width: 24px; height: 24px; font-size: 0.8rem; }
  .player-time { min-width: 50px; font-size: 0.6rem; }
  .bottombar-player .master-meter { max-width: 90px; min-width: 60px; }
  .bottombar-player .meter-label { display: none; }
  .bottombar-actions .loading-bar { display: none; }
  #statusText { max-width: 140px; font-size: 0.65rem; }
  .bottombar-creator { height: 24px; font-size: 0.55rem; }
  .bottombar-creator .footer-brand { font-size: 0.58rem; }
  .bottombar-creator .footer-dev { font-size: 0.52rem; }
  .bottombar-creator .footer-contact-title { font-size: 0.48rem; }
  .preset-grid { grid-template-columns: 1fr; }
  .panel-body { padding: var(--space-md); }
}

@media (max-width: 480px) {
  .topbar-left h1 span { display: none; }
  .nav-btn .nav-label { display: none; }
  .nav-btn { padding: 6px; }
  .bottombar-actions .btn-sm span { display: none; }
  .bottombar-actions .btn { padding: 4px 8px; font-size: 0.65rem; }
  .param-row, .param-row.four-col, .param-row.three-col, .param-row.nr-grid { grid-template-columns: 1fr 1fr; }
  .drop-zone { padding: var(--space-lg); }
  .drop-icon { font-size: 1.8rem; }
  .drop-text { font-size: 0.85rem; }
  .effect-header { padding: var(--space-sm) var(--space-md); }
  .effect-body { padding: var(--space-sm) var(--space-md) var(--space-md); }
  .modal { width: 95%; }
  .modal-body { padding: var(--space-lg); }
  .bottombar-player .master-meter { max-width: 70px; min-width: 50px; }
  .bottombar-player .meter-db { font-size: 0.55rem; min-width: 30px; }
  #statusText { max-width: 100px; }
}

/* ================================================
   ====== MOBILE-FIRST PWA UI ======
   ================================================ */

.mobile-tab-bar, .mobile-views, .mini-player { display: none; }

@media (max-width: 1023px) {
  .top-row, .main-wrapper, .topbar, .bottombar, .main-grid { display: none; }
  
  body {
    padding-bottom: 64px;
    min-height: 100dvh;
    overflow: hidden;
  }
  
  /* Tab Bar */
  .mobile-tab-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(0, 0, 0, 0.95);
    border-top: 1px solid var(--border-light);
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom, 0);
    user-select: none;
  }
  :root[data-theme="light"] .mobile-tab-bar {
    background: rgba(255, 255, 255, 0.95);
  }
  
  .mobile-tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: transparent;
    border: none;
    color: var(--on-surface-muted);
    font-size: 0.55rem;
    font-family: var(--font-body);
    font-weight: 500;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    transition: all 0.12s ease;
    min-width: 56px;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-tab-btn .tab-icon { font-size: 1.3rem; line-height: 1; }
  .mobile-tab-btn .tab-label { font-size: 0.55rem; }
  .mobile-tab-btn.active { color: var(--on-surface); }
  .mobile-tab-btn:active { transform: scale(0.92); }
  
  /* Views Container */
  .mobile-views {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 64px;
    padding-bottom: env(safe-area-inset-bottom, 0);
    z-index: 10;
  }
  .mobile-view {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    background: var(--surface-dim);
  }
  .mobile-view[hidden] { display: none; }
  
  /* Player View */
  #playerView {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
    gap: var(--space-lg);
  }
  #playerView[hidden] { display: none; }
  
  .player-artwork {
    width: 260px;
    height: 260px;
    max-width: 80vw;
    max-height: 40vh;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--uber-black);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  .artwork-placeholder { font-size: 4rem; opacity: 0.6; }
  
  .player-track-info { text-align: center; width: 100%; max-width: 360px; }
  .player-track-name {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--on-surface);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
  }
  .player-track-artist { font-size: 0.8rem; color: var(--on-surface-muted); opacity: 0.7; }
  
  .player-seek-section {
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
  }
  .seek-bar-lg {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: var(--uber-black);
    border-radius: var(--radius-full);
    outline: none;
    cursor: pointer;
    border: none;
  }
  .seek-bar-lg::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--on-surface);
    border: 2px solid var(--uber-black);
    cursor: pointer;
    transition: transform 0.1s;
  }
  .seek-bar-lg::-webkit-slider-thumb:active { transform: scale(1.2); }
  .seek-bar-lg::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--on-surface);
    border: 2px solid var(--uber-black);
    cursor: pointer;
  }
  .seek-times {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--on-surface-muted);
    opacity: 0.6;
  }
  
  .player-controls { display: flex; align-items: center; gap: var(--space-xl); }
  .ctrl-btn {
    width: 48px;
    height: 48px;
    border: none;
    background: transparent;
    color: var(--on-surface);
    font-size: 1.4rem;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.12s ease;
    -webkit-tap-highlight-color: transparent;
  }
  .ctrl-btn:active { transform: scale(0.9); }
  .ctrl-btn-play {
    width: 64px;
    height: 64px;
    background: var(--uber-black);
    color: var(--pure-white);
    font-size: 1.8rem;
    border: 1px solid rgba(255,255,255,0.15);
  }
  
  .player-extras { display: flex; align-items: center; gap: var(--space-md); }
  .ctrl-btn-sm {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--on-surface-muted);
    font-size: 1rem;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.12s;
    opacity: 0.7;
    -webkit-tap-highlight-color: transparent;
  }
  .ctrl-btn-sm:active { opacity: 1; background: var(--surface-container-high); }
  
  /* Effects Sheet */
  #effectsSheet {
    z-index: 100;
    background: var(--surface-dim);
    display: flex;
    flex-direction: column;
    padding-top: 0;
    overflow: hidden !important; /* override .mobile-view overflow-y:auto — let body scroll instead */
  }
  #effectsSheet[hidden] { display: none; }
  
  .effects-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    background: rgba(0, 0, 0, 0.95);
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9rem;
    font-weight: 700;
    position: sticky;
    top: 0;
    z-index: 10;
  }
  :root[data-theme="light"] .effects-sheet-header {
    background: rgba(255, 255, 255, 0.95);
  }
  
  .effects-sheet-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--on-surface-muted);
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.12s;
  }
  .effects-sheet-close:active { background: var(--surface-container-high); }
  
  .effects-sheet-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
    -webkit-overflow-scrolling: touch;
  }
  .effects-sheet-body .effect-card { margin-bottom: var(--space-sm); }
  .effects-sheet-body .param-row { grid-template-columns: 1fr 1fr; }
  .effects-sheet-body .param-row.four-col { grid-template-columns: 1fr 1fr; }
  .effects-sheet-body .param-row.nr-grid { grid-template-columns: 1fr 1fr; }
  .effects-sheet-body .eq-bands { gap: var(--space-xs); }
  .effects-sheet-body .eq-band input[type="range"] { height: 80px; }
  
  /* Library View */
  #libraryView { padding: var(--space-md); }
  #libraryView[hidden] { display: none; }
  
  .library-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
    padding: var(--space-sm) 0;
  }
  .library-header h3 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
  }
  .library-actions { display: flex; gap: var(--space-xs); }
  .library-input-area { margin-bottom: var(--space-md); }
  .library-drop-hint {
    font-size: 0.7rem;
    color: var(--on-surface-muted);
    opacity: 0.6;
    text-align: center;
    padding: var(--space-md);
  }
  .library-empty {
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
    color: var(--on-surface-muted);
    font-size: 0.78rem;
    opacity: 0.6;
  }
  .library-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.12s;
    margin-bottom: 4px;
    background: var(--surface-container);
    border: 1px solid var(--border);
    -webkit-tap-highlight-color: transparent;
  }
  .library-item:active { background: var(--surface-container-high); transform: scale(0.98); }
  .library-item.active { border-color: var(--on-surface); background: var(--uber-black); }
  .library-item.active .lib-name { color: var(--pure-white); }
  
  .lib-icon { font-size: 1.2rem; flex-shrink: 0; }
  .lib-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .lib-name { font-size: 0.78rem; font-weight: 600; color: var(--on-surface); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .lib-size { font-size: 0.6rem; color: var(--on-surface-muted); opacity: 0.6; font-family: var(--font-mono); }
  .lib-actions { display: flex; gap: var(--space-xs); flex-shrink: 0; }
  .lib-play-btn, .lib-remove-btn {
    width: 32px; height: 32px; border: none; background: transparent;
    font-size: 0.9rem; cursor: pointer; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.12s; -webkit-tap-highlight-color: transparent;
  }
  .lib-play-btn:active { background: var(--surface-container); }
  .lib-remove-btn { color: var(--error); opacity: 0.5; }
  .lib-remove-btn:active { opacity: 1; background: rgba(255, 69, 58, 0.1); }
  
  /* Settings View */
  #settingsView { padding: var(--space-md); }
  #settingsView[hidden] { display: none; }
  .settings-header h3 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: var(--space-md);
  }
  .settings-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
  }
  .settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    background: var(--surface-container);
    font-size: 0.8rem;
    gap: var(--space-sm);
  }
  :root[data-theme="light"] .settings-item { background: var(--pure-white); }
  
  .settings-select {
    background: var(--uber-black);
    color: var(--pure-white);
    border: none;
    border-radius: var(--radius-full);
    padding: 4px 10px;
    font-size: 0.7rem;
    font-family: var(--font-body);
  }
  .mode-select-inline {
    display: flex;
    gap: 1px;
    background: var(--uber-black);
    border-radius: var(--radius-full);
    padding: 2px;
    border: 1px solid var(--border);
  }
  .mode-select-inline .mode-btn { min-width: 30px; height: 26px; font-size: 0.8rem; }
  
  .settings-about .about-version {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--on-surface-muted);
    opacity: 0.5;
  }
  .settings-footer {
    text-align: center;
    padding: var(--space-lg);
    font-size: 0.68rem;
    color: var(--on-surface-muted);
    opacity: 0.6;
  }
  .settings-footer strong { color: var(--on-surface); }
  .settings-pwa-status {
    margin-top: var(--space-sm);
    font-size: 0.6rem;
    color: var(--green);
    opacity: 0.8;
  }
  
  /* Mini Player */
  .mini-player {
    display: flex;
    position: fixed;
    bottom: 64px;
    left: 0;
    right: 0;
    height: 48px;
    background: rgba(0, 0, 0, 0.95);
    border-top: 1px solid var(--border-light);
    z-index: 999;
    align-items: center;
    padding: 0 var(--space-md);
    gap: var(--space-sm);
    cursor: pointer;
    user-select: none;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  :root[data-theme="light"] .mini-player {
    background: rgba(255, 255, 255, 0.95);
  }
  .mini-player[hidden] { display: none !important; }
  
  .mini-info { display: flex; align-items: center; gap: var(--space-sm); flex: 1; min-width: 0; }
  .mini-icon { font-size: 1rem; flex-shrink: 0; }
  .mini-name {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--on-surface);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mini-controls { flex-shrink: 0; }
  .mini-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--uber-black);
    color: var(--pure-white);
    font-size: 0.85rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,0.15);
    transition: all 0.12s;
    -webkit-tap-highlight-color: transparent;
  }
  .mini-btn:active { transform: scale(0.9); }
  .mini-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 0%;
    background: var(--on-surface);
    transition: width 0.3s;
  }
  
  /* Mobile Preset Modal */
  @media (max-width: 480px) {
    .modal { max-width: 100%; width: 100%; max-height: 90vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; margin-top: auto; }
    .modal-overlay { align-items: flex-end; }
    .preset-grid { grid-template-columns: 1fr 1fr; }
  }
}
