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

body {
  background: #0a0a0f;
  color: #e0e0e0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

.hidden {
  display: none !important;
}

/* === Upload Screen === */
#upload-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100vw;
  background: #0a0a0f;
}

.upload-container {
  text-align: center;
  max-width: 440px;
  padding: 40px;
}

.upload-container h1 {
  font-size: 2.4rem;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #00E5FF, #AA44FF, #FF4444, #44FF88);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: #888;
  margin-bottom: 32px;
  font-size: 1rem;
}

.upload-box {
  border: 2px dashed #333;
  border-radius: 16px;
  padding: 40px 24px;
  cursor: pointer;
  transition: border-color 0.3s, background 0.3s;
}

.upload-box:hover,
.upload-box.dragover {
  border-color: #00E5FF;
  background: rgba(0, 229, 255, 0.04);
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.browse-link {
  color: #00E5FF;
  cursor: pointer;
  text-decoration: underline;
}

.hint {
  color: #555;
  font-size: 0.85rem;
  margin-top: 8px;
}

.divider {
  display: flex;
  align-items: center;
  margin: 24px 0;
  color: #444;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #222;
}

.divider span {
  padding: 0 16px;
  font-size: 0.85rem;
}

.btn-primary {
  background: linear-gradient(135deg, #00E5FF, #AA44FF);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px 32px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-primary:active {
  transform: scale(0.97);
}

/* === Processing Screen === */
#processing-screen,
#waiting-screen,
#full-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100vw;
  background: #0a0a0f;
}

.processing-container {
  text-align: center;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid #222;
  border-top-color: #00E5FF;
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.progress-bar {
  width: 280px;
  height: 4px;
  background: #1a1a24;
  border-radius: 2px;
  margin: 16px auto 0;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00E5FF, #AA44FF);
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* === Visualizer === */
#visualizer {
  position: relative;
  width: 100vw;
  height: 100vh;
}

#canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#instrument-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 4rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  opacity: 0.25;
  pointer-events: none;
  user-select: none;
}

#tab-count {
  position: absolute;
  top: 20px;
  right: 24px;
  font-size: 0.9rem;
  color: #888;
  pointer-events: none;
}

#missing-stems {
  position: absolute;
  top: 48px;
  right: 24px;
  display: flex;
  gap: 8px;
  pointer-events: none;
}

.stem-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  opacity: 0.25;
  transition: opacity 0.3s;
}

.stem-dot.active {
  opacity: 1.0;
  box-shadow: 0 0 8px currentColor;
}

.add-tab-btn {
  position: absolute;
  top: 76px;
  right: 24px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ccc;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.add-tab-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.add-tab-btn.all-assigned {
  display: none;
}

.new-song-btn {
  position: absolute;
  top: 20px;
  left: 24px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #888;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.new-song-btn:hover {
  background: rgba(255, 70, 70, 0.15);
  border-color: rgba(255, 70, 70, 0.4);
  color: #FF4444;
}

#controls {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(10, 10, 15, 0.7);
  backdrop-filter: blur(12px);
  padding: 10px 24px;
  border-radius: 40px;
  border: 1px solid #222;
}

.ctrl-btn {
  background: none;
  border: none;
  color: #e0e0e0;
  font-size: 1.4rem;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.ctrl-btn.loop-active {
  color: #00E5FF;
  background: rgba(0, 229, 255, 0.12);
}

#time-display {
  font-size: 0.85rem;
  color: #888;
  font-variant-numeric: tabular-nums;
}

/* === Stem Colors (set via JS as CSS custom properties) === */
body.stem-vocals  { --stem-color: #00E5FF; }
body.stem-drums   { --stem-color: #FF4444; }
body.stem-bass    { --stem-color: #AA44FF; }
body.stem-other   { --stem-color: #44FF88; }
