/* ============================================================
   AUDIO GENERATOR — DESIGN SYSTEM & STYLES
   Premium dark theme with glassmorphism & neon accents
   ============================================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Backgrounds */
  --bg-primary: #060609;
  --bg-secondary: #0c0c14;
  --bg-card: rgba(12, 12, 22, 0.75);
  --bg-card-hover: rgba(18, 18, 32, 0.85);
  --bg-input: rgba(15, 15, 28, 0.9);
  --bg-overlay: rgba(0, 0, 0, 0.6);

  /* Accent Colors */
  --accent-cyan: #00e5ff;
  --accent-cyan-dim: rgba(0, 229, 255, 0.15);
  --accent-cyan-glow: rgba(0, 229, 255, 0.35);
  --accent-purple: #8b5cf6;
  --accent-purple-dim: rgba(139, 92, 246, 0.15);
  --accent-purple-glow: rgba(139, 92, 246, 0.35);
  --accent-green: #10b981;
  --accent-green-dim: rgba(16, 185, 129, 0.15);
  --accent-amber: #f59e0b;
  --accent-amber-dim: rgba(245, 158, 11, 0.15);
  --accent-red: #ef4444;
  --accent-red-dim: rgba(239, 68, 68, 0.15);

  /* Text */
  --text-primary: #f0f0f5;
  --text-secondary: #a1a1aa;
  --text-muted: #52525b;
  --text-accent: var(--accent-cyan);

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.1);
  --border-active: rgba(0, 229, 255, 0.3);

  /* Shadows & Glows */
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --glow-cyan: 0 0 20px rgba(0, 229, 255, 0.25), 0 0 60px rgba(0, 229, 255, 0.1);
  --glow-purple: 0 0 20px rgba(139, 92, 246, 0.25), 0 0 60px rgba(139, 92, 246, 0.1);
  --glow-green: 0 0 20px rgba(16, 185, 129, 0.25);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

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

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Smooth transitions for theme switching */
body, 
.glass-card, 
.action-btn, 
.preset-btn, 
.piano-key,
.page-tab,
.bb-preset-card,
.theme-dot,
.bb-preset-freq,
.bb-preset-header {
  transition: background 0.4s var(--ease-out),
              background-color 0.4s var(--ease-out),
              border-color 0.4s var(--ease-out),
              color 0.4s var(--ease-out),
              box-shadow 0.4s var(--ease-out),
              transform 0.25s var(--ease-out);
}

/* Background grid + gradient */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 800px 600px at 20% 10%, rgba(0, 229, 255, 0.04), transparent),
    radial-gradient(ellipse 600px 400px at 80% 80%, rgba(139, 92, 246, 0.04), transparent);
  pointer-events: none;
  z-index: 0;
}

/* ---------- Layout ---------- */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md);
}

/* ---------- Header ---------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) 0;
  margin-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
}

.app-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
}

.app-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: var(--glow-cyan);
}

.app-logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.app-logo-text span {
  color: var(--text-muted);
  font-weight: 400;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* ---------- Hero Section ---------- */
.hero-section {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.hero-title {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: var(--space-sm);
  background: linear-gradient(135deg, var(--text-primary), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* ---------- Glass Card ---------- */
.glass-card {
  position: relative;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-lg);
  transition: border-color var(--duration-normal) var(--ease-out),
              box-shadow var(--duration-normal) var(--ease-out);
  overflow: hidden;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    350px circle at var(--mouse-x, 0px) var(--mouse-y, 0px),
    rgba(255, 255, 255, 0.04),
    transparent 60%
  );
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.3s var(--ease-out);
}

.glass-card:hover::before {
  opacity: 1;
}

.glass-card > * {
  position: relative;
  z-index: 1;
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow-card), 0 0 20px var(--accent-cyan-dim);
}

.glass-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.glass-card-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

/* ---------- Main Bento Grid ---------- */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.main-grid .visualizer-card {
  grid-column: 1 / -1;
}

.main-grid .play-controls-card {
  grid-column: 1 / -1;
}

@media (min-width: 769px) {
  .main-grid .waveform-card {
    grid-row: span 2;
  }
}

/* ---------- Visualizer ---------- */
.visualizer-card {
  position: relative;
  overflow: hidden;
  padding: var(--space-md);
}

.visualizer-wrapper {
  position: relative;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.visualizer-canvas {
  width: 100% !important;
  max-width: 100% !important;
  height: 200px;
  display: block;
}

.visualizer-tabs {
  display: flex;
  gap: var(--space-xs);
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  z-index: 2;
}

.viz-tab {
  padding: 4px 12px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.5);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.viz-tab:hover {
  color: var(--text-secondary);
  border-color: var(--border-default);
}

.viz-tab.active {
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
  background: var(--accent-cyan-dim);
}

.visualizer-overlay-info {
  position: absolute;
  bottom: var(--space-sm);
  left: var(--space-sm);
  display: flex;
  gap: var(--space-md);
  z-index: 2;
}

.viz-info-item {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.5);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.viz-info-item strong {
  color: var(--accent-cyan);
}

/* ---------- Play Controls ---------- */
.play-controls-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  padding: var(--space-lg) var(--space-xl);
}

.play-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid var(--accent-cyan);
  background: var(--accent-cyan-dim);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.5rem;
  transition: all var(--duration-normal) var(--ease-spring);
  position: relative;
  flex-shrink: 0;
}

.play-btn::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid rgba(0, 229, 255, 0.1);
  transition: all var(--duration-normal) var(--ease-out);
}

.play-btn:hover {
  background: rgba(0, 229, 255, 0.25);
  box-shadow: var(--glow-cyan);
  transform: scale(1.08);
}

.play-btn:hover::before {
  border-color: rgba(0, 229, 255, 0.3);
  inset: -8px;
}

.play-btn:active {
  transform: scale(0.95);
}

.play-btn.playing {
  border-color: var(--accent-green);
  background: var(--accent-green-dim);
  color: var(--accent-green);
  box-shadow: var(--glow-green);
  animation: pulse-ring 2s ease-out infinite;
}

.play-btn.playing::before {
  border-color: rgba(16, 185, 129, 0.2);
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.3); }
  70% { box-shadow: 0 0 0 12px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.play-btn svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

/* Frequency Display */
.freq-display {
  text-align: center;
  flex-shrink: 0;
}

.freq-value {
  font-family: var(--font-mono);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1;
  cursor: pointer;
  transition: color var(--duration-fast);
}

.freq-value:hover {
  color: var(--accent-cyan);
}

.freq-unit {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 4px;
}

.freq-note {
  font-size: 0.8rem;
  color: var(--accent-purple);
  font-weight: 500;
  margin-top: 4px;
}

/* Play side controls */
.play-side-controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.octave-btn {
  padding: 6px 14px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.octave-btn:hover {
  border-color: var(--accent-purple);
  color: var(--accent-purple);
  background: var(--accent-purple-dim);
}

/* ---------- Slider Controls ---------- */
.control-group {
  margin-bottom: var(--space-md);
}

.control-group:last-child {
  margin-bottom: 0;
}

.control-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}

.control-label-text {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.control-label-value {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent-cyan);
  background: var(--accent-cyan-dim);
  padding: 2px 10px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(0, 229, 255, 0.15);
}

/* Custom Range Slider */
.range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
  position: relative;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-cyan);
  border: 2px solid var(--bg-primary);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-spring),
              box-shadow var(--duration-fast);
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.5);
}

.range-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-cyan);
  border: 2px solid var(--bg-primary);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
  cursor: pointer;
}

.range-slider.purple::-webkit-slider-thumb {
  background: var(--accent-purple);
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
}

.range-slider.purple::-moz-range-thumb {
  background: var(--accent-purple);
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
}

.range-slider-marks {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* ---------- Waveform Selector ---------- */
.waveform-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-sm);
}

.wave-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: var(--space-sm) var(--space-xs);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.wave-btn:hover {
  border-color: var(--border-default);
  color: var(--text-secondary);
  background: var(--bg-card-hover);
}

.wave-btn.active {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: var(--accent-cyan-dim);
  box-shadow: inset 0 0 20px rgba(0, 229, 255, 0.05);
}

.wave-btn svg {
  width: 40px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.wave-btn-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---------- Presets ---------- */
.presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: var(--space-sm);
}

.preset-btn {
  padding: 8px 12px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  text-align: center;
  transition: all var(--duration-fast) var(--ease-out);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preset-btn:hover {
  border-color: var(--accent-purple);
  color: var(--accent-purple);
  background: var(--accent-purple-dim);
  transform: translateY(-1px);
}

.preset-btn.active {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: var(--accent-cyan-dim);
}

/* ---------- ADSR Envelope ---------- */
.adsr-controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-sm);
}

.adsr-knob {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.adsr-knob label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.adsr-knob input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
}

.adsr-knob input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-amber);
  border: 2px solid var(--bg-primary);
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
  cursor: pointer;
}

.adsr-knob input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-amber);
  border: 2px solid var(--bg-primary);
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
  cursor: pointer;
}

.adsr-value {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-amber);
}

/* ADSR Canvas */
.adsr-canvas-wrapper {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: var(--space-sm);
}

.adsr-canvas {
  width: 100% !important;
  max-width: 100% !important;
  height: 60px;
  display: block;
}

/* ---------- Timer ---------- */
.timer-controls {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.timer-btn {
  padding: 6px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.timer-btn:hover {
  border-color: var(--accent-amber);
  color: var(--accent-amber);
}

.timer-btn.active {
  background: var(--accent-amber-dim);
  border-color: var(--accent-amber);
  color: var(--accent-amber);
}

.timer-display {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-amber);
  padding: 4px 12px;
  background: var(--accent-amber-dim);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

/* ---------- Export & Share ---------- */
.action-buttons {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.action-btn:hover {
  border-color: var(--border-default);
  color: var(--text-primary);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.action-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.action-btn.primary {
  background: var(--accent-cyan-dim);
  border-color: rgba(0, 229, 255, 0.2);
  color: var(--accent-cyan);
}

.action-btn.primary:hover {
  background: rgba(0, 229, 255, 0.25);
  border-color: var(--accent-cyan);
  box-shadow: var(--glow-cyan);
}

/* ---------- Icon Buttons ---------- */
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.icon-btn:hover {
  border-color: var(--border-default);
  color: var(--text-secondary);
  background: var(--bg-card-hover);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* ---------- Keyboard Shortcuts Overlay ---------- */
.shortcuts-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal) var(--ease-out);
}

.shortcuts-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.shortcuts-modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.shortcuts-modal h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: var(--space-lg);
  color: var(--text-primary);
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.shortcut-row:last-child {
  border-bottom: none;
}

.shortcut-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.shortcut-keys {
  display: flex;
  gap: 4px;
}

kbd {
  display: inline-block;
  padding: 3px 8px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-default);
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ---------- Safety Warning ---------- */
.safety-warning {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--accent-amber-dim);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
}

.safety-warning-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.safety-warning-text {
  font-size: 0.8rem;
  color: rgba(245, 158, 11, 0.9);
  line-height: 1.5;
}

.safety-warning-text strong {
  color: var(--accent-amber);
}

.safety-warning .dismiss-btn {
  margin-left: auto;
  flex-shrink: 0;
  background: none;
  border: none;
  color: rgba(245, 158, 11, 0.5);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0;
  line-height: 1;
}

.safety-warning .dismiss-btn:hover {
  color: var(--accent-amber);
}

/* ---------- Footer ---------- */
.app-footer {
  text-align: center;
  padding: var(--space-2xl) 0 var(--space-lg);
  border-top: 1px solid var(--border-subtle);
  margin-top: var(--space-2xl);
}

.footer-text {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-text a {
  color: var(--accent-cyan);
  text-decoration: none;
}

.footer-text a:hover {
  text-decoration: underline;
}

/* ---------- Tooltip ---------- */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  font-size: 0.7rem;
  font-weight: 500;
  white-space: nowrap;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-fast);
  z-index: 100;
}

[data-tooltip]:hover::after {
  opacity: 1;
}

/* ---------- Frequency Input Modal ---------- */
.freq-input-modal {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal) var(--ease-out);
}

.freq-input-modal.visible {
  opacity: 1;
  pointer-events: auto;
}

.freq-input-box {
  background: var(--bg-secondary);
  border: 1px solid var(--accent-cyan);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--glow-cyan), var(--shadow-lg);
  text-align: center;
}

.freq-input-box input {
  width: 200px;
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  background: var(--bg-input);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-md);
  color: var(--accent-cyan);
  outline: none;
}

.freq-input-box input:focus {
  box-shadow: var(--glow-cyan);
}

.freq-input-box p {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: var(--space-sm);
}

/* ---------- Notification Toast ---------- */
.toast {
  position: fixed;
  bottom: var(--space-lg);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: var(--space-sm) var(--space-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  opacity: 0;
  transition: all var(--duration-normal) var(--ease-spring);
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .app-container {
    padding: var(--space-md) var(--space-sm);
  }

  .main-grid {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
    min-width: 0;
  }

  .glass-card {
    padding: var(--space-md);
    min-width: 0;
  }

  .play-controls-card {
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
  }

  .play-btn {
    width: 56px;
    height: 56px;
  }

  .play-btn svg {
    width: 22px;
    height: 22px;
  }

  .freq-value {
    font-size: 2rem;
  }

  .play-side-controls {
    flex-direction: row;
  }

  .octave-btn {
    padding: 6px 10px;
  }

  .waveform-selector {
    grid-template-columns: repeat(4, 1fr);
  }

  .presets-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .adsr-controls {
    grid-template-columns: repeat(2, 1fr);
  }

  .visualizer-canvas {
    height: 150px;
  }

  .app-header {
    flex-wrap: wrap;
    gap: var(--space-sm);
  }

  .hero-section {
    margin-bottom: var(--space-lg);
  }

  /* Hide keyboard shortcuts on mobile */
  #shortcuts-btn,
  .keyboard-shortcuts-info,
  .shortcuts-overlay {
    display: none !important;
  }
}




@media (max-width: 480px) {
  .presets-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .action-buttons {
    flex-direction: column;
  }

  .action-btn {
    width: 100%;
    justify-content: center;
  }

  .timer-controls {
    justify-content: center;
  }

  .custom-presets-form {
    flex-direction: column;
    gap: var(--space-xs);
  }

  #save-preset-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ---------- Animations ---------- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.glass-card {
  animation: fadeIn var(--duration-slow) var(--ease-out) both;
}

.glass-card:nth-child(2) { animation-delay: 50ms; }
.glass-card:nth-child(3) { animation-delay: 100ms; }
.glass-card:nth-child(4) { animation-delay: 150ms; }
.glass-card:nth-child(5) { animation-delay: 200ms; }
.glass-card:nth-child(6) { animation-delay: 250ms; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ---------- Selection ---------- */
::selection {
  background: var(--accent-cyan-dim);
  color: var(--accent-cyan);
}

/* ---------- Theme Selector & Dots ---------- */
.theme-selector {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  margin-right: var(--space-sm);
}

.theme-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  position: relative;
  outline: none;
  padding: 0;
  flex-shrink: 0;
}

.theme-dot::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 50%;
}

.theme-dot.cyberpunk::after { background: linear-gradient(135deg, #00e5ff, #8b5cf6); }
.theme-dot.matrix::after { background: linear-gradient(135deg, #00ff66, #008822); }
.theme-dot.magma::after { background: linear-gradient(135deg, #ff5500, #f59e0b); }
.theme-dot.midnight::after { background: linear-gradient(135deg, #0088ff, #6366f1); }

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

.theme-dot.active {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan-glow);
}

/* ---------- Piano Keyboard ---------- */
.piano-keyboard {
  display: flex;
  position: relative;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 6px 6px 3px 6px;
  height: 90px;
  overflow: visible;
  user-select: none;
  width: 100%;
}

.presets-section-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: var(--space-xl);
  width: 100%;
}

@media (max-width: 900px) {
  .presets-section-grid {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }
}

.piano-key {
  position: relative;
  cursor: pointer;
  transition: background-color var(--duration-fast), border-color var(--duration-fast), box-shadow var(--duration-fast);
  outline: none;
  padding: 0;
  box-sizing: border-box;
  flex-shrink: 0;
}

.piano-key.white {
  flex: 1;
  height: 100%;
  background: rgba(240, 240, 245, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.35);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  color: #1a1a24;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 6px;
  z-index: 1;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.2);
}

.piano-key.white span {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  opacity: 0.55;
  pointer-events: none;
}

.piano-key.white:hover {
  background: #ffffff;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.1), 0 4px 8px rgba(0, 0, 0, 0.3);
}

.piano-key.white.active {
  background: var(--accent-cyan);
  color: #060609;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.2), 0 0 15px var(--accent-cyan-glow);
  border-color: var(--accent-cyan);
}

.piano-key.white.active span {
  opacity: 0.95;
}

.piano-key.black {
  width: 8%;
  height: 60%;
  background: #111116;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0 0 3px 3px;
  z-index: 2;
  margin-left: -4%;
  margin-right: -4%;
  box-shadow: 0 3px 5px rgba(0,0,0,0.4), inset 0 -2px 0 rgba(255,255,255,0.05);
}

.piano-key.black:hover {
  background: #191924;
  border-color: rgba(255, 255, 255, 0.25);
}

.piano-key.black.active {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
  box-shadow: 0 0 15px var(--accent-purple-glow), 0 3px 5px rgba(0,0,0,0.4);
}

/* 3D Key Press Animations */
.piano-key.white:active {
  transform: translateY(2px) scaleY(0.97);
  box-shadow: inset 0 -1px 0 rgba(0,0,0,0.15), 0 1px 2px rgba(0,0,0,0.1);
}

.piano-key.black:active {
  transform: translateY(2px) scaleY(0.97) translateX(-4%) !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3), inset 0 -1px 0 rgba(255,255,255,0.02);
}

/* Keyboard shortcut indicators styling */
.piano-key .key-bind {
  position: absolute;
  font-family: var(--font-primary);
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  padding: 1px 3px;
  pointer-events: none;
  user-select: none;
  transition: all var(--duration-fast);
  text-transform: uppercase;
}

.piano-key.white .key-bind {
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(0, 0, 0, 0.4);
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.15);
}

.piano-key.black .key-bind {
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

.piano-key.white.active .key-bind {
  color: rgba(0, 0, 0, 0.8);
  border-color: rgba(0, 0, 0, 0.3);
  background: rgba(0, 0, 0, 0.08);
}

.piano-key.black.active .key-bind {
  color: rgba(255, 255, 255, 0.85);
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.15);
}

@media (max-width: 768px) {
  .piano-key .key-bind {
    display: none !important;
  }
}

/* ---------- Custom Presets List & Items ---------- */
.custom-presets-list {
  scrollbar-width: thin;
}

.custom-presets-list::-webkit-scrollbar {
  width: 4px;
}

.custom-preset-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.custom-preset-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-default);
}

.custom-preset-item:active {
  transform: scale(0.99);
}

.preset-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  text-align: left;
}

.preset-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

.preset-meta {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.delete-preset-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 0.8rem;
  line-height: 1;
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast);
}

.delete-preset-btn:hover {
  color: var(--accent-red);
  background: var(--accent-red-dim);
}

/* Sweep Panel Input Fields styling override */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px;
}

/* Preset card Bento spans full width */
.main-grid .presets-card {
  grid-column: 1 / -1;
}

/* ============================================================
   PAGE TABS — Frequency / Binaural Switcher
   ============================================================ */
.page-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: var(--space-lg);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 4px;
  overflow: hidden;
}

.page-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  background: transparent;
  border: none;
  border-radius: calc(var(--radius-md) - 4px);
  color: var(--text-muted);
  font-family: var(--font-primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  position: relative;
  user-select: none;
}

.page-tab:hover {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
}

.page-tab.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.page-tab.active[data-tab="frequency"] {
  color: var(--accent-cyan);
  box-shadow: 0 1px 4px rgba(0, 229, 255, 0.1), inset 0 1px 0 rgba(0, 229, 255, 0.08);
}

.page-tab.active[data-tab="binaural"] {
  color: var(--accent-purple);
  box-shadow: 0 1px 4px rgba(139, 92, 246, 0.1), inset 0 1px 0 rgba(139, 92, 246, 0.08);
}

.page-tab svg {
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity var(--duration-fast);
}

.page-tab.active svg {
  opacity: 1;
}

/* Tab Panels */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: tabFadeIn 0.3s var(--ease-out);
}

@keyframes tabFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 600px) {
  .page-tab {
    font-size: 0.75rem;
    padding: 10px 12px;
    gap: 5px;
  }
  .page-tab svg {
    width: 14px;
    height: 14px;
  }
}

/* ============================================================
   BINAURAL BEATS STUDIO — Dedicated Section
   ============================================================ */
.binaural-studio {
  margin: 0 0 var(--space-lg);
  padding-top: var(--space-md);
  position: relative;
}


/* Header */
.binaural-studio-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
  gap: var(--space-lg);
}

.binaural-studio-title {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.binaural-icon {
  font-size: 2.5rem;
  filter: drop-shadow(0 0 12px rgba(139, 92, 246, 0.4));
}

.binaural-studio-title h2 {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.binaural-studio-title p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.binaural-play-btn {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-color: var(--accent-purple);
  background: var(--accent-purple-dim);
  color: var(--accent-purple);
}

.binaural-play-btn::before {
  border-color: rgba(139, 92, 246, 0.1);
}

.binaural-play-btn:hover {
  background: rgba(139, 92, 246, 0.25);
  box-shadow: var(--glow-purple);
}

.binaural-play-btn.playing {
  border-color: var(--accent-green);
  background: var(--accent-green-dim);
  color: var(--accent-green);
  box-shadow: var(--glow-green);
  animation: pulse-ring 2s ease-out infinite;
}

.binaural-play-btn svg {
  width: 22px;
  height: 22px;
}

/* Header Controls: Beat Info + Play Button */
.binaural-header-controls {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-shrink: 0;
}

.binaural-beat-info-compact {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-sm) var(--space-md);
}

.beat-compact-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.beat-compact-meta .beat-label {
  margin-top: 0;
}

.beat-compact-meta .beat-brainwave {
  margin-top: 0;
  font-size: 0.7rem;
}

/* Top Grid: Left Ear | Right Ear (beat info moved to header) */
.binaural-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  align-items: stretch;
}

.binaural-ear-card {
  min-width: 0;
}

/* Frequency Input Row */
.binaural-freq-input-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border-subtle);
}

.binaural-freq-input-row label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  white-space: nowrap;
}

.binaural-freq-input-row input {
  flex: 1;
  padding: 6px var(--space-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  outline: none;
  text-align: center;
}

.binaural-freq-input-row input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.15);
}

/* Beat Info Center Card */
.binaural-beat-info-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-width: 140px;
  padding: var(--space-lg) var(--space-md);
}

.beat-info-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: var(--space-sm);
}

.beat-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.beat-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-top: 4px;
}

.beat-brainwave {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-purple);
  margin-top: var(--space-sm);
}

.beat-description {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Bottom Grid */
.binaural-bottom-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-lg);
}

.binaural-presets-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-sm);
}

.bb-preset-card {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  text-align: left;
}

.bb-preset-card:hover {
  border-color: var(--border-default);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Delta State Active: Cyan/Deep Blue theme */
.bb-preset-card.active[data-name="Delta"] {
  border-color: #00e5ff;
  background: rgba(0, 229, 255, 0.08);
  box-shadow: inset 0 0 20px rgba(0, 229, 255, 0.06);
}
.bb-preset-card.active[data-name="Delta"] .bb-preset-header { color: #00e5ff; }
.bb-preset-card.active[data-name="Delta"] .bb-preset-freq { background: rgba(0, 229, 255, 0.15); color: #00e5ff; }

/* Theta State Active: Purple theme */
.bb-preset-card.active[data-name="Theta"] {
  border-color: #a78bfa;
  background: rgba(167, 139, 250, 0.08);
  box-shadow: inset 0 0 20px rgba(167, 139, 250, 0.06);
}
.bb-preset-card.active[data-name="Theta"] .bb-preset-header { color: #c084fc; }
.bb-preset-card.active[data-name="Theta"] .bb-preset-freq { background: rgba(167, 139, 250, 0.15); color: #c084fc; }

/* Alpha State Active: Cyan theme */
.bb-preset-card.active[data-name="Alpha"] {
  border-color: #06b6d4;
  background: rgba(6, 182, 212, 0.08);
  box-shadow: inset 0 0 20px rgba(6, 182, 212, 0.06);
}
.bb-preset-card.active[data-name="Alpha"] .bb-preset-header { color: #22d3ee; }
.bb-preset-card.active[data-name="Alpha"] .bb-preset-freq { background: rgba(6, 182, 212, 0.15); color: #22d3ee; }

/* Beta State Active: Violet/Purple theme */
.bb-preset-card.active[data-name="Beta"] {
  border-color: #8b5cf6;
  background: rgba(139, 92, 246, 0.08);
  box-shadow: inset 0 0 20px rgba(139, 92, 246, 0.06);
}
.bb-preset-card.active[data-name="Beta"] .bb-preset-header { color: #a78bfa; }
.bb-preset-card.active[data-name="Beta"] .bb-preset-freq { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }

/* Gamma State Active: Amber/Orange theme */
.bb-preset-card.active[data-name="Gamma"] {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.08);
  box-shadow: inset 0 0 20px rgba(245, 158, 11, 0.06);
}
.bb-preset-card.active[data-name="Gamma"] .bb-preset-header { color: #fbbf24; }
.bb-preset-card.active[data-name="Gamma"] .bb-preset-freq { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }

/* Healing State Active: Emerald Green theme */
.bb-preset-card.active[data-name="Healing"] {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.08);
  box-shadow: inset 0 0 20px rgba(16, 185, 129, 0.06);
}
.bb-preset-card.active[data-name="Healing"] .bb-preset-header { color: #34d399; }
.bb-preset-card.active[data-name="Healing"] .bb-preset-freq { background: rgba(16, 185, 129, 0.15); color: #34d399; }

/* Waveform Preview Animations in Preset Cards */
.bb-preset-wave-preview {
  margin-top: var(--space-xs);
  height: 14px;
  opacity: 0.15;
  color: var(--text-muted);
  transition: all var(--duration-normal);
  display: flex;
  align-items: center;
  overflow: visible;
}

.bb-preset-card:hover .bb-preset-wave-preview {
  opacity: 0.45;
}

.bb-preset-card.active .bb-preset-wave-preview {
  opacity: 0.85;
}

.bb-wave-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.bb-wave-path {
  stroke-dasharray: 200;
  stroke-dashoffset: 0;
  transform-origin: center;
  animation: bb-wave-flow 6s linear infinite;
}

@keyframes bb-wave-flow {
  from { stroke-dashoffset: 200; }
  to { stroke-dashoffset: 0; }
}

/* Custom flow speeds to represent preset frequencies */
.bb-preset-card[data-name="Delta"] .bb-wave-path { animation-duration: 9s; }
.bb-preset-card[data-name="Theta"] .bb-wave-path { animation-duration: 5s; }
.bb-preset-card[data-name="Alpha"] .bb-wave-path { animation-duration: 3s; }
.bb-preset-card[data-name="Beta"] .bb-wave-path { animation-duration: 1.5s; }
.bb-preset-card[data-name="Gamma"] .bb-wave-path { animation-duration: 0.8s; }

/* Healing pulse aura effect */
.bb-preset-card[data-name="Healing"] .bb-wave-path {
  animation: bb-wave-pulse 2s ease-in-out infinite alternate;
}

@keyframes bb-wave-pulse {
  0% { transform: scaleY(0.6); opacity: 0.4; }
  100% { transform: scaleY(1.4); opacity: 1; }
}

.bb-preset-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.bb-preset-freq {
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.bb-preset-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.bb-preset-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 0;
}

/* Responsive */
@media (max-width: 900px) {
  .binaural-grid {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }

  .binaural-bottom-grid {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }

  .binaural-studio-header {
    flex-wrap: wrap;
  }
}

@media (max-width: 768px) {
  .binaural-studio-title p {
    display: none;
  }

  .binaural-icon {
    font-size: 1.75rem;
  }
}

/* Spin animation for loading states */
.spin {
  animation: spin-anim 1s linear infinite;
}

@keyframes spin-anim {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
