:root {
  --ipod-w: 300px;
  --ipod-h: 520px;

  --bg-0: #1a0f2a;
  --bg-1: #2d1f3d;
  --bg-2: #3d2f4d;

  --accent: #6b4fa0;
  --accent-2: #8b6fc0;

  --text: #e8dcff;
  --text-2: #d4c4f0;
  --text-3: #b8a8d8;

  --shadow-strong: 0 24px 60px rgba(0, 0, 0, 0.55);
  --shadow-soft: 0 10px 24px rgba(0, 0, 0, 0.35);
  --glow: 0 0 18px rgba(106, 79, 160, 0.35);

  --radius: 28px;
  --radius-sm: 12px;

  --mono: "DotGothic16", ui-monospace, monospace;
}

.music-panel {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 18px 0;
}

/* MIDNIGHT PURPLE iPOD */
.ipod-full {
  width: var(--ipod-w);
  height: var(--ipod-h);
  border-radius: var(--radius);
  padding: 22px;
  position: relative;

  background: linear-gradient(165deg, #5a4a6e 0%, #3d2f4d 42%, #2d1f3d 74%, #160b24 100%);
  border: 1px solid rgba(106, 79, 160, 0.28);
  box-shadow: var(--shadow-strong), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

/* A single, subtle shine (no pulsing) */
.ipod-full::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  pointer-events: none;
  background:
    radial-gradient(circle at 30% 12%, rgba(255, 255, 255, 0.12), transparent 45%),
    radial-gradient(circle at 80% 28%, rgba(106, 79, 160, 0.10), transparent 55%);
  filter: blur(12px);
  opacity: 0.75;
}

/* IPOD SCREEN */
.ipod-screen {
  width: 100%;
  height: 188px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;

  background: linear-gradient(180deg, var(--bg-0) 0%, #0f0618 100%);
  border: 2px solid rgba(107, 79, 160, 0.9);
  box-shadow: var(--shadow-soft), var(--glow), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* Clean glass reflection (static) */
.ipod-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-sm);
  pointer-events: none;
  background: linear-gradient(135deg, rgba(200, 180, 255, 0.14) 0%, rgba(200, 180, 255, 0.04) 40%, transparent 70%);
  opacity: 0.8;
}

.screen-content {
  height: 100%;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  z-index: 1;

  font-family: var(--mono);
  color: var(--text-2);
  text-shadow: 0 0 10px rgba(212, 196, 240, 0.18);
}

.screen-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(106, 79, 160, 0.35);
}

.screen-title {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--text-3);
  font-weight: 700;
}

.screen-time {
  font-size: 10px;
  color: var(--text-3);
  opacity: 0.85;
}

.now-playing {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-height: 0;
}

.song-title,
.song-artist,
.song-album {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
}

.song-artist {
  font-size: 13px;
  color: var(--text-2);
  opacity: 0.92;
}

.song-album {
  font-size: 12px;
  color: var(--text-3);
  opacity: 0.85;
}

.progress-bar-container {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;

  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(106, 79, 160, 0.28);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.35);
}

.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, #b89ee8 100%);
  transition: width 0.25s ease;
  box-shadow: 0 0 12px rgba(139, 111, 192, 0.35);
}

/* CLICK WHEEL */
.click-wheel {
  width: 200px;
  height: 200px;
  margin: 0 auto;
  position: relative;
}

.wheel-outer {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  position: relative;

  background: radial-gradient(circle at 35% 35%, #6b5a8a 0%, #4a3a5a 42%, #2d1f3d 100%);
  border: 1px solid rgba(106, 79, 160, 0.32);
  box-shadow: var(--shadow-soft), 0 0 22px rgba(106, 79, 160, 0.18);
}

/* Single subtle ring, no rotating shine */
.wheel-outer::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
}

.wheel-center {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 92px;
  height: 92px;
  transform: translate(-50%, -50%);
  border-radius: 50%;

  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;

  background: linear-gradient(145deg, #7a6594 0%, #5a4a6a 55%, #463554 100%);
  border: 1px solid rgba(106, 79, 160, 0.5);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35), inset 0 1px 2px rgba(255, 255, 255, 0.06);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.wheel-center:hover {
  transform: translate(-50%, -50%) scale(1.03);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.45), 0 0 18px rgba(106, 79, 160, 0.22);
}

.wheel-center:active {
  transform: translate(-50%, -50%) scale(0.98);
}

.play-pause-btn {
  font-size: 28px;
  color: var(--text);
  text-shadow: 0 0 10px rgba(232, 220, 255, 0.22);
}

/* WHEEL BUTTONS (no background, pushed outward) */
.wheel-btn {
  position: absolute;
  width: 54px;
  height: 54px;
  border-radius: 999px;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
  user-select: none;

  font-size: 22px;
  color: var(--text-2);

  /* remove the “pill” look */
  background: transparent;
  border: none;
  box-shadow: none;

  transition: transform 0.16s ease, color 0.16s ease;
}

.wheel-btn:hover {
  transform: scale(1.08);
  color: var(--text);
}

.wheel-btn:active {
  transform: scale(0.98);
}

/* push them outward (increase these numbers to taste) */
.wheel-btn.left {
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
}

.wheel-btn.left:hover {
  transform: translateY(-50%) scale(1.08);
}

.wheel-btn.left:active {
  transform: translateY(-50%) scale(0.98);
}

.wheel-btn.right {
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
}

.wheel-btn.right:hover {
  transform: translateY(-50%) scale(1.08);
}

.wheel-btn.right:active {
  transform: translateY(-50%) scale(0.98);
}

/* AMBIENT CONTROLS (tighter, calmer) */
.ambient-controls {
  margin-top: 16px;
  border-radius: 14px;
}

.ambient-toggles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ambient-toggle {
  display: flex;
  align-items: center;
  gap: 10px;

  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease;
  border: 1px solid transparent;
}

.toggle-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-2);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Toggle switch (clean) */
.toggle-btn {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  position: relative;

  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(106, 79, 160, 0.28);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.35);
  flex: 0 0 auto;
}

.toggle-btn.active {
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25), 0 0 14px rgba(106, 79, 160, 0.22);
}

.toggle-slider {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;

  background: linear-gradient(145deg, var(--text) 0%, var(--text-2) 100%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transition: transform 0.22s ease;
}

.toggle-btn.active .toggle-slider {
  transform: translateX(20px);
}

/* AUDIO ELEMENT */
audio {
  display: none;
}

/* Responsive */
@media (max-width: 768px) {
  :root {
    --ipod-w: 280px;
    --ipod-h: 490px;
  }

  .ipod-full {
    padding: 20px;
  }

  .ipod-screen {
    height: 172px;
  }

  .click-wheel {
    width: 186px;
    height: 186px;
  }

  .wheel-center {
    width: 86px;
    height: 86px;
  }
}

/* ============================================
   iPOD DOCK (PINNED BOTTOM + SLIDE UP)
   ============================================ */
:root {
  /* Space above bottom edge */
  --ipod-dock-gap: 12px;
  /* How much of the iPod remains visible when collapsed (top strip) */
  --ipod-collapsed-visible: 13px;
}

/* Dock the iPod itself; collapsed state slides it down so only the top strip shows */
.music-panel {
  position: fixed;
  left: calc(env(safe-area-inset-left) + var(--ipod-dock-gap));
  bottom: calc(env(safe-area-inset-bottom) + var(--ipod-dock-gap));
  z-index: 2147483647;

  padding: 0;
  margin: 0;
  min-height: 0;
  width: max-content;

  transform: translateY(calc(var(--ipod-h) - var(--ipod-collapsed-visible)));
  transition: transform 420ms cubic-bezier(0.2, 0.9, 0.2, 1);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.music-panel.is-open {
  transform: translateY(0);
  cursor: default;
}

/* Collapsed-only title strip (drawn on top of the iPod body) */
.music-panel:not(.is-open) .ipod-full::after {
  content: "♫ " attr(data-track);
  position: absolute;
  top: 6px;
  left: 16px;
  right: 16px;
  z-index: 2;

  font-family: var(--mono);
  font-size: 11px;
  color: var(--text);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  text-shadow: 0 0 10px rgba(232, 220, 255, 0.18);
  pointer-events: none;
}

/* Prevent page content from being hidden behind the collapsed strip */
body {
  padding-bottom: calc(var(--ipod-collapsed-visible) + 24px);
}