.footer-media-panel {
  --ipod-panel-base-w: 300;
  --ipod-panel-base-h: 490;

  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1070;
  display: none;
  width: min(
    300px,
    calc(100vw - 40px),
    calc((100dvh - 72px) * var(--ipod-panel-base-w) / var(--ipod-panel-base-h))
  );
  aspect-ratio: var(--ipod-panel-base-w) / var(--ipod-panel-base-h);
  height: auto;
  max-height: min(490px, calc(100dvh - 72px));
  border: 1px solid #1e2126;
  border-radius: clamp(20px, 6vw, 32px);
  background: #2b2f35;
  overflow: hidden;
  box-shadow:
    0 12px 32px rgb(0 0 0 / 52%),
    0 4px 12px rgb(0 0 0 / 38%);
  container-type: inline-size;
  container-name: ipod-panel;
}

.footer-media-panel.is-open {
  display: flex;
  flex-direction: column;
}

.footer-media-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.ipod-shell {
  --ipod-frame-top: #3a3f47;
  --ipod-frame-bottom: #2b2f35;
  --ipod-edge-light: rgb(88 94 102 / 34%);
  --ipod-edge-vignette: rgb(0 0 0 / 36%);
  --ipod-wheel: #2a2a2a;
  --ipod-wheel-glyph: #e8e8e8;
  --ipod-center-top: #50555d;
  --ipod-center-bottom: #3a3f47;
  --ipod-center-ring: #1a1c20;
  --ipod-lcd-border: #0a0a0a;
  --ipod-list-active: #4a90c2;
  --ipod-progress-border: #6b7280;
  --ipod-progress-track-1: #4b5563;
  --ipod-progress-track-2: #374151;
  --ipod-progress-fill-1: #9ec9e8;
  --ipod-progress-fill-2: #5ba3d0;
  --ipod-progress-fill-3: #2e7eb8;
  --ipod-wheel-size: min(68%, 196px);
  --ipod-wheel-gap: 45px;
  --ipod-screen-trim: 25px;
  --ipod-screen-size: calc(
    100% - var(--ipod-wheel-size) - var(--ipod-wheel-gap) - 8px - 6px -
      var(--ipod-screen-trim)
  );

  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  padding: 16px 18px 18px;
  background:
    radial-gradient(ellipse 88% 34px at 50% 0%, var(--ipod-edge-light) 0%, transparent 72%),
    radial-gradient(ellipse 88% 30px at 50% 100%, var(--ipod-edge-vignette) 0%, transparent 70%),
    radial-gradient(ellipse 38px 90% at 0% 50%, var(--ipod-edge-light) 0%, transparent 72%),
    radial-gradient(ellipse 38px 90% at 100% 50%, var(--ipod-edge-light) 0%, transparent 72%),
    linear-gradient(90deg, var(--ipod-edge-vignette) 0%, transparent 18%, transparent 82%, var(--ipod-edge-vignette) 100%),
    linear-gradient(180deg, var(--ipod-edge-vignette) 0%, transparent 16%, transparent 84%, var(--ipod-edge-vignette) 100%),
    linear-gradient(180deg, var(--ipod-frame-top) 0%, var(--ipod-frame-bottom) 100%);
  border-radius: 32px;
  box-shadow:
    inset 1px 0 0 rgb(74 80 88 / 24%),
    inset -1px 0 0 rgb(74 80 88 / 24%),
    inset 0 1px 0 rgb(74 80 88 / 14%),
    inset 0 -2px 5px rgb(0 0 0 / 42%);
  cursor: grab;
}

.ipod-shell.is-dragging {
  cursor: grabbing;
}

.ipod-shell-close {
  position: absolute;
  left: 15px;
  bottom: 15px;
  z-index: 6;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  color: #d1d5db;
  cursor: pointer;
}

.ipod-shell-close::before {
  content: "";
  position: absolute;
  inset: -50px;
}

.ipod-shell-close-mark {
  position: relative;
  z-index: 1;
  display: block;
  font-size: 20px;
  font-weight: 300;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 120ms ease 0.5s,
    color 120ms ease;
}

.ipod-shell-close:hover .ipod-shell-close-mark,
.ipod-shell-close:focus-visible .ipod-shell-close-mark {
  opacity: 1;
  transition-delay: 0s;
}

.ipod-screen {
  display: flex;
  flex-direction: column;
  width: auto;
  min-height: 130px;
  height: var(--ipod-screen-size);
  max-height: var(--ipod-screen-size);
  margin: 6px 4px 0;
  border: 5px solid var(--ipod-lcd-border);
  border-radius: 8px;
  background: #000;
  box-shadow:
    0 0 0 1px rgb(255 255 255 / 6%),
    inset 0 0 0 1px rgb(255 255 255 / 4%);
  cursor: default;
}

.footer-media-ipod-lcd {
  --ipod-header-art: clamp(40px, 19cqw, 52px);

  position: relative;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  border-radius: 2px;
  background: #000;
  container-type: inline-size;
  container-name: ipod-lcd;
}

.footer-media-player-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #000;
}

.footer-media-yt {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.footer-media-yt iframe {
  position: absolute;
  width: 1px;
  height: 1px;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.footer-media-vinyl-overlay {
  display: none;
  background: #000;
}

.footer-media-player-wrap.is-audio .footer-media-vinyl-overlay {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 26px;
  left: 0;
  z-index: 2;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
  pointer-events: none;
}

.footer-media-cover-art {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
}

.footer-media-vinyl-overlay.has-cover-art .footer-media-cover-art {
  display: block;
}

.ipod-now-meta {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  padding: 0 8px 6px;
  opacity: 1;
  transition: opacity 300ms ease;
  pointer-events: none;
}

.ipod-now-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 2px;
  pointer-events: auto;
}

.footer-media-ipod-lcd.is-playing-now:not(.is-now-chrome-visible)
  :is(.ipod-now-meta, .ipod-progress) {
  opacity: 0;
  pointer-events: none;
}

.footer-media-ipod-lcd.is-list-mode > .footer-media-player-wrap,
.footer-media-ipod-lcd.is-list-mode .ipod-now-meta,
.footer-media-ipod-lcd.is-list-mode .ipod-progress {
  visibility: hidden;
  pointer-events: none;
}

.ipod-now-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: #f3f4f6;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgb(0 0 0 / 70%);
}

.footer-media-overlay-btn {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 3px;
  border: 1px solid rgb(255 255 255 / 20%);
  border-radius: 4px;
  background: rgb(0 0 0 / 55%);
  color: rgb(255 255 255 / 75%);
  cursor: pointer;
}

.footer-media-overlay-btn:hover {
  background: rgb(0 0 0 / 80%);
  color: #fff;
}

.ipod-list {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow-x: hidden;
  overflow-y: auto;
  background: #e8e8ec;
  color: #111;
  scrollbar-width: thin;
}

.ipod-list.is-visible {
  display: block;
}

.ipod-list-header {
  display: flex;
  align-items: center;
  gap: clamp(8px, 3cqw, 12px);
  padding: clamp(6px, 2.5cqw, 10px) clamp(8px, 3.5cqw, 12px);
  background: linear-gradient(180deg, #6eb0d9 0%, #4a90c2 50%, #3a7eae 100%);
  color: #fff;
}

.ipod-list-header-art {
  width: var(--ipod-header-art);
  height: var(--ipod-header-art);
  flex-shrink: 0;
  object-fit: cover;
  border-radius: 2px;
  background: #bbb;
}

.ipod-list-header-title {
  font-size: clamp(15px, 5.5cqw, 18px);
  font-weight: 600;
  line-height: 1.2;
}

.ipod-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 7px 10px;
  border: none;
  border-bottom: 1px solid #c5c5c9;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.ipod-list-item:hover {
  background: rgb(74 144 194 / 35%);
}

#tracks-list .ipod-list-item.is-active,
#playlists-list .ipod-list-item.is-active {
  background: rgb(74 144 194 / 18%);
  color: #111;
  border-bottom-color: #c5c5c9;
  box-shadow: inset 3px 0 0 var(--ipod-list-active);
}

.ipod-list-thumb {
  width: calc(var(--ipod-header-art) * 0.72);
  height: calc(var(--ipod-header-art) * 0.72);
  flex-shrink: 0;
  object-fit: cover;
  border-radius: 2px;
  background: #bbb;
}

.ipod-list-thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #c8c8cc;
  color: #5a5a5e;
}

#tracks-list .ipod-list-item.is-active .ipod-list-thumb--empty {
  background: #c8c8cc;
  color: #5a5a5e;
}

.ipod-list-name {
  flex: 1;
  overflow: hidden;
  font-size: clamp(12px, 4.2cqw, 14px);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ipod-list-error {
  margin: 10px;
  color: #b91c1c;
}

.ipod-progress {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 2px;
  background: linear-gradient(180deg, transparent, rgb(0 0 0 / 75%));
  cursor: pointer;
}

.ipod-progress-time {
  flex-shrink: 0;
  width: 35px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.ipod-progress-time--remain {
  width: 40px;
  text-align: right;
}

.ipod-progress-track {
  position: relative;
  flex: 1 1 0;
  min-width: 40px;
  height: 16px;
  overflow: hidden;
  border: 1px solid var(--ipod-progress-border);
  background: linear-gradient(180deg, var(--ipod-progress-track-1), var(--ipod-progress-track-2));
}

.ipod-progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(
    180deg,
    var(--ipod-progress-fill-1) 0%,
    var(--ipod-progress-fill-2) 40%,
    var(--ipod-progress-fill-3) 100%
  );
  box-shadow: 0 2px 4px rgb(46 126 184 / 45%);
  pointer-events: none;
}

.ipod-wheel-spacer {
  flex: 0 0 var(--ipod-wheel-gap);
}

.ipod-click-wheel {
  position: relative;
  z-index: 8;
  flex: 0 0 auto;
  width: var(--ipod-wheel-size);
  aspect-ratio: 1 / 1;
  max-width: 100%;
  margin: 0 auto 8px;
  border-radius: 50%;
  background: var(--ipod-wheel);
  box-shadow:
    inset 0 2px 6px rgb(0 0 0 / 45%),
    0 1px 0 rgb(255 255 255 / 8%);
  user-select: none;
  cursor: default;
}

.ipod-wheel-btn {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--ipod-wheel-glyph);
  font: inherit;
  cursor: pointer;
}

.ipod-wheel-btn:active {
  opacity: 0.7;
}

.ipod-wheel-btn--menu {
  top: 3%;
  left: 50%;
  width: 44%;
  height: 18%;
  align-items: flex-start;
  padding-top: 1%;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  transform: translateX(-50%);
}

.ipod-wheel-btn--prev {
  top: 50%;
  left: 2%;
  width: 24%;
  height: 24%;
  justify-content: flex-start;
  padding-left: 3%;
  transform: translateY(-50%);
}

.ipod-wheel-btn--next {
  top: 50%;
  right: 2%;
  width: 24%;
  height: 24%;
  justify-content: flex-end;
  padding-right: 3%;
  transform: translateY(-50%);
}

.ipod-wheel-btn--play {
  bottom: 3%;
  left: 50%;
  width: 44%;
  height: 18%;
  align-items: flex-end;
  padding-bottom: 1%;
  transform: translateX(-50%);
}

.ipod-wheel-btn--center {
  top: 50%;
  left: 50%;
  width: 38%;
  height: 38%;
  border: 1px solid var(--ipod-center-ring);
  border-radius: 50%;
  background: linear-gradient(180deg, var(--ipod-center-top) 0%, var(--ipod-center-bottom) 100%);
  box-shadow:
    inset 0 2px 4px rgb(0 0 0 / 42%),
    inset 0 -1px 1px rgb(70 75 82 / 16%);
  transform: translate(-50%, -50%);
}

.ipod-wheel-btn--center:active {
  opacity: 1;
  filter: brightness(0.94);
}

audio {
  display: none;
}

@container ipod-panel (max-width: 280px) {
  .ipod-shell {
    --ipod-wheel-gap: 36px;
    --ipod-screen-trim: 18px;

    padding: 12px 14px 14px;
    border-radius: clamp(20px, 6vw, 32px);
  }

  .ipod-screen {
    min-height: 96px;
    border-width: 4px;
  }

  .ipod-wheel-btn--menu {
    font-size: 11px;
  }

  .ipod-shell-close-mark {
    font-size: 18px;
  }
}
