/* OddlyMusic — Apple Music inspired UI */
:root {
  --accent: #fa2d48;
  --bg: #fafafc;
  --bg-main: #ffffff;
  --sidebar: rgba(246, 246, 249, 0.92);
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #98989d;
  --hairline: rgba(0, 0, 0, 0.1);
  --hover: rgba(0, 0, 0, 0.05);
  --card-bg: #f2f2f7;
  --player-bg: rgba(250, 250, 252, 0.85);
  --accent-bg: rgba(250, 45, 72, 0.12);
  --danger: #e5484d;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.14);
  --radius: 10px;
  --player-height: 78px;
}
html.dark {
  --accent: #fc3d54;
  --bg: #161617;
  --bg-main: #1a1a1c;
  --sidebar: rgba(29, 29, 31, 0.92);
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #6e6e73;
  --hairline: rgba(255, 255, 255, 0.12);
  --hover: rgba(255, 255, 255, 0.07);
  --card-bg: #232325;
  --player-bg: rgba(26, 26, 28, 0.85);
  --accent-bg: rgba(252, 61, 84, 0.18);
  --danger: #ff6169;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  user-select: none;
}
button { font-family: inherit; border: none; background: none; color: inherit; cursor: pointer; }
input, select { font-family: inherit; color: inherit; }
.hidden { display: none !important; }

#app { display: grid; grid-template-columns: 232px 1fr; grid-template-rows: minmax(0, 1fr) var(--player-height); height: 100vh; height: 100dvh; }
#sidebar { grid-row: 1 / 3; grid-column: 1; }
#main { grid-row: 1; grid-column: 2; }
#player { grid-row: 2; grid-column: 2; }

/* ---------- Sidebar ---------- */
#sidebar {
  background: var(--sidebar);
  backdrop-filter: blur(30px) saturate(1.5);
  -webkit-backdrop-filter: blur(30px) saturate(1.5);
  border-right: 1px solid var(--hairline);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.side-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 20px 14px;
}
.logo-badge {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(145deg, #fc5c7d, #fa2d48);
  color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px rgba(250, 45, 72, 0.35);
}
.logo-text { font-size: 17px; font-weight: 700; letter-spacing: -0.2px; }
#side-nav { flex: 1; overflow-y: auto; padding: 0 10px 10px; display: flex; flex-direction: column; }
#side-nav::-webkit-scrollbar { width: 0; }
.nav-section { display: flex; flex-direction: column; }
.nav-title {
  font-size: 11px; font-weight: 700; color: var(--text-3);
  padding: 16px 12px 6px; display: flex; align-items: center; justify-content: space-between;
}
#pl-add { font-size: 15px; color: var(--text-3); padding: 0 4px; }
#pl-add:hover { color: var(--accent); }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px; border-radius: 8px;
  font-size: 13.5px; font-weight: 500; color: var(--text-2);
  text-align: left; width: 100%;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active { color: var(--accent); background: var(--accent-bg); }
.nav-item.active svg, .nav-item.active .ni-icon { color: var(--accent); }
.ni-icon { width: 18px; height: 18px; display: inline-flex; color: var(--text-3); }
.ni-icon svg { width: 100%; height: 100%; }
.side-bottom { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--hairline); }
#pl-list .nav-item { font-size: 13px; padding-left: 40px; }
#pl-list .nav-item .del-pl { margin-left: auto; opacity: 0; font-size: 12px; color: var(--text-3); padding: 0 2px; }
#pl-list .nav-item:hover .del-pl { opacity: 1; }
#pl-list .nav-item .del-pl:hover { color: var(--accent); }
#pl-list .nav-item.active .del-pl { opacity: 1; }

/* ---------- Main ---------- */
#main { overflow-y: auto; position: relative; background: var(--bg-main); scroll-behavior: smooth; min-width: 0; }
#main::-webkit-scrollbar { width: 10px; }
#main::-webkit-scrollbar-thumb { background: rgba(127,127,127,.25); border-radius: 5px; border: 3px solid transparent; background-clip: content-box; }
#view { padding: 28px 32px 60px; max-width: 1400px; }

.view-header { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; }
.vh-title { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; }
.vh-sub { color: var(--text-2); font-size: 13px; margin-top: 4px; }
.section-title { font-size: 20px; font-weight: 800; letter-spacing: -0.3px; margin: 26px 0 14px; }
.section-title:first-child { margin-top: 0; }

/* greeting */
.greeting { font-size: 30px; font-weight: 800; letter-spacing: -0.6px; margin-bottom: 6px; }
.greeting-sub { color: var(--text-2); margin-bottom: 24px; }

/* card row (horizontal scroll) */
.card-row { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; margin: 0 -4px; padding-left: 4px; }
.card-row::-webkit-scrollbar { height: 0; }
.album-card { width: 148px; flex-shrink: 0; cursor: pointer; }
.album-card .ac-art {
  width: 148px; height: 148px; border-radius: var(--radius);
  background: var(--card-bg) center/cover no-repeat;
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
  position: relative; overflow: hidden;
}
.album-card .ac-play {
  position: absolute; right: 8px; bottom: 8px;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(250,250,252,.9); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: translateY(6px); transition: all .18s;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
  backdrop-filter: blur(8px);
}
.album-card:hover .ac-play { opacity: 1; transform: none; }
.album-card .ac-play svg { margin-left: 2px; }
.album-card .ac-name { font-weight: 600; font-size: 13px; margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.album-card .ac-sub { color: var(--text-2); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wide-card { width: 300px; flex-shrink: 0; display: flex; gap: 10px; align-items: center; background: var(--card-bg); border-radius: var(--radius); padding: 10px; cursor: pointer; transition: background .15s; }
.wide-card:hover { background: var(--hover); }
.wide-card .wc-art { width: 56px; height: 56px; border-radius: 8px; background: var(--bg) center/cover no-repeat; flex-shrink: 0; }
.wide-card .wc-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wide-card .wc-sub { color: var(--text-2); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wide-card .wc-play { margin-left: auto; width: 32px; height: 32px; border-radius: 50%; color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.wide-card .wc-play:hover { background: var(--accent-bg); }

/* ---------- Search ---------- */
.search-hero { padding: 24px 0 18px; display: flex; justify-content: center; }
.search-box { position: relative; width: 100%; max-width: 520px; }
.search-box input {
  width: 100%; padding: 10px 40px; border-radius: 12px;
  border: 1px solid var(--hairline); background: var(--card-bg);
  font-size: 15px; outline: none; transition: box-shadow .15s, border-color .15s;
}
.search-box input:focus { box-shadow: 0 0 0 3px var(--accent-bg); border-color: var(--accent); }
.search-box .sb-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search-box .sb-clear { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 16px; padding: 4px; display: none; }
.src-tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.src-tab {
  padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  color: var(--text-2); background: var(--card-bg);
  transition: all .15s;
}
.src-tab:hover { color: var(--text); }
.src-tab.active { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(250,45,72,.3); }
.src-tabs .sp { flex: 1; }

/* ---------- Song table ---------- */
.song-table { border-radius: var(--radius); overflow: hidden; }
.song-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) minmax(0, 0.8fr) 128px;
  align-items: center; gap: 12px;
  padding: 8px 14px; min-height: 52px;
  border-radius: 8px;
  transition: background .12s;
}
.song-row:hover { background: var(--hover); }
.song-row.playing .sr-name { color: var(--accent); }
.song-row.playing .sr-idx { color: var(--accent); }
.sr-idx { color: var(--text-3); font-size: 13px; text-align: center; font-variant-numeric: tabular-nums; }
.sr-idx .sr-eq { display: none; }
.sr-main { min-width: 0; display: flex; align-items: center; gap: 10px; }
.sr-art { width: 40px; height: 40px; border-radius: 6px; background: var(--card-bg) center/cover no-repeat; flex-shrink: 0; position: relative; overflow: hidden; }
.sr-art-ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: linear-gradient(145deg, #d7d7de, #b9b9c4); color: rgba(255,255,255,.8); }
html.dark .sr-art-ph { background: linear-gradient(145deg, #333, #4a4a52); }
.sr-tcol { min-width: 0; }
.sr-name { font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-artist { color: var(--text-2); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-album { color: var(--text-2); font-size: 13px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-actions { display: flex; align-items: center; justify-content: flex-end; gap: 2px; opacity: 0; transition: opacity .12s; }
.song-row:hover .sr-actions { opacity: 1; }
.song-row.playing .sr-actions { opacity: .9; }
.sr-btn { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text-2); }
.sr-btn:hover { background: rgba(125,125,125,.15); color: var(--text); }
.sr-btn.fav-on { color: var(--accent); opacity: 1; }
.sr-btn svg { width: 15px; height: 15px; }
.sr-dur { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; padding-right: 2px; }
.song-row .sr-playover { position: absolute; display: none; }

/* list header (playlist detail) */
.list-hero { display: flex; gap: 22px; align-items: flex-end; margin-bottom: 22px; }
.list-hero .lh-art {
  width: 168px; height: 168px; border-radius: 12px;
  background: var(--card-bg) center/cover no-repeat;
  box-shadow: 0 8px 30px rgba(0,0,0,.18);
}
.lh-name { font-size: 30px; font-weight: 800; letter-spacing: -0.6px; }
.lh-meta { color: var(--text-2); margin-top: 6px; font-size: 13px; }
.lh-actions { display: flex; gap: 10px; margin-top: 14px; }
.btn-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: 999px;
  font-weight: 600; font-size: 13px;
  background: var(--card-bg); color: var(--text);
  transition: all .15s;
}
.btn-pill:hover { background: var(--hover); }
.btn-pill.primary { background: var(--accent); color: #fff; box-shadow: 0 2px 10px rgba(250,45,72,.35); }
.btn-pill.primary:hover { filter: brightness(1.05); }
.btn-pill svg { width: 14px; height: 14px; }

.empty-tip { text-align: center; color: var(--text-3); padding: 60px 0; font-size: 14px; }
.empty-tip .big { font-size: 40px; margin-bottom: 12px; opacity: .4; }
.loading-tip { text-align: center; color: var(--text-3); padding: 30px 0; }

/* ---------- Player bar ---------- */
#player {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: center;
  padding: 0 18px;
  min-width: 0;
  background: var(--player-bg);
  backdrop-filter: blur(30px) saturate(1.6);
  -webkit-backdrop-filter: blur(30px) saturate(1.6);
  border-top: 1px solid var(--hairline);
  z-index: 40;
}
.pl-left, .pl-center, .pl-right { min-width: 0; overflow: hidden; }
.pl-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pl-art {
  width: 52px; height: 52px; border-radius: 8px;
  background: var(--card-bg) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  cursor: pointer; transition: transform .15s;
}
.pl-art:hover { transform: scale(1.03); }
.pl-meta { min-width: 0; }
.pl-title { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-artist { color: var(--text-2); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-btn { position: relative; width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); flex-shrink: 0; transition: all .12s; }
.pl-btn:hover { color: var(--text); background: var(--hover); }
.pl-btn.on { color: var(--accent); }
.pl-btn.play { width: 40px; height: 40px; color: var(--text); }
.pl-btn.play:hover { transform: scale(1.06); background: transparent; }
.pl-btn.heart.fav-on { color: var(--accent); }
.pb-icon { width: 18px; height: 18px; display: inline-flex; }
.pb-icon svg { width: 100%; height: 100%; }
.pl-center { display: flex; flex-direction: column; align-items: center; padding: 0 24px; }
.pl-controls { display: flex; align-items: center; gap: 8px; }
.pl-progress { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 560px; }
.pl-time { color: var(--text-2); font-size: 11px; font-variant-numeric: tabular-nums; width: 38px; }
.pl-time:last-child { text-align: left; }
.pl-time:first-child { text-align: right; }
.pl-bar {
  position: relative; flex: 1; min-width: 0; height: 32px; padding: 0 8px;
  display: flex; align-items: center; cursor: pointer;
  touch-action: none; user-select: none;
}
.pl-bar-inner { position: relative; width: 100%; height: 4px; border-radius: 2px; background: rgba(127,127,127,.28); }
.pl-bar-buf, .pl-bar-fill {
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  height: 4px; max-width: 100%; border-radius: 2px;
}
.pl-bar-buf { width: 0%; background: rgba(127,127,127,.4); }
.pl-bar-fill { background: var(--accent); width: 0%; }
.pl-bar-dot {
  position: absolute; right: -8px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
  opacity: 0; transition: opacity .12s;
}
.pl-bar:hover .pl-bar-dot, .pl-bar.seeking .pl-bar-dot, .pl-bar:focus-visible .pl-bar-dot { opacity: 1; }
.pl-bar:focus-visible { outline: none; }
.pl-bar:focus-visible .pl-bar-inner { box-shadow: 0 0 0 3px var(--accent-bg); }
.pl-bar[aria-disabled="true"] { cursor: default; }
@media (pointer: coarse) {
  .pl-bar-dot { opacity: 1; }
}
.pl-right { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.pl-quality {
  font-size: 10px; font-weight: 700; color: var(--accent);
  border: 1px solid var(--accent); border-radius: 4px;
  padding: 1.5px 5px; margin-right: 6px; opacity: 0;
  letter-spacing: .3px;
  cursor: pointer;
}
.pl-quality.show { opacity: 1; }
.pl-vol { display: flex; align-items: center; gap: 8px; margin-left: 6px; color: var(--text-2); width: 110px; }
.pl-vol .pb-icon { width: 15px; height: 15px; }
.pl-vol input { width: 76px; accent-color: var(--accent); height: 3px; cursor: pointer; }
.pl-vol .pl-btn { width: 26px; height: 26px; }

/* ---------- Now Playing fullscreen ---------- */
#np {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg); color: #fff;
  overflow: hidden;
  transition: opacity .3s, transform .3s;
}
#np.hidden { display: none !important; }
.np-bg {
  position: absolute; inset: -60px;
  background: linear-gradient(145deg, #3a3a44, #232328) center/cover no-repeat;
  filter: blur(70px) saturate(1.4);
  transform: scale(1.1);
}
.np-close {
  position: absolute; top: 22px; left: 30px; z-index: 3;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.14); color: #fff;
  font-size: 18px; display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(10px);
}
.np-close:hover { background: rgba(255,255,255,.24); }
.np-body {
  position: relative; z-index: 2; height: 100%;
  display: grid; grid-template-columns: 1fr 1fr;
  padding: 60px 6vw 40px;
  gap: 4vw;
}
.np-left { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; }
.np-art {
  width: min(340px, 32vw); aspect-ratio: 1;
  border-radius: 14px;
  background: rgba(255,255,255,.08) center/cover no-repeat;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.4);
}
.np-info { text-align: center; }
.np-title { font-size: 24px; font-weight: 800; letter-spacing: -0.4px; }
.np-artist { font-size: 16px; opacity: .7; margin-top: 6px; }
.np-lyrics {
  overflow-y: auto; mask-image: linear-gradient(transparent, #000 14%, #000 86%, transparent);
  -webkit-mask-image: linear-gradient(transparent, #000 14%, #000 86%, transparent);
  padding: 0;
}
.np-lyrics::-webkit-scrollbar { width: 0; }
.np-lyrics-inner { text-align: center; }
.nl-line { font-size: 17px; font-weight: 600; opacity: .38; padding: 9px 0; transition: opacity .25s, transform .25s; }
.nl-line.tl { font-size: 13px; opacity: .25; font-weight: 500; }
.nl-line.rl { font-size: 13px; opacity: .25; font-weight: 500; }
.nl-line.active { opacity: 1; transform: scale(1.03); }
.nl-empty { opacity: .5; text-align: center; font-size: 15px; }
/* 逐字歌词：背景渐变按 --p 前景填充（Apple Music 式 karaoke），两层背景都裁剪到文字 */
.nl-line .lw {
  background-image: linear-gradient(#fff, #fff), linear-gradient(rgba(255,255,255,.42), rgba(255,255,255,.42));
  background-repeat: no-repeat;
  background-size: var(--p, 0%) 100%, 100% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

/* ---------- Queue drawer ---------- */
#queue-drawer {
  position: fixed; right: 0; top: 0; bottom: var(--player-height); width: min(360px, 100vw); z-index: 60;
  background: var(--sidebar); backdrop-filter: blur(30px);
  border-left: 1px solid var(--hairline);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow);
}
.q-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 10px; font-weight: 700; font-size: 15px; }
.q-head button { color: var(--text-2); font-size: 12px; }
.q-head button:hover { color: var(--accent); }
.q-list { flex: 1; overflow-y: auto; padding: 0 8px 12px; }
.q-item {
  display: flex; gap: 10px; align-items: center;
  padding: 7px 10px; border-radius: 8px; cursor: pointer;
}
.q-item:hover { background: var(--hover); }
.q-item.current .q-name { color: var(--accent); }
.q-item .q-art { width: 38px; height: 38px; border-radius: 6px; background: var(--card-bg) center/cover no-repeat; flex-shrink: 0; }
.q-item .q-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-item .q-sub { font-size: 11px; color: var(--text-2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-item .q-remove { margin-left: auto; opacity: 0; color: var(--text-3); font-size: 14px; }
.q-item:hover .q-remove { opacity: 1; }
/* 拖拽排序手柄 */
.q-drag { width: 26px; height: 44px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--text-3); border-radius: 6px; cursor: grab; touch-action: none; }
.q-drag:hover { color: var(--text-2); background: var(--hover); }
.q-drag:active { cursor: grabbing; }
.q-drag svg { width: 13px; height: 13px; }
.q-item.dragging { position: relative; z-index: 2; background: var(--bg-main); box-shadow: var(--shadow); opacity: .92; }
@media (pointer: coarse) {
  .q-drag { width: 34px; }
}

/* ---------- Modal ---------- */
#modal-root { position: fixed; inset: 0; z-index: 120; pointer-events: none; }
.modal-mask { position: absolute; inset: 0; background: rgba(0,0,0,.4); opacity: 0; transition: opacity .2s; }
.modal {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%) scale(.96);
  background: var(--bg-main); border-radius: 16px;
  width: min(560px, 92vw); max-height: 82vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow);
  opacity: 0; transition: opacity .2s, transform .2s;
  pointer-events: auto;
}
.modal.show { opacity: 1; transform: translate(-50%,-50%) scale(1); }
.modal-mask.show { opacity: 1; pointer-events: auto; }
.m-head { padding: 20px 24px 8px; display: flex; align-items: center; justify-content: space-between; }
.m-title { font-size: 18px; font-weight: 800; }
.m-close { width: 30px; height: 30px; border-radius: 50%; background: var(--card-bg); color: var(--text-2); font-size: 13px; }
.m-body { padding: 10px 24px 24px; overflow-y: auto; }
.m-body::-webkit-scrollbar { width: 8px; }
.m-body::-webkit-scrollbar-thumb { background: rgba(127,127,127,.3); border-radius: 4px; }
.set-group { margin-bottom: 22px; }
.set-title { font-size: 13px; font-weight: 700; color: var(--text-2); margin-bottom: 8px; }
.set-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; border-radius: 8px; background: var(--card-bg); margin-bottom: 6px; }
/* Apple 设置风格的分组卡片：行共享一张圆角底卡，行间用发丝线分隔 */
.set-card { background: var(--card-bg); border-radius: 12px; padding: 2px 0; overflow: hidden; }
.set-card .set-row { background: none; margin: 0; border-radius: 0; }
.set-card .set-row + .set-row { border-top: 1px solid var(--hairline); }
.set-row .sr-label { font-size: 13.5px; font-weight: 500; }
.set-row select { padding: 5px 8px; border-radius: 6px; border: 1px solid var(--hairline); background: var(--bg-main); font-size: 13px; }
.script-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 10px; border: 1.5px solid var(--hairline); margin-bottom: 8px; cursor: pointer; transition: all .15s; }
.script-item:hover { border-color: rgba(127,127,127,.4); }
.script-item.active { border-color: var(--accent); background: var(--accent-bg); }
.script-item .si-radio { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--text-3); flex-shrink: 0; }
.script-item.active .si-radio { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 3px var(--bg-main); }
.script-item .si-name { font-weight: 600; font-size: 14px; }
.script-item .si-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.script-item .si-badges { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.badge { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 4px; background: var(--hover); color: var(--text-2); }
.badge.q { color: var(--accent); background: var(--accent-bg); }
.si-update { font-size: 12px; color: var(--accent); margin-top: 6px; overflow-wrap: anywhere; opacity: .85; }
.script-item .si-ops { margin-left: auto; display: flex; gap: 4px; opacity: 0; }
.script-item:hover .si-ops { opacity: 1; }
.si-ops button { width: 26px; height: 26px; border-radius: 6px; color: var(--text-2); font-size: 12px; }
.si-ops button:hover { background: var(--hover); color: var(--accent); }
.add-script-row { display: flex; gap: 8px; margin-top: 10px; }
.add-script-row input { flex: 1; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--hairline); background: var(--card-bg); font-size: 13px; outline: none; }
.add-script-row input:focus { border-color: var(--accent); }
.switch { position: relative; width: 40px; height: 24px; border-radius: 12px; background: rgba(127,127,127,.3); transition: background .2s; cursor: pointer; flex-shrink: 0; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.switch.on { background: var(--accent); }
.switch.on::after { left: 18px; }

/* ---------- Menu (context dropdown) ---------- */
.menu {
  position: fixed; z-index: 200; min-width: 180px;
  background: var(--bg-main); border-radius: 10px;
  box-shadow: var(--shadow); border: 1px solid var(--hairline);
  padding: 5px; animation: menuIn .12s ease-out;
}
@keyframes menuIn { from { opacity: 0; transform: translateY(4px); } }
.menu-item { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 7px; font-size: 13px; font-weight: 500; width: 100%; text-align: left; }
.menu-item:hover { background: var(--hover); }
.menu-item.danger { color: var(--accent); }
.menu-sep { height: 1px; background: var(--hairline); margin: 4px 6px; }
.menu-head { padding: 7px 12px 4px; font-size: 11px; color: var(--text-3); font-weight: 700; }

/* ---------- Toast ---------- */
#toast-root { position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: rgba(30,30,34,.92); color: #fff;
  padding: 10px 20px; border-radius: 999px; font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow);
  animation: toastIn .25s ease-out;
  backdrop-filter: blur(10px);
  max-width: 70vw;
}
.toast.err { background: rgba(220,60,70,.95); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }
.toast.out { opacity: 0; transition: opacity .3s; }

/* Keyboard, source management and bounded list rendering */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button:disabled { opacity: .45; cursor: default; }

/* Search history chips */
.search-hist { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; margin-top: 14px; }
.search-hist[hidden] { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* In-content back affordance for transient lists (toplist deep views) */
.back-pill { margin-bottom: 14px; }
@media (min-width: 901px) { .back-pill { display: none; } }
.hist-chip {
  padding: 6px 14px; border-radius: 999px; font-size: 13px;
  color: var(--text-2); background: var(--card-bg);
  max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: color .15s, background .15s;
}
.hist-chip:hover { color: var(--text); background: var(--hover); }
.hist-clear { font-size: 12px; color: var(--text-3); padding: 6px 8px; flex-shrink: 0; }
.hist-clear:hover { color: var(--accent); }

/* Skeleton loading rows */
.sk-box { border-radius: 6px; background: linear-gradient(90deg, var(--card-bg) 25%, var(--hover) 50%, var(--card-bg) 75%); background-size: 200% 100%; animation: skShimmer 1.4s linear infinite; }
.sk-table { padding-bottom: 8px; }
.sk-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.sk-art { width: 40px; height: 40px; flex-shrink: 0; }
.sk-col { flex: 1; min-width: 0; }
.sk-line { height: 12px; width: 68%; }
.sk-line.short { width: 42%; margin-top: 8px; }
.sk-line.tail { width: 88px; flex-shrink: 0; }
@keyframes skShimmer { from { background-position: 200% 0 } to { background-position: -200% 0 } }

/* Home empty-state hero */
.home-hero { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 44px 20px; margin-top: 12px; border-radius: 14px; background: var(--card-bg); }
.home-hero .hh-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--accent-bg); color: var(--accent); display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.home-hero .hh-icon svg { width: 26px; height: 26px; }
.home-hero .hh-title { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.home-hero .hh-sub { color: var(--text-2); font-size: 13px; margin-bottom: 14px; max-width: 340px; }


.mobile-mode { display: none; }
.playlist-nav { display: flex; min-width: 0; align-items: center; }
.playlist-nav .nav-item { min-width: 0; padding-left: 12px !important; }
.playlist-nav .nav-item > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.playlist-nav .del-pl { flex-shrink: 0; width: 32px; min-height: 32px; color: var(--text-2); }
.song-row { content-visibility: auto; contain-intrinsic-size: auto 56px; }
.song-row:focus-within .sr-actions { opacity: 1; }
.sr-main { cursor: pointer; }
.q-select { flex: 1; }
.q-name, .q-sub { display: block; }
.q-remove, .q-head button { min-width: 44px; min-height: 44px; opacity: 1 !important; }
.script-item { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; cursor: default; }
.si-select { display: flex; align-items: center; gap: 10px; text-align: left; min-height: 36px; }
.si-detail, .si-sub, .si-error { overflow-wrap: anywhere; }
.si-error { font-size: 12px; color: var(--accent); margin-top: 6px; }
.script-item.disabled .si-name { color: var(--text-2); }
.script-item .si-ops { opacity: 1; margin-left: 0; flex-wrap: wrap; }
.si-ops button { min-width: 44px; width: auto; min-height: 36px; padding: 4px 10px; background: var(--card-bg); }
.add-script-row input { min-width: 0; }
#as-local { margin-top: 10px; }
.settings-hint, .cache-notice { font-size: 12px; color: var(--text-2); line-height: 1.7; margin: 10px 0; overflow-wrap: anywhere; }
.backup-actions { display: flex; flex-wrap: wrap; gap: 10px; }
#search-more { margin: 20px auto; display: flex; }
.list-hero > div:last-child { min-width: 0; }
.lh-art { flex-shrink: 0; }
.lh-name { overflow-wrap: anywhere; }
.lh-actions { flex-wrap: wrap; }
.menu { max-width: calc(100vw - 16px); max-height: calc(100dvh - 24px); overflow-y: auto; }
.menu-head { overflow-wrap: anywhere; }
.np-body { grid-template-rows: minmax(0, 1fr) auto auto; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.np-left, .np-lyrics { min-width: 0; min-height: 0; }
.np-progress { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; width: 100%; max-width: 560px; margin: 0 auto; align-self: end; padding-bottom: 4px; }
.np-progress .pl-time { color: rgba(255, 255, 255, 0.65); }
.np-controls { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 12px; }
.np-controls .pl-btn { color: #fff; width: 44px; height: 44px; }
.np-controls .pl-btn.on { color: #ff8092; }
.np-controls svg { width: 22px; height: 22px; }
.np-source { font-size: 12px; opacity: .75; margin-top: 8px; }
.np-lyric-src { font-size: 11px; opacity: 0; margin-top: 4px; transition: opacity .3s; }
.np-lyric-src.show { opacity: .55; }
.np-title, .np-artist { overflow-wrap: anywhere; }
.np-lyrics { user-select: text; }
.np-lyrics-inner { position: relative; padding: var(--lyric-pad, 0px) 10px; }
.nl-line { overflow-wrap: anywhere; }
.np-lyrics .nl-line { cursor: pointer; }
.pl-btn[data-mode="one"]::after {
  content: '1'; position: absolute; top: 0; right: 0;
  font-size: 8px; font-weight: 700; line-height: 1;
  color: var(--accent); background: var(--accent-bg);
  border-radius: 999px; padding: 2px 4px;
}
#player[data-state="resolving"] .pl-title::after { content: ' · 解析中'; color: var(--text-2); font-size: 11px; }
#player[data-state="error"] .pl-title::after { content: ' · 播放失败'; color: var(--accent); font-size: 11px; }
.pl-btn.play > svg { width: 22px; height: 22px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .pl-vol { display: none; }
  .pl-center { padding: 0 6px; }
  #player { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) auto; padding: 0 10px; }
  .pl-right { gap: 0; }
  #pl-fullscreen { display: none; }
}
@media (max-width: 900px) {
  #app { grid-template-columns: 64px minmax(0, 1fr); }
  .logo-text, .nav-item span:not(.ni-icon), .nav-title { display: none; }
  .nav-item { justify-content: center; min-height: 44px; padding: 10px 0; }
  .side-logo { justify-content: center; padding: 14px 0; }
  #pl-title-row { display: flex; font-size: 0; padding: 0; justify-content: center; }
  #pl-add { display: block; width: 44px; height: 44px; font-size: 22px; }
  .playlist-nav .del-pl { display: none; }
  .playlist-nav .nav-item { padding: 10px 0 !important; }
  .sr-album, .sr-idx, .sr-dur { display: none; }
  .song-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px; padding: 8px; }
  .sr-actions { opacity: 1; }
  .sr-btn { width: 36px; height: 36px; }
  .np-body { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr) auto auto; padding: 64px 24px max(20px, env(safe-area-inset-bottom)); gap: 14px; }
  .np-left { flex-direction: row; gap: 16px; justify-content: flex-start; }
  .np-art { width: 96px; flex-shrink: 0; border-radius: 10px; }
  .np-info { text-align: left; }
  .np-title { font-size: 20px; }
  .np-artist { font-size: 14px; }
  .np-lyrics { display: block; }
  .np-close { left: 18px; top: max(12px, env(safe-area-inset-top)); width: 44px; height: 44px; }
  .np-controls { gap: 4px; }
  .list-hero { gap: 16px; align-items: flex-start; }
  .list-hero .lh-art { width: 100px; height: 100px; }
  .lh-name { font-size: 24px; }
}
@media (max-width: 600px) {
  :root { --player-height: calc(144px + env(safe-area-inset-bottom)); }
  #app { grid-template-columns: 56px minmax(0, 1fr); }
  #sidebar { grid-row: 1; }
  #view { padding: 20px 14px 40px; }
  #player { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 52px 36px 44px; padding: 6px 12px max(6px, env(safe-area-inset-bottom)); }
  .pl-left { grid-column: 1; grid-row: 1; gap: 8px; }
  .pl-center { display: contents; }
  .pl-controls { grid-column: 2; grid-row: 1; gap: 0; }
  .pl-progress { grid-column: 1 / -1; grid-row: 2; gap: 4px; max-width: none; }
  .pl-right { grid-column: 1 / -1; grid-row: 3; display: flex; justify-content: center; gap: 6px; }
  .mobile-mode { display: inline-flex; }
  #pl-shuffle, #pl-repeat, #pl-fullscreen, .pl-vol { display: none; }
  .pl-btn, .pl-btn.play { width: 44px; height: 44px; }
  .pl-art { width: 42px; height: 42px; }
  .pl-time { display: inline; width: 34px; }
  .pl-bar { height: 36px; }
  .pl-quality { min-height: 32px; flex-shrink: 0; margin-right: 0; }
  .pl-quality:disabled { display: none; }
  .sr-art { display: none; }
  .sr-btn { width: 44px; height: 44px; }
  .song-row { padding: 4px; }
  .greeting { font-size: 26px; }
  .list-hero { flex-direction: column; }
  .set-row { gap: 10px; flex-wrap: wrap; }
  .set-row select { max-width: 100%; }
  .btn-pill, .src-tab, .si-ops button { min-height: 44px; }
  .si-select { min-height: 44px; }
  .add-script-row { flex-wrap: wrap; }
  .add-script-row input { flex-basis: 100%; min-height: 44px; }
  .np-body { padding-left: 16px; padding-right: 16px; }
  .np-art { width: 72px; }
  .np-controls { gap: 0; }
  #toast-root { bottom: calc(var(--player-height) + 12px); width: 100%; }
  .toast { max-width: 90vw; }
}
@media (max-height: 500px) and (max-width: 900px) {
  .np-left { display: none; }
  .np-body { grid-template-rows: minmax(0, 1fr) auto auto; padding-top: 56px; gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
