/**
 * Modern Audio Player - Frontend Styles
 * Version: 1.4.0
 */

/* ─── CSS Custom Properties ───────────────────────────── */

.map-player-container {
  --map-accent: #6366f1;
  --map-accent-rgb: 99, 102, 241;
  --map-accent-secondary: #818cf8;
  --map-radius: 20px;
  --map-radius-sm: 12px;
  --map-radius-xs: 8px;
  --map-transition: 220ms cubic-bezier(0.4, 0, 0.2, 1);
  --map-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --map-waveform-color: #e2e8f0;
  --map-active-track: #06b6d4;

  font-family: var(--map-font);
  width: 100%;
  max-width: 520px;
  margin: 1.5em auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Theme: Light ────────────────────────────────────── */

.map-player-container[data-theme-active="light"] {
  --map-bg: rgba(255, 255, 255, 0.85);
  --map-bg-solid: #ffffff;
  --map-bg-secondary: #f1f5f9;
  --map-text: #0f172a;
  --map-text-secondary: #64748b;
  --map-border: rgba(148, 163, 184, 0.2);
  --map-hover: rgba(99, 102, 241, 0.06);
  --map-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.03),
    0 4px 16px rgba(0, 0, 0, 0.04),
    0 12px 40px rgba(0, 0, 0, 0.06);
  --map-glow: 0 0 60px -12px rgba(var(--map-accent-rgb), 0.15);
  --map-progress-bg: #e2e8f0;
  --map-waveform-color: #cbd5e1;
  --map-glass-blur: 16px;
  --map-control-bg: rgba(0, 0, 0, 0.04);
  --map-control-hover: rgba(var(--map-accent-rgb), 0.1);
  --map-active-track: #06b6d4;
}

/* ─── Theme: Dark ─────────────────────────────────────── */

.map-player-container[data-theme-active="dark"] {
  --map-bg: rgba(22, 22, 35, 0.88);
  --map-bg-solid: #161623;
  --map-bg-secondary: rgba(255, 255, 255, 0.05);
  --map-text: #f1f5f9;
  --map-text-secondary: #94a3b8;
  --map-border: rgba(148, 163, 184, 0.08);
  --map-hover: rgba(99, 102, 241, 0.1);
  --map-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 4px 16px rgba(0, 0, 0, 0.2),
    0 12px 40px rgba(0, 0, 0, 0.4);
  --map-glow: 0 0 80px -12px rgba(var(--map-accent-rgb), 0.25);
  --map-progress-bg: rgba(255, 255, 255, 0.08);
  --map-waveform-color: rgba(255, 255, 255, 0.12);
  --map-glass-blur: 20px;
  --map-control-bg: rgba(255, 255, 255, 0.06);
  --map-control-hover: rgba(var(--map-accent-rgb), 0.15);
  --map-active-track: #22d3ee;
}

/* ─── Theme: Neon Glow ───────────────────────────────── */

.map-player-container[data-theme-active="neon-glow"] {
  --map-bg: rgba(8, 8, 18, 0.95);
  --map-bg-solid: #080812;
  --map-bg-secondary: rgba(var(--map-accent-rgb), 0.08);
  --map-text: #f0f0ff;
  --map-text-secondary: rgba(var(--map-accent-rgb), 0.7);
  --map-border: rgba(var(--map-accent-rgb), 0.2);
  --map-hover: rgba(var(--map-accent-rgb), 0.12);
  --map-shadow:
    0 0 0 1px rgba(var(--map-accent-rgb), 0.15),
    0 0 30px -5px rgba(var(--map-accent-rgb), 0.3),
    0 0 80px -10px rgba(var(--map-accent-rgb), 0.15);
  --map-glow: 0 0 100px -8px rgba(var(--map-accent-rgb), 0.5);
  --map-progress-bg: rgba(var(--map-accent-rgb), 0.1);
  --map-waveform-color: rgba(var(--map-accent-rgb), 0.18);
  --map-glass-blur: 24px;
  --map-control-bg: rgba(var(--map-accent-rgb), 0.06);
  --map-control-hover: rgba(var(--map-accent-rgb), 0.2);
  --map-active-track: #f472b6;
}

.map-player-container[data-theme-active="neon-glow"] .map-player {
  border-color: rgba(var(--map-accent-rgb), 0.25);
}

.map-player-container[data-theme-active="neon-glow"] .map-player::before {
  background: linear-gradient(
    135deg,
    rgba(var(--map-accent-rgb), 0.4),
    transparent 40%,
    rgba(var(--map-accent-rgb), 0.2) 70%,
    rgba(var(--map-accent-rgb), 0.4)
  );
  opacity: 1;
}

.map-player-container[data-theme-active="neon-glow"] .map-playing .map-btn-play {
  animation: map-neon-pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes map-neon-pulse {
  0%, 100% {
    box-shadow:
      0 0 10px rgba(var(--map-accent-rgb), 0.4),
      0 0 30px rgba(var(--map-accent-rgb), 0.2),
      0 0 60px rgba(var(--map-accent-rgb), 0.1);
  }
  50% {
    box-shadow:
      0 0 15px rgba(var(--map-accent-rgb), 0.6),
      0 0 45px rgba(var(--map-accent-rgb), 0.35),
      0 0 90px rgba(var(--map-accent-rgb), 0.2);
  }
}

.map-player-container[data-theme-active="neon-glow"] .map-cover {
  box-shadow:
    0 0 12px rgba(var(--map-accent-rgb), 0.3),
    inset 0 0 12px rgba(var(--map-accent-rgb), 0.08);
  border: 1px solid rgba(var(--map-accent-rgb), 0.2);
}

.map-player-container[data-theme-active="neon-glow"] .map-progress-fill {
  box-shadow: 0 0 8px rgba(var(--map-accent-rgb), 0.5);
}

/* ─── Theme: Celestial ───────────────────────────────── */

.map-player-container[data-theme-active="celestial"] {
  --map-accent: #c9a84c;
  --map-accent-rgb: 201, 168, 76;
  --map-accent-secondary: #e8d48b;
  --map-bg: rgba(12, 14, 36, 0.94);
  --map-bg-solid: #0c0e24;
  --map-bg-secondary: rgba(201, 168, 76, 0.06);
  --map-text: #e8e4f0;
  --map-text-secondary: #9b97b0;
  --map-border: rgba(201, 168, 76, 0.12);
  --map-hover: rgba(201, 168, 76, 0.08);
  --map-shadow:
    0 0 0 1px rgba(201, 168, 76, 0.08),
    0 4px 20px rgba(0, 0, 0, 0.4),
    0 0 60px -15px rgba(201, 168, 76, 0.2);
  --map-glow: 0 0 80px -10px rgba(201, 168, 76, 0.3);
  --map-progress-bg: rgba(201, 168, 76, 0.1);
  --map-waveform-color: rgba(201, 168, 76, 0.15);
  --map-glass-blur: 20px;
  --map-control-bg: rgba(201, 168, 76, 0.05);
  --map-control-hover: rgba(201, 168, 76, 0.12);
  --map-active-track: #60a5fa;
}

.map-player-container[data-theme-active="celestial"] .map-player {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(201, 168, 76, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(100, 80, 200, 0.05) 0%, transparent 50%),
    var(--map-bg);
}

.map-player-container[data-theme-active="celestial"] .map-player::before {
  background: linear-gradient(
    160deg,
    rgba(201, 168, 76, 0.25),
    transparent 30%,
    transparent 70%,
    rgba(201, 168, 76, 0.15)
  );
  opacity: 1;
}

.map-player-container[data-theme-active="celestial"] .map-cover {
  box-shadow:
    0 2px 12px rgba(0, 0, 0, 0.3),
    0 0 20px rgba(201, 168, 76, 0.15);
  border: 1px solid rgba(201, 168, 76, 0.15);
}

.map-player-container[data-theme-active="celestial"] .map-cover-placeholder {
  color: #c9a84c;
  filter: drop-shadow(0 0 8px rgba(201, 168, 76, 0.6));
}

.map-player-container[data-theme-active="celestial"] .map-btn-play {
  background: linear-gradient(135deg, #c9a84c, #e8d48b) !important;
  box-shadow: 0 2px 12px rgba(201, 168, 76, 0.3);
}

.map-player-container[data-theme-active="celestial"] .map-playing .map-btn-play {
  animation: map-celestial-glow 3s ease-in-out infinite;
}

@keyframes map-celestial-glow {
  0%, 100% { box-shadow: 0 0 12px rgba(201, 168, 76, 0.3), 0 0 30px rgba(201, 168, 76, 0.1); }
  50% { box-shadow: 0 0 20px rgba(201, 168, 76, 0.5), 0 0 50px rgba(201, 168, 76, 0.2); }
}

/* ─── Theme: Angel Wings ─────────────────────────────── */

.map-player-container[data-theme-active="angel-wings"] {
  --map-accent: #b89150;
  --map-accent-rgb: 184, 145, 80;
  --map-accent-secondary: #d4b478;
  --map-bg: rgba(255, 253, 248, 0.92);
  --map-bg-solid: #fffdf8;
  --map-bg-secondary: rgba(184, 145, 80, 0.05);
  --map-text: #3d3225;
  --map-text-secondary: #8c7a65;
  --map-border: rgba(184, 145, 80, 0.15);
  --map-hover: rgba(184, 145, 80, 0.06);
  --map-shadow:
    0 0 0 1px rgba(184, 145, 80, 0.06),
    0 4px 20px rgba(184, 145, 80, 0.06),
    0 12px 48px rgba(184, 145, 80, 0.08);
  --map-glow: 0 0 70px -12px rgba(184, 145, 80, 0.2);
  --map-progress-bg: rgba(184, 145, 80, 0.1);
  --map-waveform-color: rgba(184, 145, 80, 0.18);
  --map-glass-blur: 16px;
  --map-control-bg: rgba(184, 145, 80, 0.04);
  --map-control-hover: rgba(184, 145, 80, 0.1);
  --map-active-track: #e16b8a;
}

.map-player-container[data-theme-active="angel-wings"] .map-player {
  background:
    radial-gradient(ellipse at 50% -20%, rgba(255, 240, 200, 0.5) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 120%, rgba(240, 230, 215, 0.3) 0%, transparent 60%),
    var(--map-bg);
}

.map-player-container[data-theme-active="angel-wings"] .map-player::before {
  background: linear-gradient(
    180deg,
    rgba(255, 235, 180, 0.25),
    transparent 40%,
    transparent 70%,
    rgba(255, 235, 180, 0.12)
  );
  opacity: 1;
}

.map-player-container[data-theme-active="angel-wings"] .map-cover {
  box-shadow:
    0 2px 10px rgba(184, 145, 80, 0.12),
    0 0 24px rgba(255, 235, 180, 0.15);
  border: 1px solid rgba(184, 145, 80, 0.12);
  background-color: rgba(255, 248, 230, 0.8);
}

.map-player-container[data-theme-active="angel-wings"] .map-cover-placeholder {
  color: #b89150;
  filter: drop-shadow(0 0 8px rgba(255, 220, 150, 0.5));
}

.map-player-container[data-theme-active="angel-wings"] .map-btn-play {
  background: linear-gradient(135deg, #b89150, #d4b478) !important;
  box-shadow: 0 2px 14px rgba(184, 145, 80, 0.25);
}

.map-player-container[data-theme-active="angel-wings"] .map-playing .map-btn-play {
  animation: map-angelic-glow 3s ease-in-out infinite;
}

@keyframes map-angelic-glow {
  0%, 100% {
    box-shadow:
      0 0 12px rgba(184, 145, 80, 0.2),
      0 0 30px rgba(255, 235, 180, 0.12);
  }
  50% {
    box-shadow:
      0 0 20px rgba(184, 145, 80, 0.35),
      0 0 50px rgba(255, 235, 180, 0.2);
  }
}

.map-player-container[data-theme-active="angel-wings"] .map-track-title {
  letter-spacing: 0.01em;
}

/* ─── Theme: Aurora ──────────────────────────────────── */

.map-player-container[data-theme-active="aurora"] {
  --map-accent: #22d3ee;
  --map-accent-rgb: 34, 211, 238;
  --map-accent-secondary: #a78bfa;
  --map-bg: rgba(10, 15, 30, 0.94);
  --map-bg-solid: #0a0f1e;
  --map-bg-secondary: rgba(34, 211, 238, 0.06);
  --map-text: #e0f2fe;
  --map-text-secondary: #7dd3fc;
  --map-border: rgba(34, 211, 238, 0.1);
  --map-hover: rgba(34, 211, 238, 0.08);
  --map-shadow:
    0 0 0 1px rgba(34, 211, 238, 0.06),
    0 4px 20px rgba(0, 0, 0, 0.4),
    0 0 60px -15px rgba(34, 211, 238, 0.15);
  --map-glow: 0 0 80px -10px rgba(34, 211, 238, 0.25);
  --map-progress-bg: rgba(34, 211, 238, 0.08);
  --map-waveform-color: rgba(34, 211, 238, 0.14);
  --map-glass-blur: 22px;
  --map-control-bg: rgba(34, 211, 238, 0.04);
  --map-control-hover: rgba(34, 211, 238, 0.12);
  --map-active-track: #a78bfa;
}

.map-player-container[data-theme-active="aurora"] .map-player {
  background:
    radial-gradient(ellipse at 15% 0%, rgba(34, 211, 238, 0.08) 0%, transparent 45%),
    radial-gradient(ellipse at 85% 10%, rgba(167, 139, 250, 0.06) 0%, transparent 45%),
    radial-gradient(ellipse at 50% 100%, rgba(52, 211, 153, 0.04) 0%, transparent 50%),
    var(--map-bg);
}

.map-player-container[data-theme-active="aurora"] .map-player::before {
  background: linear-gradient(
    135deg,
    rgba(34, 211, 238, 0.2),
    rgba(167, 139, 250, 0.15) 30%,
    transparent 50%,
    rgba(52, 211, 153, 0.12) 80%,
    rgba(34, 211, 238, 0.15)
  );
  opacity: 1;
  animation: map-aurora-shift 8s ease-in-out infinite alternate;
}

@keyframes map-aurora-shift {
  0% { opacity: 0.7; filter: hue-rotate(0deg); }
  50% { opacity: 1; filter: hue-rotate(15deg); }
  100% { opacity: 0.8; filter: hue-rotate(-10deg); }
}

.map-player-container[data-theme-active="aurora"] .map-cover {
  box-shadow:
    0 2px 12px rgba(0, 0, 0, 0.3),
    0 0 16px rgba(34, 211, 238, 0.15);
  border: 1px solid rgba(34, 211, 238, 0.12);
}

.map-player-container[data-theme-active="aurora"] .map-cover-placeholder {
  color: #22d3ee;
  filter: drop-shadow(0 0 6px rgba(34, 211, 238, 0.5));
}

.map-player-container[data-theme-active="aurora"] .map-btn-play {
  background: linear-gradient(135deg, #22d3ee, #a78bfa) !important;
}

.map-player-container[data-theme-active="aurora"] .map-playing .map-btn-play {
  animation: map-aurora-pulse 2.5s ease-in-out infinite;
}

@keyframes map-aurora-pulse {
  0%, 100% {
    box-shadow:
      0 0 12px rgba(34, 211, 238, 0.3),
      0 0 24px rgba(167, 139, 250, 0.15);
  }
  50% {
    box-shadow:
      0 0 20px rgba(34, 211, 238, 0.5),
      0 0 40px rgba(167, 139, 250, 0.25);
  }
}

.map-player-container[data-theme-active="aurora"] .map-progress-fill {
  background: linear-gradient(90deg, #22d3ee, #a78bfa) !important;
  box-shadow: 0 0 6px rgba(34, 211, 238, 0.4);
}

/* ─── Theme: Ember ───────────────────────────────────── */

.map-player-container[data-theme-active="ember"] {
  --map-accent: #f97316;
  --map-accent-rgb: 249, 115, 22;
  --map-accent-secondary: #fb923c;
  --map-bg: rgba(20, 12, 8, 0.95);
  --map-bg-solid: #140c08;
  --map-bg-secondary: rgba(249, 115, 22, 0.06);
  --map-text: #fef3e2;
  --map-text-secondary: #d4a574;
  --map-border: rgba(249, 115, 22, 0.12);
  --map-hover: rgba(249, 115, 22, 0.08);
  --map-shadow:
    0 0 0 1px rgba(249, 115, 22, 0.08),
    0 4px 20px rgba(0, 0, 0, 0.4),
    0 0 50px -12px rgba(249, 115, 22, 0.2);
  --map-glow: 0 0 80px -8px rgba(249, 115, 22, 0.3);
  --map-progress-bg: rgba(249, 115, 22, 0.1);
  --map-waveform-color: rgba(249, 115, 22, 0.15);
  --map-glass-blur: 20px;
  --map-control-bg: rgba(249, 115, 22, 0.05);
  --map-control-hover: rgba(249, 115, 22, 0.14);
  --map-active-track: #2dd4bf;
}

.map-player-container[data-theme-active="ember"] .map-player {
  background:
    radial-gradient(ellipse at 30% 100%, rgba(249, 115, 22, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 100%, rgba(239, 68, 68, 0.05) 0%, transparent 50%),
    var(--map-bg);
}

.map-player-container[data-theme-active="ember"] .map-player::before {
  background: linear-gradient(
    0deg,
    rgba(249, 115, 22, 0.25),
    rgba(239, 68, 68, 0.12) 30%,
    transparent 60%,
    transparent
  );
  opacity: 1;
}

.map-player-container[data-theme-active="ember"] .map-cover {
  box-shadow:
    0 2px 12px rgba(0, 0, 0, 0.3),
    0 0 16px rgba(249, 115, 22, 0.2);
  border: 1px solid rgba(249, 115, 22, 0.15);
}

.map-player-container[data-theme-active="ember"] .map-cover-placeholder {
  color: #f97316;
  filter: drop-shadow(0 0 6px rgba(249, 115, 22, 0.5));
}

.map-player-container[data-theme-active="ember"] .map-btn-play {
  background: linear-gradient(135deg, #f97316, #ef4444) !important;
}

.map-player-container[data-theme-active="ember"] .map-playing .map-btn-play {
  animation: map-ember-pulse 2s ease-in-out infinite;
}

@keyframes map-ember-pulse {
  0%, 100% {
    box-shadow:
      0 0 10px rgba(249, 115, 22, 0.35),
      0 0 25px rgba(239, 68, 68, 0.15);
  }
  50% {
    box-shadow:
      0 0 18px rgba(249, 115, 22, 0.55),
      0 0 45px rgba(239, 68, 68, 0.25);
  }
}

.map-player-container[data-theme-active="ember"] .map-progress-fill {
  background: linear-gradient(90deg, #f97316, #ef4444) !important;
  box-shadow: 0 0 6px rgba(249, 115, 22, 0.4);
}

/* ─── Player Container ────────────────────────────────── */

.map-player {
  background: var(--map-bg);
  -webkit-backdrop-filter: blur(var(--map-glass-blur));
  backdrop-filter: blur(var(--map-glass-blur));
  border-radius: var(--map-radius);
  box-shadow: var(--map-shadow);
  border: 1px solid var(--map-border);
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: box-shadow 400ms cubic-bezier(0.4, 0, 0.2, 1),
              border-color 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Gradient glow behind the player */
.map-player::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--map-radius);
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(var(--map-accent-rgb), 0.15),
    transparent 50%,
    rgba(var(--map-accent-rgb), 0.08)
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: opacity 400ms ease;
}

.map-player:hover::before,
.map-player.map-playing::before {
  opacity: 1;
}

.map-player:hover {
  box-shadow: var(--map-shadow), var(--map-glow);
}

.map-player.map-playing {
  box-shadow: var(--map-shadow), var(--map-glow);
  border-color: rgba(var(--map-accent-rgb), 0.12);
}

/* ─── Header: Cover + Track Info (inline) ─────────────── */

.map-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.map-cover-wrap {
  flex-shrink: 0;
}

.map-cover {
  width: 52px;
  height: 52px;
  border-radius: var(--map-radius-xs);
  background-color: var(--map-bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 300ms ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.map-playing .map-cover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(var(--map-accent-rgb), 0.2);
}

.map-cover-placeholder {
  width: 28px;
  height: 28px;
  color: var(--map-accent, #6366f1);
  opacity: 0.85;
  filter: drop-shadow(0 0 6px rgba(var(--map-accent-rgb), 0.5));
}

.map-playing .map-cover-placeholder {
  opacity: 1;
  filter: drop-shadow(0 0 10px rgba(var(--map-accent-rgb), 0.7));
  animation: map-icon-pulse 2s ease-in-out infinite;
}

@keyframes map-icon-pulse {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(var(--map-accent-rgb), 0.5)); }
  50% { filter: drop-shadow(0 0 14px rgba(var(--map-accent-rgb), 0.9)); }
}

/* ─── Track Info ──────────────────────────────────────── */

.map-info {
  min-width: 0;
  flex: 1;
}

.map-track-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--map-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.map-track-artist {
  font-size: 12.5px;
  color: var(--map-text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-error-text {
  color: #f87171;
}

/* ─── Progress / Waveform ─────────────────────────────── */

.map-progress-container {
  position: relative;
  cursor: pointer;
  padding: 4px 0;
  margin-bottom: 4px;
  -webkit-user-select: none;
  user-select: none;
  outline: none;
}

.map-progress-container:focus-visible {
  outline: 2px solid var(--map-accent);
  outline-offset: 4px;
  border-radius: 4px;
}

.map-waveform {
  display: block;
  width: 100%;
  height: 56px;
  position: relative;
  z-index: 1;
}

/* Glow mode: taller canvas, dark bg for contrast */
.map-player-container[data-waveform-style="glow"] .map-waveform {
  height: 80px;
  border-radius: 8px;
}

.map-progress-bar {
  position: relative;
  height: 4px;
  background: var(--map-progress-bg);
  border-radius: 100px;
  overflow: visible;
  transition: height var(--map-transition);
}

.map-waveform + .map-progress-bar {
  margin-top: -4px;
  height: 0;
  opacity: 0;
}

.map-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--map-accent), var(--map-accent-secondary));
  border-radius: 100px;
  width: 0;
  position: relative;
  transition: none;
}

.map-progress-handle {
  width: 14px;
  height: 14px;
  background: #fff;
  border: 3px solid var(--map-accent);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 0;
  transform: translate(-50%, -50%) scale(0);
  transition: transform var(--map-transition);
  box-shadow: 0 2px 6px rgba(var(--map-accent-rgb), 0.25);
  z-index: 2;
}

.map-progress-container:hover .map-progress-handle,
.map-progress-container:active .map-progress-handle {
  transform: translate(-50%, -50%) scale(1);
}

.map-progress-container:hover .map-progress-bar:not(.map-waveform + .map-progress-bar) {
  height: 6px;
}

/* Time display */

.map-time {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--map-text-secondary);
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  opacity: 0.8;
}

/* ─── Controls ────────────────────────────────────────── */

.map-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 16px;
}

.map-controls-left,
.map-controls-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.map-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: none;
  background: transparent;
  color: var(--map-text-secondary);
  cursor: pointer;
  border-radius: var(--map-radius-xs);
  transition: all var(--map-transition);
  padding: 0;
  text-decoration: none;
  flex-shrink: 0;
  position: relative;
}

.map-btn:hover {
  background: var(--map-control-hover);
  color: var(--map-text);
}

.map-btn:active {
  transform: scale(0.92);
}

.map-btn:focus-visible {
  outline: 2px solid var(--map-accent);
  outline-offset: 2px;
}

.map-btn.map-active {
  color: var(--map-accent);
  background: rgba(var(--map-accent-rgb), 0.08);
}

/* Play button — gradient glow */

.map-btn-play {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--map-accent), var(--map-accent-secondary));
  color: #ffffff;
  border-radius: 50%;
  transition: all var(--map-transition);
  box-shadow: 0 4px 14px rgba(var(--map-accent-rgb), 0.3);
  position: relative;
}

.map-btn-play::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--map-accent-secondary), var(--map-accent));
  opacity: 0;
  transition: opacity var(--map-transition);
}

.map-btn-play:hover {
  background: linear-gradient(135deg, var(--map-accent), var(--map-accent-secondary));
  color: #ffffff;
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(var(--map-accent-rgb), 0.4);
}

.map-btn-play:hover::before {
  opacity: 1;
}

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

.map-btn-play svg {
  position: relative;
  z-index: 1;
}

/* Speed button */

.map-btn-speed {
  font-size: 11px;
  font-weight: 700;
  width: auto;
  padding: 0 10px;
  font-family: var(--map-font);
  border-radius: 100px;
  background: var(--map-control-bg);
  letter-spacing: -0.01em;
}

.map-btn-speed:hover {
  background: var(--map-control-hover);
}

.map-speed-label {
  font-size: 11px;
  font-weight: 700;
}

/* ─── Volume ──────────────────────────────────────────── */

.map-volume-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
}

.map-volume-slider {
  width: 72px;
  cursor: pointer;
  padding: 10px 0;
  outline: none;
}

.map-volume-slider:focus-visible {
  outline: 2px solid var(--map-accent);
  outline-offset: 4px;
  border-radius: 4px;
}

.map-volume-track {
  position: relative;
  height: 4px;
  background: var(--map-progress-bg);
  border-radius: 100px;
  transition: height var(--map-transition);
}

.map-volume-slider:hover .map-volume-track {
  height: 5px;
}

.map-volume-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--map-accent), var(--map-accent-secondary));
  border-radius: 100px;
  width: 80%;
}

.map-volume-handle {
  width: 14px;
  height: 14px;
  background: #fff;
  border: 3px solid var(--map-accent);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 80%;
  transform: translate(-50%, -50%) scale(0);
  transition: transform var(--map-transition);
  box-shadow: 0 2px 6px rgba(var(--map-accent-rgb), 0.25);
}

.map-volume-slider:hover .map-volume-handle,
.map-volume-slider:active .map-volume-handle {
  transform: translate(-50%, -50%) scale(1);
}

/* ─── Playlist ────────────────────────────────────────── */

.map-playlist {
  margin-top: 18px;
  border-top: 1px solid var(--map-border);
  padding-top: 14px;
  position: relative;
  overflow: hidden;
  border-radius: 0 0 var(--map-radius-sm) var(--map-radius-sm);
}

/* Transparent playlist */
.map-playlist-transparent .map-playlist {
  background: transparent;
  border-top-color: transparent;
}

.map-playlist-transparent .map-playlist-item {
  background: transparent;
}

.map-playlist-transparent .map-playlist-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.map-playlist-transparent .map-playlist-active {
  background: rgba(var(--map-accent-rgb), 0.08);
}

/* Playlist background image */
.map-playlist-has-bg .map-playlist {
  position: relative;
  border-top-color: transparent;
}

.map-playlist-bg-image {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
  border-radius: 0 0 var(--map-radius-sm) var(--map-radius-sm);
}

.map-playlist-bg-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  border-radius: inherit;
}

/* Light themes: lighter overlay on playlist bg */
.map-player-container[data-theme-active="light"] .map-playlist-bg-image::after,
.map-player-container[data-theme-active="angel-wings"] .map-playlist-bg-image::after {
  background: rgba(255, 255, 255, 0.25);
}

.map-playlist-has-bg .map-playlist-header,
.map-playlist-has-bg .map-playlist-tracks {
  position: relative;
  z-index: 1;
}

.map-playlist-has-bg .map-playlist-item {
  background: rgba(0, 0, 0, 0.08);
}

.map-playlist-has-bg .map-playlist-item:hover {
  background: rgba(0, 0, 0, 0.15);
}

.map-playlist-has-bg .map-playlist-active {
  background: rgba(var(--map-accent-rgb), 0.15);
}

.map-player-container[data-theme-active="light"] .map-playlist-has-bg .map-playlist-item,
.map-player-container[data-theme-active="angel-wings"] .map-playlist-has-bg .map-playlist-item {
  background: rgba(255, 255, 255, 0.1);
}

.map-player-container[data-theme-active="light"] .map-playlist-has-bg .map-playlist-item:hover,
.map-player-container[data-theme-active="angel-wings"] .map-playlist-has-bg .map-playlist-item:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ─── Header transparency & background image ──────────── */

.map-header-transparent .map-header {
  background: transparent;
}

.map-header-has-bg .map-header {
  position: relative;
  overflow: hidden;
  border-radius: var(--map-radius-sm) var(--map-radius-sm) 0 0;
  padding: 14px;
}

.map-header-bg-image {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
  border-radius: inherit;
}

.map-header-bg-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  border-radius: inherit;
}

.map-player-container[data-theme-active="light"] .map-header-bg-image::after,
.map-player-container[data-theme-active="angel-wings"] .map-header-bg-image::after {
  background: rgba(255, 255, 255, 0.25);
}

.map-header-has-bg .map-cover-wrap,
.map-header-has-bg .map-info {
  position: relative;
  z-index: 1;
}

.map-header-has-bg .map-track-title {
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.map-player-container[data-theme-active="light"] .map-header-has-bg .map-track-title,
.map-player-container[data-theme-active="angel-wings"] .map-header-has-bg .map-track-title {
  text-shadow: 0 1px 4px rgba(255, 255, 255, 0.6);
}

.map-playlist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.map-playlist-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--map-text-secondary);
  opacity: 0.7;
}

.map-playlist-tracks {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.map-playlist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: var(--map-radius-xs);
  cursor: pointer;
  transition: all var(--map-transition);
  gap: 10px;
  outline: none;
}

.map-playlist-item:hover {
  background: var(--map-hover);
}

.map-playlist-item:focus-visible {
  outline: 2px solid var(--map-accent);
  outline-offset: -2px;
}

.map-playlist-active {
  background: rgba(var(--map-accent-rgb), 0.1);
}

.map-playlist-active .map-playlist-item-title {
  color: var(--map-active-track);
  font-weight: 700;
  text-shadow: 0 0 12px rgba(0, 0, 0, 0.15);
}

.map-playlist-active .map-playlist-item-num {
  color: var(--map-active-track);
  font-weight: 800;
  opacity: 1;
}

.map-playlist-item-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.map-playlist-item-num {
  font-size: 12px;
  color: var(--map-text-secondary);
  font-weight: 600;
  min-width: 22px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  opacity: 0.6;
}

.map-playlist-item-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--map-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-playlist-item-artist {
  font-size: 11px;
  color: var(--map-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-playlist-item-format {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--map-text-secondary);
  background: var(--map-bg-secondary);
  padding: 3px 7px;
  border-radius: 100px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  text-transform: uppercase;
  opacity: 0.7;
}

/* Scrollbar */

.map-playlist-tracks::-webkit-scrollbar {
  width: 4px;
}

.map-playlist-tracks::-webkit-scrollbar-track {
  background: transparent;
}

.map-playlist-tracks::-webkit-scrollbar-thumb {
  background: var(--map-border);
  border-radius: 100px;
}

/* ─── Error ───────────────────────────────────────────── */

.map-error {
  text-align: center;
  color: #f87171;
  padding: 20px;
  font-size: 14px;
  font-weight: 500;
  background: rgba(239, 68, 68, 0.06);
  border-radius: var(--map-radius);
  border: 1px solid rgba(239, 68, 68, 0.12);
}

/* ─── Responsive ──────────────────────────────────────── */

@media (max-width: 480px) {
  .map-player-container {
    max-width: 100%;
  }

  .map-player {
    padding: 18px;
    border-radius: 16px;
  }

  .map-header {
    gap: 12px;
  }

  .map-cover {
    width: 44px;
    height: 44px;
  }

  .map-controls {
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
  }

  .map-controls-left {
    order: 1;
  }

  .map-controls-right {
    order: 2;
    flex-wrap: wrap;
    justify-content: center;
  }

  .map-volume-slider {
    width: 56px;
  }

  .map-btn {
    width: 34px;
    height: 34px;
  }

  .map-btn-play {
    width: 44px;
    height: 44px;
  }

  .map-track-title {
    font-size: 14px;
  }
}

@media (max-width: 360px) {
  .map-volume-wrap {
    display: none;
  }
}

/* ─── Animations ──────────────────────────────────────── */

@keyframes map-glow-pulse {
  0%, 100% {
    box-shadow: 0 4px 14px rgba(var(--map-accent-rgb), 0.3);
  }
  50% {
    box-shadow: 0 4px 24px rgba(var(--map-accent-rgb), 0.45);
  }
}

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

.map-playing .map-btn-play {
  animation: map-glow-pulse 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Loading state */

.map-loading .map-btn-play {
  opacity: 0.7;
  pointer-events: none;
}

.map-loading .map-btn-play::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  border: 2px solid transparent;
  border-top-color: #fff;
  border-radius: 50%;
  animation: map-spin 0.8s linear infinite;
  z-index: 2;
}

/* ─── Print ───────────────────────────────────────────── */

@media print {
  .map-player-container {
    display: none;
  }
}

/* ─── Reduced motion ──────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .map-player-container * {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─── 3D Card Flip & Lyrics ─────────────────────────── */

/*
 * The flip uses visibility toggling instead of backface-visibility
 * because backface-visibility: hidden is unreliable across browsers
 * (especially on mobile/WebKit with nested transforms).
 */

.map-flip-wrapper {
  width: 100%;
  position: relative;
}

.map-flip-front {
  position: relative;
  width: 100%;
  transition: opacity 0.3s ease, transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: center center;
}

.map-flip-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: center center;
  transform: rotateY(90deg);
  border-radius: var(--map-radius);
  overflow: hidden;
}

/* Flipped state: hide front, show back */
.map-flip-wrapper.map-flipped .map-flip-front {
  opacity: 0;
  pointer-events: none;
  transform: rotateY(-90deg);
}

.map-flip-wrapper.map-flipped .map-flip-back {
  opacity: 1;
  pointer-events: auto;
  transform: rotateY(0deg);
}

/* Lyrics panel */
.map-lyrics-panel {
  padding: 20px 24px;
  min-height: 200px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--map-bg);
  color: var(--map-text);
  border-radius: var(--map-radius);
  border: 1px solid var(--map-border);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  scrollbar-width: thin;
  scrollbar-color: var(--map-accent) transparent;
}

.map-lyrics-panel::-webkit-scrollbar {
  width: 4px;
}

.map-lyrics-panel::-webkit-scrollbar-thumb {
  background: var(--map-accent);
  border-radius: 4px;
}

.map-lyrics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--map-border);
}

.map-lyrics-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--map-text);
}

.map-lyrics-artist {
  font-size: 12px;
  color: var(--map-text-secondary);
  margin-top: 2px;
}

.map-lyrics-content {
  font-size: 14px;
  line-height: 1.9;
  white-space: pre-wrap;
  color: var(--map-text);
  opacity: 0.85;
}

.map-lyrics-content.map-lyrics-loading {
  text-align: center;
  opacity: 0.5;
  font-style: italic;
  padding: 40px 0;
}

.map-lyrics-content.map-lyrics-error {
  text-align: center;
  opacity: 0.5;
  padding: 40px 0;
}

/* Flip button */
.map-lyrics-flip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--map-text-secondary);
  cursor: pointer;
  transition: all var(--map-transition);
  padding: 0;
  flex-shrink: 0;
}

.map-lyrics-flip-btn:hover {
  background: rgba(var(--map-accent-rgb), 0.12);
  color: var(--map-accent);
}

.map-lyrics-flip-btn svg {
  width: 18px;
  height: 18px;
}

/* Back-side flip button (to return) */
.map-lyrics-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  background: rgba(var(--map-accent-rgb), 0.1);
  color: var(--map-accent);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  transition: all var(--map-transition);
  font-family: var(--map-font);
}

.map-lyrics-back-btn:hover {
  background: rgba(var(--map-accent-rgb), 0.2);
}

.map-lyrics-back-btn svg {
  width: 14px;
  height: 14px;
}
