/* ── Reset & Base ─────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'Inter', sans-serif;
  color: #fff;
  cursor: default;
}

/* ── Canvas Container ────────────────────── */
#canvas-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

#canvas-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ── Strobe Layer ────────────────────────── */
#strobe-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  background: #fff;
  mix-blend-mode: screen;
  transition: none;
}

/* ── Word Flasher ── */
#word-display {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 500;
  text-align: center;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.flashing-word {
  font-size: 8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.8), 0 0 50px rgba(138, 43, 226, 0.6);
  animation: wordFlash 0.4s cubic-bezier(0.1, 0.9, 0.2, 1) forwards;
  letter-spacing: 5px;
}

@keyframes wordFlash {
  0% {
    opacity: 0;
    transform: scale(0.5) rotate(var(--rot, 0deg));
    filter: blur(10px);
  }

  50% {
    opacity: 1;
    transform: scale(1.2) rotate(var(--rot, 0deg));
    filter: blur(0px);
  }

  100% {
    opacity: 0;
    transform: scale(1.5) rotate(var(--rot, 0deg));
    filter: blur(5px);
  }
}

/* ── Dancer Overlay ── */
#dancer-display {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 400;
  /* Behind words, above visuals */
  pointer-events: none;
  width: 60vh;
  /* Responsive height based */
  height: 60vh;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  mix-blend-mode: screen;
  opacity: 0.9;
  filter: drop-shadow(0 0 20px rgba(138, 43, 226, 0.4));
  transition: opacity 0.5s ease;
}

#dancer-display.hidden {
  opacity: 0;
}

#dancer-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: bottom center;
  will-change: transform;
}

/* ── GIF Overlay Layer ───────────────────── */
#gif-overlay-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.gif-overlay-item {
  position: absolute;
  max-width: 45%;
  max-height: 45%;
  object-fit: contain;
  opacity: 0;
  transition: none;
  filter: drop-shadow(0 0 30px rgba(138, 43, 226, 0.5));
  mix-blend-mode: screen;
}

.gif-overlay-item.active {
  opacity: 0.7;
}

/* ── Drop Zone ───────────────────────────── */
#drop-zone {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(138, 43, 226, 0.15);
  border: 3px dashed rgba(138, 43, 226, 0.6);
  backdrop-filter: blur(8px);
}

#drop-zone.active {
  display: flex;
}

.drop-zone-content {
  text-align: center;
  color: rgba(255, 255, 255, 0.8);
}

.drop-zone-content svg {
  opacity: 0.6;
  margin-bottom: 16px;
}

.drop-zone-content p {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.3em;
  color: rgba(255, 255, 255, 0.5);
}

/* ── UI Overlay ──────────────────────────── */
#ui-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

#ui-overlay * {
  pointer-events: auto;
}

/* ── Loading Screen ──────────────────────── */
#loading-screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(10, 5, 30, 0.95) 0%, rgba(0, 0, 0, 0.98) 100%);
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}

#loading-screen.visible {
  opacity: 1;
  pointer-events: auto;
}

.loader-content {
  text-align: center;
  animation: fadeInUp 1s ease forwards;
}

.logo-text {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: clamp(3rem, 8vw, 6rem);
  letter-spacing: 0.15em;
  text-shadow: 0 0 40px rgba(138, 43, 226, 0.6), 0 0 80px rgba(138, 43, 226, 0.3);
}

.logo-text .accent {
  background: linear-gradient(135deg, #ff006e, #8b5cf6, #00d4ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  font-family: 'Orbitron', sans-serif;
  font-weight: 400;
  font-size: clamp(0.7rem, 2vw, 1rem);
  letter-spacing: 0.5em;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 0.5rem;
}

/* ── Glow Button ─────────────────────────── */
.glow-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 3rem;
  padding: 16px 48px;
  border: 1px solid rgba(138, 43, 226, 0.5);
  border-radius: 60px;
  background: rgba(138, 43, 226, 0.12);
  color: #fff;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.2em;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 0 30px rgba(138, 43, 226, 0.2), inset 0 0 30px rgba(138, 43, 226, 0.05);
  animation: pulse-glow 2s ease-in-out infinite;
}

.glow-btn:hover {
  background: rgba(138, 43, 226, 0.3);
  box-shadow: 0 0 60px rgba(138, 43, 226, 0.5), inset 0 0 40px rgba(138, 43, 226, 0.1);
  transform: scale(1.05);
}

.glow-btn .play-icon {
  width: 24px;
  height: 24px;
}

/* ── HUD ─────────────────────────────────── */
#hud {
  position: absolute;
  inset: 0;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: opacity 0.5s ease;
}

#hud.hidden {
  opacity: 0;
  pointer-events: none;
}

.hud-top-left {
  position: absolute;
  top: 24px;
  left: 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hud-label {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.3em;
  color: rgba(255, 255, 255, 0.3);
  text-shadow: 0 0 20px rgba(138, 43, 226, 0.3);
}

.scene-mode-label {
  font-family: 'Orbitron', sans-serif;
  font-weight: 400;
  font-size: 0.6rem;
  letter-spacing: 0.4em;
  color: rgba(138, 43, 226, 0.5);
  text-shadow: 0 0 15px rgba(138, 43, 226, 0.3);
  transition: color 0.5s ease, text-shadow 0.5s ease;
}

.hud-top-right {
  position: absolute;
  top: 24px;
  right: 24px;
  display: flex;
  gap: 12px;
}

.hud-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all 0.2s ease;
}

.hud-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(138, 43, 226, 0.5);
  box-shadow: 0 0 20px rgba(138, 43, 226, 0.2);
}

.hud-btn svg {
  width: 20px;
  height: 20px;
}

/* ── Progress Bar ────────────────────────── */
.hud-bottom {
  position: absolute;
  bottom: 24px;
  left: 24px;
  right: 24px;
}

#progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  cursor: pointer;
  overflow: hidden;
}

#progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #8b5cf6, #ff006e, #00d4ff);
  border-radius: 2px;
  transition: width 0.1s linear;
}

.hud-time {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.35);
  font-family: 'Orbitron', sans-serif;
  letter-spacing: 0.1em;
}

/* ── Animations ──────────────────────────── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse-glow {

  0%,
  100% {
    box-shadow: 0 0 30px rgba(138, 43, 226, 0.2), inset 0 0 30px rgba(138, 43, 226, 0.05);
  }

  50% {
    box-shadow: 0 0 50px rgba(138, 43, 226, 0.4), inset 0 0 40px rgba(138, 43, 226, 0.1);
  }
}

/* ── Generic Overlay ── */
.overlay {
  position: absolute;
  top: 80px;
  width: 320px;
  max-height: calc(100% - 160px);
  background: rgba(10, 5, 30, 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(138, 43, 226, 0.3);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
  pointer-events: auto;
}

#playlist-overlay {
  left: 24px;
}

#lyrics-overlay {
  right: 24px;
}

.overlay.hidden {
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
}

.overlay-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.overlay-header {
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
}

.overlay-header h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.2em;
  color: #fff;
  margin: 0;
}

.close-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.2s;
}

.close-btn:hover {
  color: #ff006e;
}

/* ── Buttons ── */
.btn {
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.9);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
  transform: translateY(-1px);
}

.accent-btn {
  background: rgba(138, 43, 226, 0.25);
  border-color: rgba(138, 43, 226, 0.5);
  color: #fff;
}

.accent-btn:hover {
  background: rgba(138, 43, 226, 0.4);
  box-shadow: 0 0 15px rgba(138, 43, 226, 0.3);
}

.danger-btn {
  background: rgba(255, 0, 110, 0.15);
  border-color: rgba(255, 0, 110, 0.3);
  color: rgba(255, 255, 255, 0.9);
}

.danger-btn:hover {
  background: rgba(255, 0, 110, 0.3);
  box-shadow: 0 0 15px rgba(255, 0, 110, 0.3);
}

/* ── Playlist Specifics ── */
.playlist-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.playlist-controls {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.icon-btn {
  /* Keep existing styles if needed, or rely on .hud-btn */
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: all 0.2s;
}

.icon-btn:hover {
  color: #fff;
  transform: scale(1.1);
}

/* Reuse other playlist styles... */

.url-input-group {
  display: flex;
  gap: 8px;
}

#stream-url-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #fff;
  padding: 6px 10px;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
}

#stream-url-input:focus {
  outline: none;
  border-color: rgba(138, 43, 226, 0.6);
}

.track-list-container {
  flex: 1;
  overflow-y: auto;
  min-height: 150px;
}

#track-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.track-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.track-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.track-item.active {
  background: rgba(138, 43, 226, 0.15);
  border-left: 3px solid #8b5cf6;
}

.track-info {
  flex: 1;
  overflow: hidden;
}

.track-title {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.track-item.active .track-title {
  color: #8b5cf6;
  font-weight: 600;
}

.track-type {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  margin-top: 2px;
  display: block;
}

.remove-track-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  padding: 4px;
}

.remove-track-btn:hover {
  color: #ff006e;
}

.playlist-footer {
  padding: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: flex-end;
  background: rgba(0, 0, 0, 0.2);
}

.text-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.7rem;
  font-family: 'Orbitron', sans-serif;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: color 0.2s;
}

.text-btn:hover {
  color: #fff;
}

/* Scrollbar */
.track-list-container::-webkit-scrollbar {
  width: 6px;
}

.track-list-container::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}

.track-list-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.track-list-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}