:root {
  --bg-primary: #0A0E14;
  --bg-secondary: #111820;
  --bg-tertiary: #1A2230;
  --bg-elevated: #1E2A3A;
  --accent-cyan: #00D4FF;
  --accent-magenta: #FF006E;
  --accent-green: #00FF87;
  --accent-yellow: #FFD600;
  --accent-orange: #FF8C00;
  --text-primary: #E8ECF1;
  --text-secondary: #8899AA;
  --text-muted: #556677;
  --border-color: #1E2A3A;
  --glow-cyan: 0 0 20px rgba(0, 212, 255, 0.3);
  --glow-magenta: 0 0 20px rgba(255, 0, 110, 0.3);
  --glow-green: 0 0 20px rgba(0, 255, 135, 0.3);
}

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

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

#root {
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
}

.mono { font-family: 'JetBrains Mono', monospace; }

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  min-height: 50px;
  flex-shrink: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-title {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-magenta));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-tagline {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.perf-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: var(--bg-tertiary);
  border-radius: 6px;
  font-size: 11px;
}

.perf-badge span { color: var(--accent-green); }

/* Equalizer Animation */
.eq-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 18px;
}

.eq-bar {
  width: 3px;
  background: var(--accent-cyan);
  border-radius: 1px;
  transition: height 0.1s ease;
}

.eq-bar.active {
  animation: eqPulse 0.6s ease-in-out infinite alternate;
}

.eq-bar:nth-child(1) { animation-delay: 0s; }
.eq-bar:nth-child(2) { animation-delay: 0.15s; }
.eq-bar:nth-child(3) { animation-delay: 0.3s; }
.eq-bar:nth-child(4) { animation-delay: 0.1s; }
.eq-bar:nth-child(5) { animation-delay: 0.25s; }

@keyframes eqPulse {
  0% { height: 4px; }
  100% { height: 18px; }
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* Drop Zone */
.drop-zone-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.drop-zone {
  width: 100%;
  max-width: 560px;
  padding: 60px 40px;
  border: 2px dashed var(--text-muted);
  border-radius: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--bg-secondary);
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent-cyan);
  background: rgba(0, 212, 255, 0.05);
  box-shadow: var(--glow-cyan);
}

.drop-zone-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.6;
}

.drop-zone-text {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.drop-zone-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.browse-btn {
  padding: 10px 28px;
  background: linear-gradient(135deg, var(--accent-cyan), #0099cc);
  border: none;
  border-radius: 8px;
  color: var(--bg-primary);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'DM Sans', sans-serif;
}

.browse-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--glow-cyan);
}

/* Loading */
.loading-container {
  text-align: center;
  padding: 40px;
}

.loading-bar-track {
  width: 300px;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  margin: 20px auto;
  overflow: hidden;
}

.loading-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-magenta));
  border-radius: 3px;
  transition: width 0.3s ease;
}

.loading-msg {
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
}

/* Track Panel */
.track-panel {
  width: 240px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  flex-shrink: 0;
  transition: width 0.3s ease;
}

.track-panel.collapsed {
  width: 0;
  overflow: hidden;
}

.track-panel-header {
  padding: 12px 14px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.track-item {
  padding: 8px 14px;
  border-bottom: 1px solid rgba(30, 42, 58, 0.5);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  transition: background 0.15s;
}

.track-item:hover { background: var(--bg-tertiary); }

.track-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.track-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.track-note-count {
  font-size: 10px;
  color: var(--text-muted);
  padding: 2px 6px;
  background: var(--bg-tertiary);
  border-radius: 4px;
}

.track-controls {
  display: flex;
  gap: 4px;
}

.track-btn {
  width: 22px;
  height: 22px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-muted);
  border-radius: 3px;
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  font-family: 'JetBrains Mono', monospace;
}

.track-btn:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); }
.track-btn.active { background: var(--accent-cyan); color: var(--bg-primary); border-color: var(--accent-cyan); }
.track-btn.muted { background: var(--accent-magenta); color: white; border-color: var(--accent-magenta); }

/* Piano Roll Container */
.piano-roll-area {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.piano-roll-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Zoom Controls */
.zoom-controls {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: flex;
  gap: 6px;
  z-index: 10;
}

.zoom-btn {
  width: 32px;
  height: 32px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  font-family: 'JetBrains Mono', monospace;
}

.zoom-btn:hover { border-color: var(--accent-cyan); }

/* Stats */
.stats-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 11px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 3px;
  backdrop-filter: blur(10px);
}

.stats-badge .stat-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.stats-badge .stat-label { color: var(--text-muted); }
.stats-badge .stat-value { color: var(--accent-cyan); font-weight: 700; }

/* Transport Bar */
.transport-bar {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 8px 20px 6px;
  flex-shrink: 0;
  z-index: 100;
}

.transport-progress {
  width: 100%;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  cursor: pointer;
  margin-bottom: 8px;
  position: relative;
}

.transport-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-green));
  border-radius: 2px;
  transition: width 0.05s linear;
  position: relative;
}

.transport-progress-fill::after {
  content: '';
  position: absolute;
  right: -5px;
  top: -3px;
  width: 10px;
  height: 10px;
  background: var(--accent-cyan);
  border-radius: 50%;
  box-shadow: var(--glow-cyan);
}

.transport-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.transport-time {
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 100px;
}

.transport-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.transport-btn {
  width: 36px;
  height: 36px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.transport-btn:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); }

.transport-btn.play-btn {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent-cyan), #0099cc);
  border: none;
  color: var(--bg-primary);
  font-size: 18px;
}

.transport-btn.play-btn:hover {
  transform: scale(1.05);
  box-shadow: var(--glow-cyan);
}

.transport-controls-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.transport-slider-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.transport-slider {
  -webkit-appearance: none;
  width: 80px;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  outline: none;
}

.transport-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background: var(--accent-cyan);
  border-radius: 50%;
  cursor: pointer;
}

.transport-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: var(--accent-cyan);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.loop-btn {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-muted);
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
}

.loop-btn.active {
  border-color: var(--accent-green);
  color: var(--accent-green);
  background: rgba(0, 255, 135, 0.1);
}

/* Footer */
.footer {
  text-align: center;
  padding: 4px;
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-primary);
  flex-shrink: 0;
}

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

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

/* Settings Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  width: 90%;
  max-width: 420px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
}

.setting-group {
  margin-bottom: 16px;
}

.setting-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.setting-select, .setting-input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 6px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
}

.modal-close {
  width: 100%;
  padding: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  margin-top: 8px;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.15s;
}

.modal-close:hover { border-color: var(--accent-cyan); }

/* Settings Button */
.settings-btn {
  width: 32px;
  height: 32px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.settings-btn:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); }

/* Toggle Panel Button */
.toggle-panel-btn {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 48px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-left: none;
  border-radius: 0 6px 6px 0;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.15s;
}

.toggle-panel-btn:hover { color: var(--accent-cyan); border-color: var(--accent-cyan); }

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

/* Mobile */
@media (max-width: 768px) {
  .track-panel { width: 200px; }
  .header-tagline { display: none; }
  .transport-main { flex-wrap: wrap; justify-content: center; }
  .transport-controls-right { flex-wrap: wrap; justify-content: center; }
  .transport-slider { width: 60px; }
  .stats-badge { font-size: 10px; }
  .zoom-controls { bottom: 8px; right: 8px; }
}

@media (max-width: 480px) {
  .track-panel { position: absolute; left: 0; top: 0; bottom: 0; z-index: 50; width: 220px; }
  .track-panel.collapsed { width: 0; }
  .header { padding: 8px 12px; }
  .header-title { font-size: 16px; }
  .transport-bar { padding: 6px 12px 4px; }
}