/* ========== 音乐侧滑面板 ========== */
#musicPanel {
  position: fixed;
  top: 85px;
  right: 0;
  width: 360px;
  max-width: 90vw;
  height: 100px;
  background: linear-gradient(135deg, rgba(20, 20, 40, 0.95), rgba(10, 10, 30, 0.95));
  backdrop-filter: blur(15px);
  border-radius: 30px 0 0 30px;
  box-shadow: -8px 8px 30px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  transform: translateX(330px);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  overflow: hidden;
  border-right: none;
}

#musicPanel.collapsed { transform: translateX(330px); }
#musicPanel.expanded { transform: translateX(0); }

/* 拉手按钮 */
#musicToggle {
  width: 42px;
  height: 100%;
  background: linear-gradient(135deg, #ff69b4, #ff1493, #ff0080);
  background-size: 200% 200%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 30px 0 0 30px;
  font-size: 20px;
  font-weight: bold;
  flex-shrink: 0;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  animation: toggleGradient 3s ease infinite;
}

@keyframes toggleGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

#musicToggle::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
  transition: left 0.5s ease;
}

#musicToggle:hover::before {
  left: 100%;
}

#musicToggle:hover {
  transform: scale(1.02);
  letter-spacing: 2px;
}

/* 面板主体 */
.music-body {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 8px 15px 8px 12px;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
}

/* 封面区域 */
.music-cover {
  position: relative;
  flex-shrink: 0;
}

.music-cover::before {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  background: linear-gradient(135deg, #ff0080, #ff8c00, #ffd700, #00ff88);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.music-cover:hover::before {
  opacity: 1;
  animation: borderSpin 1s linear infinite;
}

@keyframes borderSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.music-cover img {
  width: 55px;
  height: 55px;
  border-radius: 50%;
  object-fit: cover;
  animation: rotateDisc 8s linear infinite;
  animation-play-state: paused;
  border: 2px solid rgba(255,255,255,0.3);
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  transition: all 0.3s ease;
}

.music-cover img:hover {
  transform: scale(1.05);
  border-color: #ff69b4;
}

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

/* 歌曲信息区域 */
.music-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.music-title {
  font-weight: bold;
  color: #fff;
  font-size: 14px;
  text-shadow: 0 0 5px rgba(0,0,0,0.3);
  letter-spacing: normal;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.music-artist {
  color: rgba(255,255,255,0.6);
  margin-top: 5px;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 音乐控制按钮组 */
.music-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.music-controls button {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(5px);
  border: none;
  cursor: pointer;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  padding: 0;
}

.music-controls button img {
  width: 20px;
  height: 20px;
  display: block;
  object-fit: contain;
  transition: transform 0.3s ease;
  filter: brightness(0) invert(1);
}

/* 白光划过特效 */
.music-controls button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
  transition: left 0.4s ease;
  pointer-events: none;
}

.music-controls button:hover::before {
  left: 100%;
}

.music-controls button:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: scale(1.08);
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.music-controls button:hover img {
  transform: scale(1.1);
}

.music-controls button:active {
  transform: scale(0.96);
}

/* 播放/暂停按钮特殊样式 */
.music-controls .play-pause-btn {
  background: linear-gradient(135deg, #ff69b4, #ff1493);
  box-shadow: 0 4px 12px rgba(255,105,180,0.4);
}

.music-controls .play-pause-btn:hover {
  background: linear-gradient(135deg, #ff1493, #ff0080);
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(255,105,180,0.6);
}

/* 面板整体呼吸光效 */
#musicPanel::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 30px 0 0 30px;
  background: linear-gradient(135deg, rgba(255,105,180,0.1), rgba(0,255,255,0.05));
  pointer-events: none;
  animation: panelGlow 3s ease-in-out infinite;
}

@keyframes panelGlow {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* 移动端适配 */
@media (max-width: 480px) {
  #musicPanel { 
    width: 320px; 
    transform: translateX(290px);
  }
  #musicPanel.collapsed { 
    transform: translateX(290px); 
  }
  .music-cover img { 
    width: 45px; 
    height: 45px; 
  }

  .music-info {
    display: flex !important;
    flex-direction: column;
    flex: 1 !important;
    min-width: 70px !important;
    overflow: hidden !important;
  }
  
  .music-title {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .music-artist {
    font-size: 9px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .music-controls button { 
    width: 34px; 
    height: 34px; 
  }
  .music-controls button img { 
    width: 18px; 
    height: 18px; 
  }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  #musicToggle,
  .music-controls button,
  .music-cover img,
  .music-cover::before,
  #musicPanel::after {
    animation: none;
    transition: none;
  }
  
  .music-controls button::before {
    display: none;
  }
}