#musicGrid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.musicCard {
  display: flex;
  flex-direction: column;
  background-color: rgba(0, 0, 0, 0.85);
  border-radius: 5px;
  overflow: hidden;
}

.musicCard-imageWrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
}

.musicCard-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.musicCard-body {
  padding: 8px;
}

.musicCard-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.musicCard-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.musicCard-year {
  margin: 0;
  opacity: 0.6;
  font-size: 12px;
  white-space: nowrap;
}

.musicCard-links {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.musicCard-links a {
  display: inline-flex;
  align-items: center;
  padding: 8px;
  border-radius: 4px;
  background-color: rgba(0, 0, 0, 0.6);
  transition: background-color 0.15s;
}

.musicCard-links a:hover {
  background-color: rgba(0, 0, 0, 0.8);
}

.musicCard-links img {
  width: 28px;
  height: 28px;
  display: block;
}

@media (hover: hover) {
  .musicCard-links-overlay {
    position: absolute;
    bottom: 8px;
    left: 8px;
    opacity: 0;
    transition: opacity 0.2s;
  }

  .musicCard:hover .musicCard-links-overlay {
    opacity: 1;
  }

  .musicCard-links-body {
    display: none;
  }
}

@media (hover: none) {
  .musicCard-links-overlay {
    display: none;
  }

  .musicCard-links-body {
    margin-top: 8px;
  }
}

/* ── Player ── */
#playerOverlay {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999;
  background: rgba(12, 12, 12, 0.97);
  transform: translateY(calc(100% - 90px));
  transition: transform 0.3s ease;
}

#playerOverlay.visible {
  display: block;
}

#playerOverlay:hover,
#playerOverlay.touch-expanded {
  transform: translateY(0);
}

/* ── Top bar (always visible when player is open) ── */
#playerBar {
  padding: 4px 16px;
  height: 66px;
  box-sizing: border-box;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 20px;
  cursor: pointer;
  border-top: 1px solid rgba(255,255,255,0.1);
}

#playerBackBtn {
  padding: 2px 10px;
  font-size: 16px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  font-family: Jost, sans-serif;
  margin-left: 50px;
}

#playerBackBtn img {
  width: 18px;
  height: 18px;
  display: block;
  transition: filter 0.1s linear;
}

#playerBackBtn:hover img,
#playerBackBtn:active img {
  filter: invert(1);
}

#playerBarNowPlaying {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 3px;
  opacity: 0.5;
  flex-shrink: 0;
}

#playerBarNames {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

#playerBarTrack {
  font-size: 26px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#playerBarAlbum {
  font-size: 22px;
  opacity: 0.55;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

:root {
  --VVADRed: #950400;
}

/* ── Progress row (always visible) ── */
#playerProgressRow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 6px;
  height: 24px;
  box-sizing: border-box;
  margin-left: 50px;
}

#playerProgressBar {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.15);
  border-radius: 0;
  cursor: pointer;
  position: relative;
}

#playerProgressFill {
  height: 100%;
  width: 0%;
  background: var(--VVADRed);
  border-radius: 0;
  transition: width 0.1s linear;
}

#playerTime {
  display: flex;
  gap: 6px;
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  flex-shrink: 0;
}

/* ── Expanded panel ── */
#playerPanel {
  padding: 16px;
  box-sizing: border-box;
  max-height: 70vh;
  overflow-y: auto;
}

#playerPanelContent {
  display: flex;
  gap: 24px;
}

#playerLeft {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

#playerCoverWrapper {
  flex-shrink: 0;
  width: 220px;
  height: 220px;
}

#playerCover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 5px;
}

#playerLeftRow {
  display: flex;
  flex-direction: row;
  gap: 12px;
  align-items: flex-start;
}

#playerVolumeWrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 220px;
  width: 28px;
}

#playerVolumeIcon {
  width: 20px;
  height: 20px;
  display: block;
  opacity: 0.6;
  flex-shrink: 0;
}

#playerVolumeSlider {
  -webkit-appearance: none;
  appearance: none;
  width: 8px;
  height: 100%;
  background: rgba(255,255,255,0.15);
  border-radius: 0;
  outline: none;
  cursor: pointer;
  writing-mode: vertical-lr;
  direction: rtl;
}

#playerVolumeSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 0;
  height: 0;
}

#playerVolumeSlider::-moz-range-thumb {
  width: 0;
  height: 0;
  border: none;
}

#playerVolumeSlider::-moz-range-track {
  height: 100%;
  background: transparent;
  border: none;
}

#visualizerContainer {
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

#visualizerContainer.visible {
  opacity: 1;
}

#playerTracklist {
  flex: 1;
  min-width: 0;
}

/* ── Track list ── */
#playerTracklist {
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.player-track {
  padding: 4px 8px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.3;
  color: rgba(255,255,255,0.7);
  transition: background 0.15s, color 0.15s;
}

.player-track:hover {
  background: rgba(255,255,255,0.08);
  color: white;
}

.player-track.active {
  background: color-mix(in srgb, var(--VVADRed) 40%, transparent);
  color: white;
}

.player-track.no-audio {
  opacity: 0.4;
  cursor: default;
}

/* ── Controls ── */
#playerControls {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

#playerButtons {
  display: flex;
  align-items: center;
  gap: 8px;
}

#playerButtons button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

#playerButtons button:hover {
  background: rgba(255,255,255,0.1);
}

#playerButtons button img {
  width: 28px;
  height: 28px;
  display: block;
}

@media (max-aspect-ratio: 1/1.2) {
  #musicGrid {
    grid-template-columns: 1fr 1fr;
  }

  .musicCard-title {
    font-size: 18px;
  }

  .musicCard-year {
    font-size: 11px;
    line-height: 1;
  }

  .musicCard-links a {
    padding: 6px;
  }

  .musicCard-links img {
    width: 22px;
    height: 22px;
  }

  #playerCoverWrapper {
    width: 140px;
    height: 140px;
  }

  #playerVolumeWrapper {
    height: 140px;
    width: 24px;
  }

  #playerVolumeIcon {
    width: 18px;
    height: 18px;
  }

  #playerPanelContent {
    gap: 12px;
  }

  #playerTracklist {
    max-height: 200px;
  }

  #playerBarNowPlaying {
    display: none;
  }

  #playerOverlay {
    transform: translateY(calc(100% - 78px));
  }

  #playerPanel {
    padding-bottom: 60px;
  }

  #playerProgressRow {
    padding: 0 12px 4px;
    height: 22px;
  }

  #playerBar {
    height: 56px;
    padding: 3px 12px 5px;
  }

  #playerBarTrack {
    font-size: 12px;
  }

  #playerBarAlbum {
    font-size: 10px;
  }
}
