/* =========================================================
   悬浮音乐播放器 · Dripping honey
   与全站共用 styles.css 的配色与字体变量
   ========================================================= */

.mp-root {
  position: fixed;
  right: 32px;
  bottom: 32px;
  z-index: 46;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}
.mp-root > * { pointer-events: auto; }
.mp-root [hidden] { display: none !important; }

/* ---------- 悬浮按钮 ---------- */
.mp-fab {
  position: relative;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1px solid rgba(212, 184, 150, 0.7);
  border-radius: 50%;
  background: rgba(255, 253, 249, 0.94);
  color: var(--rose-ink);
  box-shadow: 0 12px 30px rgba(93, 78, 74, 0.14);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: transform 0.28s ease, border-color 0.28s ease, box-shadow 0.28s ease;
}
.mp-fab:hover { transform: translateY(-2px); border-color: var(--rose); box-shadow: 0 16px 34px rgba(201, 138, 148, 0.18); }
.mp-fab:active { transform: scale(0.96); }
.mp-fab svg { width: 22px; height: 22px; }
.mp-root.is-open .mp-fab { display: none; }

.mp-fab-eq { display: none; align-items: flex-end; gap: 2px; height: 14px; }
.mp-root.is-playing .mp-fab-eq { display: flex; }
.mp-root.is-playing .mp-fab-note { display: none; }
.mp-fab-eq i {
  display: block;
  width: 2px;
  height: 100%;
  border-radius: 1px;
  background: currentColor;
  transform-origin: bottom;
  animation: mpEq 0.95s ease-in-out infinite;
}
.mp-fab-eq i:nth-child(1) { animation-delay: -0.2s; height: 60%; }
.mp-fab-eq i:nth-child(2) { animation-delay: -0.5s; height: 100%; }
.mp-fab-eq i:nth-child(3) { animation-delay: -0.8s; height: 75%; }
@keyframes mpEq {
  0%, 100% { transform: scaleY(0.35); }
  50% { transform: scaleY(1); }
}

.mp-fab-count {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--rose-ink);
  color: var(--pearl);
  font-family: var(--serif-en);
  font-size: 10px;
  line-height: 18px;
  text-align: center;
}

/* ---------- 面板 ---------- */
.mp-panel {
  position: relative;
  width: min(332px, calc(100vw - 32px));
  max-height: calc(100vh - 130px);
  padding: 20px 20px 14px;
  overflow-y: auto;
  border: 1px solid rgba(212, 184, 150, 0.55);
  border-radius: 8px;
  background: var(--pearl);
  box-shadow: 0 24px 60px rgba(93, 78, 74, 0.18);
  animation: mpIn 0.24s ease both;
}
@keyframes mpIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.mp-panel::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(212, 184, 150, 0.22);
  pointer-events: none;
}
.mp-panel > * { position: relative; z-index: 1; }

.mp-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.mp-script {
  display: block;
  color: var(--rose);
  font-family: var(--script);
  font-size: 32px;
  line-height: 1;
}
.mp-close {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(212, 184, 150, 0.55);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.mp-close:hover { transform: rotate(90deg); border-color: var(--rose); color: var(--rose-ink); }

.mp-now { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.mp-vinyl {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(212, 184, 150, 0.55);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #fffdf9 0 22%, #f5e6e8 23% 46%, #fffdf9 47% 100%);
  color: var(--rose);
}
.mp-vinyl::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.mp-root.is-playing .mp-vinyl { animation: mpSpin 7s linear infinite; }
@keyframes mpSpin { to { transform: rotate(360deg); } }

.mp-copy { min-width: 0; }
.mp-title {
  overflow: hidden;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mp-artist { color: var(--muted); font-size: 10px; letter-spacing: 0.06em; }

.mp-seek { display: flex; align-items: center; gap: 8px; }
.mp-time { flex: 0 0 auto; color: var(--muted); font-family: var(--serif-en); font-size: 11px; }
.mp-range {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  height: 14px;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.mp-range::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--rose) var(--p, 0%), rgba(212, 184, 150, 0.45) var(--p, 0%));
}
.mp-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  margin-top: -4px;
  border: 2px solid var(--pearl);
  border-radius: 50%;
  background: var(--rose);
}
.mp-range::-moz-range-track { height: 2px; border-radius: 2px; background: rgba(212, 184, 150, 0.45); }
.mp-range::-moz-range-progress { height: 2px; border-radius: 2px; background: var(--rose); }
.mp-range::-moz-range-thumb { width: 8px; height: 8px; border: 2px solid var(--pearl); border-radius: 50%; background: var(--rose); }

.mp-controls { display: flex; align-items: center; justify-content: center; gap: 20px; margin: 10px 0 12px; }
.mp-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}
.mp-btn:hover { color: var(--rose-ink); background: var(--cream); }
.mp-btn svg { width: 17px; height: 17px; }
.mp-btn.is-on { color: var(--rose-ink); }

.mp-play {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #b4747f;
  color: var(--pearl);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.mp-play:hover { background: #a76370; transform: translateY(-1px); box-shadow: 0 10px 22px rgba(201, 138, 148, 0.25); }
.mp-play svg { width: 18px; height: 18px; }
.mp-play .mp-icon-pause { display: none; }
.mp-root.is-playing .mp-play .mp-icon-play { display: none; }
.mp-root.is-playing .mp-play .mp-icon-pause { display: block; }

.mp-root.need-tap .mp-play { animation: mpPulse 1.6s ease-in-out infinite; }
@keyframes mpPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201, 138, 148, 0.4); }
  50% { box-shadow: 0 0 0 9px rgba(201, 138, 148, 0); }
}

.mp-foot { display: flex; align-items: center; gap: 10px; padding-top: 10px; border-top: 1px solid rgba(212, 184, 150, 0.22); }
.mp-vol-icon { flex: 0 0 auto; color: var(--muted); }
.mp-vol-icon svg { width: 15px; height: 15px; }
.mp-list-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 2px;
  border: 0;
  border-bottom: 1px solid rgba(212, 184, 150, 0.5);
  background: transparent;
  color: var(--rose-ink);
  font-size: 10px;
  letter-spacing: 0.1em;
  cursor: pointer;
}
.mp-list-btn span { color: var(--muted); font-family: var(--serif-en); font-size: 11px; }

.mp-list {
  margin: 10px 0 0;
  padding: 4px 0 0;
  max-height: 180px;
  overflow-y: auto;
  border-top: 1px dashed rgba(212, 184, 150, 0.35);
  list-style: none;
}
.mp-track {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 6px;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.mp-track:hover { background: var(--cream); }
.mp-track.is-current { color: var(--rose-ink); }
.mp-track-no { flex: 0 0 18px; color: var(--gold); font-family: var(--serif-en); font-size: 11px; text-align: right; }
.mp-track-main { min-width: 0; flex: 1 1 auto; }
.mp-track-title { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.mp-track-artist { display: block; color: var(--muted); font-size: 9px; letter-spacing: 0.04em; }
.mp-track-dur { flex: 0 0 auto; color: var(--muted); font-family: var(--serif-en); font-size: 10px; }

.mp-hint { margin: 10px 0 0; color: var(--muted); font-size: 9px; letter-spacing: 0.06em; text-align: center; }

.mp-toast {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 2;
  max-width: calc(100% - 40px);
  padding: 7px 14px;
  border: 1px solid rgba(212, 184, 150, 0.6);
  border-radius: 999px;
  background: var(--pearl);
  box-shadow: 0 8px 20px rgba(93, 78, 74, 0.12);
  color: var(--ink);
  font-size: 10px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.mp-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* 播放器出现时把「回到顶部」让上去 */
body.has-player .to-top { bottom: 96px; }

@media (max-width: 760px) {
  .mp-root { right: 16px; bottom: 18px; }
  .mp-panel { padding: 18px 16px 12px; }
  body.has-player .to-top { bottom: 84px; }
}

@media (prefers-reduced-motion: reduce) {
  .mp-vinyl, .mp-fab-eq i, .mp-root.need-tap .mp-play { animation: none; }
  .mp-panel { animation: none; }
}
