* { box-sizing: border-box; margin: 0; padding: 0; }
:root, [data-theme="classic"] {
  /* CLASSIC — default dark + Spotify green */
  --bg: #0b0e14; --bg2: #11161f; --bg3: #1a2230; --border: #1e2632;
  --text: #e6edf3; --dim: #9aa7b8; --mute: #5a6678;
  --accent: #1db954; --accent2: #4f8df9; --sidebar-bg: #07090d; --danger: #ff6b6b;
}
[data-theme="blue"] {
  --bg: #05080f; --bg2: #0c1424; --bg3: #1c2b4a; --border: #1f2c4a;
  --text: #dfe7f5; --dim: #7a8aae; --mute: #56638a;
  --accent: #4f8df9; --accent2: #79aaff; --sidebar-bg: #060b16; --danger: #e25c5c;
}
[data-theme="neutral"] {
  --bg: #0e1218; --bg2: #181d28; --bg3: #2c3445; --border: #2a313e;
  --text: #dde2ea; --dim: #8893a5; --mute: #5f6a7c;
  --accent: #7d8da3; --accent2: #a3b3c8; --sidebar-bg: #0a0e14; --danger: #e25c5c;
}
[data-theme="synthwave"] {
  --bg: #14001f; --bg2: #1f002e; --bg3: #3d1565; --border: #4a1080;
  --text: #f5e6ff; --dim: #c89dd8; --mute: #8a5fa8;
  --accent: #ff2cb6; --accent2: #00f0ff; --sidebar-bg: #0a0014; --danger: #ff5a8a;
}
[data-theme="crimson"] {
  --bg: #0e0608; --bg2: #1a0c10; --bg3: #321c24; --border: #3a1d28;
  --text: #f0dde0; --dim: #ad8088; --mute: #7a555c;
  --accent: #e63946; --accent2: #ff8a96; --sidebar-bg: #0a0408; --danger: #ff5a68;
}
[data-theme="forest"] {
  --bg: #06100a; --bg2: #0c1c14; --bg3: #1c3a2a; --border: #1f3a2a;
  --text: #dceee2; --dim: #7aa890; --mute: #557868;
  --accent: #34d399; --accent2: #5ff5b8; --sidebar-bg: #050c08; --danger: #ff6b6b;
}
[data-theme="amber"] {
  --bg: #100c04; --bg2: #1d160c; --bg3: #3a2c1a; --border: #3a2c18;
  --text: #f0e6d0; --dim: #b09870; --mute: #7a684c;
  --accent: #f59e0b; --accent2: #ffc04a; --sidebar-bg: #0a0806; --danger: #ff6b6b;
}
[data-theme="royal"] {
  --bg: #0a0815; --bg2: #16122a; --bg3: #2e2454; --border: #2d2454;
  --text: #e6dff5; --dim: #9888c0; --mute: #685a90;
  --accent: #a78bfa; --accent2: #c4adff; --sidebar-bg: #07050e; --danger: #ff6b6b;
}
html, body { height: 100%; }
body { background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; overflow: hidden; }
button { font-family: inherit; cursor: pointer; }
img { display: block; }

#app { display: grid; grid-template-columns: 250px 1fr; grid-template-rows: 1fr 92px; height: 100vh; height: 100dvh; }

/* Sidebar */
.sidebar { grid-row: 1; grid-column: 1; background: var(--sidebar-bg); border-right: 1px solid var(--border); padding: 16px 12px; overflow-y: auto; }
.how-btn { display: inline-flex; align-items: center; gap: 4px; margin: 0 6px 8px; padding: 3px 8px; font-size: 11px; color: var(--dim); background: transparent; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; transition: color .15s ease, border-color .15s ease; }
.how-btn:hover { color: var(--text); border-color: var(--accent); }
.how-body { font-size: 14px; line-height: 1.6; color: var(--text); }
.how-body p { margin-bottom: 12px; }
.how-body p:last-child { margin-bottom: 0; }
.how-body strong { color: var(--accent2, var(--accent)); }
.brand { font-weight: 800; font-size: 16px; color: var(--accent); margin: 4px 6px 6px; display: flex; gap: 6px; }
.brand span { color: var(--text); }
.tagline { color: var(--dim); font-size: 11px; line-height: 1.5; margin: 0 6px 20px; }
.nav-item { display: block; width: 100%; text-align: left; background: none; border: none; color: var(--dim); font-size: 14px; font-weight: 600; padding: 8px 8px; border-radius: 6px; }
.nav-item:hover, .nav-item.active { color: var(--text); background: var(--bg3); }
.section { margin-top: 22px; }
.section-head { display: flex; justify-content: space-between; align-items: center; color: var(--mute); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; padding: 0 8px 6px; }
.section-head button { background: none; border: 1px solid var(--border); color: var(--dim); width: 22px; height: 22px; border-radius: 5px; line-height: 1; }
.section-head button:hover { color: var(--text); border-color: var(--accent); }
.list { list-style: none; }
.list li { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 6px; color: var(--dim); font-size: 13px; cursor: pointer; }
.list li:hover, .list li.active { background: var(--bg3); color: var(--text); }
.list li .li-text { min-width: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list li .badge { font-size: 10px; color: var(--mute); margin-left: 6px; }

/* square cover (playlist song collage / group member images) */
.cover { width: 38px; height: 38px; border-radius: 5px; overflow: hidden; flex-shrink: 0; background: var(--bg2); display: block; }
.cover > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-grid { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.cover-2 { display: grid; grid-template-columns: 1fr 1fr; }
.cover-3 { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.cover-3 img:first-child { grid-row: 1 / 3; } /* one tall on the left, two stacked on the right */
.cover-grid img, .cover-2 img, .cover-3 img, .cover-grid .ph { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-grid .ph { background: var(--bg3); }
.cover-2 img, .cover-3 img { border: 0.5px solid var(--bg); }
.cover-empty { display: flex; align-items: center; justify-content: center; font-size: 16px; color: var(--mute); }
.linkbtn { background: none; border: none; color: var(--dim); font-size: 12px; padding: 6px 8px; text-decoration: underline; }
.linkbtn:hover { color: var(--accent2); }

/* Main */
.main { grid-row: 1; grid-column: 2; display: flex; flex-direction: column; overflow: hidden; position: relative; }
/* 3-column grid keeps the search box centered (aligned over the centered results
   card) regardless of how wide the account/menu items on either side are. */
.topbar { display: grid; grid-template-columns: 1fr minmax(0, 520px) 1fr; align-items: center; gap: 16px; padding: 14px 22px; border-bottom: 1px solid var(--border); }
.search-wrap { grid-column: 2; width: 100%; max-width: 520px; }
#searchInput { width: 100%; background: var(--bg2); border: 1px solid var(--border); color: var(--text); border-radius: 999px; padding: 10px 16px; font-size: 14px; outline: none; }
#searchInput:focus { border-color: var(--accent); }
.account { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.account button { background: var(--bg3); border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 6px 12px; font-size: 13px; }
.account button:hover { border-color: var(--accent); }
.account .uname { color: var(--accent); font-weight: 600; }
.content { flex: 1; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 20px 22px 28px; }
.content h2 { font-size: 20px; margin-bottom: 14px; }
.muted { color: var(--dim); }

/* Search overlay — a dimmed backdrop over the open list with a floating result
   card (not full-width). Sits below the search bar so you can keep typing. */
.search-overlay { position: absolute; left: 0; right: 0; top: var(--topbar-h, 56px); bottom: 0; z-index: 60; display: flex; flex-direction: column; padding: 16px; background: rgba(0,0,0,.5); backdrop-filter: blur(2px); animation: overlayIn .15s ease; }
.search-overlay[hidden] { display: none; }
.search-panel { width: 100%; max-width: 720px; margin: 0 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 24px 70px rgba(0,0,0,.55); padding: 18px 20px; animation: dialogPop .18s ease; }
.search-panel h2 { font-size: 20px; margin-bottom: 14px; }
@media (max-width: 700px) { .search-overlay { padding: 10px; } .search-panel { padding: 14px 14px 18px; border-radius: 12px; } }

/* Track rows */
.rows { display: flex; flex-direction: column; gap: 2px; }
.row { display: grid; grid-template-columns: 44px 1fr auto auto; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.row:hover { background: var(--bg2); }
.thumb { position: relative; width: 44px; height: 44px; flex-shrink: 0; }
.row img { width: 44px; height: 44px; border-radius: 5px; object-fit: cover; background: var(--bg3); }
.play-ov { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.5); color: #fff; border-radius: 5px; font-size: 15px; opacity: 0; transition: opacity .15s ease; pointer-events: none; }
@media (hover: hover) { .row:hover .play-ov { opacity: 1; } }
.t-meta { min-width: 0; display: flex; align-items: center; gap: 8px; }
.t-text { min-width: 0; flex: 1; }
.listeners { display: flex; align-items: center; flex-shrink: 0; }
.avatar { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: #fff; border: 2px solid var(--bg); text-shadow: 0 1px 1px rgba(0,0,0,.4); cursor: pointer; transition: transform .12s ease; }
.avatar:hover { transform: scale(1.18); position: relative; z-index: 1; }
.listeners .avatar:not(:first-child) { margin-left: -7px; }
.row:hover .avatar { border-color: var(--bg2); }
/* currently-playing row (your own playback) highlighted in theme colours */
.row.playing { background: color-mix(in srgb, var(--accent) 15%, transparent); box-shadow: inset 3px 0 0 var(--accent); }
.row.playing .t-title { color: var(--accent); }
.row.playing .play-ov { opacity: 1; }
/* Play overlay contents: ▶ icon (on hover) vs animated equalizer (when playing) */
.play-ov .eq { display: none; align-items: flex-end; gap: 2px; height: 18px; }
.play-ov .eq i { width: 3px; height: 5px; background: var(--accent); border-radius: 1px; animation: eqPlay .9s ease-in-out infinite; }
.play-ov .eq i:nth-child(2) { animation-delay: .3s; }
.play-ov .eq i:nth-child(3) { animation-delay: .15s; }
@keyframes eqPlay { 0%, 100% { height: 5px; } 50% { height: 17px; } }
/* Playing row → hide ▶, show the equalizer (frozen when paused) */
.row.playing .play-ov .pl-ic { display: none; }
.row.playing .play-ov .eq { display: flex; }
.row.playing.paused .play-ov .eq i { animation-play-state: paused; }
/* While a track is loading/buffering, swap the overlay for a spinner */
.row.buffering .play-ov { opacity: 1; }
.row.buffering .play-ov .pl-ic, .row.buffering .play-ov .eq { display: none; }
.row.buffering .play-ov::after { content: ''; width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.row .t-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .t-sub { font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .t-src { color: var(--mute); opacity: .6; text-transform: uppercase; font-size: 11px; }
.row .t-views { color: var(--mute); white-space: nowrap; }
.row .pill { font-size: 10px; color: var(--mute); display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.row .pill.pending, .row .pill.downloading { color: var(--accent2); }
.row .pill.pending::before, .row .pill.downloading::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent2); animation: pulse 1s ease-in-out infinite; }
.row .pill.ready { color: var(--accent); } .row .pill.failed { color: var(--danger); }
@keyframes pulse { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }
.row .acts { display: flex; gap: 6px; }
.row .acts button { background: none; border: 1px solid var(--border); color: var(--dim); border-radius: 6px; padding: 5px 9px; font-size: 12px; }
.row .acts button:hover { color: var(--text); border-color: var(--accent); }
.dur { color: var(--dim); font-size: 12px; }

.pheader { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.pheader h2 { margin: 0; }
.pheader button { background: var(--bg3); border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 6px 12px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; transition: border-color .15s ease, background .15s ease, color .15s ease; }
.pheader button:hover { border-color: var(--accent); }
.pheader .play-all { background: var(--accent); color: #06120a; border: none; font-weight: 700; }
/* "Most viewed first" sort toggle (slider switch), shown in the results header */
.results-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.results-head h2 { margin-bottom: 0; }
.sort-toggle { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; cursor: pointer; user-select: none; font-size: 13px; font-weight: 600; color: var(--dim); white-space: nowrap; padding: 5px 6px; transition: color .15s ease; }
.sort-toggle:hover { color: var(--text); }
.sort-toggle input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.sort-toggle input:checked ~ .dl-switch { background: var(--accent); }
.sort-toggle input:checked ~ .dl-switch .dl-knob { transform: translateX(15px); }
.sort-toggle:has(input:checked) { color: var(--accent); }
.sort-sel { background: var(--bg3); border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 6px 10px; font-size: 13px; cursor: pointer; transition: border-color .15s ease; }
.sort-sel:hover { border-color: var(--accent); }
.sort-sel:focus { outline: none; border-color: var(--accent); }
.pheader .play-all:hover { filter: brightness(1.06); }
.pheader button.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); margin-left: auto; }
.pheader button.danger:hover { color: #fff; background: var(--danger); border-color: var(--danger); }
.member-stack { display: inline-flex; align-items: center; }
.member-stack .stack-av { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; border: 2px solid var(--bg); background: var(--bg3); }
.member-stack .stack-av:not(:first-child), .member-stack .stack-more { margin-left: -8px; }
.member-stack .stack-more { width: 28px; height: 28px; border-radius: 50%; background: var(--bg3); border: 2px solid var(--bg); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--dim); }
.members { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 18px; }

/* collapsible section header */
.toggle-head { cursor: pointer; user-select: none; display: inline-flex; align-items: center; gap: 7px; }
.toggle-head:hover { color: var(--text); }
.toggle-head .chev { display: inline-block; transition: transform .15s ease; font-size: 11px; }
.toggle-head.open .chev { transform: rotate(90deg); }
.toggle-head .count { color: var(--mute); font-weight: 400; font-size: 11px; background: var(--bg3); border-radius: 999px; padding: 1px 8px; }

/* group activity log */
.activity-log { list-style: none; margin: 8px 0 8px; display: flex; flex-direction: column; gap: 2px; max-width: 640px; }
.activity-log[hidden] { display: none; } /* explicit display: flex above would otherwise beat the hidden attribute */
.activity-log li { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 6px; font-size: 13px; color: var(--dim); }
.activity-log li:hover { background: var(--bg2); }
.activity-log .log-av { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; background: var(--bg3); flex-shrink: 0; }
.activity-log .log-text { min-width: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-log .log-actor { color: var(--text); font-weight: 600; }
.activity-log .log-track { color: var(--text); }
.activity-log .log-pl { color: var(--accent2); }
.activity-log .log-time { color: var(--mute); font-size: 11px; flex-shrink: 0; }
.member { display: inline-flex; align-items: center; gap: 7px; background: var(--bg2); border: 1px solid var(--border); border-radius: 999px; padding: 3px 12px 3px 3px; font-size: 12px; }
.member-av { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; background: var(--bg3); flex-shrink: 0; }
.member-x { background: none; border: none; color: var(--mute); font-size: 11px; line-height: 1; margin-left: 2px; padding: 2px 3px; border-radius: 4px; }
.member-x:hover { color: var(--danger); background: var(--bg3); }
.add-member { background: var(--bg2); border: 1px dashed var(--border); color: var(--dim); border-radius: 999px; padding: 4px 14px; font-size: 12px; }
.add-member:hover { color: var(--text); border-color: var(--accent); }

/* Player bar */
.player { grid-column: 1 / 3; grid-row: 2; background: linear-gradient(180deg, var(--bg2), var(--bg)); border-top: 1px solid var(--border); box-shadow: 0 -6px 24px rgba(0,0,0,.25); display: grid; grid-template-columns: 1fr 2fr 1fr; align-items: center; gap: 16px; padding: 0 18px; }
.np { display: flex; align-items: center; gap: 12px; min-width: 0; }
.np-art { position: relative; width: 54px; height: 54px; border-radius: 8px; background: var(--bg3); flex-shrink: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; box-shadow: 0 3px 10px rgba(0,0,0,.45); }
.np-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.np-note { color: var(--mute); font-size: 22px; }
.np-meta { min-width: 0; }
.np-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-artist { font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.controls { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.btns { display: flex; align-items: center; gap: 10px; }
.btns button { background: none; border: none; color: var(--dim); font-size: 17px; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: all .15s ease; }
.btns button:hover { color: var(--text); background: var(--bg3); }
.btns button:active { transform: scale(.92); }
.btns .play { position: relative; width: 44px; height: 44px; background: var(--accent); color: var(--bg); font-size: 16px; box-shadow: 0 4px 16px color-mix(in srgb, var(--accent) 45%, transparent); }
.btns .play:hover { filter: brightness(1.12); transform: scale(1.06); }

/* Loading state: spinner on the play button + over the album art */
.np-spinner { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,.5); border-radius: 8px; }
.player.loading .np-spinner { display: flex; }
.np-spinner::after { content: ''; width: 22px; height: 22px; border: 2.5px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.player.loading .btns .play { color: transparent; pointer-events: none; }
.player.loading .btns .play::after { content: ''; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; border: 2.5px solid color-mix(in srgb, var(--bg) 30%, transparent); border-top-color: var(--bg); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.seekrow { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 540px; font-size: 11px; color: var(--dim); }
.seekrow span { font-variant-numeric: tabular-nums; min-width: 34px; }
.seekrow #curTime { text-align: right; }
.seekrow #durTime { text-align: left; }
.seekrow input { flex: 1; }

/* custom range sliders (seek + volume) with a filled track */
.player input[type=range] { -webkit-appearance: none; appearance: none; height: 5px; border-radius: 999px; cursor: pointer; background: linear-gradient(to right, var(--accent) 0 var(--fill, 0%), var(--bg3) var(--fill, 0%) 100%); }
.player input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 13px; height: 13px; border-radius: 50%; background: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.5); transition: transform .12s ease; }
.player input[type=range]:hover::-webkit-slider-thumb { transform: scale(1.25); background: var(--accent2); }
.player input[type=range]::-moz-range-thumb { width: 13px; height: 13px; border: none; border-radius: 50%; background: var(--text); }
.player input[type=range]::-moz-range-track { height: 5px; border-radius: 999px; background: var(--bg3); }
.player input[type=range]::-moz-range-progress { height: 5px; border-radius: 999px; background: var(--accent); }

.right { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.status { font-size: 11px; color: var(--accent2); white-space: nowrap; }
.status:not(:empty) { background: color-mix(in srgb, var(--accent2) 14%, transparent); padding: 3px 9px; border-radius: 999px; }
.volwrap { display: flex; align-items: center; gap: 8px; color: var(--dim); font-size: 14px; }
.volwrap input { width: 90px; }

/* drag-to-reorder */
.row.drag { grid-template-columns: 18px 44px 1fr auto auto; }
.row .grip { color: var(--mute); cursor: grab; font-size: 14px; user-select: none; line-height: 1; text-align: center; }
.row.dragging { opacity: .45; background: var(--bg3); }
.row.moved { position: relative; z-index: 2; background: var(--bg2); } /* lifts while sliding into a new spot */

/* sidebar "someone is listening" — left-side beacon on the cover + glow ring,
   so it's obvious the list is live and joinable. */
.list li { position: relative; }
.list li.live .cover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 70%, transparent); animation: listenGlow 1.7s ease-in-out infinite; }
.list li.live .li-text { color: var(--text); }
/* the pulsing "live" ball, sat on the cover's bottom-right corner (fixed 38px cover) */
.list li.live::after {
  content: ''; position: absolute; left: 39px; top: 36px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--sidebar-bg);
  z-index: 3; pointer-events: none;
  animation: livePulse 1.4s ease-out infinite;
}
@keyframes livePulse {
  0%   { box-shadow: 0 0 5px var(--accent), 0 0 0 0 color-mix(in srgb, var(--accent) 70%, transparent); }
  70%  { box-shadow: 0 0 5px var(--accent), 0 0 0 9px transparent; }
  100% { box-shadow: 0 0 5px var(--accent), 0 0 0 0 transparent; }
}
@keyframes listenGlow {
  0%, 100% { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
  50%      { box-shadow: 0 0 0 2px var(--accent), 0 0 10px color-mix(in srgb, var(--accent) 45%, transparent); }
}

/* toasts */
#toasts { position: fixed; right: 18px; bottom: 104px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { position: relative; overflow: hidden; background: var(--bg3); border: 1px solid var(--border); border-left: 3px solid var(--accent); color: var(--text); padding: 10px 14px 12px; border-radius: 8px; font-size: 13px; max-width: 340px; box-shadow: 0 10px 30px rgba(0,0,0,.5); animation: toastIn .2s ease; }
.toast.out { opacity: 0; transform: translateY(8px); transition: opacity .3s, transform .3s; }
.toast-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--accent); transform-origin: left; animation: toastBar var(--toast-dur, 7000ms) linear forwards; }
.toast.toast-err { border-left-color: var(--danger); }
.toast.toast-err .toast-bar { background: var(--danger); }
/* A track that failed to play — dimmed, with a struck-through, red title */
.row.unavailable { opacity: .55; }
.row.unavailable .t-title { color: var(--danger); text-decoration: line-through; }
.row.unavailable .play-ov { opacity: 1; font-size: 18px; }
.row.unavailable .play-ov .pl-ic, .row.unavailable .play-ov .eq { display: none; }
.row.unavailable .play-ov::after { content: '⚠'; color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toastBar { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* "Listen together" sync bar — floats above the player */
#syncBar { position: fixed; left: 50%; bottom: 104px; transform: translateX(-50%) translateY(8px); z-index: 150; display: flex; align-items: center; gap: 10px; background: var(--bg3); border: 1px solid var(--accent); border-radius: 999px; padding: 6px 8px 6px 14px; box-shadow: 0 12px 34px rgba(0,0,0,.55); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; max-width: calc(100vw - 24px); }
#syncBar:empty { display: none; }
#syncBar.show { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
#syncBar .sync-ic { font-size: 15px; }
#syncBar .sync-avs { display: inline-flex; flex-shrink: 0; }
#syncBar .sync-av { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; border: 2px solid var(--bg3); background: var(--bg2); }
#syncBar .sync-av:not(:first-child) { margin-left: -8px; }
#syncBar .sync-text { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#syncBar #syncLeave { background: var(--bg2); border: 1px solid var(--border); color: var(--text); border-radius: 999px; padding: 5px 14px; font-size: 12px; font-weight: 600; flex-shrink: 0; }
#syncBar #syncLeave:hover { border-color: var(--danger); color: var(--danger); }
@media (max-width: 760px) { #syncBar { bottom: 128px; } #syncBar .sync-text { max-width: 44vw; } }

/* row context menu (⋯) */
.row .acts .kebab { font-size: 16px; line-height: 1; padding: 4px 9px; letter-spacing: 1px; }
.menu { position: absolute; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 6px; z-index: 250; min-width: 200px; max-height: calc(100vh - 16px); overflow-y: auto; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.menu button { display: block; width: 100%; text-align: left; background: none; border: none; color: var(--text); font-size: 13px; padding: 7px 10px; border-radius: 5px; }
.menu button:hover { background: var(--bg3); }
.menu .mh { color: var(--mute); font-size: 11px; padding: 4px 10px; }
.menu .msep { height: 1px; background: var(--border); margin: 6px 4px; }
.menu button.danger { color: var(--danger); }

/* ── Header right cluster + icon buttons ── */
.header-right { grid-column: 3; justify-self: end; display: flex; align-items: center; gap: 10px; }
.icon-btn { background: var(--bg3); border: 1px solid var(--border); color: var(--dim); width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all .2s ease; }
.icon-btn:hover { color: var(--text); border-color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.gear:hover { transform: rotate(30deg); }
.hamburger { display: none; grid-column: 1; justify-self: start; }

/* ── Settings modal ── */
/* Player → Now Playing expand button */
.np-expand { background: var(--bg3); border: 1px solid var(--border); color: var(--dim); width: 32px; height: 32px; border-radius: 8px; font-size: 16px; line-height: 1; cursor: pointer; flex-shrink: 0; transition: color .15s ease, border-color .15s ease; }
.np-expand:hover { color: var(--text); border-color: var(--accent); }
/* ── Now Playing fullscreen cover-flow (covers content; stops above the player bar) ── */
.npv { position: fixed; top: 0; left: 0; right: 0; bottom: var(--player-h, 96px); z-index: 150;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(120% 90% at 50% 30%, color-mix(in srgb, var(--accent) 8%, var(--bg2)), var(--bg) 72%);
  padding: 28px 0 18px; animation: npvIn .22s ease; }
.npv[hidden] { display: none; }
@keyframes npvIn { from { opacity: 0; } to { opacity: 1; } }
.npv-close { position: absolute; top: 16px; right: 18px; width: 40px; height: 40px; border-radius: 10px; background: var(--bg3); border: 1px solid var(--border); color: var(--dim); font-size: 16px; cursor: pointer; z-index: 4; }
.npv-close:hover { color: var(--text); border-color: var(--accent); }
.npv-stage { position: relative; width: 100%; flex: 1; min-height: 0; overflow: hidden; display: flex; align-items: center; }
.npv-strip { display: flex; align-items: center; transition: transform .5s cubic-bezier(.22,.61,.36,1); will-change: transform; }
.npv-strip.no-anim { transition: none; }
.npv-cover { flex: 0 0 clamp(150px, 44vmin, 360px); height: clamp(150px, 44vmin, 360px); display: flex; align-items: center; justify-content: center;
  opacity: .28; transform: scale(.64); transition: transform .5s cubic-bezier(.22,.61,.36,1), opacity .5s; cursor: pointer; }
.npv-cover.cur { opacity: 1; transform: scale(1); cursor: default; }
.npv-cover img, .npv-noart { width: 90%; height: 90%; object-fit: cover; border-radius: 16px; box-shadow: 0 26px 70px rgba(0,0,0,.6); }
.npv-noart { display: flex; align-items: center; justify-content: center; background: var(--bg3); color: var(--mute); font-size: 64px; }
.npv-empty { color: var(--mute); font-size: 16px; padding: 40px; }
.npv-meta { text-align: center; margin-top: 20px; padding: 0 24px; max-width: 92vw; }
.npv-title { font-size: 22px; font-weight: 800; color: var(--text); margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.npv-artist { font-size: 14px; color: var(--dim); }
.npv-arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 3; width: 46px; height: 46px; border-radius: 50%;
  background: color-mix(in srgb, var(--bg3) 80%, transparent); border: 1px solid var(--border); color: var(--text); font-size: 24px; line-height: 1; cursor: pointer; transition: background .15s ease, border-color .15s ease; }
.npv-arrow:hover { background: var(--bg3); border-color: var(--accent); }
.npv-prev { left: 24px; }
.npv-next { right: 24px; }
@media (max-width: 760px) { .npv-arrow { display: none; } .npv-title { font-size: 18px; } }

/* Custom tooltip (replaces native title="") — floating, styled, smart-placed */
.tip { position: fixed; left: 0; top: 0; z-index: 9999; pointer-events: none; max-width: 260px;
  background: color-mix(in srgb, var(--bg2) 92%, var(--accent)); color: var(--text);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border)); border-radius: 8px;
  padding: 6px 10px; font-size: 12px; line-height: 1.4; font-weight: 500; white-space: normal;
  box-shadow: 0 10px 30px rgba(0,0,0,.5); opacity: 0; transform: translateY(-3px);
  transition: opacity .12s ease, transform .12s ease; }
.tip.show { opacity: 1; transform: none; }
.tip::after { content: ''; position: absolute; left: var(--tip-arrow, 50%); transform: translateX(-50%);
  border: 5px solid transparent; }
.tip[data-placement="bottom"]::after { bottom: 100%; border-bottom-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.tip[data-placement="top"]::after { top: 100%; border-top-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }

.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 300; padding: 20px; animation: overlayIn .2s ease; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.overlay[hidden] { display: none; }
.modal { background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; width: 420px; max-width: 100%; max-height: 85vh; overflow-y: auto; padding: 22px; box-shadow: 0 24px 70px rgba(0,0,0,.6); animation: dialogPop .2s ease; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h3 { font-size: 18px; font-weight: 700; }
.modal-section { margin-bottom: 18px; }
.modal-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--mute); font-weight: 700; margin-bottom: 10px; }
/* unified dialogs (alert/confirm/prompt) */
.dialog { width: 400px; } /* pop animation comes from .modal */
@keyframes dialogPop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.dialog .modal-head { margin-bottom: 12px; }
.dialog-msg { font-size: 14px; color: var(--text); line-height: 1.5; margin-bottom: 16px; white-space: pre-wrap; word-break: break-word; }
/* loader dialog: centered spinner + message for multi-second operations */
.loader-dialog { text-align: center; }
.loader-spin { width: 34px; height: 34px; margin: 6px auto 14px; border: 3px solid color-mix(in srgb, var(--accent) 25%, transparent); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.loader-msg { margin-bottom: 0; text-align: center; }
/* playlist stats modal */
.stats-box { display: flex; flex-direction: column; }
.stat-row { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; padding: 12px 4px; border-bottom: 1px solid var(--border); font-size: 14px; }
.stat-row:last-child { border-bottom: none; }
.stat-k { color: var(--dim); }
.stat-v { color: var(--text); font-weight: 700; text-align: right; }
.stat-note { color: var(--mute); font-weight: 400; font-size: 12px; }
.dialog-input { width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 10px 12px; font-size: 14px; outline: none; margin-bottom: 18px; }
.dialog-input:focus { border-color: var(--accent); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.dialog-actions button { background: var(--bg3); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 8px 16px; font-size: 13px; font-weight: 600; }
.dialog-actions button:hover { border-color: var(--accent); }
.dialog-actions .dlg-ok { background: var(--accent); color: var(--bg); border-color: transparent; }
.dialog-actions .dlg-ok:hover { filter: brightness(1.1); }
.dialog-actions .dlg-ok.danger { background: var(--danger); color: #fff; }

.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.acct-link { display: inline-block; color: var(--accent2); text-decoration: none; font-size: 13px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg3); }
.acct-link:hover { border-color: var(--accent); color: var(--text); }
.theme-option { display: flex; align-items: center; gap: 10px; padding: 9px 11px; background: var(--bg3); border: 1px solid var(--border); color: var(--text); border-radius: 8px; font-size: 13px; text-align: left; transition: all .15s ease; }
.theme-option:hover { border-color: var(--accent); }
.theme-option.active { border-color: var(--accent); box-shadow: inset 2px 0 0 var(--accent); }
.theme-option.active::after { content: '✓'; margin-left: auto; color: var(--accent); font-weight: bold; }
.theme-swatch { width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg, var(--sw1) 0 50%, var(--sw2) 50% 100%); border: 1px solid rgba(255,255,255,.12); flex-shrink: 0; }

/* ── Mobile drawer backdrop ── */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 90; opacity: 0; pointer-events: none; transition: opacity .25s ease; }
.backdrop.show { opacity: 1; pointer-events: auto; }

/* ── Mobile layout ── */
@media (max-width: 760px) {
  #app { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .main { grid-column: 1; grid-row: 1; }
  .player { grid-column: 1; grid-row: 2; }

  /* Sidebar becomes a swipeable off-canvas drawer */
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 80%; max-width: 300px; z-index: 100; transform: translateX(-100%); transition: transform .28s ease; box-shadow: 0 0 40px rgba(0,0,0,.6); }
  .sidebar.open { transform: translateX(0); }

  .hamburger { display: flex; }
  .topbar { padding: 10px 12px; gap: 8px; }
  .content { padding: 16px 14px 24px; }
  .content h2 { font-size: 18px; }

  /* Tighter track rows */
  .row { gap: 8px; }

  /* Header actions wrap instead of overflowing (content clips overflow-x) */
  .pheader { gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
  .pheader h2 { flex-basis: 100%; font-size: 18px; }
  .pheader button, .sort-sel { padding: 7px 11px; font-size: 12px; }
  .pheader button.danger { margin-left: 0; } /* flow inline once wrapped, don't force to the far edge */
  .members { gap: 8px; }

  /* Player: now-playing + status on top row, controls span the bottom */
  .player { grid-template-columns: 1fr auto; grid-template-rows: auto auto; height: auto; padding: 8px 12px 10px; gap: 4px 10px; }
  .np { grid-column: 1; grid-row: 1; min-width: 0; }
  .np img { width: 42px; height: 42px; }
  .right { grid-column: 2; grid-row: 1; }
  .volwrap { display: none; }
  .controls { grid-column: 1 / -1; grid-row: 2; }
  .seekrow { max-width: none; }

  .modal { width: 100%; }
}

/* Hidden YouTube IFrame player — offscreen (not display:none, which can throttle playback) */
#ytWrap { position: fixed; left: -9999px; top: 0; width: 320px; height: 180px; pointer-events: none; opacity: 0; }

/* "Download all songs" toggle in the playlist header */
/* "Download all" pill toggle — styled switch around a visually-hidden checkbox */
.dl-toggle { display: inline-flex; align-items: center; gap: 9px; font-size: 13px; color: var(--dim); cursor: pointer; user-select: none; padding: 5px 13px 5px 9px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg3); transition: border-color .15s ease, color .15s ease, background .15s ease; }
.dl-toggle:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.dl-toggle input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.dl-switch { position: relative; width: 34px; height: 19px; border-radius: 999px; background: color-mix(in srgb, var(--text) 22%, transparent); transition: background .2s ease; flex-shrink: 0; }
.dl-knob { position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.45); transition: transform .2s ease; }
.dl-toggle input:checked ~ .dl-switch { background: var(--accent); }
.dl-toggle input:checked ~ .dl-switch .dl-knob { transform: translateX(15px); }
.dl-toggle:has(input:checked) { color: var(--text); border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); background: color-mix(in srgb, var(--accent) 12%, var(--bg3)); }
.dl-toggle:has(input:checked) .dl-toggle-label { color: var(--accent); font-weight: 600; }
.dl-toggle input:focus-visible ~ .dl-switch { outline: 2px solid var(--accent); outline-offset: 2px; }
.dl-toggle-label { white-space: nowrap; }

/* Settings: music-responsive toggles */
.exp-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border)); border-radius: 999px; padding: 1px 7px; margin-left: 6px; vertical-align: middle; }
.modal-hint { font-size: 12px; color: var(--mute); line-height: 1.5; margin: -2px 0 10px; }
.mr-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 2px; cursor: pointer; font-size: 14px; color: var(--text); border-bottom: 1px solid var(--border); user-select: none; }
.mr-toggle:last-of-type { border-bottom: none; }
.mr-toggle input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.mr-toggle input:checked ~ .dl-switch { background: var(--accent); }
.mr-toggle input:checked ~ .dl-switch .dl-knob { transform: translateX(15px); }
.mr-toggle input:focus-visible ~ .dl-switch { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Music-responsive effects — driven by --mr-level/--mr-bass/--mr-treble (0..1),
   set by the analyser loop in app.js; default to 0 when idle/disabled. */
/* Loudness — album art pulse + play-button & seek-thumb glow */
body.mr-loud .np img { transform: scale(calc(1 + var(--mr-level, 0) * 0.18)); transform-origin: center; transition: transform .04s linear; }
body.mr-loud .btns .play { box-shadow: 0 0 calc(var(--mr-level, 0) * 22px) color-mix(in srgb, var(--accent) 75%, transparent); }
body.mr-loud .player input[type=range]::-webkit-slider-thumb { box-shadow: 0 1px 4px rgba(0,0,0,.5), 0 0 calc(var(--mr-level, 0) * 12px) var(--accent); }
body.mr-loud .player input[type=range]::-moz-range-thumb { box-shadow: 0 0 calc(var(--mr-level, 0) * 12px) var(--accent); }

/* Bass — player bar glow only (snaps, no transition) */
body.mr-bass .player { box-shadow: 0 -6px 24px rgba(0,0,0,.25), 0 0 calc(6px + var(--mr-bass, 0) * 55px) color-mix(in srgb, var(--accent) calc(12% + var(--mr-bass, 0) * 58%), transparent); }

/* Spectrum ribbon — a live EQ across the top edge of the window. Bars hang down
   from the top; heights are set per-frame in JS. pointer-events:none so it never
   blocks the topbar underneath. */
#mrSpectrum { position: fixed; left: 0; right: 0; top: 0; height: 44px; display: none; align-items: flex-start; gap: 2px; padding: 0 6px; pointer-events: none; z-index: 155; opacity: .6; }
#mrSpectrum.show { display: flex; }
#mrSpectrum i { flex: 1 1 0; height: 100%; transform: scaleY(0); transform-origin: top; border-radius: 0 0 3px 3px; background: linear-gradient(to bottom, var(--accent), color-mix(in srgb, var(--accent) 10%, transparent)); }
/* Bottom placement — rests on top of the player bar (its bottom edge at the
   player's top), not over the controls. --player-h is set from JS. */
#mrSpectrum.pos-bottom { top: auto; bottom: var(--player-h, 96px); align-items: flex-end; }
#mrSpectrum.pos-bottom i { transform-origin: bottom; border-radius: 3px 3px 0 0; background: linear-gradient(to top, var(--accent), color-mix(in srgb, var(--accent) 10%, transparent)); }
/* Settings sub-option row (e.g. ribbon position) */
.mr-suboption { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 2px 8px 6px; font-size: 13px; color: var(--dim); }

/* Full-screen bump — the whole UI scales up with the bass envelope (zooms out
   on a hit, settles back). Scale UP only so no background gaps show at the edges. */
body.mr-bump #app { transform: scale(calc(1 + var(--mr-bass-abs, 0) * 0.03)); transform-origin: center center; transition: transform .05s linear; will-change: transform; }
#scPlayer { width: 320px; height: 166px; border: 0; }

/* ── Group view: two-column layout with chat on the right ── */
.group-layout { display: flex; gap: 18px; height: 100%; }
.group-main { flex: 1; min-width: 0; overflow-y: auto; padding-right: 4px; }
.group-chat { width: 320px; flex-shrink: 0; display: flex; flex-direction: column; border-left: 1px solid var(--border); min-height: 0; }
.chat-head { font-size: 13px; font-weight: 700; color: var(--text); padding: 4px 12px 10px; border-bottom: 1px solid var(--border); }
.chat-msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { display: flex; gap: 8px; align-items: flex-start; }
.chat-av { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--bg3); }
.chat-bubble { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px; min-width: 0; }
.chat-meta { display: flex; gap: 8px; align-items: baseline; margin-bottom: 2px; }
.chat-user { font-size: 12px; font-weight: 700; color: var(--text); }
.chat-time { font-size: 10px; color: var(--dim); }
.chat-body { font-size: 13px; color: var(--text); white-space: pre-wrap; word-break: break-word; line-height: 1.4; }
.chat-msg.mine { flex-direction: row-reverse; }
.chat-msg.mine .chat-bubble { border-color: var(--accent); background: var(--bg3); }
.chat-input { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); }
.chat-input input { flex: 1; min-width: 0; background: var(--bg2); border: 1px solid var(--border); color: var(--text); border-radius: 999px; padding: 8px 14px; font-size: 13px; outline: none; }
.chat-input input:focus { border-color: var(--accent); }
.chat-input button { flex-shrink: 0; background: var(--accent); color: #06120a; border: none; border-radius: 50%; width: 36px; height: 36px; font-size: 14px; cursor: pointer; }

/* Themed scrollbars for the app's scroll areas (mostly visible on desktop;
   phones use transient overlay bars). Firefox via scrollbar-*, WebKit via
   ::-webkit-scrollbar. The thumb is a translucent pill that accents on hover. */
.chat-msgs, .content, .sidebar, .menu, .search-panel { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--text) 24%, transparent) transparent; }
.chat-msgs::-webkit-scrollbar, .content::-webkit-scrollbar, .sidebar::-webkit-scrollbar, .menu::-webkit-scrollbar, .search-panel::-webkit-scrollbar { width: 10px; height: 10px; }
.chat-msgs::-webkit-scrollbar-track, .content::-webkit-scrollbar-track, .sidebar::-webkit-scrollbar-track, .menu::-webkit-scrollbar-track, .search-panel::-webkit-scrollbar-track { background: transparent; }
.chat-msgs::-webkit-scrollbar-thumb, .content::-webkit-scrollbar-thumb, .sidebar::-webkit-scrollbar-thumb, .menu::-webkit-scrollbar-thumb, .search-panel::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text) 22%, transparent);
  border-radius: 999px; border: 2px solid transparent; background-clip: padding-box;
}
.chat-msgs::-webkit-scrollbar-thumb:hover, .content::-webkit-scrollbar-thumb:hover, .sidebar::-webkit-scrollbar-thumb:hover, .menu::-webkit-scrollbar-thumb:hover, .search-panel::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--accent) 65%, var(--text)); background-clip: padding-box;
}

/* Group/Chat tab switch — only shown on narrow screens (see media query). */
.group-tabs { display: none; }
.gtab { flex: 1; padding: 10px; background: var(--bg3); border: 1px solid var(--border); border-radius: 9px; color: var(--dim); font-weight: 600; font-size: 13px; }
.gtab.active { background: var(--accent); color: var(--bg); border-color: transparent; }
.gtab .tab-dot { display: none; width: 7px; height: 7px; border-radius: 50%; background: var(--accent2, #4ea1ff); margin-left: 6px; vertical-align: middle; }
.gtab.has-unread .tab-dot { display: inline-block; }
.gtab.active .tab-dot { display: none; }
@media (max-width: 820px) {
  /* One full-height panel at a time (no nested page scroll), toggled by the tabs. */
  .group-tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-shrink: 0; }
  .group-layout { flex-direction: column; gap: 0; height: 100%; min-height: 0; }
  .group-main { overflow-y: auto; min-height: 0; padding-right: 0; flex: 1; }
  .group-chat { width: auto; border-left: none; border-top: none; min-height: 0; flex: 1; }
  .group-layout.tab-main .group-chat { display: none; }
  .group-layout.tab-chat .group-main { display: none; }
}

/* Unread group-chat bubble on the sidebar — sits at the far right (the "live"
   listening beacon is now an absolutely-positioned ball on the cover, so the two
   never collide). */
.list li .unread-badge { margin-left: auto; flex-shrink: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #06120a; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }

/* "Downloaded to server" indicator on track rows */
.dl-icon { color: var(--accent); font-size: 15px; line-height: 1; font-weight: 700; opacity: .9; flex-shrink: 0; cursor: default; }

/* "Friend is listening" avatar on a track row: profile image + listening animation */
.listeners .avatar { position: relative; overflow: visible; }
.listeners .avatar:not(:first-child) { margin-left: -5px; }
.listeners .avatar .avatar-init { position: relative; z-index: 0; }
.listeners .avatar .avatar-img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; z-index: 1; }
.listeners .avatar.listening { animation: listenerPulse 1.5s ease-out infinite; }
@keyframes listenerPulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 70%, transparent); } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.listeners .avatar .eq { position: absolute; right: -3px; bottom: -3px; z-index: 2; display: flex; align-items: flex-end; gap: 1px; height: 10px; padding: 1px 2px; background: var(--sidebar-bg); border-radius: 4px; }
.listeners .avatar .eq i { width: 2px; height: 3px; background: var(--accent); border-radius: 1px; animation: eqBar .9s ease-in-out infinite; }
.listeners .avatar .eq i:nth-child(2) { animation-delay: .3s; }
.listeners .avatar .eq i:nth-child(3) { animation-delay: .15s; }
@keyframes eqBar { 0%, 100% { height: 3px; } 50% { height: 9px; } }

/* Listener avatar sits right next to the song title (not pushed to the far right),
   and a bit bigger so the profile picture reads clearly. */
.t-meta .t-text { flex: 0 1 auto; }
.listeners .avatar { width: 28px; height: 28px; font-size: 11px; }

.menu button[disabled] { opacity: .5; cursor: default; }

/* In the group view, let the shared-playlist title shrink so the listener bubble
   sits right next to it (not pushed to the far-right corner). */
.group-main .list li .li-text { flex: 0 1 auto; }
.group-main .list li .listeners { margin-left: 4px; }

/* Download-state indicator now lives next to the song title — keep it from being squished. */
.t-meta .pill, .t-meta .dl-icon { flex-shrink: 0; }

/* Group member count on the right of the sidebar entry: person icon + number */
.list li .member-count { margin-left: auto; flex-shrink: 0; display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--mute); }
.list li:hover .member-count, .list li.active .member-count { color: var(--dim); }
.list li .member-count svg { opacity: .85; }
