/* ==========================================================================
 * XPlayer Mini Player — 紧凑常驻小播放器
 * Winamp 式密度 + 现代暗色；复用 tokens.css 的调色板/字号/间距/圆角/动效。
 *
 * 档位（窗口尺寸）   <html data-mode="bar|player|player-list">
 * 主题 / 换皮        <html data-theme="dark|light" data-skin="amber|jade|azure|violet|crimson">
 * 独立小窗（铺满）     <body class="is-bare">
 * 零依赖，file:// 直接打开可用。
 *
 * 结构：小播放器 = 顶部控制条（按钮 / 进度 / 开关）+ 下方大图区（封面 + 歌手专辑 + 底部波形融合）
 *      迷你模式 = 仅顶部控制条（横排）
 * ========================================================================== */

:root {
  --mini-titlebar-h: 30px;
  --mini-col-player: 360px;
  --mini-col-list: 440px;
  --mini-cover-sm: 44px;
  --mini-viz-h: 60px;
  --mini-bar-h: 96px;
  --mini-row-h: 50px;
}

* {
  box-sizing: border-box;
}

/* 单文档多视图：这些全局规则只属于迷你视图，必须作用域化，否则会串到完整界面。 */
html[data-view="mini"],
html[data-view="mini"] body {
  height: 100%;
}

html[data-view="mini"] body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--t-body-size);
  line-height: var(--t-body-lh);
  color: var(--text-1);
  background: var(--bg-base);
  overflow: hidden;
  user-select: none;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

/* ---------- 原型桌面背景（仅“预览档位”时出现，独立小窗模式自动隐藏） ---------- */
html[data-view="mini"] body:not(.is-bare) {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: var(--s-6);
  background:
    radial-gradient(900px 520px at 18% 0%, var(--bg-elev-1) 0%, transparent 62%),
    radial-gradient(760px 460px at 92% 100%, var(--bg-elev-2) 0%, transparent 58%),
    var(--bg-base);
}

html[data-view="mini"] body.is-bare {
  overflow: hidden;
  background: var(--bg-base);
}

/* ==========================================================================
 * 窗口外壳
 * ========================================================================== */
.mwin {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-cover);
  overflow: hidden;
  flex: none;
}

/* 各档位窗口尺寸 */
html[data-mode="bar"] .mwin { width: 660px; height: var(--mini-bar-h); }
html[data-mode="player"] .mwin { width: 360px; height: 560px; }
html[data-mode="player-list"] .mwin { width: 800px; height: 560px; }

html[data-view="mini"] body.is-bare .mwin {
  width: 100% !important;
  height: 100% !important;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

/* ==========================================================================
 * 标题栏（拖拽把手 + 全局控制）
 * ========================================================================== */
.mbar {
  flex: none;
  height: var(--mini-titlebar-h);
  display: flex;
  align-items: center;
  gap: var(--s-1);
  padding: 0 var(--s-1) 0 var(--s-2);
  background: var(--bg-elev-2);
  border-bottom: 1px solid var(--line);
  cursor: default;
}

.mbar-grip {
  display: inline-flex;
  align-items: center;
  color: var(--text-3);
  cursor: grab;
}

.mbar-grip:active {
  cursor: grabbing;
}

.mbar-title {
  font-size: var(--t-caption-size);
  font-weight: var(--t-weight-semibold);
  letter-spacing: 0.04em;
  color: var(--text-2);
  white-space: nowrap;
}

.mbar-now {
  font-size: var(--t-caption-size);
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
  padding-left: var(--s-2);
}

.mbar-spacer {
  flex: 1;
  min-width: var(--s-2);
}

.mtb {
  flex: none;
  width: var(--icon-btn-sm);
  height: var(--icon-btn-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--d-fast) var(--ease), color var(--d-fast) var(--ease);
}

.mtb:hover {
  background: var(--bg-elev-3);
  color: var(--text-1);
}

.mtb:focus-visible {
  outline: var(--focus-ring-w) solid var(--accent);
  outline-offset: var(--focus-ring-offset);
}

.mtb.is-on {
  color: var(--accent);
  background: var(--accent-soft);
}

.mtb-close:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* 独立小窗（is-bare）：把「弹出为独立小窗」换成「完整界面」——壳里它已经是个窗口了，
 * 而原型档位台是隐藏的，没有这个入口就回不到完整界面。 */
#btn-full-win {
  display: none;
}

html[data-view="mini"] body.is-bare #btn-pop {
  display: none;
}

html[data-view="mini"] body.is-bare #btn-full-win {
  display: inline-flex;
  color: var(--text-2);
}

html[data-view="mini"] body.is-bare #btn-full-win:hover {
  color: var(--text-1);
}

/* ==========================================================================
 * 主体：播放器 / 队列
 * ========================================================================== */
.mbody {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.mp {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.mp-player {
  flex: none;
  width: var(--mini-col-player);
}

.mp-list {
  flex: none;
  width: var(--mini-col-list);
  border-left: 1px solid var(--line);
  background: var(--bg-elev-1);
}

/* ---- 按档位显示 / 隐藏队列 ---- */
html[data-mode="bar"] .mp-list,
html[data-mode="player"] .mp-list {
  display: none;
}

html[data-mode="bar"] .mp-player,
html[data-mode="player"] .mp-player {
  width: 100%;
}

/* ---- 窄窗兜底：窗口没能展开（老壳 / 普通标签页）时，列表做成抽屉盖住播放器 ----
 * 正常路径是 JS 调 win.set 把整窗拉到 800px，两栏并排；这里只负责「挤不下时别硬挤」。
 */
@media (max-width: 799px) {
  html[data-mode="player-list"] .mbody {
    position: relative;
  }

  html[data-mode="player-list"] .mp-player {
    width: 100%;
  }

  html[data-mode="player-list"] .mp-list {
    position: absolute;
    inset: 0;
    width: 100%;
    z-index: var(--z-menu);
    border-left: 0;
    box-shadow: var(--shadow-menu);
  }
}

/* ==========================================================================
 * 控制条（小播放器上半 / 迷你模式全部）
 * ========================================================================== */
.mp-controls {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-3);
  background: var(--bg-elev-1);
}

.mp-now {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  width: 100%;
  min-width: 0;
}

.mp-meta {
  flex: 1;
  min-width: 0;
}

.mp-title {
  font-size: var(--t-small-size);
  line-height: 1.35;
  font-weight: var(--t-weight-semibold);
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mp-artist {
  font-size: var(--t-micro-size);
  line-height: 1.35;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 缩略封面（控制条） */
.mp-cover {
  flex: none;
  width: var(--mini-cover-sm);
  height: var(--mini-cover-sm);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-pure);
  font-size: 17px;
  font-weight: var(--t-weight-bold);
  background-image: var(--cover-grad-0);
  position: relative;
  overflow: hidden;
}

.mp-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 30% 15%, rgba(255, 255, 255, 0.16), transparent 60%);
}

.mp-cover-char {
  position: relative;
  z-index: 1;
  opacity: 0.92;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}

/* 进度行：时间 + 滑块 */
.mp-seek-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  width: 100%;
}

.mp-seek-row .mslider {
  flex: 1;
  min-width: 0;
}

.mp-t {
  flex: none;
  font-size: var(--t-micro-size);
  color: var(--text-3);
  letter-spacing: 0.03em;
}

/* 按钮行 */
.mp-ctrl {
  display: flex;
  align-items: center;
  width: 100%;
}

.mp-ctrl-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  margin: 0 auto;
}

.mp-vol {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--s-1);
  width: 88px;
}

.mp-vol .mslider {
  flex: 1;
  min-width: 0;
}

/* ==========================================================================
 * 展示区（stage）：环境光 + 封面 / 唱片 + 滚动歌词 + 元信息 + 底部波形
 *
 * 主题差异全部收敛在 --stage-* / --amb-* 这两组变量里：
 *   暗色 = 深底 + 封面主色的霓虹晕染 + 亮字
 *   亮色 = 浅底 + 同一主色的柔和晕染 + 深字（封面本身仍是深色渐变，形成对比）
 * 封面渐变永远是那 6 组深色棚拍色调，所以封面上的字固定用白色，不跟随主题翻转。
 * ========================================================================== */
.mp-stage {
  --stage-fg: rgba(255, 255, 255, 0.96);
  --stage-fg-dim: rgba(255, 255, 255, 0.72);
  --stage-fg-faint: rgba(255, 255, 255, 0.5);
  --stage-chip-bg: rgba(255, 255, 255, 0.08);
  --stage-chip-line: rgba(255, 255, 255, 0.16);
  --stage-empty-ring: rgba(255, 255, 255, 0.2);
  --stage-viz-scale: 1;
  --amb-a1: 0.5;
  --amb-a2: 0.3;
  --amb-a3: 0.24;
  --cover-w: clamp(132px, 48%, 208px);
  --mini-lyric-lh: 24px;

  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
  background: var(--bg-base);
}

:root[data-theme="light"] .mp-stage {
  --stage-fg: rgba(23, 26, 31, 0.94);
  --stage-fg-dim: rgba(23, 26, 31, 0.68);
  --stage-fg-faint: rgba(23, 26, 31, 0.52);
  --stage-chip-bg: rgba(23, 26, 31, 0.05);
  --stage-chip-line: rgba(23, 26, 31, 0.12);
  --stage-empty-ring: rgba(23, 26, 31, 0.16);
  /* 同一份主色在浅底上更“吵”，波形整体压暗一档才不抢戏 */
  --stage-viz-scale: 0.62;
  --amb-a1: 0.34;
  --amb-a2: 0.2;
  --amb-a3: 0.15;
}

/* ---- 环境光：取封面主色，缓慢漂移，负责“这张专辑的气味” ---- */
.mp-ambient {
  position: absolute;
  left: -14%;
  right: -14%;
  top: -18%;
  bottom: 6%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(64% 52% at 50% 12%, rgba(var(--amb-rgb, 255, 122, 69), var(--amb-a1)) 0%, transparent 72%),
    radial-gradient(56% 40% at 16% 78%, rgba(var(--amb-rgb, 255, 122, 69), var(--amb-a2)) 0%, transparent 70%),
    radial-gradient(46% 34% at 86% 62%, rgba(var(--amb-rgb, 255, 122, 69), var(--amb-a3)) 0%, transparent 72%);
  filter: blur(28px) saturate(1.2);
  animation: mp-drift 26s var(--ease) infinite alternate;
}

@keyframes mp-drift {
  from { transform: translate3d(-2%, -1%, 0) scale(1); }
  to   { transform: translate3d(2%, 2%, 0) scale(1.08); }
}

/* ---- 颗粒：给渐变一层胶片质感，避免大面积色块发“塑料” ---- */
.mp-grain {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.045;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* 底部压暗，保证歌词 / 元信息在环境光上依然清晰 */
.mp-stage::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 52%;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(to top, var(--bg-base) 6%, transparent 100%);
}

/* ---- 封面 + 唱片 ---- */
.mp-hero {
  position: relative;
  z-index: 3;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-3) 0;
  overflow: hidden;
}

.mp-art {
  position: relative;
  z-index: 2;
  flex: none;
  width: var(--cover-w);
  height: var(--cover-w);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: var(--cover-grad-0);
  background-size: cover;
  background-position: center;
  overflow: hidden;
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.52),
    0 2px 6px rgba(0, 0, 0, 0.36),
    inset 0 0 0 1px rgba(255, 255, 255, 0.09);
  transition: box-shadow var(--d-base) var(--ease), transform var(--d-base) var(--ease);
}

:root[data-theme="light"] .mp-art {
  box-shadow:
    0 16px 34px rgba(20, 24, 32, 0.24),
    0 2px 6px rgba(20, 24, 32, 0.14),
    inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

/* 封面上的光泽（固定白色：封面渐变恒为深色棚拍色调） */
.mp-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 80% at 28% 10%, rgba(255, 255, 255, 0.2), transparent 58%),
    linear-gradient(to top, rgba(0, 0, 0, 0.24), transparent 42%);
}

.mp-art-char {
  position: relative;
  z-index: 1;
  font-size: calc(var(--cover-w) * 0.46);
  font-weight: var(--t-weight-bold);
  color: #fff;
  opacity: 0.92;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.45);
}

/* 唱片：与封面同心、向右探出一截；播放时旋转，暂停时定格 */
.mp-vinyl {
  position: absolute;
  z-index: 1;
  width: var(--cover-w);
  height: var(--cover-w);
  border-radius: 50%;
  transform: translateX(26%);
  background:
    repeating-radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.055) 0 1px, transparent 1px 4px),
    radial-gradient(circle at 50% 50%, #16181d 0%, #0b0c0f 78%);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  animation: mp-spin 18s linear infinite;
  animation-play-state: paused;
  transition: transform var(--d-slow) var(--ease);
}

.mp-stage.is-playing .mp-vinyl {
  animation-play-state: running;
}

/* 一道固定角度的反光，让旋转看得出来 */
.mp-vinyl::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    from 210deg,
    rgba(255, 255, 255, 0.16),
    rgba(255, 255, 255, 0) 26%,
    rgba(255, 255, 255, 0) 74%,
    rgba(255, 255, 255, 0.07)
  );
  mix-blend-mode: screen;
}

@keyframes mp-spin {
  to { transform: translateX(26%) rotate(360deg); }
}

/* ---- 滚动歌词窗 ---- */
.mp-lyric {
  position: relative;
  z-index: 4;
  flex: none;
  width: calc(100% - var(--s-3) * 2);
  max-width: 720px;
  margin: 0 auto;
  height: calc(var(--mini-lyric-lh) * 3);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 18%, #000 82%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 18%, #000 82%, transparent 100%);
}

.mp-lyric-track {
  will-change: transform;
  transition: transform 420ms var(--ease);
}

.mp-lyric-line {
  height: var(--mini-lyric-lh);
  line-height: var(--mini-lyric-lh);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: var(--t-small-size);
  color: var(--stage-fg-faint);
  cursor: pointer;
  transition: color var(--d-base) var(--ease);
}

.mp-lyric-line:hover {
  color: var(--stage-fg-dim);
}

.mp-lyric-line.is-active {
  color: var(--stage-fg);
  font-weight: var(--t-weight-semibold);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.28);
}

:root[data-theme="light"] .mp-lyric-line.is-active {
  text-shadow: none;
}

/* 无歌词 / 无曲目：降级成「专辑 + 歌手」两行 */
.mp-lyric-empty {
  display: none;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
}

.mp-lyric.is-empty .mp-lyric-track {
  display: none;
}

.mp-lyric.is-empty .mp-lyric-empty {
  display: flex;
}

.mp-lyric-empty-title {
  max-width: 100%;
  font-size: var(--t-h2-size);
  font-weight: var(--t-weight-semibold);
  color: var(--stage-fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mp-lyric-empty-sub {
  max-width: 100%;
  font-size: var(--t-caption-size);
  color: var(--stage-fg-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mp-lyric-empty-next {
  max-width: 100%;
  margin-top: var(--s-1);
  font-size: var(--t-micro-size);
  color: var(--stage-fg-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mp-lyric-empty-next:empty {
  display: none;
}

/* ---- 元信息条：格式 / 码率 / 采样率 + 队列位置 ---- */
.mp-stage-meta {
  position: relative;
  z-index: 4;
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  height: 26px;
  padding: 0 var(--s-4);
}

.mp-chips {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  min-width: 0;
  overflow: hidden;
}

.mp-chip {
  flex: none;
  padding: 1px var(--s-1-5);
  border-radius: var(--r-pill);
  border: 1px solid var(--stage-chip-line);
  background: var(--stage-chip-bg);
  color: var(--stage-fg-dim);
  font-size: var(--t-micro-size);
  line-height: 1.5;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.mp-chip.is-format {
  color: var(--stage-fg);
  font-weight: var(--t-weight-semibold);
  border-color: rgba(var(--amb-rgb, 255, 122, 69), 0.55);
  background: rgba(var(--amb-rgb, 255, 122, 69), 0.16);
}

.mp-queue-pos {
  flex: none;
  margin-left: auto;
  color: var(--stage-fg-faint);
  font-size: var(--t-micro-size);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

/* ---- 底部波形：顶部渐隐，与展示区融合 ---- */
.mp-viz {
  position: relative;
  z-index: 4;
  flex: none;
  height: var(--mini-viz-h);
  padding-bottom: var(--s-1);
  -webkit-mask-image: linear-gradient(to top, #000 64%, transparent 100%);
  mask-image: linear-gradient(to top, #000 64%, transparent 100%);
}

.mp-viz canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---- 空态（没有正在播放的曲目） ---- */
.mp-stage.is-empty .mp-vinyl {
  display: none;
}

.mp-stage.is-empty .mp-art {
  background-image: none;
  border: 1px dashed var(--stage-empty-ring);
  box-shadow: none;
  color: var(--stage-fg-dim);
}

.mp-stage.is-empty .mp-art::after {
  display: none;
}

.mp-stage.is-empty .mp-stage-meta {
  visibility: hidden;
}

.mp-stage.is-empty .mp-viz {
  opacity: 0.4;
}

/* ==========================================================================
 * 滑块（进度 / 音量）
 * ========================================================================== */
.mslider {
  position: relative;
  width: 100%;
  height: var(--track-bar-h-hover);
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}

.mslider-track {
  position: absolute;
  left: 0;
  right: 0;
  height: var(--track-bar-h);
  border-radius: var(--r-pill);
  background: var(--bg-elev-4);
  overflow: hidden;
  transition: height var(--d-fast) var(--ease);
}

.mslider:hover .mslider-track,
.mslider.is-dragging .mslider-track {
  height: var(--track-bar-h-hover);
}

.mslider-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--p, 0%);
  background: var(--accent);
  border-radius: var(--r-pill);
}

.mslider-thumb {
  position: absolute;
  left: var(--p, 0%);
  width: var(--thumb-size);
  height: var(--thumb-size);
  margin-left: calc(var(--thumb-size) / -2);
  border-radius: 50%;
  background: var(--text-1);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity var(--d-fast) var(--ease);
  pointer-events: none;
}

.mslider:hover .mslider-thumb,
.mslider.is-dragging .mslider-thumb,
.mslider:focus-visible .mslider-thumb {
  opacity: 1;
}

.mslider:focus-visible {
  outline: var(--focus-ring-w) solid var(--accent);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--r-xs);
}

/* ==========================================================================
 * 控制按钮
 * ========================================================================== */
.cbtn {
  flex: none;
  width: var(--icon-btn-size);
  height: var(--icon-btn-size);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--d-fast) var(--ease), color var(--d-fast) var(--ease);
}

.cbtn:hover {
  background: var(--bg-elev-3);
  color: var(--text-1);
}

.cbtn:focus-visible {
  outline: var(--focus-ring-w) solid var(--accent);
  outline-offset: var(--focus-ring-offset);
}

.cbtn.is-on {
  color: var(--accent);
}

.cbtn-play {
  width: var(--play-btn-size);
  height: var(--play-btn-size);
  border-radius: 50%;
  background: var(--accent);
  color: var(--text-on-accent);
}

.cbtn-play:hover {
  background: var(--accent-hover);
  color: var(--text-on-accent);
}

.cbtn-play:active {
  background: var(--accent-active);
  transform: scale(0.96);
}

.cbtn-play:disabled {
  background: var(--bg-elev-4);
  color: var(--text-3);
  cursor: not-allowed;
  transform: none;
}

/* ==========================================================================
 * 队列列表（两行：标题 + 歌手·专辑）
 * ========================================================================== */
.mlist-head {
  flex: none;
  height: var(--btn-h);
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 0 var(--s-2) 0 var(--s-3);
  border-bottom: 1px solid var(--line);
  font-size: var(--t-caption-size);
  color: var(--text-2);
  font-weight: var(--t-weight-semibold);
  letter-spacing: 0.04em;
}

.mlist-head .mlist-count {
  margin-left: auto;
  color: var(--text-3);
  font-weight: var(--t-weight-normal);
}

/* 收起列表：窗口整体缩回小播放器 */
.mlist-close {
  flex: none;
  width: var(--icon-btn-sm);
  height: var(--icon-btn-sm);
  color: var(--text-3);
}

.mlist-close:hover {
  background: var(--bg-elev-4);
  color: var(--text-1);
}

.mlist-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--s-1) 0;
  min-height: 0;
}

.mlist-body::-webkit-scrollbar {
  width: var(--scrollbar-w);
}

.mlist-body::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: var(--r-pill);
}

.mlist-body::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

.mlist-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: var(--s-2);
  align-items: center;
  height: var(--mini-row-h);
  padding: 0 var(--s-3);
  cursor: pointer;
  color: var(--text-2);
}

.mlist-row:hover {
  background: var(--bg-elev-3);
}

.mlist-row.is-current {
  background: var(--accent-soft);
}

.mlist-idx {
  grid-column: 1;
  grid-row: 1 / span 2;
  text-align: right;
  color: var(--text-3);
  font-size: var(--t-micro-size);
}

.mlist-row.is-current .mlist-idx {
  color: var(--accent);
}

.mlist-name {
  grid-column: 2;
  grid-row: 1;
  align-self: end;
  font-size: var(--t-small-size);
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mlist-sub {
  grid-column: 2;
  grid-row: 2;
  align-self: start;
  font-size: var(--t-micro-size);
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mlist-dur {
  grid-column: 3;
  grid-row: 1 / span 2;
  color: var(--text-3);
  font-size: var(--t-micro-size);
}

.mlist-row.is-current .mlist-name {
  color: var(--accent);
}

.mlist-note {
  padding: var(--s-2) var(--s-3);
  font-size: var(--t-micro-size);
  color: var(--text-3);
  text-align: center;
}

/* ==========================================================================
 * 档位：bar（迷你播放条 = 小播放器的上部控制条，横排）
 * ========================================================================== */
html[data-mode="bar"] .mbar {
  height: var(--s-6);
  padding-left: var(--s-2);
}

html[data-mode="bar"] .mbar-title {
  display: none;
}

/* bar 模式下标题栏只保留必备按钮 */
html[data-mode="bar"] #btn-viz {
  display: none;
}

html[data-mode="bar"] .mp-player {
  justify-content: center;
}

html[data-mode="bar"] .mp-stage {
  display: none;
}

html[data-mode="bar"] .mp-controls {
  flex-direction: row;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-1) var(--s-2);
  background: transparent;
}

html[data-mode="bar"] .mp-now {
  flex: 1;
  min-width: 0;
}

html[data-mode="bar"] .mp-meta {
  text-align: left;
}

html[data-mode="bar"] .mp-seek-row {
  flex: none;
  width: 260px;
}

html[data-mode="bar"] .mp-ctrl {
  flex: none;
  width: auto;
}

html[data-mode="bar"] .mp-ctrl-main {
  margin: 0;
  gap: var(--s-1);
}

html[data-mode="bar"] .mp-vol {
  display: none;
}

/* ==========================================================================
 * 原型档位切换台
 * ========================================================================== */
.harness {
  position: fixed;
  left: 50%;
  bottom: var(--s-4);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-lg);
  background: var(--surface-overlay);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-menu);
  backdrop-filter: blur(8px);
  z-index: var(--z-menu);
  max-width: calc(100% - var(--s-6));
}

html[data-view="mini"] body.is-bare .harness {
  display: none;
}

.harness-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
}

.harness-title {
  width: var(--s-7);
  flex: none;
  font-size: var(--t-micro-size);
  color: var(--text-3);
  letter-spacing: 0.08em;
}

.seg {
  display: inline-flex;
  padding: var(--s-0-5);
  gap: var(--s-0-5);
  background: var(--bg-base);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}

.seg-btn {
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-size: var(--t-caption-size);
  font-family: inherit;
  padding: var(--s-1) var(--s-2-5);
  border-radius: var(--r-xs);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--d-fast) var(--ease), color var(--d-fast) var(--ease);
}

.seg-btn:hover {
  color: var(--text-1);
}

.seg-btn.is-on {
  background: var(--accent);
  color: var(--text-on-accent);
}

.seg-btn:focus-visible {
  outline: var(--focus-ring-w) solid var(--accent);
  outline-offset: 1px;
}

.seg-btn .seg-dot {
  display: inline-block;
  width: var(--s-1-5);
  height: var(--s-1-5);
  border-radius: 50%;
  margin-right: var(--s-1);
  vertical-align: middle;
  background: currentColor;
}

.hbtn {
  border: 1px solid var(--line);
  background: var(--bg-elev-2);
  color: var(--text-1);
  font-family: inherit;
  font-size: var(--t-caption-size);
  padding: var(--s-1) var(--s-3);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--d-fast) var(--ease);
}

.hbtn:hover {
  background: var(--bg-elev-3);
}

.hbtn:focus-visible {
  outline: var(--focus-ring-w) solid var(--accent);
  outline-offset: var(--focus-ring-offset);
}

/* ==========================================================================
 * Toast
 * ========================================================================== */
.mtoast {
  position: fixed;
  left: 50%;
  bottom: var(--s-5);
  transform: translate(-50%, var(--s-2));
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-sm);
  background: var(--bg-elev-3);
  border: 1px solid var(--line);
  color: var(--text-1);
  font-size: var(--t-small-size);
  box-shadow: var(--shadow-toast);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--d-base) var(--ease), transform var(--d-base) var(--ease);
  z-index: var(--z-toast);
  max-width: calc(100% - var(--s-6));
  text-align: center;
}

.mtoast.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ==========================================================================
 * 置顶指示（原型：静态页无法真正置顶，符号与持久化交给壳层消费）
 * ========================================================================== */
.mwin.is-pinned::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px var(--accent-ring);
  pointer-events: none;
  z-index: 5;
}

/* ==========================================================================
 * PWA：安装 / 更新提示条 + 离线角标
 * （mini 窗不加载 app.css，pwa.js 注入的 .pwa-banner 必须在这里自备样式）
 * ========================================================================== */
.pwa-banner {
  position: fixed;
  left: var(--s-3);
  right: var(--s-3);
  bottom: calc(var(--s-4) + 72px);
  z-index: var(--z-toast);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  border-left: var(--border-accent-w) solid var(--accent);
  background: var(--bg-elev-2);
  box-shadow: var(--shadow-toast);
  color: var(--text-1);
  font-size: var(--t-small-size);
}

.pwa-banner[hidden] {
  display: none;
}

.pwa-banner-msg {
  flex: 1;
  min-width: 0;
  color: var(--text-2);
}

/* 迷你窗里没有 app.css 的 .btn 体系，给提示条按钮一套紧凑外观 */
.pwa-banner .btn {
  flex: none;
  border: 1px solid var(--line);
  background: var(--bg-elev-3);
  color: var(--text-1);
  font-family: inherit;
  font-size: var(--t-caption-size);
  padding: var(--s-1) var(--s-2-5);
  border-radius: var(--r-xs);
  cursor: pointer;
  transition: background var(--d-fast) var(--ease);
}

.pwa-banner .btn:hover {
  background: var(--bg-elev-4);
}

.pwa-banner .btn-primary {
  border-color: transparent;
  background: var(--accent);
  color: var(--text-on-accent);
}

.pwa-banner .btn-primary:hover {
  background: var(--accent-hover);
}

.pwa-banner .btn-ghost {
  background: transparent;
  color: var(--text-2);
}

.offline-chip {
  position: fixed;
  top: var(--s-2);
  right: var(--s-2);
  z-index: var(--z-toast);
  padding: 2px var(--s-2);
  border-radius: 999px;
  border: 1px solid var(--warn);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: var(--t-micro-size);
}

.offline-chip[hidden] {
  display: none;
}

/* ==========================================================================
 * 展示区的高度兜底：窗口被拖得很矮时，先把「元信息 / 歌词行数」让出去，
 * 别让封面把歌词和波形挤没。
 * ========================================================================== */
@media (max-height: 500px) {
  .mp-stage {
    --cover-w: clamp(104px, 34%, 140px);
    --mini-lyric-lh: 21px;
  }

  .mp-stage-meta {
    height: 22px;
  }

  .mp-viz {
    height: 44px;
  }
}

@media (max-height: 440px) {
  .mp-stage {
    --cover-w: clamp(96px, 32%, 128px);
    --mini-lyric-lh: 20px;
  }

  .mp-stage-meta {
    height: 20px;
  }

  /* 矮到这份上，波形只会变成一条多余的虚线，直接让位给封面和歌词 */
  .mp-viz {
    display: none;
  }
}

@media (max-height: 370px) {
  .mp-stage-meta {
    display: none;
  }
}

/* ==========================================================================
 * 降级动效
 * ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  /* 0.01ms 的无限动画会变成高负载空转：直接关掉环境光漂移与唱片旋转 */
  .mp-ambient,
  .mp-vinyl {
    animation: none !important;
  }

  .mp-lyric-track {
    transition: none !important;
  }
}

/* ==========================================================================
 * 无边框窗口的边缘拖拽改尺寸（与主界面一致）
 * ========================================================================== */
.resize-frame {
  display: none;
}

html[data-frameless="1"] .resize-frame {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
}

.resize-frame .rf {
  position: absolute;
  pointer-events: auto;
}

.rf-n { top: 0; left: 10px; right: 10px; height: 5px; cursor: ns-resize; }
.rf-s { bottom: 0; left: 10px; right: 10px; height: 5px; cursor: ns-resize; }
.rf-e { right: 0; top: 10px; bottom: 10px; width: 5px; cursor: ew-resize; }
.rf-w { left: 0; top: 10px; bottom: 10px; width: 5px; cursor: ew-resize; }
.rf-ne { top: 0; right: 0; width: 12px; height: 12px; cursor: nesw-resize; }
.rf-nw { top: 0; left: 0; width: 12px; height: 12px; cursor: nwse-resize; }
.rf-se { bottom: 0; right: 0; width: 12px; height: 12px; cursor: nwse-resize; }
.rf-sw { bottom: 0; left: 0; width: 12px; height: 12px; cursor: nesw-resize; }

/* ==========================================================================
 * 单文档多视图（P1）：视图显隐由 app.js 的 setView() 写 html[data-view]。
 * 迷你 DOM 现在常驻 index.html 的 #mini-view 里，切换视图不销毁 <audio>。
 * ========================================================================== */
#mini-view {
  display: block;
  height: 100%;
}

#mini-view[hidden] {
  display: none;
}

html[data-view="main"] #mini-view,
html[data-view="mini"] .app-shell,
html[data-view="mini"] #mini-overlay-host {
  display: none !important;
}
/* ==========================================================================
 * 队列行内动作（P2）：上移 / 下移 / 移出，悬停才显形（小窗里不占地方）
 * ========================================================================== */
.mlist-row {
  position: relative;
}

.mlist-acts {
  position: absolute;
  right: var(--s-3);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  padding-left: 6px;
  background: inherit;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.mlist-row:hover .mlist-acts {
  opacity: 1;
  pointer-events: auto;
}

.mlist-row:hover .mlist-dur {
  opacity: 0;
}

.mlist-act {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text-3);
  font: inherit;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.mlist-act:hover {
  color: var(--text-1);
  border-color: var(--line);
  background: var(--bg-elev-2);
}

.mlist-act.is-remove:hover {
  color: #ff6b6b;
}