/* ============================================
   瓜奇全局音乐播放器 - Guaqi Music Player
   ============================================ */

/* ----- 基础重置（只影响 gq-music 内部）----- */
.gq-music *,
.gq-music *::before,
.gq-music *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.gq-music {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #fff;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ============================================
   1. 按钮容器（固定定位，按钮和提示抽屉都在其中）
   ============================================ */
.gq-music-btn-wrap {
  position: fixed;
  top: 12vh;
  right: 2vw;
  z-index: 99999;
  width: 48px;
  height: 48px;
}

/* ============================================
   2. 浮动按钮
   ============================================ */
.gq-music-btn {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(30, 30, 50, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.gq-music-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 32px rgba(224, 122, 138, 0.35);
  border-color: rgba(224, 122, 138, 0.4);
}

.gq-music-btn:active {
  transform: scale(0.95);
}

.gq-music-btn svg {
  width: 28px;
  height: 28px;
  transition: transform 0.3s ease;
}

/* 播放时旋转动画 */
.gq-music-btn.gq-playing svg {
  animation: gqMusicSpin 6s linear infinite;
}

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

/* ============================================
   2. 音乐控制台（横向面板）
   ============================================ */
.gq-music-panel {
  position: fixed;
  bottom: -320px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  z-index: 99998;
  width: min(720px, calc(100vw - 32px));
  background: rgba(28, 28, 48, 0.85);
  backdrop-filter: blur(40px) saturate(140%);
  -webkit-backdrop-filter: blur(40px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
  padding: 20px 24px 18px;
  transition: bottom 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  opacity: 0;
  visibility: hidden;
}

.gq-music-panel.gq-active {
  bottom: 0;
  opacity: 1;
  visibility: visible;
}

/* 控制台头部（标题 + 关闭按钮） */
.gq-music-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.gq-music-panel-title {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 1px;
  font-weight: 500;
}

.gq-music-panel-close {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: all 0.2s ease;
  line-height: 1;
}

.gq-music-panel-close:hover {
  background: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 1);
}

/* 控制台内部布局 */
.gq-music-panel-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gq-music-panel-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* 左侧：封面 + 信息 */
.gq-music-cover {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.gq-music-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gq-music-title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.3px;
}

.gq-music-artist {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 中间：控制按钮 */
.gq-music-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.gq-music-controls button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 18px;
}

.gq-music-controls button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

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

.gq-music-btn-play {
  width: 40px !important;
  height: 40px !important;
  background: rgba(224, 122, 138, 0.2) !important;
  color: #e07a8a !important;
  font-size: 20px !important;
}

.gq-music-btn-play:hover {
  background: rgba(224, 122, 138, 0.35) !important;
}

/* 进度条行 */
.gq-music-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gq-music-time {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  min-width: 36px;
}

.gq-music-time:last-child {
  text-align: right;
}

/* 进度条 */
.gq-music-progress {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
  position: relative;
  transition: height 0.15s ease;
}

.gq-music-progress:hover {
  height: 6px;
}

.gq-music-progress.gq-dragging {
  cursor: grabbing !important;
}

.gq-music-progress-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #e07a8a, #f09aaa);
  position: relative;
  transition: width 0.1s linear;
}

.gq-music-progress-fill::after {
  content: '';
  position: absolute;
  right: -5px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 8px rgba(224, 122, 138, 0.5);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.gq-music-progress:hover .gq-music-progress-fill::after {
  opacity: 1;
}

/* 右侧：播放模式 + 功能按钮 */
.gq-music-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.gq-music-actions button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 15px;
  position: relative;
}

.gq-music-actions button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
}

.gq-music-actions button.gq-active {
  color: #e07a8a;
}

/* 播放模式图标文字 */
.gq-music-mode-btn {
  font-size: 13px !important;
  font-weight: 600;
  width: 48px !important;
  letter-spacing: 0.5px;
}

/* 音量控制 */
.gq-music-volume-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.gq-music-btn-volume {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

/* 音量条固定显示 */
.gq-music-volume-slider {
  width: 64px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.15);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}

.gq-music-volume-slider-fill {
  height: 100%;
  border-radius: 2px;
  background: #e07a8a;
  transition: width 0.05s linear;
  position: relative;
}

/* 音量拖动圆点 */
.gq-music-volume-slider-fill::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px rgba(224, 122, 138, 0.4);
  transition: transform 0.15s ease;
}

.gq-music-volume-slider:hover .gq-music-volume-slider-fill::after {
  transform: translateY(-50%) scale(1.15);
}

/* ============================================
   3. 歌单面板
   ============================================ */
.gq-music-playlist {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  opacity: 0;
}

.gq-music-playlist.gq-open {
  max-height: 240px;
  opacity: 1;
}

.gq-music-playlist-inner {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 10px;
  margin-top: 2px;
  max-height: 210px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.gq-music-playlist-inner::-webkit-scrollbar {
  width: 4px;
}

.gq-music-playlist-inner::-webkit-scrollbar-track {
  background: transparent;
}

.gq-music-playlist-inner::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

.gq-music-playlist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.gq-music-playlist-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.gq-music-playlist-item.gq-current {
  background: rgba(224, 122, 138, 0.12);
}

.gq-music-playlist-item.gq-current .gq-music-playlist-title {
  color: #e07a8a;
}

.gq-music-playlist-num {
  width: 20px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
  text-align: center;
  flex-shrink: 0;
}

.gq-music-playlist-item.gq-current .gq-music-playlist-num {
  color: #e07a8a;
}

.gq-music-playlist-title {
  flex: 1;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.gq-music-playlist-artist {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
}

/* ============================================
   4. 歌词抽屉
   ============================================ */
.gq-music-lyrics {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99997;
  height: 80px;
  background: rgba(20, 20, 38, 0.85);
  backdrop-filter: blur(40px) saturate(140%);
  -webkit-backdrop-filter: blur(40px) saturate(140%);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transform: translateY(100%);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gq-music-lyrics.gq-visible {
  transform: translateY(0);
}

/* 歌词区域关闭按钮 */
.gq-music-lyrics-close {
  position: absolute;
  top: 8px;
  right: 12px;
  z-index: 2;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: all 0.2s ease;
  line-height: 1;
}

.gq-music-lyrics-close:hover {
  background: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 1);
}

/* 唱歌词面板打开时，控制台需要上移避开歌词抽屉 */
.gq-music-panel.gq-lyrics-open {
  bottom: 80px;
}

.gq-music-lyrics-container {
  position: relative;
  width: 100%;
  max-width: 800px;
  height: 60px;
  overflow: hidden;
  text-align: center;
}

.gq-music-lyric-line {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 15px;
  line-height: 60px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 24px;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, opacity;
}

.gq-music-lyric-line.gq-lyric-prev {
  top: -60px;
  opacity: 0;
  transform: translateY(8px);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.25);
}

.gq-music-lyric-line.gq-lyric-current {
  top: 0;
  opacity: 1;
  color: #fff;
  font-weight: 500;
  text-shadow: 0 0 20px rgba(224, 122, 138, 0.3);
}

.gq-music-lyric-line.gq-lyric-next {
  top: 60px;
  opacity: 0;
  transform: translateY(-8px);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.25);
}

/* 无歌词时的提示 */
.gq-music-lyrics-empty {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.25);
  letter-spacing: 1px;
}

/* ============================================
   5. 歌曲提示抽屉（图标左侧展开）
   ============================================ */
.gq-music-drawer {
  position: absolute;
  top: 0;
  right: calc(100% + 8px);
  height: 48px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px 0 10px;
  background: rgba(28, 28, 48, 0.85);
  backdrop-filter: blur(30px) saturate(140%);
  -webkit-backdrop-filter: blur(30px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;

  /* 从右侧收缩展开 */
  transform-origin: right center;
  transform: scaleX(0);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.3s ease,
              visibility 0s 0.45s;
}

.gq-music-drawer.gq-drawer-show {
  transform: scaleX(1);
  opacity: 1;
  visibility: visible;
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.25s ease 0.1s,
              visibility 0s 0s;
}

.gq-music-drawer.gq-drawer-hiding {
  transform: scaleX(0);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.2s ease,
              visibility 0s 0.35s;
}

.gq-music-drawer:hover {
  background: rgba(28, 28, 48, 0.92);
  border-color: rgba(255, 255, 255, 0.15);
}

/* 音符图标 */
.gq-drawer-icon {
  flex-shrink: 0;
  font-size: 16px;
  color: #e07a8a;
  line-height: 1;
  animation: gqDrawerBounce 1.2s ease-in-out infinite;
}

@keyframes gqDrawerBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

/* 文字 */
.gq-drawer-text {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.3px;
}

/* ============================================
   6. 移动端适配
   ============================================ */
@media (max-width: 768px) {
  /* 按钮缩小 + 容器位置 */
   .gq-music-btn-wrap {
     top: 12px;
     right: 12px;
     width: 40px;
     height: 40px;
   }

  .gq-music-btn {
    width: 40px;
    height: 40px;
  }

  .gq-music-btn svg {
    width: 22px;
    height: 22px;
  }

  /* 控制台改为全屏底部面板 */
  .gq-music-panel {
    width: 100%;
    left: 0;
    right: 0;
    transform: none;
    border-radius: 16px 16px 0 0;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  }

  .gq-music-panel.gq-active {
    bottom: 0;
  }

  /* 移动端抽屉位置跟随按钮（绝对定位自动跟随） */
  .gq-music-drawer {
    height: 40px;
    border-radius: 8px;
  }
  .gq-music-drawer.gq-drawer-show {
    padding: 0 12px 0 8px;
  }

  .gq-drawer-icon {
    font-size: 14px;
  }

  .gq-drawer-text {
    font-size: 12px;
  }

  .gq-music-panel-row {
    flex-wrap: wrap;
    gap: 10px;
  }

  .gq-music-cover {
    width: 44px;
    height: 44px;
  }

  .gq-music-title {
    font-size: 13px;
  }

  .gq-music-controls button {
    width: 30px;
    height: 30px;
    font-size: 16px;
  }

  .gq-music-btn-play {
    width: 36px !important;
    height: 36px !important;
  }

  /* 控制台 + 歌词同时打开时 */
  .gq-music-panel.gq-lyrics-open {
    bottom: 80px;
  }

  /* 歌词适应 */
  .gq-music-lyric-line {
    font-size: 13px;
    line-height: 60px;
  }

  .gq-music-lyrics-container {
    max-width: 100%;
  }

  /* 操作按钮精简 */
  .gq-music-actions button {
    width: 28px;
    height: 28px;
    font-size: 13px;
  }

  .gq-music-mode-btn {
    width: 40px !important;
    font-size: 12px !important;
  }
}

/* 针对歌词抽屉打开时的控制台上移（桌面） */
@media (min-width: 769px) {
  .gq-music-panel.gq-lyrics-open {
    bottom: 80px;
  }
}

/* ============================================
   7. 暗黑模式适配（与网站主题保持一致）
   ============================================ */
/* 瓜奇主题暗黑模式下背景已经偏暗，保持现有样式即可 */
/* 亮色主题下，略微调整透明度 */
html:not(.dark) .gq-music-btn {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

html:not(.dark) .gq-music-btn:hover {
  box-shadow: 0 6px 28px rgba(224, 122, 138, 0.25);
}

html:not(.dark) .gq-music-panel {
  background: rgba(248, 248, 252, 0.88);
  backdrop-filter: blur(40px) saturate(140%);
  -webkit-backdrop-filter: blur(40px) saturate(140%);
  border-color: rgba(0, 0, 0, 0.06);
  color: #333;
}

html:not(.dark) .gq-music-title {
  color: #222;
}

html:not(.dark) .gq-music-artist {
  color: rgba(0, 0, 0, 0.6);
}

html:not(.dark) .gq-music-time {
  color: rgba(0, 0, 0, 0.5);
}

html:not(.dark) .gq-music-panel-title {
  color: rgba(0, 0, 0, 0.5);
}

html:not(.dark) .gq-music-controls button {
  color: rgba(0, 0, 0, 0.55);
}

html:not(.dark) .gq-music-controls button:hover {
  background: rgba(0, 0, 0, 0.05);
  color: rgba(0, 0, 0, 0.8);
}

html:not(.dark) .gq-music-time {
  color: rgba(0, 0, 0, 0.35);
}

html:not(.dark) .gq-music-progress {
  background: rgba(0, 0, 0, 0.1);
}

html:not(.dark) .gq-music-actions button {
  color: rgba(0, 0, 0, 0.6);
}

html:not(.dark) .gq-music-controls button {
  color: rgba(0, 0, 0, 0.75);
}

html:not(.dark) .gq-music-panel-close,
html:not(.dark) .gq-music-lyrics-close {
  background: rgba(0, 0, 0, 0.05);
  color: rgba(0, 0, 0, 0.5);
}

html:not(.dark) .gq-music-panel-close:hover,
html:not(.dark) .gq-music-lyrics-close:hover {
  background: rgba(0, 0, 0, 0.12);
  color: rgba(0, 0, 0, 0.9);
}

html:not(.dark) .gq-music-volume-slider {
  background: rgba(0, 0, 0, 0.12);
}

html:not(.dark) .gq-music-volume-slider-fill {
  background: #e07a8a;
}

html:not(.dark) .gq-music-btn-volume {
  color: rgba(0, 0, 0, 0.5);
}

html:not(.dark) .gq-music-playlist-item .gq-music-playlist-title {
  color: rgba(0, 0, 0, 0.7);
}

html:not(.dark) .gq-music-playlist-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

html:not(.dark) .gq-music-lyrics {
  background: rgba(245, 245, 252, 0.88);
  backdrop-filter: blur(40px) saturate(140%);
  -webkit-backdrop-filter: blur(40px) saturate(140%);
  border-top-color: rgba(0, 0, 0, 0.06);
}

html:not(.dark) .gq-music-lyric-line.gq-lyric-current {
  color: #222;
}

html:not(.dark) .gq-music-lyric-line.gq-lyric-prev,
html:not(.dark) .gq-music-lyric-line.gq-lyric-next {
  color: rgba(0, 0, 0, 0.2);
}

html:not(.dark) .gq-music-drawer {
  background: rgba(248, 248, 252, 0.90);
  backdrop-filter: blur(30px) saturate(140%);
  -webkit-backdrop-filter: blur(30px) saturate(140%);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

html:not(.dark) .gq-music-drawer:hover {
  background: rgba(240, 240, 248, 0.95);
  border-color: rgba(0, 0, 0, 0.12);
}

html:not(.dark) .gq-drawer-text {
  color: rgba(0, 0, 0, 0.8);
}

html:not(.dark) .gq-music-lyrics-empty {
  color: rgba(0, 0, 0, 0.2);
}
