/* ═══════════════════════════════════════
   RESET & VARIABLES
═══════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --accent:      #6366f1;
  --accent-2:    #8b5cf6;
  --accent-dim:  rgba(99,102,241,.1);
  --accent-glow: rgba(99,102,241,.25);
  --pink:        #ec4899;
  --danger:      #ef4444;
  --success:     #10b981;

  --bg:          #f8f9fc;
  --bg2:         #f0f2f8;
  --bg3:         #e8ebf2;
  --surface:     rgba(255,255,255,.98);
  --surface-2:   rgba(255,255,255,.92);
  --glass:       rgba(0,0,0,.02);
  --glass-hover: rgba(0,0,0,.045);
  --border:      rgba(0,0,0,.06);
  --border-hi:   rgba(0,0,0,.1);

  --t1: #1a1a2e;
  --t2: #5a5a7a;
  --t3: #9a9ab8;

  --player-h:     72px;
  --panel-w:      clamp(260px, 28vw, 340px);
  --sidebar-w:    clamp(220px, 24vw, 320px);
  --header-h:     58px;
  --radius:       16px;
  --tr:           .2s cubic-bezier(0.4, 0, 0.2, 1);
  --shell-pad-x:  clamp(12px, 2.5vw, 28px);
  --stage-pad-y:  clamp(16px, 4vmin, 40px);
}

html, body {
  height: 100%; overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui,
               'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--t1);
  transition: background .8s ease, background-image .8s ease;
  position: relative;
}

/* 背景模糊效果 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: inherit;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  filter: blur(40px) saturate(1.3) brightness(.85);
  z-index: -1;
  transition: background-image .8s ease;
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.12); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.22); }

/* ═══════════════════════════════════════
   SHELL
═══════════════════════════════════════ */
#app {
  display: flex; flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
}
#header-mobile-actions { display: none; }

.hdr-mini-btn {
  background: var(--glass);
  border: 1px solid var(--border);
  color: var(--t2);
  font-size: 16px;
  line-height: 1;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--tr), color var(--tr), border-color var(--tr);
  -webkit-tap-highlight-color: transparent;
}
.hdr-mini-btn:hover {
  color: var(--t1);
  background: var(--glass-hover);
  border-color: var(--border-hi);
}
.hdr-mini-btn:active {
  transform: scale(0.96);
}

/* ═══════════════════════════════════════
   HEADER
═══════════════════════════════════════ */
#header {
  min-height: var(--header-h); flex-shrink: 0; z-index: 30;
  display: flex; align-items: center; flex-wrap: nowrap;
  gap: clamp(10px, 2vw, 18px);
  padding: 0 var(--shell-pad-x);
  background: var(--surface);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,.03);
}

#header-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

#logo {
  font-size: clamp(14px, 2.5vw, 17px); font-weight: 800; letter-spacing: -0.5px;
  background: linear-gradient(130deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; white-space: nowrap; flex-shrink: 0;
  margin: 0;
  line-height: 1;
}

#search-block {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  max-width: min(440px, 100%);
}

#search-wrap {
  display: flex; width: 100%; position: relative;
  border-radius: 12px; overflow: visible;
  background: var(--bg); border: 1.5px solid var(--border);
  transition: all var(--tr);
}
#search-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-dim), 0 2px 8px rgba(99,102,241,.1);
}
#search-input {
  flex: 1; background: transparent; border: none;
  padding: 10px 15px; color: var(--t1); font-size: 14px;
  outline: none; font-family: inherit; border-radius: 12px 0 0 12px;
}
#search-input::placeholder { color: var(--t3); }
#search-btn {
  background: linear-gradient(130deg, var(--accent) 0%, var(--accent-2) 100%);
  border: none; padding: 0 clamp(12px, 3vw, 20px); color: #fff;
  font-size: 13px; font-weight: 600; cursor: pointer;
  white-space: nowrap; font-family: inherit;
  border-radius: 0 11px 11px 0;
  transition: all var(--tr);
}
#search-btn:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 4px 12px var(--accent-glow); }
#search-btn:disabled, #search-btn.loading {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

#source-bar {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 6px;
  overflow-x: auto; flex: 1 1 120px; min-width: 0;
  scrollbar-width: thin;
}
#source-bar::-webkit-scrollbar { height: 4px; }
.source-bar-label {
  color: var(--t3); font-size: 11px; white-space: nowrap; flex-shrink: 0;
  font-weight: 600; letter-spacing: 0.2px; margin-right: 2px;
}
.source-offline-note {
  display: block;
  width: 100%;
  flex: 1 1 100%;
  font-size: 11px;
  line-height: 1.45;
  color: var(--danger);
  padding: 4px 0 6px;
  margin-bottom: 2px;
}

.src-tag {
  padding: 5px 12px; border-radius: 22px;
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--t2); font-size: 11px; font-weight: 600;
  cursor: pointer; white-space: nowrap; user-select: none; flex-shrink: 0;
  transition: all var(--tr);
}
.src-tag:hover   { background: var(--bg2); color: var(--t1); border-color: var(--border-hi); transform: translateY(-1px); }
.src-tag.active  { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.src-tag.loading { opacity: .35; pointer-events: none; }
.src-tag.done    { border-color: var(--success); color: var(--success); background: rgba(16,185,129,.08); }
.src-tag.error   { border-color: var(--danger);  color: var(--danger);  background: rgba(239,68,68,.08); }

/* ═══════════════════════════════════════
   BODY ROW
═══════════════════════════════════════ */
#body { flex: 1; display: flex; overflow: hidden; position: relative; min-height: 0; }

/* 侧栏收起后贴在左缘的展开条（桌面），避免底栏过窄时 ☰ 被挤没 */
.panel-reveal {
  display: none;
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 25;
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 10px 10px 0;
  background: var(--surface);
  color: var(--t2);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 4px 0 12px rgba(0,0,0,.08);
  transition: all var(--tr);
  -webkit-tap-highlight-color: transparent;
}
.panel-reveal:hover {
  color: var(--accent);
  background: var(--accent-dim);
  transform: translateY(-50%) scale(1.05);
  box-shadow: 4px 0 16px rgba(99,102,241,.15);
}
#body.left-panel-collapsed .panel-reveal {
  display: flex;
}

/* ═══════════════════════════════════════
   SEARCH PANEL (left)
═══════════════════════════════════════ */
#search-panel {
  width: var(--panel-w); flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow-x: visible;
  overflow-y: hidden;
  min-height: 0;
  transition: width .24s ease, opacity .24s ease;
  box-shadow: 3px 0 12px rgba(0,0,0,.03);
}
#search-panel.collapsed { width: 0; opacity: 0; pointer-events: none; }

#search-panel-header {
  display: flex; align-items: center;
  gap: 8px;
  padding: 10px 12px 10px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  overflow: visible;
}

.panel-tabs {
  display: flex; align-items: center; gap: 4px;
  padding: 3px; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--border);
  flex: 1;
  min-width: 0;
}
.panel-tab {
  flex: 1; min-width: 0;
  border: none; background: transparent; cursor: pointer;
  font-family: inherit; font-size: 12px; font-weight: 700;
  color: var(--t3); padding: 7px 8px; border-radius: 9px;
  transition: color var(--tr), background var(--tr);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.panel-tab:hover { color: var(--t2); }
.panel-tab.active {
  color: var(--accent);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

#panel-close {
  flex-shrink: 0;
  width: 38px;
  min-width: 38px;
  height: 38px;
  margin-left: -4px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--t2);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  transition: all var(--tr);
  -webkit-tap-highlight-color: transparent;
}
#panel-close:hover {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: rgba(99,102,241,.25);
  transform: translateX(-1px) scale(1.05);
  box-shadow: 0 3px 12px rgba(99,102,241,.15);
}

.panel-body {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.panel-body.active { display: flex; }

.panel-list-head {
  padding: 10px 18px 6px;
  flex-shrink: 0;
}
#results-title,
#queue-title {
  font-size: 12px; color: var(--t2); font-weight: 700;
  letter-spacing: 0.3px; text-transform: uppercase;
}
#queue-meta {
  font-size: 11px; color: var(--t3); font-weight: 600;
  margin-left: 6px; letter-spacing: 0;
  text-transform: none;
}

.queue-header {
  padding: 10px;
  border-bottom: 1px solid var(--border);
}
.queue-btn {
  padding: 6px 12px;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--tr);
}
.queue-btn:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

#results-list,
#queue-list {
  flex: 1; min-height: 0; overflow-y: auto; padding: 10px;
  display: flex; flex-direction: column; gap: 3px;
}

.song-row { display: grid; grid-template-columns: 44px 1fr auto auto auto auto; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; cursor: pointer; border: 1px solid transparent; transition: all var(--tr); }
.song-row:hover   { background: var(--glass-hover); transform: translateX(2px); }
.song-row.playing { background: var(--accent-dim); border-color: rgba(99,102,241,.15); }

.sr-cover { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--bg3); flex-shrink: 0; box-shadow: 0 2px 6px rgba(0,0,0,.06); }
.sr-info  { min-width: 0; }
.sr-name  { font-size: 13px; font-weight: 700; overflow: hidden; color: var(--t1); letter-spacing: -0.2px; display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.sr-name > span:first-child { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-meta  { font-size: 11px; color: var(--t3); overflow: hidden; text-overflow: ellipsis; margin-top: 3px; display: flex; align-items: center; flex-wrap: nowrap; gap: 6px; white-space: nowrap; }
.sr-dur   { font-size: 11px; color: var(--t3); white-space: nowrap; font-weight: 500; }
.sr-fav   { font-size: 16px; color: var(--t3); transition: all var(--tr); line-height: 1; cursor: pointer; padding: 4px; }
.sr-fav.active, .sr-fav:hover { color: var(--pink); transform: scale(1.15); }
.sr-download { font-size: 14px; color: var(--t3); transition: all var(--tr); line-height: 1; cursor: pointer; padding: 4px; }
.sr-download:hover { color: var(--accent); transform: scale(1.15); }
.sr-remove { font-size: 14px; color: var(--t3); transition: all var(--tr); line-height: 1; cursor: pointer; padding: 4px; }
.sr-remove:hover { color: var(--danger); transform: scale(1.15); }
.sr-source {
  display: inline-block;
  font-size: 10px;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 2px 6px;
  border-radius: 8px;
  margin-left: 8px;
  font-weight: 500;
}

.empty-hint { text-align: center; color: var(--t3); padding: 52px 0; font-size: 13px; line-height: 2; }

#search-loading {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 12px; color: var(--t2); font-size: 12px;
}
.search-spinner {
  width: 14px; height: 14px; flex-shrink: 0;
  border: 2px solid var(--bg3); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════
   STAGE (center)
═══════════════════════════════════════ */
#stage {
  flex: 1; position: relative; overflow: hidden;
  min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: var(--bg);
}

#stage-bg {
  position: absolute; inset: -30px;
  background-size: cover; background-position: center;
  filter: blur(80px) saturate(1.5) brightness(.92);
  opacity: 0; transition: opacity 1.4s ease;
  transform: scale(1.1);
}
#stage-bg.visible { opacity: .5; }

#stage-content {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center;
  gap: clamp(14px, 3vmin, 24px);
  padding: var(--stage-pad-y) clamp(14px, 4vw, 32px);
  flex: 1 1 auto;
  width: min(520px, 92vw, 100%);
  min-height: 0;
  max-height: 100%;
  box-sizing: border-box;
  overflow: hidden;
  justify-content: flex-start;
}

#stage-cover-wrap {
  width: clamp(140px, 38vmin, 240px);
  aspect-ratio: 1;
  height: auto;
  border-radius: clamp(14px, 3vmin, 24px);
  overflow: hidden; flex-shrink: 0;
  box-shadow: 0 20px 56px rgba(0,0,0,.14), 0 0 0 1px var(--border);
  background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--tr);
}
#stage-cover-wrap:hover { transform: scale(1.02); }
#stage-cover { width: 100%; height: 100%; object-fit: cover; display: none; }
#stage-idle {
  font-size: clamp(40px, 12vmin, 68px); color: var(--t3); line-height: 1;
  animation: pulse 3s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: .5; transform: scale(1); }
  50%       { opacity: .8; transform: scale(1.05); }
}

#stage-info { text-align: center; }
#stage-name {
  font-size: clamp(16px, 4.2vmin, 22px); font-weight: 800; color: var(--t1);
  letter-spacing: -0.5px; line-height: 1.3;
  max-width: 100%; padding: 0 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
#stage-singer {
  font-size: clamp(12px, 2.8vmin, 14px); color: var(--t2);
  margin-top: 6px; font-weight: 500;
  max-width: 100%; padding: 0 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ═══════════════════════════════════════
   LYRIC
═══════════════════════════════════════ */
#lyric-scroll {
  width: 100%; flex: 1 1 0; min-height: 128px;
  max-height: min(62vh, 520px);
  overflow-y: auto;
  text-align: center;
  padding: 20px 14px 28px;
  -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(to bottom, transparent 0%, black 6%, black 94%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 6%, black 94%, transparent 100%);
}
#lyric-empty { font-size: 13px; color: var(--t3); padding: 20px 12px; line-height: 1.6; }

.lyric-line {
  max-width: 42em;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.75;
  letter-spacing: 0.02em;
  transition: color .22s ease, font-size .22s ease, background .2s ease, box-shadow .2s ease, transform .2s ease;
}

.lyric-line.timed {
  font-size: clamp(13px, 2.8vmin, 15px);
  color: var(--t3);
  cursor: pointer;
  padding: 10px 16px;
  margin: 4px 0;
  border-radius: 14px;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}
.lyric-line.timed:hover {
  color: var(--t2);
  background: var(--glass-hover);
}
.lyric-line.timed:focus-visible {
  box-shadow: 0 0 0 2px var(--accent), 0 0 0 6px var(--accent-dim);
}
.lyric-line.timed.active {
  font-size: clamp(15px, 3.4vmin, 18px);
  font-weight: 700;
  color: var(--t1);
  background: linear-gradient(135deg, var(--accent-dim) 0%, rgba(139,92,246,.12) 100%);
  box-shadow: inset 0 0 0 1px rgba(99,102,241,.2), 0 4px 20px rgba(99,102,241,.08);
  transform: scale(1.02);
}

.lyric-line.lyric-plain {
  font-size: clamp(12px, 2.5vmin, 14px);
  color: var(--t3);
  cursor: default;
  padding: 5px 8px;
  margin: 2px 0;
}

/* ═══════════════════════════════════════
   SIDEBAR (right)
═══════════════════════════════════════ */
#sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: -3px 0 12px rgba(0,0,0,.03);
}

.sidebar-tabs {
  display: flex; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.sidebar-tab {
  flex: 1; padding: 14px 0; text-align: center;
  font-size: 12px; font-weight: 700; color: var(--t3);
  cursor: pointer; border-bottom: 2.5px solid transparent;
  transition: all var(--tr);
  letter-spacing: 0.3px; text-transform: uppercase;
}
.sidebar-tab:hover  { color: var(--t2); }
.sidebar-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.sidebar-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.sidebar-btn {
  width: 100%;
  padding: 8px 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--tr);
}
.sidebar-btn:hover {
  background: var(--accent-2);
  transform: translateY(-1px);
}

#sidebar-list {
  flex: 1; overflow-y: auto; padding: 10px;
  display: flex; flex-direction: column; gap: 3px;
}

.sidebar-item {
  display: grid; grid-template-columns: 40px 1fr auto auto auto auto;
  align-items: center; gap: 8px; padding: 10px 12px;
  border-radius: 12px; cursor: pointer; border: 1px solid transparent;
  transition: all var(--tr);
}
.sidebar-item:hover   { background: var(--glass-hover); transform: translateX(-2px); }
.sidebar-item.playing { background: var(--accent-dim); border-color: rgba(99,102,241,.12); }

.si-cover  { width: 40px; height: 40px; border-radius: 9px; object-fit: cover; background: var(--bg3); flex-shrink: 0; box-shadow: 0 2px 5px rgba(0,0,0,.05); }
.si-info   { min-width: 0; }
.si-name  { font-size: 13px; font-weight: 600; overflow: hidden; color: var(--t1); display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; letter-spacing: -0.2px; }
.si-name > span:first-child { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.si-singer { font-size: 11px; color: var(--t3); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.si-fav { font-size: 14px; color: var(--t3); cursor: pointer; padding: 4px; border-radius: 4px; transition: all var(--tr); }
.si-fav.active, .si-fav:hover { color: var(--pink); background: var(--pink-dim); }
.si-download { font-size: 14px; color: var(--t3); cursor: pointer; padding: 4px; border-radius: 4px; transition: all var(--tr); }
.si-download:hover { color: var(--accent); background: var(--accent-dim); }
.si-add-to-queue { font-size: 14px; font-weight: bold; color: var(--accent); cursor: pointer; padding: 4px; border-radius: 4px; transition: all var(--tr); }
.si-add-to-queue:hover { background: var(--accent-dim); }
.si-del { font-size: 12px; color: var(--t3); cursor: pointer; padding: 4px; border-radius: 4px; transition: all var(--tr); }
.si-del:hover { color: var(--danger); background: var(--danger-dim); }

/* ═══════════════════════════════════════
   PLAYER BAR
═══════════════════════════════════════ */
#player-bar {
  min-height: var(--player-h); flex-shrink: 0; z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 2fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(10px, 2vw, 20px);
  padding: 8px var(--shell-pad-x);
  padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 24px rgba(0,0,0,.04), 0 -1px 2px rgba(0,0,0,.02);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}

#pb-info { display: flex; align-items: center; gap: 14px; min-width: 0; }
#pb-cover {
  width: 48px; height: 48px; border-radius: 12px;
  object-fit: cover; background: var(--bg3); flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.08), 0 0 0 1px rgba(0,0,0,.03);
  transition: transform var(--tr), box-shadow var(--tr);
}
#pb-cover:hover { transform: scale(1.05); box-shadow: 0 4px 12px rgba(0,0,0,.12), 0 0 0 1px rgba(0,0,0,.04); }
#pb-cover.hidden { display: none; }
#pb-text   { min-width: 0; flex: 1; }
#pb-name   { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--t1); letter-spacing: -0.3px; }
#pb-singer { font-size: 12px; color: var(--t2); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#pb-fav, #pb-download {
  font-size: 20px; color: var(--t3); cursor: pointer; flex-shrink: 0;
  transition: all var(--tr); padding: 6px; line-height: 1;
}
#pb-fav:hover { color: var(--pink); transform: scale(1.15); }
#pb-fav.active { color: var(--pink); }
#pb-download:hover { color: var(--accent); transform: scale(1.15); }

#pb-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 0 8px;
}
#pb-btns     { display: flex; align-items: center; gap: 12px; }

.pb-btn {
  background: none; border: none; color: var(--t2); font-size: 20px;
  cursor: pointer; padding: 8px; border-radius: 10px;
  transition: all var(--tr); line-height: 1;
}
.pb-btn:hover { color: var(--t1); background: var(--glass-hover); transform: scale(1.08); }

#pb-play {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  border: none; color: #fff; font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px var(--accent-glow), 0 2px 4px rgba(0,0,0,.04);
  transition: all var(--tr); line-height: 1;
}
#pb-play:hover { 
  filter: brightness(1.08); 
  transform: scale(1.08); 
  box-shadow: 0 6px 20px var(--accent-glow), 0 3px 6px rgba(0,0,0,.06);
}

#pb-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 600px;
}
#pb-time { font-size: 11px; color: var(--t3); white-space: nowrap; min-width: 90px; text-align: center; font-weight: 500; font-variant-numeric: tabular-nums; }

input[type=range] {
  -webkit-appearance: none; appearance: none;
  flex: 1; height: 4px; border-radius: 4px;
  background: var(--bg3); outline: none; cursor: pointer;
  transition: background var(--tr);
}
input[type=range]:hover { background: linear-gradient(to right, var(--accent) var(--value, 0%), var(--bg3) var(--value, 0%)); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px;
  border-radius: 50%; background: #fff; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.15), 0 0 0 1px rgba(0,0,0,.04);
  transition: transform var(--tr), box-shadow var(--tr);
  margin-top: -5px;
}
input[type=range]:hover::-webkit-slider-thumb { 
  transform: scale(1.2); 
  box-shadow: 0 3px 12px rgba(99,102,241,.3), 0 0 0 1px rgba(99,102,241,.1);
}

#pb-extra {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  min-width: min-content;
  position: relative;
}

/* 确保展开/收起按钮在同一位置 */
#toggle-search, #toggle-queue {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 16px;
}
#pb-mode {
  font-size: 18px; cursor: pointer; color: var(--t3); padding: 8px;
  border-radius: 10px; transition: all var(--tr); line-height: 1;
}
#pb-mode:hover, #pb-mode.active { color: var(--accent); background: var(--accent-dim); transform: scale(1.08); }
#pb-vol-wrap { display: flex; align-items: center; gap: 10px; }
#pb-mute {
  font-size: 18px; cursor: pointer; color: var(--t2); padding: 8px;
  border-radius: 10px; transition: all var(--tr); line-height: 1;
}
#pb-mute:hover { color: var(--t1); background: var(--glass-hover); transform: scale(1.08); }
#pb-vol { width: clamp(56px, 12vw, 88px); min-width: 0; }
#toggle-search,
#toggle-queue {
  background: var(--glass); border: 1px solid var(--border);
  color: var(--t2); font-size: 15px; cursor: pointer;
  padding: 8px 11px; border-radius: 10px;
  transition: all var(--tr); line-height: 1;
  font-family: inherit;
}
#toggle-search:hover,
#toggle-queue:hover,
#toggle-search.active,
#toggle-queue.active {
  background: var(--accent-dim); border-color: var(--accent); color: var(--accent);
  transform: scale(1.05);
}

/* ═══════════════════════════════════════
   SEARCH HISTORY DROPDOWN
═══════════════════════════════════════ */
#search-history {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  width: 100%; min-width: 0; max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-hi); border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,.12);
  z-index: 100; overflow: hidden;
  opacity: 0; pointer-events: none; transform: translateY(-6px);
  transition: opacity .18s ease, transform .18s ease;
}
#search-history.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }

.sh-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px 8px; font-size: 11px; color: var(--t3);
  font-weight: 600; letter-spacing: .3px; text-transform: uppercase;
}
.sh-clear { cursor: pointer; color: var(--t3); transition: color var(--tr); }
.sh-clear:hover { color: var(--danger); }

.sh-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 14px; cursor: pointer; font-size: 13px; color: var(--t2);
  transition: background var(--tr), color var(--tr);
}
.sh-item:hover { background: var(--glass-hover); color: var(--t1); }
.sh-del {
  font-size: 11px; color: var(--t3); padding: 2px 5px;
  border-radius: 4px; transition: color var(--tr), background var(--tr);
}
.sh-del:hover { color: var(--danger); background: rgba(239,68,68,.08); }

/* ═══════════════════════════════════════
   KEYBOARD HELP MODAL
═══════════════════════════════════════ */
.kbd-help-trigger {
  font-size: 17px;
}

body.kbd-modal-open {
  overflow: hidden;
}

.kbd-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  padding-bottom: max(24px, env(safe-area-inset-bottom, 0px));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .2s ease, visibility .2s ease;
}
.kbd-modal.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.kbd-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 26, 46, .45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.kbd-modal-panel {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: min(85dvh, 560px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0,0,0,.18);
  overflow: hidden;
}

.kbd-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.kbd-modal-head h2 {
  font-size: 16px;
  font-weight: 800;
  color: var(--t1);
  letter-spacing: -0.3px;
}
.kbd-modal-close {
  background: var(--glass);
  border: 1px solid var(--border);
  color: var(--t2);
  font-size: 14px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
  transition: background var(--tr), color var(--tr);
}
.kbd-modal-close:hover {
  color: var(--t1);
  background: var(--glass-hover);
}

.kbd-modal-body {
  padding: 12px 18px 18px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.kbd-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.kbd-row {
  display: grid;
  grid-template-columns: minmax(0, 42%) 1fr;
  gap: 12px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.kbd-row:last-child { border-bottom: none; }
.kbd-keys {
  color: var(--t2);
  font-weight: 600;
}
.kbd-desc {
  color: var(--t1);
  line-height: 1.45;
}
.kbd-row-media .kbd-keys {
  font-size: 12px;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.2px;
}

kbd {
  display: inline-block;
  font-family: ui-monospace, 'Cascadia Code', 'SF Mono', Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 7px;
  margin: 0 1px;
  border-radius: 6px;
  background: var(--bg3);
  border: 1px solid var(--border-hi);
  color: var(--t1);
  box-shadow: 0 1px 0 var(--border);
  white-space: nowrap;
}

.kbd-footnote {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--t3);
  line-height: 1.55;
}

/* ═══════════════════════════════════════
   TOAST
═══════════════════════════════════════ */
#toast {
  position: fixed;
  bottom: calc(var(--player-h) + env(safe-area-inset-bottom, 0px) + 20px);
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  max-width: min(92vw, 360px);
  background: var(--t1); color: #fff;
  font-size: 13px; font-weight: 500;
  padding: 9px 20px; border-radius: 24px;
  box-shadow: 0 8px 28px rgba(0,0,0,.18);
  opacity: 0; pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
  white-space: normal; text-align: center; z-index: 999;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ═══════════════════════════════════════
   MOBILE SEEK (injected by JS)
═══════════════════════════════════════ */
#pb-seek-mobile-wrap { display: none; }

/* ═══════════════════════════════════════
   MOBILE SIDEBAR OVERLAY (class from JS)
═══════════════════════════════════════ */
.mobile-sidebar-overlay {
  position: fixed;
  inset: 0;
  bottom: calc(env(safe-area-inset-bottom, 0px) + var(--player-h));
  background: var(--bg2);
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.mobile-sidebar-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.mobile-sidebar-overlay-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--t1);
  letter-spacing: -0.2px;
}
.mobile-sidebar-overlay-close {
  background: var(--glass);
  border: 1px solid var(--border);
  color: var(--t2);
  font-size: 15px;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 10px;
  line-height: 1;
  font-family: inherit;
  transition: background var(--tr), color var(--tr);
}
.mobile-sidebar-overlay-close:hover {
  color: var(--t1);
  background: var(--glass-hover);
}
.mobile-sidebar-overlay-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  -webkit-overflow-scrolling: touch;
}
