/* ============================================================
 * Biko · 音乐圆角面板（点击左列音符按钮展开）
 * 以 APlayer 为音频引擎，外观参考 noimpty，蓝灰配色、深浅自适应
 * ============================================================ */
#biko-music-panel {
  --bmp-accent: #7e96b8;
  --bmp-accent2: #9db4d3;
  /* 底部避让：右侧按钮列高度 + 安全区，供窄屏复用（原先是硬编码 160px） */
  --bmp-bottom-gap: 24px;
  --bmp-safe: env(safe-area-inset-bottom, 0px);
  --bmp-tap: 44px;
  position: fixed;
  z-index: var(--z-music-panel, 90);
  left: 68px;
  bottom: 3px;
  width: min(370px, calc(100vw - 80px));
  color: var(--font-color, #e9ebf1);
  font-family: var(--font-ui);
  pointer-events: none;
}
#biko-music-panel.open {
  pointer-events: auto;
}
.bmp-card {
  padding: 16px;
  border-radius: var(--r-panel);
  border: 1px solid rgba(126, 150, 184, .3);
  background: color-mix(in srgb, var(--card-bg, #171b23) 90%, transparent);
  box-shadow: 0 18px 55px rgba(8, 12, 20, .5);
  -webkit-backdrop-filter: blur(20px) saturate(125%);
  backdrop-filter: blur(20px) saturate(125%);
  opacity: 0;
  transform: translateY(12px) scale(.98);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
#biko-music-panel.open .bmp-card {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
html[data-theme='light'] .bmp-card {
  border-color: rgba(126, 150, 184, .4);
  box-shadow: 0 16px 44px rgba(40, 55, 80, .28);
}

/* 顶栏：唱片 + 信息 + 收起 */
.bmp-topline {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 12px;
}
.bmp-disc {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #2a2f3a center / cover no-repeat;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .1), 0 8px 20px rgba(0, 0, 0, .35);
}
.bmp-disc::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(12, 15, 21, .92) 0 11%, transparent 12%);
}
.bmp-disc::after {
  content: attr(data-n);
  position: absolute;
  right: -4px;
  bottom: -3px;
  display: grid;
  width: 19px;
  height: 19px;
  place-items: center;
  border: 2px solid var(--card-bg, #171b23);
  border-radius: 50%;
  background: var(--bmp-accent);
  color: #fff;
  font-size: .62rem;
  font-weight: 700;
}
#biko-music-panel.playing .bmp-disc {
  animation: bmp-spin 7s linear infinite;
}
@keyframes bmp-spin { to { transform: rotate(360deg); } }

.bmp-meta { display: flex; min-width: 0; flex-direction: column; }
.bmp-kicker {
  color: var(--bmp-accent2);
  font-size: .64rem;
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.bmp-title, .bmp-artist {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bmp-title { margin-top: 2px; color: var(--text-highlight-color, #f2f4f8); font-size: .98rem; }
.bmp-artist { margin-top: 1px; color: var(--card-meta, #aab2c0); font-size: .72rem; }

.bmp-collapse {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--font-color, #e9ebf1);
  cursor: pointer;
}
.bmp-collapse:hover { background: rgba(126, 150, 184, .14); color: var(--bmp-accent2); }

/* 进度行 */
.bmp-progress-row {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  gap: 8px;
  margin-top: 13px;
  color: var(--card-meta, #aab2c0);
  font-size: .67rem;
  font-variant-numeric: tabular-nums;
}
.bmp-progress {
  width: 100%;
  height: 4px;
  margin: 0;
  accent-color: var(--bmp-accent);
  cursor: pointer;
}

/* 控制行 */
.bmp-controls {
  display: grid;
  grid-template-columns: 36px 40px 48px 40px minmax(72px, 1fr);
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
}
.bmp-controls button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--font-color, #e9ebf1);
  cursor: pointer;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}
.bmp-controls button:active { transform: scale(.92); }
.bmp-controls button:hover { background: rgba(126, 150, 184, .14); color: var(--bmp-accent2); }
.bmp-controls button.is-active { color: var(--bmp-accent2); }
.bmp-play {
  width: 46px !important;
  height: 46px !important;
  background: linear-gradient(135deg, #7e96b8, #9db4d3) !important;
  box-shadow: 0 9px 20px rgba(126, 150, 184, .32);
  color: #fff !important;
  font-size: 1rem;
}
.bmp-play:hover { filter: brightness(1.07); color: #fff; }

.bmp-volume { display: flex; min-width: 0; align-items: center; gap: 7px; color: var(--card-meta, #aab2c0); }
.bmp-volume input {
  min-width: 0;
  width: 100%;
  height: 4px;
  accent-color: var(--bmp-accent);
  cursor: pointer;
}

.bmp-status {
  min-height: 1.2em;
  margin: 5px 0 0;
  color: var(--card-meta, #aab2c0);
  font-size: .66rem;
  text-align: center;
}

@media (max-width: 768px) {
  #biko-music-panel {
    left: auto;
    right: 12px;
    /* 不再写死 160px：用变量叠加安全区，兼容 iPhone 底部横条 */
    bottom: calc(var(--bmp-bottom-gap) + var(--bmp-safe));
    width: min(370px, calc(100vw - 24px));
  }
  .bmp-card { padding: 14px; border-radius: var(--r-panel-sm); }
  /* 触控目标补到 44px，避免手指点不中 */
  .bmp-controls { grid-template-columns: var(--bmp-tap) var(--bmp-tap) 48px var(--bmp-tap) minmax(56px, 1fr); gap: 4px; }
  .bmp-controls button,
  .bmp-collapse { width: var(--bmp-tap); height: var(--bmp-tap); }
  .bmp-play { width: 48px !important; height: 48px !important; }
}
@media (prefers-reduced-motion: reduce) {
  #biko-music-panel.playing .bmp-disc { animation: none; }
}
