:root {
  --bg: #08070d;
  --bg-glow: #17112a;
  --panel: #110f19;
  --panel-2: #181522;
  --line: #262233;
  --line-strong: #3a3550;
  --field: #0c0a12;
  --text: #f3f0fb;
  --text-2: #d8d3e6;
  --icon: #e6e1f2;
  --muted: #9c97b0;
  --faint: #6b6680;
  --violet: #9d4bff;
  --violet-hi: #b97aff;
  --violet-row: #5a2a9c;
  --track: #3a3548;
  --shell-top: #13101d;
  --shell-bottom: #0d0b14;
  --shell-shadow: 0 30px 80px -30px rgba(80, 30, 160, 0.45);
  --cover-shadow: 0 24px 50px -18px rgba(0, 0, 0, 0.8);
  --thumb-ring: 0 0 0 4px rgba(157, 75, 255, 0.25);
  --hover: rgba(255, 255, 255, 0.05);
  --scrim: rgba(8, 7, 13, 0.82);
  --skeleton: #221e2e;
  --backdrop: rgba(4, 3, 8, 0.7);
  --toast: #1d1929;
  --toast-shadow: none;
  --heart: #ff5fa2;
  --error: #ff7a9a;
  --art-opacity: 0.38;
  color-scheme: dark;

  --r-shell: 18px;
  --queue-w: clamp(360px, 27vw, 460px);
  --r-panel: 14px;
  --r-row: 10px;
  --font: "Sora", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

/* 浅色主题：跟随系统，或由右上角按钮手动指定 */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f2f9;
    --bg-glow: #e6dbfb;
    --panel: #ffffff;
    --panel-2: #efebf6;
    --line: #e6e1ef;
    --line-strong: #d3cbe2;
    --field: #f7f5fb;
    --text: #1a1625;
    --text-2: #4b4559;
    --icon: #2d2838;
    --muted: #6c6680;
    --faint: #9a94ab;
    --violet: #8a3cf5;
    --violet-hi: #7428e0;
    --violet-row: #8a3cf5;
    --track: #ddd5ea;
    --shell-top: #ffffff;
    --shell-bottom: #fbfaff;
    --shell-shadow: 0 30px 70px -36px rgba(80, 40, 150, 0.35);
    --cover-shadow: 0 24px 44px -20px rgba(50, 20, 100, 0.45);
    --thumb-ring: 0 0 0 1px rgba(40, 20, 80, 0.12), 0 1px 3px rgba(40, 20, 80, 0.3), 0 0 0 5px rgba(138, 60, 245, 0.16);
    --hover: rgba(60, 30, 120, 0.06);
    --scrim: rgba(250, 248, 255, 0.9);
    --skeleton: #e2dcec;
    --backdrop: rgba(30, 20, 50, 0.35);
    --toast: #ffffff;
    --toast-shadow: 0 10px 30px -10px rgba(40, 20, 80, 0.3);
    --heart: #e0307e;
    --error: #c8264f;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f4f2f9;
  --bg-glow: #e6dbfb;
  --panel: #ffffff;
  --panel-2: #efebf6;
  --line: #e6e1ef;
  --line-strong: #d3cbe2;
  --field: #f7f5fb;
  --text: #1a1625;
  --text-2: #4b4559;
  --icon: #2d2838;
  --muted: #6c6680;
  --faint: #9a94ab;
  --violet: #8a3cf5;
  --violet-hi: #7428e0;
  --violet-row: #8a3cf5;
  --track: #ddd5ea;
  --shell-top: #ffffff;
  --shell-bottom: #fbfaff;
  --shell-shadow: 0 30px 70px -36px rgba(80, 40, 150, 0.35);
  --cover-shadow: 0 24px 44px -20px rgba(50, 20, 100, 0.45);
  --thumb-ring: 0 0 0 1px rgba(40, 20, 80, 0.12), 0 1px 3px rgba(40, 20, 80, 0.3), 0 0 0 5px rgba(138, 60, 245, 0.16);
  --hover: rgba(60, 30, 120, 0.06);
  --scrim: rgba(250, 248, 255, 0.9);
  --skeleton: #e2dcec;
  --backdrop: rgba(30, 20, 50, 0.35);
  --toast: #ffffff;
  --toast-shadow: 0 10px 30px -10px rgba(40, 20, 80, 0.3);
  --heart: #e0307e;
  --error: #c8264f;
  --art-opacity: 0.45;
  color-scheme: light;
}


* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  display: flow-root; /* 防止 .app 的外边距穿透 body，多出一截滚动 */
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 15% -10%, var(--bg-glow), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
/* 整页背景：当前歌曲封面高度模糊后铺满，让窗口两侧不再空白，颜色随歌曲变化 */
body::before {
  content: "";
  position: fixed; inset: -10%;
  z-index: -1;
  background-image: var(--art, none);
  background-size: cover; background-position: center;
  filter: blur(90px) saturate(1.5);
  opacity: var(--art-opacity);
  transition: opacity 0.6s ease;
  pointer-events: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 1em; height: 1em; display: block; }
:focus-visible { outline: 2px solid var(--violet-hi); outline-offset: 2px; border-radius: 6px; }

/* ---------- shell ---------- */
.app {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1680px, calc(100vw - 48px));
  height: calc(100dvh - 48px);
  min-height: 640px;
  margin: 24px auto;
  background: linear-gradient(180deg, var(--shell-top) 0%, var(--shell-bottom) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-shell);
  box-shadow: var(--shell-shadow);
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 18px; color: inherit; text-decoration: none; }
.brand-mark {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--violet);
  color: #fff;
  font-size: 26px;
  box-shadow: 0 6px 20px -6px var(--violet);
}
.brand-mark svg { transform: translateX(1px); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 23px; font-weight: 700; letter-spacing: 0.04em; }
.brand-text span { font-size: 12px; letter-spacing: 0.32em; text-transform: uppercase; color: var(--text-2); margin-top: 6px; }

.topbar-actions { display: flex; align-items: center; gap: 12px; }
.theme-toggle {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border: 1px solid var(--line-strong); border-radius: 50%;
  background: var(--field); color: var(--icon);
  font-size: 20px;
}
.theme-toggle:hover { border-color: var(--violet); color: var(--violet); }
#btnQueue[aria-expanded="true"] { color: var(--violet); border-color: color-mix(in srgb, var(--violet) 45%, var(--line-strong)); }
.theme-toggle .i-moon { display: none; }

/* 语言选择：原生 select，键盘和读屏都可用；左侧地球图标，右侧小箭头 */
.lang-picker {
  position: relative;
  display: inline-flex; align-items: center;
  height: 42px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--field); color: var(--icon);
}
.lang-picker:hover, .lang-picker:focus-within { border-color: var(--violet); }
.lang-picker > svg { position: absolute; left: 12px; font-size: 18px; pointer-events: none; }
.lang-picker::after {
  content: ""; position: absolute; right: 13px; top: 50%;
  width: 6px; height: 6px; margin-top: -5px;
  border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
  transform: rotate(45deg); pointer-events: none; opacity: 0.7;
}
.lang-picker select {
  -webkit-appearance: none; appearance: none;
  height: 100%;
  padding: 0 32px 0 38px;
  border: 0; border-radius: 999px;
  background: transparent; color: inherit;
  font-size: 14px; cursor: pointer;
}
.lang-picker select:focus-visible { outline: 2px solid var(--violet-hi); outline-offset: 2px; }
.lang-picker option { color: var(--text); background: var(--panel); }
:root[data-theme="light"] .theme-toggle .i-sun { display: none; }
:root[data-theme="light"] .theme-toggle .i-moon { display: block; }

/* mode switch */
.mode-switch {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--field);
}
.mode-thumb {
  position: absolute; inset: 3px auto 3px 3px;
  width: calc(50% - 3px);
  border-radius: 999px;
  background: var(--violet);
  box-shadow: 0 4px 18px -4px var(--violet);
  transition: transform 0.32s cubic-bezier(.5, 0, .2, 1.2);
}
[data-mode="audio"] .mode-thumb { transform: translateX(100%); }
.mode-switch button {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 128px;
  padding: 8px 18px;
  border: 0; background: none; border-radius: 999px;
  color: var(--text-2); font-size: 15px; white-space: nowrap;
}
.mode-switch button svg { font-size: 20px; }
.mode-switch button[aria-checked="true"] { color: #fff; }

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--queue-w);
  gap: 22px;
  transition: grid-template-columns 0.38s cubic-bezier(.4, 0, .2, 1), column-gap 0.38s cubic-bezier(.4, 0, .2, 1);
  padding: 18px 20px 20px;
}

/* stage */
.stage {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
}
.stage-video, .stage-video iframe, #yt { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.stage-audio {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: var(--panel);
  opacity: 0; visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s;
}
[data-mode="audio"] .stage { background: var(--panel); }
[data-mode="audio"] .stage-audio { opacity: 1; visibility: visible; }
[data-mode="audio"] .stage-video { opacity: 0; pointer-events: none; }

.ambient {
  position: absolute; inset: -20%;
  background-size: cover; background-position: center;
  filter: blur(60px) saturate(1.4);
  opacity: 0.32;
  transition: background-image 0.6s;
}
.ambient::after { content: ""; position: absolute; inset: 0; background: radial-gradient(closest-side, transparent, var(--panel)); }
.stage-audio { container-type: size; }
.cover-wrap { --s: min(62cqh, 70cqw); position: relative; display: flex; flex-direction: column; align-items: center; gap: 3.5cqh; }
.cover {
  width: var(--s);
  height: var(--s);
  object-fit: cover;
  border-radius: 8px;
  background: var(--panel-2);
  box-shadow: var(--cover-shadow);
}
.cover { position: relative; overflow: hidden; }
.cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.cover img.ready { opacity: 1; }


/* visualizer */
/* 音柱宽度为封面的 90%，在 .cover-wrap 里居中；柱子数量固定、宽度自适应 */
.bars { display: flex; align-items: flex-end; gap: 3px; width: calc(var(--s) * 0.9); height: clamp(28px, 7cqh, 52px); flex: none; }
.bars i {
  flex: 1 1 0;
  min-width: 2px;
  height: 100%;
  border-radius: 2px 2px 0 0;
  background: var(--violet);
  transform-origin: bottom;
  /* 高度全部由 app.js 逐帧写入 --v：没开“跟随节奏”时是随机律动，开了就是真实频谱 */
  transform: scaleY(var(--v, 0.06));
}

.beat-toggle {
  position: absolute; top: 14px; right: 14px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 80%, transparent);
  backdrop-filter: blur(8px);
  color: var(--text-2); font-size: 13px;
}
.beat-toggle svg { font-size: 16px; }
.beat-toggle:hover { color: var(--text); border-color: var(--violet); }
.beat-toggle[aria-pressed="true"] { background: var(--violet); border-color: var(--violet); color: #fff; }
.beat-toggle[hidden] { display: none; }
@keyframes bounce {
  from { transform: scaleY(var(--lo, 0.2)); }
  to { transform: scaleY(var(--hi, 1)); }
}

.stage-status {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 24px; text-align: center;
  background: var(--scrim);
  color: var(--muted);
}
.stage-status[hidden] { display: none; }

/* now playing */
.now {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  margin: 16px 8px 4px;
}
.now-text { min-width: 0; }
.now-title {
  margin: 0;
  font-size: clamp(22px, 1.1vw + 12px, 32px); font-weight: 700; line-height: 1.3; letter-spacing: 0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.now-sub { margin: 4px 0 0 2px; color: var(--text-2); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.yt-chip {
  flex: none;
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 6px;
  padding: 5px 12px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  color: var(--text); text-decoration: none; font-size: 14px;
}
.yt-chip svg { width: 20px; height: 14px; }
.yt-chip:hover { border-color: var(--violet); }

/* timeline */
.timeline {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px;
  margin: 8px 8px 0;
}
.time { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; min-width: 42px; }
.time:last-child { text-align: right; }

/* range inputs */
.range {
  --p: 0%;
  -webkit-appearance: none; appearance: none;
  height: 18px; margin: 0; background: transparent; cursor: pointer;
}
.range::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(to right, var(--violet) var(--p), var(--track) var(--p));
}
.range::-moz-range-track { height: 4px; border-radius: 2px; background: var(--track); }
.range::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--violet); }
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px; margin-top: -5px;
  border-radius: 50%; background: #fff; border: 0;
  box-shadow: var(--thumb-ring);
  transition: transform 0.15s;
}
.range::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 0; box-shadow: var(--thumb-ring); }
.range:hover::-webkit-slider-thumb { transform: scale(1.15); }
.range:focus-visible { outline-offset: 4px; }

/* controls */
.controls {
  display: flex; align-items: center; justify-content: center; gap: 18px;
  padding: 10px 0 4px;
}
.ctl {
  position: relative;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: none; color: var(--icon);
  font-size: 22px;
  transition: color 0.15s, background-color 0.15s;
}
.ctl:hover { background: var(--hover); }
.ctl[aria-pressed="true"], .ctl[data-repeat="all"], .ctl[data-repeat="one"] { color: var(--violet-hi); }
.ctl[data-repeat="off"] { color: var(--icon); }
.repeat-one {
  position: absolute; right: 7px; bottom: 7px;
  font-size: 9px; font-weight: 600; line-height: 1;
  padding: 1px 3px; border-radius: 4px;
  background: var(--violet); color: #fff;
  display: none;
}
.ctl[data-repeat="one"] .repeat-one { display: block; }
.ctl-main {
  width: 54px; height: 54px; margin: 0 4px;
  background: var(--violet); color: #fff; font-size: 24px;
  box-shadow: 0 8px 24px -8px var(--violet);
}
.ctl-main:hover { background: var(--violet-hi); }
.ctl-sep { width: 1px; height: 24px; background: var(--line-strong); margin: 0 2px; }
.volume { display: flex; align-items: center; gap: 4px; }
.vol { width: 130px; }
.ctl-like[aria-pressed="true"] { color: var(--heart); --heart-fill: currentColor; }
.ctl-like.pop svg { animation: pop 0.35s ease; }
@keyframes pop { 50% { transform: scale(1.3); } }

/* ---------- queue ---------- */
.queue {
  display: flex; flex-direction: column;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  background: var(--panel);
  overflow: hidden;
}
.queue-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px 10px 20px;
}
.queue-head h2 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: 0.04em; }
.queue-count { font-size: 13px; font-weight: 400; color: var(--muted); letter-spacing: 0; margin-left: 6px; }
.ghost, .solid {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 8px; font-size: 13px;
}
.ghost { border: 1px solid var(--line); background: none; color: var(--muted); }
.ghost:hover { color: var(--text); border-color: var(--line-strong); }
.ghost svg { font-size: 15px; }
.queue-actions { display: flex; align-items: center; gap: 8px; flex: none; }
/* 法语等较长的文案也保持一行 */
.queue-head h2, .ghost, .yt-chip, .beat-toggle { white-space: nowrap; }
.queue-head h2 { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ghost.icon-only { padding: 6px; }
.ghost.icon-only svg { font-size: 17px; }
.ghost[hidden] { display: none; }
.ghost:disabled { cursor: progress; }
.spinning svg { animation: spin 0.9s linear infinite; color: var(--violet); }
@keyframes spin { to { transform: rotate(360deg); } }
.solid { border: 0; background: var(--violet); color: #fff; font-weight: 500; }
.solid:hover { background: var(--violet-hi); }

.queue-list {
  list-style: none; margin: 0; padding: 0 8px 8px;
  overflow-y: auto;
  flex: 1;
  height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.row {
  display: grid;
  grid-template-columns: 22px 58px minmax(0, 1fr) auto;
  align-items: center; gap: 0 14px;
  width: 100%;
  padding: 6px 12px 6px 10px;
  border: 0; border-radius: var(--r-row);
  background: none; text-align: left;
  position: relative;
}
.queue-list li + li .row::before {
  content: ""; position: absolute; left: 10px; right: 10px; top: 0;
  border-top: 1px solid var(--line);
}
.row:hover { background: var(--hover); }
.row.active { background: var(--violet-row); }
.row.active .row-title, .row.active .row-dur { color: #fff; }
.row.active .row-artist { color: rgba(255, 255, 255, 0.82); }
.row.active .row-index { color: rgba(255, 255, 255, 0.7); }
.row.active::before, li:has(.row.active) + li .row::before { display: none; }
.row-thumb { width: 58px; height: 52px; border-radius: 6px; object-fit: cover; background: var(--panel-2); }
.row-text { min-width: 0; display: flex; flex-direction: column; }
.row-title { font-size: 16px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0.02em; }
.row-artist { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-dur { font-size: 14px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.row.unavailable { opacity: 0.4; }
.row-eq { display: flex; align-items: flex-end; gap: 2px; height: 14px; }
.row-eq i { width: 3px; height: 100%; background: #fff; border-radius: 1px; transform-origin: bottom; transform: scaleY(0.5); }
.row-eq i:nth-child(1) { transform: scaleY(0.55); }
.row-eq i:nth-child(2) { transform: scaleY(0.9); }
.row-eq i:nth-child(3) { transform: scaleY(0.4); }
.is-playing .row-eq i { animation: bounce 0.7s ease-in-out infinite alternate; --lo: 0.25; --hi: 1; }
.is-playing .row-eq i:nth-child(2) { animation-duration: 0.5s; animation-delay: -0.2s; }
.is-playing .row-eq i:nth-child(3) { animation-duration: 0.85s; animation-delay: -0.4s; }
.row-index { font-size: 13px; color: var(--faint); text-align: center; font-variant-numeric: tabular-nums; }
.skeleton .row-thumb, .skeleton .row-title, .skeleton .row-artist {
  background: linear-gradient(90deg, var(--panel-2), var(--skeleton), var(--panel-2));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: 4px; color: transparent;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.queue-empty { padding: 24px 20px; color: var(--muted); font-size: 14px; }

.footnote { margin: 0; padding: 0 28px 16px; color: var(--faint); font-size: 12.5px; }

/* ---------- dialog & toast ---------- */
.open-dialog {
  width: min(480px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--line); border-radius: var(--r-panel);
  background: var(--panel); color: var(--text);
}
.open-dialog::backdrop { background: var(--backdrop); backdrop-filter: blur(4px); }
.open-dialog h3 { margin: 0 0 6px; font-size: 18px; }
.open-dialog p { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.open-dialog input {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--field); font-size: 14px;
}
.open-dialog input:focus { outline: none; border-color: var(--violet); }
.open-error { min-height: 1.4em; margin: 8px 0 8px !important; color: var(--error) !important; font-size: 13px !important; }
.open-actions { display: flex; justify-content: flex-end; gap: 10px; }

.toast {
  position: fixed; left: 50%; bottom: 28px;
  transform: translate(-50%, 20px);
  padding: 10px 16px;
  border-radius: 10px; border: 1px solid var(--line);
  background: var(--toast); color: var(--text); box-shadow: var(--toast-shadow); font-size: 14px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 收起播放列表：宽屏时列宽收到 0，播放区占满；窄屏时直接隐藏 */
.queue { transition: opacity 0.25s ease, visibility 0.38s; }
.queue-head, .queue-list { min-width: 340px; }
[data-queue="hidden"] .layout { grid-template-columns: minmax(0, 1fr) 0px; column-gap: 0; }
[data-queue="hidden"] .queue { opacity: 0; visibility: hidden; border-color: transparent; }

/* ---------- responsive ---------- */
@media (min-width: 981px) {
  .layout { flex: 1 1 auto; min-height: 0; }
  .deck { display: flex; flex-direction: column; min-height: 0; }
  .stage { flex: 1 1 auto; aspect-ratio: auto; min-height: 280px; }
}
@media (max-width: 980px) {
  .app { margin: 0; border-radius: 0; border-width: 0; width: 100%; height: auto; min-height: 100dvh; }
  .layout { grid-template-columns: 1fr; transition: none; }
  [data-queue="hidden"] .layout { grid-template-columns: 1fr; }
  [data-queue="hidden"] .queue { display: none; }
  .queue-head, .queue-list { min-width: 0; }
  .queue-list { height: auto; max-height: 520px; }
}
@media (max-width: 640px) {
  .topbar { padding: 12px 16px; flex-wrap: wrap; }
  .brand { gap: 12px; }
  .brand-mark { width: 38px; height: 38px; font-size: 20px; }
  .brand-text strong { font-size: 19px; }
  .brand-text span { font-size: 10px; margin-top: 3px; }
  .topbar-actions { width: 100%; flex-wrap: wrap; }
  .lang-picker select { padding: 0 28px 0 34px; font-size: 13px; }
  .lang-picker > svg { left: 10px; }
  .mode-switch { flex: 1 1 100%; order: 10; } /* 窄屏单独占一行，长文案也放得下 */
  .lang-picker { margin-right: auto; }
  .mode-switch button { min-width: 0; padding: 7px 10px; font-size: 14px; }
  .layout { padding: 12px 16px 16px; gap: 16px; }
  .stage { margin: 0 -16px; border-radius: 0; }
  .now { margin: 12px 0 0; flex-direction: column; gap: 8px; }
  .now-title { font-size: 20px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .yt-chip { margin-top: 0; }
  .timeline { margin: 8px 0 0; gap: 10px; }
  .controls { flex-wrap: wrap; gap: 6px 8px; }
  .ctl-sep { display: none; }
  .volume { order: 10; flex: 1 1 100%; justify-content: center; }
  .vol { width: 160px; }
  .row { grid-template-columns: 18px 52px minmax(0, 1fr) auto; gap: 0 10px; }
  .row-thumb { width: 52px; height: 46px; }
  .row-title { font-size: 15px; }
  .footnote { padding: 0 16px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
