/* ============================================================
   player.css — 侧边背景音乐播放器
   颜色全部取自主题变量（--surface / --accent / --border …），
   因此「姚金龙·人文档案」与「DJ WEAPON·电音现场」两套皮肤自动适配。
   ============================================================ */

.ply {
  position: fixed;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}
.ply[hidden] { display: none; }
.ply[data-pos="right"] { right: 22px; top: 50%; transform: translateY(-50%); flex-direction: row-reverse; }
.ply[data-pos="left"]  { left: 22px;  top: 50%; transform: translateY(-50%); flex-direction: row; }
.ply > * { pointer-events: auto; }

/* ---------- 折叠态：迷你条（PC / 手机通用） ----------
   原小圆钮（.ply-fab）仅保留作为兜底，折叠态一律展示迷你条，
   信息更全（曲名 + 播放/暂停 + 下一首 + 展开），体积也更可控。 */
.ply-fab { display: none !important; }
.ply-mini {
  display: none;
  align-items: center; gap: 8px;
  max-width: 268px; padding: 6px 8px 6px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--card-shadow-hi);
  backdrop-filter: blur(14px);
  color: var(--text);
  animation: plyIn .3s ease both;
}
.ply.is-min .ply-mini { display: flex; }
.ply.is-min .ply-panel { display: none; }
.ply-mini-btn {
  width: 30px; height: 30px; flex: none; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  background: var(--chip-bg); color: var(--text);
  transition: color .2s, border-color .2s, transform .2s;
}
.ply-mini-btn svg { width: 13px; height: 13px; fill: currentColor; }
.ply-mini-btn:hover { color: var(--accent); border-color: var(--accent); }
.ply-mini-play {
  width: 34px; height: 34px; border-color: transparent;
  background: var(--accent-grad); color: var(--on-accent);
  box-shadow: var(--btn-shadow);
}
.ply-mini-play svg { width: 15px; height: 15px; }
.ply-mini-play:hover { color: var(--on-accent); transform: scale(1.05); }
.ply-mini-meta {
  flex: 1; min-width: 0; cursor: pointer;
  padding: 0 2px;
}
.ply-mini-meta b {
  display: block; font-size: 12.5px; font-weight: 700; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ply-mini-meta i {
  display: block; font-style: normal; font-size: 11px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- 面板 ---------- */
.ply-panel {
  width: 296px;
  max-height: min(78vh, 660px);
  display: flex; flex-direction: column;
  gap: 10px; padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow-hi);
  backdrop-filter: blur(14px);
  color: var(--text);
  overflow: hidden;
  animation: plyIn .35s ease both;
}
@keyframes plyIn { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }
.ply[data-pos="left"] .ply-panel { animation-name: plyInL; }
@keyframes plyInL { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }

.ply-head { display: flex; align-items: center; gap: 8px; }
.ply-note {
  width: 22px; height: 22px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 12px;
  background: var(--accent-soft); color: var(--accent);
}
.ply-head b { flex: 1; font-size: 13px; letter-spacing: .06em; font-weight: 700; }
.ply-x {
  width: 22px; height: 22px; flex: none; border-radius: 50%;
  color: var(--text-dim); font-size: 15px; line-height: 1;
  transition: color .2s, background .2s;
  touch-action: manipulation;
}
.ply-x:hover { color: var(--accent); background: var(--accent-soft); }
/* 所有可点元素：按下即反馈，避免手机端「点了没反应」的错觉 */
.ply-btn, .ply-mini-btn, .ply-x, .ply-fab, .ply-ask-btns button, .ply-list li {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.ply-btn:active, .ply-mini-btn:active, .ply-x:active, .ply-ask-btns button:active {
  transform: scale(.92);
}
.ply-play:active { transform: scale(.95); }
.ply-list li:active { background: var(--accent-soft); }

/* ---------- 当前曲目 ---------- */
.ply-now { display: flex; align-items: center; gap: 10px; }
.ply-cover {
  width: 52px; height: 52px; flex: none;
  border-radius: calc(var(--radius) - 1px);
  background: var(--cover-bg);
  border: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); font-size: 18px; overflow: hidden;
}
.ply-cover img { width: 100%; height: 100%; object-fit: cover; }
.ply-meta { flex: 1; min-width: 0; }
.ply-meta b {
  display: block; font-size: 13.5px; font-weight: 700; line-height: 1.35;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ply-meta i {
  display: block; font-style: normal; font-size: 11.5px;
  color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ply-eq { display: flex; align-items: flex-end; gap: 2px; height: 18px; flex: none; }
.ply-eq i { width: 2px; background: var(--accent); animation: plyEq .9s ease-in-out infinite; }
.ply-eq i:nth-child(1) { height: 40%; animation-delay: 0s; }
.ply-eq i:nth-child(2) { height: 90%; animation-delay: .18s; }
.ply-eq i:nth-child(3) { height: 60%; animation-delay: .36s; }
.ply-eq i:nth-child(4) { height: 80%; animation-delay: .54s; }
@keyframes plyEq { 0%, 100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }

/* ---------- 进度 / 音量滑杆 ----------
   轨道细（4px）但滑块命中区高（18px），手指也点得中。 */
.ply-range {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 18px; background: transparent; cursor: pointer;
  touch-action: manipulation;
}
.ply-range::-webkit-slider-runnable-track {
  height: 4px; border-radius: 999px;
  background: linear-gradient(to right,
              var(--accent) var(--ply-p, 0%),
              var(--border) var(--ply-p, 0%));
}
.ply-range::-webkit-slider-thumb {
  -webkit-appearance: none; margin-top: -4.5px;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent);
  box-shadow: var(--card-shadow);
}
.ply-range::-moz-range-track {
  height: 4px; border-radius: 999px; background: var(--border);
}
.ply-range::-moz-range-progress {
  height: 4px; border-radius: 999px; background: var(--accent);
}
.ply-range::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent);
}
.ply-time {
  display: flex; justify-content: space-between;
  font-size: 10.5px; color: var(--text-dim); letter-spacing: .04em;
  margin-top: -2px;
}

/* ---------- 控制按钮 ---------- */
.ply-ctrl { display: flex; align-items: center; justify-content: center; gap: 10px; }
.ply-btn {
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  background: var(--chip-bg); color: var(--text);
  transition: color .2s, border-color .2s, background .2s, transform .2s;
}
.ply-btn svg { width: 16px; height: 16px; fill: currentColor; }
.ply-btn:hover { color: var(--accent); border-color: var(--accent); }
.ply-btn.sm { width: 26px; height: 26px; }
.ply-btn.sm svg { width: 13px; height: 13px; }
.ply-play {
  width: 44px; height: 44px;
  background: var(--accent-grad); color: var(--on-accent); border-color: transparent;
  box-shadow: var(--btn-shadow);
}
.ply-play svg { width: 19px; height: 19px; }
.ply-play:hover { color: var(--on-accent); transform: scale(1.05); }
.ply-btn.is-off { color: var(--text-dim); opacity: .6; }

/* ---------- 音量 ---------- */
.ply-vol { display: flex; align-items: center; gap: 8px; }
.ply-volnum {
  width: 24px; text-align: right; font-size: 10.5px;
  color: var(--text-dim); font-variant-numeric: tabular-nums;
}

/* ---------- 播放列表 ---------- */
.ply-listwrap { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
.ply-listwrap[hidden] { display: none; }
.ply-listhead {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim);
  border-top: 1px solid var(--border-soft); padding-top: 9px;
}
.ply-listhead em { font-style: normal; color: var(--accent); }
.ply-list { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.ply-list::-webkit-scrollbar { width: 5px; }
.ply-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.ply-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 7px; border-radius: calc(var(--radius) - 2px);
  font-size: 12.5px; color: var(--text-dim); cursor: pointer;
  transition: background .18s, color .18s;
}
.ply-list li:hover { background: var(--accent-soft); color: var(--text); }
.ply-list li.is-on { background: var(--chip-bg); color: var(--accent); font-weight: 700; }
.ply-no { font-size: 10px; opacity: .7; font-variant-numeric: tabular-nums; flex: none; }
.ply-nm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ply-eqi { display: none; align-items: flex-end; gap: 1px; height: 11px; flex: none; }
.ply-list li.is-on .ply-eqi { display: inline-flex; }
.ply-eqi i { width: 2px; background: var(--accent); animation: plyEq .8s ease-in-out infinite; }
.ply-eqi i:nth-child(1) { height: 50%; }
.ply-eqi i:nth-child(2) { height: 100%; animation-delay: .2s; }
.ply-eqi i:nth-child(3) { height: 70%; animation-delay: .4s; }
.ply-empty { justify-content: center; color: var(--text-dim); font-size: 12px; cursor: default; }

.ply-tip {
  font-size: 11px; line-height: 1.5; margin: 0;
  padding: 6px 8px; border-radius: calc(var(--radius) - 2px);
  background: var(--chip-bg); color: var(--text-dim);
}
.ply-tip[hidden] { display: none; }
.ply-tip.warn { color: var(--accent-2); border: 1px solid var(--border); }
.ply-tip.ok { color: var(--accent); }

/* ---------- 进站询问：是否播放背景音乐 ----------
   定位原则：永远浮在播放器「上方」，绝不与面板 / 迷你条重叠，
   否则会挡住播放、下一首等按钮（曾因此导致按键点了没反应）。 */
.ply-ask {
  position: absolute; z-index: 3;
  left: 50%; bottom: calc(100% + 12px);
  width: 224px; padding: 12px 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow-hi);
  backdrop-filter: blur(14px);
  color: var(--text);
  animation: plyAskIn .3s ease both;
}
.ply-ask[hidden] { display: none; }
@keyframes plyAskIn {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
.ply-ask-txt { margin: 0 0 9px; font-size: 12.5px; line-height: 1.5; color: var(--text); }
.ply-ask-btns { display: flex; gap: 8px; }
.ply-ask-btns button {
  flex: 1; padding: 6px 0; border-radius: calc(var(--radius) - 2px);
  font-size: 12px; letter-spacing: .04em; cursor: pointer;
  transition: background .2s, color .2s, border-color .2s, transform .2s;
}
.ply-ask-yes {
  border: 1px solid transparent;
  background: var(--accent-grad); color: var(--on-accent);
  box-shadow: var(--btn-shadow);
}
.ply-ask-yes:hover { transform: scale(1.03); }
.ply-ask-no {
  border: 1px solid var(--border);
  background: var(--chip-bg); color: var(--text-dim);
}
.ply-ask-no:hover { color: var(--text); border-color: var(--accent); }

/* ---------- 移动端：底部条（默认折叠，展开也瘦身） ---------- */
@media (max-width: 860px) {
  .ply[data-pos="right"], .ply[data-pos="left"] {
    left: 10px; right: 10px; top: auto; bottom: 10px;
    transform: none; flex-direction: column; align-items: stretch;
    gap: 0;
  }
  .ply.is-min { align-items: stretch; }
  /* 折叠态：整条迷你条铺满底部，高度约 48px */
  .ply.is-min .ply-mini {
    max-width: none; width: 100%; gap: 10px;
    padding: 7px 10px 7px 7px; border-radius: 26px;
  }
  .ply-mini-meta b { font-size: 13px; }
  /* 展开态：面板瘦身，列表可滚动 */
  .ply-panel {
    width: 100%; max-height: min(46vh, 360px);
    padding: 12px; gap: 8px;
    border-radius: var(--radius);
  }
  .ply-cover { width: 44px; height: 44px; }
  .ply-meta b { font-size: 13px; }
  .ply-ctrl { gap: 8px; }
  .ply-btn { width: 32px; height: 32px; }
  .ply-play { width: 40px; height: 40px; }
  .ply-play svg { width: 17px; height: 17px; }
  .ply-listwrap { min-height: 0; }
  .ply-list { max-height: 132px; }
  .ply[data-pos="left"] .ply-panel { animation-name: plyIn; }
  /* 移动端同样浮在播放器上方：宽度自适应，不遮挡底部条的任何按钮 */
  .ply-ask {
    width: min(320px, calc(100% - 24px));
    bottom: calc(100% + 10px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ply-ring, .ply-eq i, .ply-eqi i, .ply-ask { animation: none !important; }
}
