.music-player {
  position: fixed;
  right: 2rem;
  bottom: calc(40px + env(safe-area-inset-bottom, 0px));
  width: min(360px, calc(100vw - 4rem));
  margin: 0;
  padding: 0;
  z-index: 999;
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 140px);
  border-radius: 22px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.55);
  border: none;
  /* Match homepage hero card shadow. */
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  /* Match the homepage hero-content float-up feel. */
  transform: translateY(12px);
  opacity: 0;
  transition: transform 0.6s ease, opacity 0.6s ease, box-shadow 0.25s ease;
  will-change: transform, opacity;
}

.music-player.is-mounted {
  transform: translateY(0);
  opacity: 1;
}

.music-player.is-mounted:hover {
  transform: translateY(-2px);
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.06),
    0 18px 60px rgba(216, 168, 216, 0.12);
}

@media (prefers-reduced-motion: reduce) {
  .music-player {
    transition: none;
    transform: none;
    opacity: 1;
  }
}

.player-header {
  background: transparent;
  padding: 16px 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.player-header-content {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.player-header-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.player-header-title {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-size: 0.95rem;
  color: #4a4a5a;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-header-title i {
  color: rgba(216, 168, 216, 0.95);
  font-size: 1.1rem;
  transform: translateY(1px);
}

.player-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(90, 90, 106, 0.75);
  padding: 0;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-size: 1rem;
  transition: color 0.2s ease, transform 0.2s ease;
  flex-shrink: 0;
}

.toggle-btn:hover {
  color: rgba(90, 90, 106, 0.92);
  transform: translateY(-1px);
}

.player-container {
  background: transparent;
  padding: 12px 16px 16px;
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  align-items: start;
  border-top: 1px solid rgba(240, 230, 240, 0.55);
  max-height: 220px;
  overflow: hidden;
  animation: mpSlideDown 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.player-container.collapse {
  animation: mpSlideUp 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes mpSlideDown {
  from {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
  }
  to {
    max-height: 220px;
    padding-top: 12px;
    padding-bottom: 16px;
    opacity: 1;
  }
}

@keyframes mpSlideUp {
  from {
    max-height: 220px;
    padding-top: 12px;
    padding-bottom: 16px;
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
  to {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
  }
}

.player-display {
  text-align: left;
  margin-bottom: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.album-art {
  margin-bottom: 0;
  overflow: hidden;
  border-radius: 50%;
  width: 88px;
  height: 88px;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
  position: relative;
  box-shadow:
    0 12px 34px rgba(216, 168, 216, 0.18),
    0 6px 18px rgba(180, 210, 255, 0.12);
}

.album-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 50%;
  animation: spin 15s linear infinite;
  animation-play-state: paused;
}

.album-art.spinning img {
  animation-play-state: running;
}

.album-art::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  z-index: 10;
  box-shadow: 0 2px 10px rgba(51, 51, 51, 0.12);
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.player-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.song-info-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.controls-bottom {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}

.progress-container {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 0;
}

.time {
  font-size: 0.65rem;
  color: rgba(90, 90, 106, 0.72);
  min-width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.progress-bar {
  flex: 1;
  height: 4px;
  background: rgba(216, 168, 216, 0.22);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  border-radius: 999px;
}

.progress-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  background: rgba(216, 168, 216, 0.9);
  cursor: pointer;
  border-radius: 999px;
}

.progress-bar::-moz-range-thumb {
  width: 10px;
  height: 10px;
  background: rgba(216, 168, 216, 0.9);
  cursor: pointer;
  border: none;
  border-radius: 999px;
}

.buttons-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 44px;
}

.control-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(90, 90, 106, 0.72);
  padding: 0;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  transition: color 0.2s ease, transform 0.2s ease;
}

.control-btn:hover {
  color: rgba(90, 90, 106, 0.92);
  transform: translateY(-1px);
}

.control-btn i {
  font-size: 1rem;
  line-height: 1;
}

.mini-play-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.38);
  border: 1px solid rgba(240, 230, 240, 0.62);
  box-shadow: 0 10px 22px rgba(216, 168, 216, 0.14);
}

.mini-play-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(216, 168, 216, 0.18);
}

.control-btn svg polygon {
  rx: 4px;
  ry: 4px;
}

.play-btn i {
  font-size: 1.4rem;
}

.play-btn {
  width: 40px;
  height: 40px;
  background: none;
  color: rgba(90, 90, 106, 0.72);
  box-shadow: none;
}

.play-btn:hover {
  transform: translateY(-1px);
  box-shadow: none;
  color: rgba(90, 90, 106, 0.92);
}

.play-btn.playing {
  background: none;
  box-shadow: none;
  color: rgba(90, 90, 106, 0.92);
}

.play-btn svg {
  width: 24px;
  height: 24px;
  filter: drop-shadow(0 0 0 0);
}

.play-btn svg polygon,
.play-btn svg rect {
  rx: 3px;
  ry: 3px;
}

.song-title-display {
  font-size: 0.85rem;
  color: #4a4a5a;
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0px;
}

.song-artist-display {
  font-size: 0.7rem;
  color: rgba(90, 90, 106, 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Responsive Design */
@media screen and (max-width: 1100px) {
  .music-player {
    display: none;
  }
}
