/* ==========================================================================
   Page Music Player · player.css
   滑块 / 底部播放条 / 队列抽屉 / 全屏播放页 / 打开状态
   依赖 base.css 中的设计变量。
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. range 滑块
   JS 通过内联 --fill 提供进度：
     · 底部播放条  playerbar.js  →  带单位，如 42%
     · 全屏播放页  playerpage.js →  无单位，如 42
   因此填充位置统一用 var(--fill, 0%)。
   -------------------------------------------------------------------------- */
.range {
  display: block;
  width: 100%;
  height: 16px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  touch-action: none;
}

.range:focus {
  outline: none;
}

.range:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-pill);
}

.range:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* --- WebKit 轨道 --- */
.range::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.14);
}

.range::-webkit-slider-thumb {
  width: 12px;
  height: 12px;
  margin-top: -4px;
  border: 0;
  border-radius: 50%;
  background: #ffffff;
  box-shadow:
    0 1px 4px rgba(0, 0, 0, 0.45),
    0 0 0 3px rgba(139, 108, 255, 0.18);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.16s var(--ease), transform 0.16s var(--ease);
  -webkit-appearance: none;
  appearance: none;
}

.range:hover::-webkit-slider-thumb,
.range:focus-visible::-webkit-slider-thumb,
.range:active::-webkit-slider-thumb {
  opacity: 1;
  transform: scale(1);
}

/* --- Firefox 轨道 --- */
.range::-moz-range-track {
  width: 100%;
  height: 4px;
  border: 0;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.14);
}

.range::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 50%;
  background: #ffffff;
  box-shadow:
    0 1px 4px rgba(0, 0, 0, 0.45),
    0 0 0 3px rgba(139, 108, 255, 0.18);
  opacity: 0;
  transition: opacity 0.16s var(--ease);
}

.range:hover::-moz-range-thumb,
.range:focus-visible::-moz-range-thumb,
.range:active::-moz-range-thumb {
  opacity: 1;
}

/* --- 底部播放条（--fill 带 %） --- */
.pb-seek::-webkit-slider-runnable-track,
.pb-vol::-webkit-slider-runnable-track {
  background: linear-gradient(
    90deg,
    var(--accent) var(--fill, 0%),
    rgba(255, 255, 255, 0.14) 0
  );
}

.pb-seek::-moz-range-track,
.pb-vol::-moz-range-track {
  background: linear-gradient(
    90deg,
    var(--accent) var(--fill, 0%),
    rgba(255, 255, 255, 0.14) 0
  );
}

/* --- 全屏播放页（--fill 带 %） --- */
.pp-seek::-webkit-slider-runnable-track,
.pp-vol-range::-webkit-slider-runnable-track {
  background: linear-gradient(
    90deg,
    var(--accent) var(--fill, 0%),
    rgba(255, 255, 255, 0.14) 0
  );
}

.pp-seek::-moz-range-track,
.pp-vol-range::-moz-range-track {
  background: linear-gradient(
    90deg,
    var(--accent) var(--fill, 0%),
    rgba(255, 255, 255, 0.14) 0
  );
}

/* 悬停时轨道两端微亮 */
.pb-seek:hover::-webkit-slider-runnable-track,
.pp-seek:hover::-webkit-slider-runnable-track {
  filter: brightness(1.18);
}

.pb-seek:hover::-moz-range-track,
.pp-seek:hover::-moz-range-track {
  filter: brightness(1.18);
}

/* --------------------------------------------------------------------------
   2. 底部播放条
   -------------------------------------------------------------------------- */
.player-bar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  height: calc(var(--bar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(20, 23, 32, 0.86), rgba(10, 12, 17, 0.94));
  box-shadow: 0 -18px 48px rgba(0, 0, 0, 0.42);
  -webkit-backdrop-filter: blur(26px) saturate(140%);
  backdrop-filter: blur(26px) saturate(140%);
}

/* 顶部一条柔和强调线 */
.player-bar::before {
  content: "";
  position: absolute;
  top: -1px;
  right: 0;
  left: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(139, 108, 255, 0.45) 28%,
    rgba(34, 211, 238, 0.34) 72%,
    transparent
  );
  pointer-events: none;
}

.pb-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 1.55fr) minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  height: var(--bar-h);
  padding: 0 clamp(12px, 2.4vw, 26px);
}

/* 左侧：当前曲目 */
.pb-now {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 6px;
  margin-left: -6px;
  border-radius: 12px;
  text-align: left;
  transition: background var(--dur) var(--ease);
}

.pb-now:hover {
  background: var(--surface);
}

.pb-cover {
  position: relative;
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.pb-cover .cover {
  width: 100%;
  height: 100%;
  border-radius: 12px;
}

.pb-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.pb-title {
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pb-sub {
  color: var(--text-dim);
  font-size: 11.5px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 中部：控制 + 进度 */
.pb-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.pb-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.pb-btn {
  width: 34px;
  height: 34px;
}

.pb-play {
  display: grid;
  flex: none;
  place-items: center;
  width: 42px;
  height: 42px;
  margin: 0 4px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--accent) 0%, #6f4dff 58%, #4f7cff 100%);
  color: #fff;
  box-shadow:
    0 8px 22px -8px rgba(124, 92, 255, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.14s var(--ease), box-shadow 0.2s var(--ease),
    filter 0.2s var(--ease);
}

.pb-play:hover {
  filter: brightness(1.08);
  transform: scale(1.05);
  box-shadow:
    0 10px 26px -8px rgba(124, 92, 255, 1),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.pb-play:active {
  transform: scale(0.97);
}

.pb-play:focus-visible {
  outline-offset: 3px;
}

.pb-play-icon {
  display: grid;
  place-items: center;
  color: #fff;
}

.pb-mode {
  width: 32px;
  height: 32px;
}

.pb-mode[data-mode="shuffle"],
.pb-mode[data-mode="one"] {
  color: var(--accent-ink);
}

.pb-progress {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  max-width: 560px;
  min-width: 0;
}

.pb-time {
  flex: none;
  min-width: 38px;
  color: var(--text-faint);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  text-align: center;
  letter-spacing: 0.01em;
}

.pb-seek {
  flex: 1 1 auto;
  min-width: 40px;
}

/* 右侧：歌词 / 音量 / 队列 */
.pb-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
}

.pb-volume {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.pb-vol {
  width: 84px;
  flex: none;
}

/* 播放中：控制按钮与封面的轻微呼吸感 */
.player-bar.is-playing .pb-play {
  box-shadow:
    0 8px 24px -6px rgba(124, 92, 255, 1),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.player-bar.is-playing .pb-now {
  background: linear-gradient(90deg, rgba(139, 108, 255, 0.12), transparent 72%);
}

/* 空状态 */
.player-bar.is-empty .pb-title {
  color: var(--text-dim);
}

.player-bar.is-empty .pb-sub {
  color: var(--text-faint);
}

.player-bar.is-empty .pb-play,
.player-bar.is-empty .pb-seek,
.player-bar.is-empty .pb-vol {
  opacity: 0.45;
}

.player-bar.is-empty .pb-play {
  filter: grayscale(0.3);
}

/* 静音：图标由 [data-role=volicon] 自身切换，这里仅弱化滑块 */
.player-bar.is-muted .pb-vol::-webkit-slider-runnable-track {
  background: linear-gradient(
    90deg,
    var(--text-faint) var(--fill, 0%),
    rgba(255, 255, 255, 0.1) 0
  );
}

.player-bar.is-muted .pb-vol::-moz-range-track {
  background: linear-gradient(
    90deg,
    var(--text-faint) var(--fill, 0%),
    rgba(255, 255, 255, 0.1) 0
  );
}

/* --------------------------------------------------------------------------
   3. 队列抽屉
   -------------------------------------------------------------------------- */
.queue-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  width: 360px;
  max-width: 92vw;
  height: 100%;
  border-left: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(22, 26, 36, 0.96), rgba(10, 12, 17, 0.98));
  box-shadow: -28px 0 70px rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(26px) saturate(135%);
  backdrop-filter: blur(26px) saturate(135%);
  transform: translateX(100%);
  transition: transform 0.3s var(--ease);
  will-change: transform;
}

body.queue-open .queue-panel {
  transform: none;
}

.queue-backdrop {
  position: fixed;
  inset: 0;
  z-index: 59;
  visibility: hidden;
  background: rgba(4, 6, 10, 0.5);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s var(--ease), visibility 0.28s var(--ease);
}

body.queue-open .queue-backdrop {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.queue-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: calc(18px + env(safe-area-inset-top)) 16px 14px;
  border-bottom: 1px solid var(--border);
}

.queue-title {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.queue-meta {
  color: var(--text-faint);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.queue-head-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.queue-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 8px 10px calc(18px + env(safe-area-inset-bottom));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

.queue-body .empty-state {
  padding: 46px 14px;
  border-style: solid;
  background: rgba(255, 255, 255, 0.015);
}

/* 队列内曲目行：更紧凑的列 */
.queue-panel .track-row {
  grid-template-columns: 26px 40px minmax(0, 1fr) 42px auto;
  gap: 8px;
  min-height: 52px;
  padding: 5px 8px;
}

.queue-panel .track-format,
.queue-panel .track-album {
  display: none;
}

.queue-panel .track-index {
  width: 26px;
  height: 40px;
}

.queue-panel .track-title {
  font-size: 12.5px;
}

.queue-panel .track-sub {
  font-size: 11px;
}

.queue-panel .track-time {
  font-size: 11px;
}

.queue-panel .cover-sm {
  width: 40px;
  height: 40px;
  border-radius: 9px;
}

.queue-panel .track-actions {
  opacity: 1;
  gap: 0;
}

.queue-panel .track-actions .icon-btn {
  width: 25px;
  height: 25px;
  border-radius: 7px;
}

.queue-panel .track-actions .icon-btn[data-act="enqueue"] {
  display: none;
}

.queue-panel .track-row-head {
  display: none;
}

/* --------------------------------------------------------------------------
   4. 全屏播放页
   -------------------------------------------------------------------------- */
#player-page.player-page {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: block;
  overflow: hidden;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px) scale(0.995);
  background:
    radial-gradient(1000px 640px at 12% -6%, rgba(139, 108, 255, 0.2), transparent 62%),
    radial-gradient(900px 620px at 108% 8%, rgba(34, 211, 238, 0.13), transparent 58%),
    radial-gradient(800px 600px at 50% 118%, rgba(139, 108, 255, 0.1), transparent 64%),
    linear-gradient(180deg, #0b0d13, #080a0f);
  transition: opacity 0.28s var(--ease), transform 0.34s var(--ease),
    visibility 0.28s var(--ease);
  will-change: opacity, transform;
}

body.now-open #player-page {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

body.now-open .player-bar {
  display: none;
}

body.now-open {
  overscroll-behavior: none;
}

.pp-inner {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: calc(14px + env(safe-area-inset-top)) clamp(16px, 3vw, 40px)
    calc(14px + env(safe-area-inset-bottom));
}

/* 顶栏 */
.pp-top {
  display: flex;
  flex: none;
  align-items: center;
  gap: 10px;
  min-height: 40px;
}

.pp-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  padding: 0 12px 0 8px;
  color: var(--text-dim);
}

.pp-back:hover {
  color: var(--text);
}

.pp-back-text {
  font-size: 12.5px;
  white-space: nowrap;
}

.pp-top-title {
  flex: 1;
  min-width: 0;
  color: var(--text-faint);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 舞台 */
.pp-stage {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  align-items: stretch;
  gap: clamp(24px, 4vw, 64px);
  min-height: 0;
  padding: clamp(14px, 2.4vh, 30px) 0 6px;
}

.pp-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 2.2vh, 24px);
  min-width: 0;
  min-height: 0;
}

/* 封面 */
.pp-cover-frame {
  position: relative;
  flex: 0 1 auto;
  width: min(100%, 46vh, 430px);
  max-width: 430px;
  aspect-ratio: 1 / 1;
  min-height: 0;
  border-radius: var(--radius-xl);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* 封面框本身是可点击的歌词切换按钮（playerpage.js 加了 role/tabindex） */
.pp-cover-frame:focus {
  outline: none;
}

.pp-cover-frame:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 5px;
}

.pp-cover-frame:active {
  transform: scale(0.995);
}

.pp-cover {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--surface);
  box-shadow:
    0 40px 80px -28px rgba(0, 0, 0, 0.72),
    0 12px 30px -10px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.pp-cover .cover {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-xl);
}

.pp-cover-glow {
  position: absolute;
  inset: -16%;
  z-index: 0;
  border-radius: 50%;
  /* playerpage.js 会在光晕上写入 --cover-h / --cover-h2（0–359 的色相） */
  background:
    radial-gradient(
      circle at 50% 50%,
      hsla(var(--cover-h, 265), 78%, 62%, 0.42),
      transparent 66%
    ),
    radial-gradient(
      circle at 34% 26%,
      hsla(var(--cover-h2, 190), 82%, 56%, 0.3),
      transparent 58%
    ),
    radial-gradient(
      circle at 74% 80%,
      hsla(var(--cover-h, 265), 70%, 48%, 0.22),
      transparent 60%
    );
  filter: blur(42px);
  opacity: 0.85;
  pointer-events: none;
}

/* 信息 */
.pp-meta {
  width: min(100%, 460px);
  text-align: center;
}

.pp-title {
  color: var(--text);
  font-size: clamp(18px, 2.4vw, 26px);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pp-artist {
  margin-top: 6px;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pp-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
}

.pp-badges:empty {
  display: none;
}

/* 进度 */
.pp-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(100%, 460px);
}

.pp-time {
  flex: none;
  min-width: 42px;
  color: var(--text-faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.pp-seek {
  flex: 1 1 auto;
  min-width: 40px;
  height: 18px;
}

/* 控制按钮 */
.pp-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.4vw, 18px);
}

.pp-mode {
  width: 38px;
  height: 38px;
}

.pp-mode[data-mode="shuffle"],
.pp-mode[data-mode="one"] {
  color: var(--accent-ink);
}

.pp-skip {
  width: 46px;
  height: 46px;
  color: var(--text-dim);
}

.pp-skip:hover {
  color: var(--text);
}

.pp-play {
  display: grid;
  flex: none;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--accent) 0%, #6f4dff 56%, #4f7cff 100%);
  color: #fff;
  box-shadow:
    0 18px 40px -12px rgba(124, 92, 255, 0.95),
    0 0 0 1px rgba(255, 255, 255, 0.12) inset,
    inset 0 2px 0 rgba(255, 255, 255, 0.24);
  transition: transform 0.16s var(--ease), box-shadow 0.24s var(--ease),
    filter 0.2s var(--ease);
}

.pp-play:hover {
  filter: brightness(1.07);
  transform: scale(1.045);
  box-shadow:
    0 22px 52px -12px rgba(124, 92, 255, 1),
    inset 0 2px 0 rgba(255, 255, 255, 0.28);
}

.pp-play:active {
  transform: scale(0.97);
}

.pp-play:focus-visible {
  outline-offset: 4px;
}

/* 附加行：歌词操作 + 音量 */
.pp-extra {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 18px;
  width: min(100%, 460px);
}

.pp-lrc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pp-vol {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text-faint);
  cursor: pointer;
}

.pp-vol:hover {
  color: var(--text-dim);
}

.pp-vol-range {
  width: clamp(74px, 12vw, 116px);
  flex: none;
}

/* 右侧歌词栏 */
.pp-right {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: clamp(8px, 1.6vh, 18px) 0;
}

.pp-lyrics-head {
  display: flex;
  flex: none;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px 10px;
  border-bottom: 1px solid var(--border);
}

.pp-lyrics-title {
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.pp-lyrics-state {
  color: var(--text-faint);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 播放中：封面的呼吸光晕 */
.player-page.is-playing .pp-cover-glow {
  animation: pp-glow 5.2s ease-in-out infinite;
}

.player-page.is-playing .pp-cover {
  box-shadow:
    0 44px 90px -30px rgba(0, 0, 0, 0.78),
    0 0 60px -18px rgba(139, 108, 255, 0.42),
    inset 0 0 0 1px rgba(255, 255, 255, 0.09);
}

@keyframes pp-glow {
  0%,
  100% {
    opacity: 0.72;
    transform: scale(1);
  }
  50% {
    opacity: 0.95;
    transform: scale(1.045);
  }
}

/* --------------------------------------------------------------------------
   5. 响应式
   -------------------------------------------------------------------------- */

/* 中等宽度：播放条压缩 */
@media (max-width: 1080px) {
  .pb-inner {
    grid-template-columns: minmax(0, 0.9fr) minmax(260px, 1.5fr) minmax(0, 0.9fr);
    gap: 12px;
  }

  .pb-vol {
    width: 64px;
  }

  .pb-time {
    min-width: 32px;
  }
}

/* 窄屏：播放页单栏 */
@media (max-width: 1000px) {
  .pp-inner {
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .pp-stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    align-content: start;
    gap: 18px;
    padding-top: 8px;
  }

  .pp-left {
    justify-content: flex-start;
    gap: 14px;
  }

  .pp-cover-frame {
    width: min(52vw, 230px);
    max-width: 230px;
  }

  .pp-cover {
    border-radius: var(--radius-lg);
  }

  .pp-cover .cover {
    border-radius: var(--radius-lg);
  }

  .pp-right {
    justify-content: flex-start;
    min-height: 0;
    padding-top: 0;
  }

  .pp-lyrics {
    min-height: 0;
  }

  .pp-title {
    font-size: 19px;
  }

  .pp-play {
    width: 58px;
    height: 58px;
  }

  .pp-skip {
    width: 42px;
    height: 42px;
  }

  .pp-extra {
    gap: 8px 14px;
  }
}

/* 平板 / 小桌面：播放条纵向紧凑 */
@media (max-width: 900px) {
  .pb-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    grid-template-areas:
      "now right"
      "center center";
    align-content: center;
    gap: 4px 12px;
    padding: 0 12px;
  }

  .pb-now {
    grid-area: now;
    padding: 4px;
    margin-left: -4px;
  }

  .pb-right {
    grid-area: right;
  }

  .pb-center {
    grid-area: center;
    gap: 4px;
  }

  .pb-progress {
    max-width: none;
  }

  :root {
    --bar-h: 120px;
  }

  .pb-cover {
    width: 44px;
    height: 44px;
    border-radius: 10px;
  }

  .pb-cover .cover {
    border-radius: 10px;
  }

  .pb-play {
    width: 38px;
    height: 38px;
    margin: 0 2px;
  }

  /* 小屏只保留队列与播放控制，歌词入口仍在播放页内 */
  .queue-panel {
    width: min(360px, 88vw);
  }
}

/* 手机 */
@media (max-width: 640px) {
  :root {
    --bar-h: 124px;
  }

  .pb-inner {
    gap: 4px 8px;
    padding: 0 10px;
  }

  .pb-now {
    padding: 3px;
    margin-left: -3px;
  }

  .pb-vol {
    display: none;
  }

  .pb-meta {
    gap: 2px;
  }

  .pb-title {
    font-size: 12.5px;
  }

  .pb-sub {
    font-size: 11px;
  }

  .pb-progress {
    gap: 6px;
  }

  .pb-time {
    min-width: 30px;
    font-size: 10px;
  }

  .pb-center {
    gap: 2px;
  }

  .pb-controls {
    gap: 2px;
  }

  .pb-mode {
    width: 28px;
    height: 28px;
  }

  .pb-btn {
    width: 30px;
    height: 30px;
  }

  .pb-play {
    width: 36px;
    height: 36px;
  }

  .pb-right {
    gap: 0;
  }

  .pb-right .icon-btn {
    width: 30px;
    height: 30px;
  }

  /* 播放页 */
  .pp-inner {
    padding: calc(10px + env(safe-area-inset-top)) 14px
      calc(26px + env(safe-area-inset-bottom));
  }

  .pp-stage {
    gap: 12px;
    padding-top: 4px;
  }

  .pp-cover-frame {
    width: min(58vw, 190px);
    max-width: 190px;
  }

  .pp-title {
    font-size: 17px;
  }

  .pp-artist {
    margin-top: 4px;
    font-size: 12px;
  }

  .pp-badges {
    margin-top: 7px;
  }

  .pp-play {
    width: 54px;
    height: 54px;
  }

  .pp-skip {
    width: 38px;
    height: 38px;
  }

  .pp-mode {
    width: 34px;
    height: 34px;
  }

  .pp-progress,
  .pp-meta,
  .pp-extra {
    width: 100%;
  }

  .pp-back {
    padding-right: 8px;
  }

  .pp-back-text {
    display: none;
  }

  .pp-top-title {
    font-size: 10.5px;
    letter-spacing: 0.08em;
  }

  .pp-lyrics-head {
    padding-bottom: 7px;
  }

  .pp-lrc-actions .btn {
    height: 28px;
    padding: 0 9px;
    font-size: 11.5px;
  }

  .pp-vol-range {
    width: 70px;
  }

  .queue-panel {
    width: 100%;
    max-width: 100%;
  }

  .queue-head {
    padding-top: calc(14px + env(safe-area-inset-top));
  }
}

/* 极矮窗口：进一步压缩封面，保证控制区可见 */
@media (max-height: 560px) and (min-width: 1001px) {
  .pp-cover-frame {
    width: min(100%, 34vh, 300px);
  }

  .pp-stage {
    gap: 22px;
  }
}

/* --------------------------------------------------------------------------
   全屏播放页：移动端（QQ 音乐式布局）
   封面/歌词切换 + 控制区靠底 + 歌词模式占满剩余高度
   -------------------------------------------------------------------------- */
.pp-lyrics-toggle {
  display: none;
}

@media (max-width: 1000px) {
  #player-page .pp-inner {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    gap: 0;
    padding: 8px 18px calc(10px + env(safe-area-inset-bottom));
  }

  #player-page .pp-top {
    flex: 0 0 auto;
    padding-top: calc(8px + env(safe-area-inset-top));
  }

  #player-page .pp-stage {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    gap: 0;
  }

  /* 让 .pp-left 的子项直接参与 .pp-stage 的纵向排布 */
  #player-page .pp-left {
    display: contents;
  }

  #player-page .pp-cover-frame {
    order: 1;
    flex: 0 1 auto;
    align-self: center;
    width: min(74vw, 44vh, 340px);
    max-width: none;
    /* 与 .pp-meta 的 margin-top:auto 平分剩余空间，让封面在控制区上方居中 */
    margin: auto auto 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  #player-page .pp-cover-frame:active {
    transform: scale(0.985);
  }

  #player-page .pp-right {
    order: 2;
    flex: 1 1 auto;
    min-height: 0;
    display: none;
    padding: 10px 0 0;
  }

  #player-page .pp-meta {
    order: 3;
    flex: 0 0 auto;
    margin-top: auto;
    padding-top: 10px;
    text-align: center;
  }

  #player-page .pp-title {
    font-size: clamp(19px, 5.4vw, 24px);
  }

  #player-page .pp-badges {
    justify-content: center;
  }

  #player-page .pp-progress {
    order: 4;
    flex: 0 0 auto;
    margin-top: 10px;
  }

  #player-page .pp-controls {
    order: 5;
    flex: 0 0 auto;
    margin: 4px 0 6px;
  }

  #player-page .pp-extra {
    order: 6;
    flex: 0 0 auto;
    justify-content: center;
  }

  /* 手机端：歌词切换按钮常显；加载歌词等次要操作收进歌词页 */
  #player-page .pp-lyrics-toggle {
    display: inline-flex;
  }

  #player-page .pp-lrc-actions,
  #player-page .pp-vol {
    display: none;
  }

  /* 歌词模式：封面让位给歌词 */
  #player-page.is-lyrics .pp-cover-frame {
    display: none;
  }

  #player-page.is-lyrics .pp-right {
    display: flex;
    flex-direction: column;
    order: 1;
    padding-top: 4px;
  }

  #player-page.is-lyrics .pp-meta {
    margin-top: 2px;
    padding-top: 6px;
  }

  #player-page.is-lyrics .pp-title {
    font-size: 17px;
  }

  #player-page.is-lyrics .pp-badges {
    display: none;
  }
}

@media (max-width: 640px) {
  #player-page .pp-inner {
    padding: 6px 16px calc(8px + env(safe-area-inset-bottom));
  }

  #player-page .pp-cover-frame {
    width: min(78vw, 40vh, 300px);
  }
}

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  .queue-panel,
  .player-bar,
  #player-page {
    transition-duration: 0.001ms !important;
  }

  .player-page.is-playing .pp-cover-glow {
    animation: none;
  }
}
