/* V18：显式尊重 hidden，防止部分移动端/缓存状态下播放列表默认展开 */
.bgm-panel[hidden],
.bgm-mini-menu[hidden],
.bgm-lyric-line[hidden] {
  display: none !important;
}

/* V12 极简迷你音乐播放器：常驻外壳层，不占内容区 */
.bgm-mini-player {
  position: fixed;
  right: 14px;
  bottom: calc(78px + env(safe-area-inset-bottom));
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(28, 16, 24, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.bgm-mini-play,
.bgm-mini-menu-btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
}

.bgm-mini-play:active,
.bgm-mini-menu-btn:active,
.bgm-mini-menu button:active,
.bgm-panel button:active {
  transform: scale(0.96);
}

.bgm-mini-play.is-playing {
  background: rgba(255, 117, 157, 0.88);
}

.bgm-mini-menu {
  position: absolute;
  right: 0;
  bottom: 48px;
  min-width: 128px;
  padding: 8px;
  border-radius: 16px;
  background: rgba(30, 19, 28, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.30);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.bgm-mini-menu button {
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #fff;
  font-size: 14px;
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
}

.bgm-mini-menu button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.bgm-panel {
  position: fixed;
  left: 50%;
  bottom: calc(132px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 26px));
  max-height: min(64vh, 520px);
  overflow: auto;
  z-index: 1210;
  padding: 14px;
  border-radius: 22px;
  background: rgba(30, 19, 28, 0.95);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.bgm-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.bgm-panel-title {
  font-size: 16px;
  font-weight: 700;
}

.bgm-panel-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
}

.bgm-track-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bgm-track-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 14px;
  padding: 10px 12px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  text-align: left;
  cursor: pointer;
}

.bgm-track-item.is-current {
  background: rgba(255, 117, 157, 0.26);
}

.bgm-track-index {
  flex: 0 0 auto;
  width: 24px;
  opacity: 0.76;
  font-size: 12px;
}

.bgm-track-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bgm-upload-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bgm-upload-form input[type="file"],
.bgm-upload-form input[type="password"] {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  padding: 11px 12px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.bgm-upload-form button {
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
  color: #fff;
  background: rgba(255, 117, 157, 0.86);
  cursor: pointer;
}

.bgm-panel-note {
  margin-top: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.5;
}

.bgm-lyric-line {
  position: fixed;
  left: 50%;
  bottom: calc(132px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 1190;
  max-width: min(520px, calc(100vw - 36px));
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(20, 12, 18, 0.55);
  color: #fff;
  font-size: 14px;
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  pointer-events: none;
}

@media (max-width: 640px) {
  .bgm-mini-player {
    right: 12px;
    bottom: calc(72px + env(safe-area-inset-bottom));
  }
  .bgm-mini-play,
  .bgm-mini-menu-btn {
    width: 32px;
    height: 32px;
  }
  .bgm-panel {
    bottom: calc(122px + env(safe-area-inset-bottom));
  }
  .bgm-lyric-line {
    bottom: calc(120px + env(safe-area-inset-bottom));
    font-size: 13px;
  }
}

body.love-shell-locked .bgm-mini-player,
body.love-shell-locked .bgm-panel,
body.love-shell-locked .bgm-lyric-line {
  display: none !important;
}

.bgm-upload-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.78);
}

/* V13：播放列表删除和歌词动效收口 */
.bgm-track-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 0;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.bgm-track-item.is-current {
  background: rgba(255, 117, 157, 0.22);
}

.bgm-track-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 14px;
  padding: 10px 8px 10px 12px;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.bgm-track-delete {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  margin-right: 8px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.bgm-track-delete:hover {
  background: rgba(255, 92, 126, 0.86);
}

.bgm-track-lock {
  flex: 0 0 auto;
  margin-right: 10px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.52);
}

.bgm-track-lyric-mark {
  flex: 0 0 auto;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #fff;
  background: rgba(255, 176, 205, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.16);
}


/* V17：歌词整行淡入，并支持补传/替换歌词。 */
.bgm-lyric-line {
  position: fixed;
  left: 50%;
  bottom: calc(132px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 1190;
  width: min(620px, calc(100vw - 34px));
  max-width: min(620px, calc(100vw - 34px));
  padding: 0 16px !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  pointer-events: none;
  opacity: 0.96;
}

.bgm-lyric-side {
  max-width: min(560px, calc(100vw - 46px));
  display: block;
  color: rgba(165, 255, 235, 0.22);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.22;
  transform: scale(0.96);
  text-shadow:
    0 2px 8px rgba(0, 0, 0, 0.55),
    0 0 10px rgba(39, 232, 202, 0.10);
}

.bgm-lyric-current {
  max-width: min(590px, calc(100vw - 34px));
  display: block;
  color: rgba(132, 255, 229, 0.96);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.36;
  letter-spacing: 0.04em;
  white-space: normal;
  word-break: break-word;
  text-shadow:
    0 2px 12px rgba(0, 0, 0, 0.88),
    0 0 14px rgba(40, 255, 213, 0.34),
    0 0 26px rgba(118, 255, 232, 0.22);
}

.bgm-lyric-line.is-line-enter .bgm-lyric-current {
  animation: bgmLyricLineEnter 420ms ease-out both;
}

@keyframes bgmLyricLineEnter {
  from {
    opacity: 0;
    transform: translateY(6px);
    filter: blur(1.2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@media (max-width: 640px) {
  .bgm-lyric-line {
    bottom: calc(118px + env(safe-area-inset-bottom));
    width: calc(100vw - 30px);
    max-width: calc(100vw - 30px);
    gap: 3px;
    padding: 0 12px !important;
  }

  .bgm-lyric-current {
    font-size: 18px;
    max-width: calc(100vw - 32px);
  }

  .bgm-lyric-side {
    font-size: 11px;
    max-width: calc(100vw - 48px);
  }
}

/* V17：播放列表支持给上传歌曲补传/替换歌词。 */
.bgm-track-actions {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.bgm-track-lyric-btn {
  border: 1px solid rgba(92, 255, 225, 0.30);
  background: rgba(52, 240, 210, 0.12);
  color: rgba(185, 255, 244, 0.95);
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 12px;
  line-height: 1;
}

.bgm-track-lyric-btn:active {
  transform: scale(0.96);
}
/* V47.3：音乐入口收拢为右上角绿色旋转音符。 */
.bgm-note-player {
  position: fixed !important;
  top: calc(14px + env(safe-area-inset-top)) !important;
  right: 14px !important;
  bottom: auto !important;
  z-index: 12550 !important;
  display: block !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.bgm-note-toggle {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: radial-gradient(circle at 32% 24%, rgba(212, 255, 230, 0.96), rgba(29, 205, 104, 0.96) 42%, rgba(10, 128, 67, 0.98));
  box-shadow: 0 12px 28px rgba(0, 120, 68, 0.32), 0 0 0 1px rgba(255, 255, 255, 0.22) inset;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  animation: bgmNoteSpin 5.2s linear infinite;
  transform-origin: 50% 50%;
}

.bgm-note-player.is-playing .bgm-note-toggle {
  animation-duration: 3.2s;
}

.bgm-note-toggle:active {
  transform: scale(0.94);
}

@keyframes bgmNoteSpin {
  from { rotate: 0deg; }
  to { rotate: 360deg; }
}

.bgm-note-menu {
  position: absolute !important;
  top: 56px !important;
  right: 0 !important;
  bottom: auto !important;
  min-width: 150px !important;
  padding: 8px !important;
  border-radius: 18px !important;
  background: rgba(12, 52, 34, 0.94) !important;
  border: 1px solid rgba(170, 255, 210, 0.24) !important;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.32) !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
}

.bgm-note-menu button {
  width: 100%;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: #fff;
  font-size: 14px;
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
}

.bgm-note-menu button:hover,
.bgm-note-menu button:active {
  background: rgba(135, 255, 190, 0.15);
}

.bgm-panel {
  top: calc(76px + env(safe-area-inset-top)) !important;
  right: 14px !important;
  left: auto !important;
  bottom: auto !important;
  transform: none !important;
  width: min(420px, calc(100vw - 28px)) !important;
  max-height: min(72vh, 560px) !important;
  z-index: 12540 !important;
}

@media (max-width: 640px) {
  .bgm-note-player {
    top: calc(10px + env(safe-area-inset-top)) !important;
    right: 10px !important;
    bottom: auto !important;
  }

  .bgm-note-toggle {
    width: 42px;
    height: 42px;
    font-size: 24px;
  }

  .bgm-note-menu {
    top: 50px !important;
    right: 0 !important;
  }

  .bgm-panel {
    top: calc(64px + env(safe-area-inset-top)) !important;
    right: 10px !important;
    width: calc(100vw - 20px) !important;
    max-height: min(72vh, 560px) !important;
  }
}

/* V47.3.2：只保留绿色渐变音符；播放时音符“公转”不自转，暂停时静止。 */
.bgm-note-toggle {
  position: relative !important;
  width: 50px !important;
  height: 50px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  font-size: 0 !important;
  line-height: 1 !important;
  overflow: visible !important;
  animation: none !important;
  transform: none !important;
}

.bgm-note-player.is-playing .bgm-note-toggle {
  animation: none !important;
  transform: none !important;
}

.bgm-note-toggle::before {
  content: "♪";
  position: absolute;
  left: 50%;
  top: 50%;
  display: block;
  font-size: 38px;
  font-weight: 900;
  line-height: 1;
  font-family: Arial, "Microsoft YaHei", "PingFang SC", sans-serif;
  background: linear-gradient(135deg, #d8ffd9 0%, #64ee84 36%, #15c763 64%, #057b3f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter:
    drop-shadow(0 2px 3px rgba(0, 78, 40, 0.30))
    drop-shadow(0 0 8px rgba(60, 255, 135, 0.36));
  transform: translate(-50%, -50%);
  transform-origin: 50% 50%;
  pointer-events: none;
  will-change: transform;
}

.bgm-note-toggle:active::before {
  transform: translate(-50%, -50%) scale(0.92);
}

.bgm-note-player.is-playing .bgm-note-toggle::before {
  animation: bgmNoteOrbitUpright 3.2s linear infinite;
}

.bgm-note-player:not(.is-playing) .bgm-note-toggle::before {
  animation: none !important;
  transform: translate(-50%, -50%);
}

@keyframes bgmNoteOrbitUpright {
  0% {
    transform: translate(-50%, -50%) translate(0, -6px);
  }
  12.5% {
    transform: translate(-50%, -50%) translate(4px, -4px);
  }
  25% {
    transform: translate(-50%, -50%) translate(6px, 0);
  }
  37.5% {
    transform: translate(-50%, -50%) translate(4px, 4px);
  }
  50% {
    transform: translate(-50%, -50%) translate(0, 6px);
  }
  62.5% {
    transform: translate(-50%, -50%) translate(-4px, 4px);
  }
  75% {
    transform: translate(-50%, -50%) translate(-6px, 0);
  }
  87.5% {
    transform: translate(-50%, -50%) translate(-4px, -4px);
  }
  100% {
    transform: translate(-50%, -50%) translate(0, -6px);
  }
}

@media (max-width: 640px) {
  .bgm-note-toggle {
    width: 46px !important;
    height: 46px !important;
  }

  .bgm-note-toggle::before {
    font-size: 35px;
  }
}

/* V47.3.3：真正公转。外层绕中心转，内层音符反向抵消角度，所以音符始终竖直。 */
.bgm-note-toggle {
  position: relative !important;
  width: 58px !important;
  height: 58px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: visible !important;
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  font-size: 0 !important;
  line-height: 1 !important;
  animation: none !important;
  transform: none !important;
}

.bgm-note-toggle::before,
.bgm-note-toggle::after {
  content: none !important;
}

.bgm-note-orbit {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  transform-origin: 0 0;
  transform: rotate(0deg);
  pointer-events: none;
  will-change: transform;
}

.bgm-note-icon {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  font-size: 39px;
  font-weight: 900;
  line-height: 1;
  font-family: Arial, "Microsoft YaHei", "PingFang SC", sans-serif;
  background: linear-gradient(135deg, #e4ffe7 0%, #85f69d 30%, #18cf6a 64%, #04783d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter:
    drop-shadow(0 2px 3px rgba(0, 78, 40, 0.30))
    drop-shadow(0 0 8px rgba(60, 255, 135, 0.34));
  transform: translate(-50%, -50%) translateY(-8px) rotate(0deg);
  transform-origin: 50% 50%;
  will-change: transform;
}

.bgm-note-player.is-playing .bgm-note-orbit {
  animation: bgmNoteRealOrbit 3.4s linear infinite !important;
}

.bgm-note-player.is-playing .bgm-note-icon {
  animation: bgmNoteKeepUpright 3.4s linear infinite !important;
}

.bgm-note-player:not(.is-playing) .bgm-note-orbit,
.bgm-note-player:not(.is-playing) .bgm-note-icon {
  animation: none !important;
}

.bgm-note-toggle:active .bgm-note-icon {
  transform: translate(-50%, -50%) translateY(-8px) scale(0.92) rotate(0deg);
}

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

@keyframes bgmNoteKeepUpright {
  from { transform: translate(-50%, -50%) translateY(-8px) rotate(0deg); }
  to { transform: translate(-50%, -50%) translateY(-8px) rotate(-360deg); }
}

@media (max-width: 640px) {
  .bgm-note-toggle {
    width: 52px !important;
    height: 52px !important;
  }

  .bgm-note-icon {
    font-size: 36px;
    transform: translate(-50%, -50%) translateY(-7px) rotate(0deg);
  }

  .bgm-note-player.is-playing .bgm-note-icon {
    animation-name: bgmNoteKeepUprightMobile !important;
  }

  .bgm-note-toggle:active .bgm-note-icon {
    transform: translate(-50%, -50%) translateY(-7px) scale(0.92) rotate(0deg);
  }
}

@keyframes bgmNoteKeepUprightMobile {
  from { transform: translate(-50%, -50%) translateY(-7px) rotate(0deg); }
  to { transform: translate(-50%, -50%) translateY(-7px) rotate(-360deg); }
}
