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

:root {
  color-scheme: dark;
  --bg: #0a0a12;
  --surface: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.1);
  --text: #f4f4f8;
  --muted: #9b9bb0;
  --accent: #7c5cff;
  --accent-glow: rgba(124, 92, 255, 0.45);
  --live: #ff4d6d;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7ff;
  --surface: rgba(255, 255, 255, 0.9);
  --border: rgba(15, 23, 42, 0.12);
  --text: #111827;
  --muted: #4b5563;
  --accent: #5b21b6;
  --accent-glow: rgba(91, 33, 182, 0.2);
  --live: #d9465f;
}

html,
body {
  min-height: 100%;
}

body {
  font-family: "Outfit", system-ui, sans-serif;
  background: #0a0a12;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow: hidden;
}

.background {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

canvas {
  display: block;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  animation: float 55s ease-in-out infinite;
}

.orb-1 {
  width: 420px;
  height: 420px;
  background: #7c5cff;
  top: -120px;
  left: -80px;
}

.orb-2 {
  width: 360px;
  height: 360px;
  background: #ff4d6d;
  bottom: -100px;
  right: -60px;
  animation-delay: -18s;
}

.orb-3 {
  width: 280px;
  height: 280px;
  background: #3dd6c6;
  top: 40%;
  left: 55%;
  animation-delay: -36s;
}

@keyframes float {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(14px, -18px) scale(1.02);
  }
  66% {
    transform: translate(-10px, 12px) scale(0.99);
  }
}

.player {
  position: relative;
  z-index: 10;
  width: min(100%, 420px);
  padding: 2.5rem 2rem;
  border-radius: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(24px);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  text-align: center;
}

.player-header__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.theme-switcher {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background 0.2s ease,
    transform 0.2s ease,
    border-color 0.2s ease;
}

.theme-switcher:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: translateY(-1px);
}

.theme-switcher svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: currentColor;
}

.theme-switcher .icon-moon {
  display: none;
}

[data-theme="light"] .theme-switcher .icon-sun {
  display: none;
}

[data-theme="light"] .theme-switcher .icon-moon {
  display: block;
}

.player-header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 1rem;
}

.subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 0.35rem;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 77, 109, 0.15);
  border: 1px solid rgba(255, 77, 109, 0.35);
  color: var(--live);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  opacity: 0.5;
  transition: opacity 0.3s ease;
}

.live-badge.active {
  opacity: 1;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 12px var(--live);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.85);
  }
}

.visualizer {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  height: 64px;
  margin: 2rem 0 1.5rem;
}

.visualizer span {
  display: block;
  width: 6px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), #3dd6c6);
  opacity: 0.35;
  transition: height 0.15s ease;
}

.visualizer.playing span {
  opacity: 1;
  animation: bars 0.9s ease-in-out infinite;
}

.visualizer.playing span:nth-child(1) {
  animation-delay: 0s;
}
.visualizer.playing span:nth-child(2) {
  animation-delay: 0.1s;
}
.visualizer.playing span:nth-child(3) {
  animation-delay: 0.2s;
}
.visualizer.playing span:nth-child(4) {
  animation-delay: 0.15s;
}
.visualizer.playing span:nth-child(5) {
  animation-delay: 0.05s;
}
.visualizer.playing span:nth-child(6) {
  animation-delay: 0.25s;
}
.visualizer.playing span:nth-child(7) {
  animation-delay: 0.12s;
}
.visualizer.playing span:nth-child(8) {
  animation-delay: 0.18s;
}
.visualizer.playing span:nth-child(9) {
  animation-delay: 0.08s;
}
.visualizer.playing span:nth-child(10) {
  animation-delay: 0.22s;
}

@keyframes bars {
  0%,
  100% {
    height: 12px;
  }
  50% {
    height: 52px;
  }
}

.controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.play-btn {
  width: 88px;
  height: 88px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #5a3fd4);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 40px var(--accent-glow);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.play-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 16px 48px var(--accent-glow);
}

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

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

.play-btn .icon-pause {
  display: none;
}

.play-btn.playing .icon-play {
  display: none;
}

.play-btn.playing .icon-pause {
  display: block;
}

.volume {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 220px;
  color: var(--muted);
}

.volume svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.volume input[type="range"] {
  flex: 1;
  appearance: none;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  outline: none;
}

.volume input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 10px var(--accent-glow);
}

.status {
  margin-top: 1.25rem;
  font-size: 0.875rem;
  color: var(--muted);
  min-height: 1.25rem;
}

.status.error {
  color: #ff8fa8;
}

.page-footer {
  position: relative;
  z-index: 10;
  margin: 1.25rem auto 0;
  max-width: min(100%, 420px);
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  opacity: 0.85;
  letter-spacing: 0.02em;
}

/* Tablet Responsive (768px and below) */
@media (max-width: 768px) {
  body {
    padding: 1rem;
  }

  .player {
    width: min(100%, 380px);
    padding: 2rem 1.5rem;
  }

  .player-header h1 {
    font-size: 1.5rem;
    margin-top: 0.75rem;
  }

  .subtitle {
    font-size: 0.9rem;
  }

  .visualizer {
    height: 48px;
    margin: 1.5rem 0 1.25rem;
  }

  .visualizer span {
    width: 5px;
    height: 10px;
  }

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

  .volume {
    max-width: 180px;
  }

  .volume svg {
    width: 20px;
    height: 20px;
  }

  .status {
    margin-top: 1rem;
    font-size: 0.8rem;
  }
}

/* Mobile Responsive (480px and below) */
@media (max-width: 480px) {
  body {
    padding: 0.75rem;
  }

  .player {
    width: 100%;
    padding: 1.5rem 1rem;
    border-radius: 20px;
  }

  .player-header h1 {
    font-size: 1.25rem;
    margin-top: 0.5rem;
  }

  .subtitle {
    font-size: 0.85rem;
    margin-top: 0.25rem;
  }

  .live-badge {
    padding: 0.3rem 0.6rem;
    font-size: 0.7rem;
  }

  .live-dot {
    width: 6px;
    height: 6px;
  }

  .visualizer {
    height: 40px;
    gap: 4px;
    margin: 1.25rem 0 1rem;
  }

  .visualizer span {
    width: 4px;
    height: 8px;
  }

  .controls {
    gap: 1rem;
  }

  .play-btn {
    width: 48px;
    height: 48px;
    min-width: 48px;
  }

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

  .volume {
    max-width: 100%;
    flex: 1;
  }

  .volume svg {
    width: 18px;
    height: 18px;
  }

  .volume input[type="range"] {
    height: 3px;
  }

  .volume input[type="range"]::-webkit-slider-thumb {
    width: 14px;
    height: 14px;
  }

  .volume input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
  }

  .status {
    margin-top: 0.75rem;
    font-size: 0.75rem;
    min-height: 1rem;
  }
}

/* Extra small devices (320px and below) */
@media (max-width: 320px) {
  .player {
    padding: 1.25rem 0.75rem;
    border-radius: 16px;
  }

  .player-header h1 {
    font-size: 1.1rem;
  }

  .subtitle {
    font-size: 0.8rem;
  }

  .visualizer {
    height: 32px;
    gap: 3px;
  }

  .visualizer span {
    width: 3px;
    height: 6px;
  }
}
