:root {
  --bg-darkest: #0D0D0D;
  --bg-dark: #121212;
  --bg-panel: #1A1A1E;
  --bg-card: #222228;
  --bg-input: #2A2A32;
  --border: #333340;
  --text-primary: #E8E8EC;
  --text-secondary: #8888A0;
  --text-dim: #55556A;
  --magenta: #FF2D78;
  --magenta-glow: rgba(255, 45, 120, 0.3);
  --teal: #00CED1;
  --teal-glow: rgba(0, 206, 209, 0.3);
  --accent-gradient: linear-gradient(135deg, #FF2D78, #FF6B9D);
  --teal-gradient: linear-gradient(135deg, #00CED1, #20E8D6);
}

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

body {
  background: var(--bg-darkest);
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* Header */
#header {
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border);
  position: relative;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
}

.header-title {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 1px;
}

.header-sub {
  font-weight: 300;
  color: var(--text-secondary);
}

.header-tagline {
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
  font-family: 'JetBrains Mono', monospace;
}

.header-accent {
  height: 2px;
  background: linear-gradient(90deg, var(--magenta), var(--teal), var(--magenta));
  background-size: 200% 100%;
  animation: headerShimmer 4s linear infinite;
}

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

/* Main Layout */
#main {
  display: flex;
  height: calc(100vh - 140px);
  min-height: 400px;
}

/* Sidebars */
#effects-panel, #presets-panel {
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
}

#effects-panel {
  width: 280px;
}

#presets-panel {
  width: 180px;
  border-right: none;
  border-left: 1px solid var(--border);
  padding: 0 0 10px 0;
}

.panel-header {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-dim);
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
}

/* FX Cards */
.fx-card {
  border-bottom: 1px solid var(--border);
}

.fx-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.fx-card-header:hover {
  background: rgba(255,255,255,0.02);
}

.fx-icon {
  font-size: 16px;
}

.fx-name {
  font-size: 12px;
  font-weight: 500;
  flex: 1;
}

.fx-card-body {
  padding: 4px 14px 14px;
  display: none;
}

.fx-card.active .fx-card-body {
  display: block;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 18px;
  flex-shrink: 0;
}

.toggle-switch input { display: none; }

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--bg-input);
  border-radius: 18px;
  transition: 0.3s;
  border: 1px solid var(--border);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 12px;
  width: 12px;
  left: 2px;
  bottom: 2px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--magenta);
  border-color: var(--magenta);
  box-shadow: 0 0 12px var(--magenta-glow);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
  background: white;
}

/* Sliders */
.slider-group {
  margin-bottom: 10px;
}

.slider-group label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  font-family: 'JetBrains Mono', monospace;
}

.slider-val {
  color: var(--teal);
  font-weight: 500;
}

.styled-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--bg-input);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.styled-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 8px var(--teal-glow);
  cursor: pointer;
  transition: box-shadow 0.2s;
}

.styled-slider::-webkit-slider-thumb:hover {
  box-shadow: 0 0 16px var(--teal-glow);
}

.styled-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 8px var(--teal-glow);
  cursor: pointer;
  border: none;
}

.pitch-slider::-webkit-slider-thumb {
  background: var(--magenta);
  box-shadow: 0 0 8px var(--magenta-glow);
}

.pitch-slider::-moz-range-thumb {
  background: var(--magenta);
  box-shadow: 0 0 8px var(--magenta-glow);
}

.hint {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 6px;
}

/* Direction Buttons */
.btn-group {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.dir-btn {
  flex: 1;
  padding: 4px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  transition: all 0.2s;
}

.dir-btn:hover { border-color: var(--teal); }

.dir-btn.active {
  background: var(--teal);
  color: var(--bg-darkest);
  border-color: var(--teal);
  font-weight: 700;
}

/* Pitch Display */
.pitch-display {
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--magenta);
  padding: 6px;
  background: var(--bg-input);
  border-radius: 4px;
  margin-top: 6px;
}

/* Canvas Area */
#canvas-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-darkest);
}

#canvas-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 40px 40px;
}

#canvas {
  max-width: 100%;
  max-height: 100%;
  display: block;
  cursor: crosshair;
  image-rendering: auto;
}

#canvas-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 13, 13, 0.8);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

#canvas-overlay.show {
  opacity: 1;
}

.overlay-content {
  text-align: center;
}

.overlay-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.overlay-text {
  color: var(--text-dim);
  font-size: 14px;
}

#media-controls {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.ctrl-btn {
  padding: 6px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.ctrl-btn:hover {
  border-color: var(--teal);
  background: rgba(0, 206, 209, 0.1);
}

.ctrl-btn.primary {
  background: linear-gradient(135deg, rgba(255,45,120,0.2), rgba(0,206,209,0.2));
  border-color: var(--magenta);
}

.ctrl-btn.primary:hover {
  background: linear-gradient(135deg, rgba(255,45,120,0.35), rgba(0,206,209,0.35));
}

/* Presets */
.preset-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.preset-btn:hover {
  background: rgba(255, 45, 120, 0.08);
  color: var(--text-primary);
}

.preset-btn.active {
  background: rgba(255, 45, 120, 0.15);
  color: var(--magenta);
  border-left: 3px solid var(--magenta);
}

.preset-icon { font-size: 16px; }

/* Timeline */
#timeline {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
}

.timeline-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.tl-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.tl-btn:hover {
  border-color: var(--teal);
  background: rgba(0, 206, 209, 0.1);
}

.time-display {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
  margin-left: 8px;
  white-space: nowrap;
}

#timeline-bar {
  flex: 1;
  position: relative;
  height: 20px;
  display: flex;
  align-items: center;
}

#timeline-progress {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  background: var(--magenta);
  border-radius: 2px;
  pointer-events: none;
  width: 0%;
  box-shadow: 0 0 8px var(--magenta-glow);
}

#timeline-scrub {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--bg-input);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  position: relative;
  z-index: 2;
}

#timeline-scrub::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 16px;
  border-radius: 2px;
  background: var(--magenta);
  cursor: pointer;
  box-shadow: 0 0 6px var(--magenta-glow);
}

#timeline-scrub::-moz-range-thumb {
  width: 10px;
  height: 16px;
  border-radius: 2px;
  background: var(--magenta);
  cursor: pointer;
  border: none;
}

.timeline-info {
  flex-shrink: 0;
}

#fx-status {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-dim);
}

/* Footer */
#footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 20px;
  background: var(--bg-dark);
  border-top: 1px solid var(--border);
  font-size: 10px;
  color: var(--text-dim);
}

#footer a {
  color: var(--teal);
  text-decoration: none;
}

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

/* Drag-over visual on canvas wrapper */
#canvas-wrapper.drag-over {
  outline: 2px dashed var(--magenta);
  outline-offset: -4px;
}

/* Responsive */
@media (max-width: 1000px) {
  #main {
    flex-direction: column;
    height: auto;
  }
  #effects-panel, #presets-panel {
    width: 100%;
    max-height: 250px;
    overflow-y: auto;
    border-right: none;
    border-left: none;
    border-bottom: 1px solid var(--border);
  }
  #canvas-wrapper {
    min-height: 300px;
  }
}

@media (max-width: 600px) {
  .header-tagline { display: none; }
  #effects-panel { width: 100%; }
  #presets-panel { width: 100%; }
  #media-controls { justify-content: center; }
  #timeline { flex-wrap: wrap; }
}