/* ===================== FONT ===================== */
@font-face {
  font-family: "Figtree";
  src: url("/static/fonts/figtree-latin.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2013-2014, U+2018-201A,
    U+201C-201E, U+2020-2022, U+2026, U+2030, U+2039-203A, U+2044, U+2212, U+2215;
}
@font-face {
  font-family: "Figtree";
  src: url("/static/fonts/figtree-latin-ext.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ===================== TOKENS ===================== */
:root {
  color-scheme: dark;
  --bg: #000000;
  --bg-elev: #121212;
  --elev1: #181818;
  --elev2: #242424;
  --elev-hover: #2a2a2a;
  --fg: #ffffff;
  --muted: #b3b3b3;
  --muted-dim: #7a7a7a;
  --accent: #e6162d;
  --accent-hi: #ff2f42;
  --on-accent: #ffffff;
  --chip: #2a2a2a;
  --danger: #f15e6c;
  --radius: 8px;
  --sidebar-w: 240px;
  --nppanel-w: 340px;
  --player-h: 84px;
  /* Dynamic art-derived colors; player.js overrides these per song. */
  --tint: #3a2d3d;
  --np-grad-top: #5a3a3f;
  font-family: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  height: 100%;
  width: 100%;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-user-select: none;
  user-select: none;
  -webkit-text-size-adjust: 100%;
  -webkit-touch-callout: none;
}
body.app { user-select: text; }

a { color: inherit; text-decoration: none; }
img { display: block; }

/* Thin top progress bar shown during boosted (htmx) navigation — see
   #nav-progress in _shell.html. Invisible until .active, so it never flashes
   on fast loads but tells the user a slow page is genuinely still loading. */
#nav-progress {
  position: fixed;
  top: 0; left: 0;
  width: 0%;
  height: 3px;
  background: var(--accent);
  z-index: 9999;
  opacity: 0;
  transition: opacity .15s ease;
  pointer-events: none;
}
#nav-progress.active {
  opacity: 1;
  width: 70%;
  transition: width 6s cubic-bezier(.1,.6,.2,1), opacity .15s ease;
}

.ico { width: 24px; height: 24px; display: inline-block; vertical-align: middle; flex-shrink: 0; }
.ico.sm { width: 18px; height: 18px; }
.ico.lg { width: 30px; height: 30px; }

h1 { font-size: 2.2rem; font-weight: 800; letter-spacing: -0.02em; margin: 1.2rem 0 .8rem; }
h2 { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.01em; margin: 1.6rem 0 1rem; }
h3 { font-size: 1.1rem; font-weight: 700; margin: 0 0 .6rem; }
p.subtitle { color: var(--muted); margin: 0 0 1.8rem; font-size: .9rem; line-height: 1.5; }

/* ===================== BUTTONS / CHIPS ===================== */
button { font-family: inherit; cursor: pointer; }

.btn {
  border: none; border-radius: 999px; background: var(--accent); color: var(--on-accent);
  font-weight: 800; font-size: 1rem; padding: .85rem 2rem; transition: transform .1s, background .2s;
}
.btn:hover { background: var(--accent-hi); transform: scale(1.04); }
/* Any bare submit button gets the primary look so no form appears broken */
button[type="submit"]:not(.btn):not(.icon-btn) { border: none; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: .95rem; padding: .7rem 1.6rem; transition: transform .1s, background .2s; }
button[type="submit"]:not(.btn):not(.icon-btn):hover { background: var(--accent-hi); transform: scale(1.03); }
.btn-ghost { background: transparent; color: var(--fg); border: 1px solid var(--muted-dim); }
.btn-ghost:hover { border-color: var(--fg); background: transparent; }

.icon-btn {
  border: none; background: transparent; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px; border-radius: 50%; transition: color .15s, transform .1s, background .15s;
  min-width: 44px; min-height: 44px; -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { color: var(--fg); }
.icon-btn.active { color: var(--accent); }

.chips { display: flex; gap: .6rem; flex-wrap: wrap; margin: 0 0 1.4rem; }
.chip {
  border: none; background: var(--chip); color: var(--fg);
  padding: .5rem 1rem; border-radius: 999px; font-size: .9rem; font-weight: 600;
  transition: background .15s;
}
.chip:hover { background: var(--elev-hover); }
.chip.active { background: var(--fg); color: #000; }

/* ===================== APP GRID (desktop-first shell, collapses on mobile) ===================== */
.app-grid {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  height: 100dvh;
}

.sidebar { display: none; }
.np-panel { display: none; }

/* content column */
#content {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: linear-gradient(180deg, #1e1e1e 0%, var(--bg-elev) 240px, var(--bg-elev) 100%);
  padding-bottom: calc(var(--player-h) + 100px + env(safe-area-inset-bottom));
  overflow-x: hidden;
}
.container { max-width: 100vw; margin: 0 auto; padding: max(1rem, env(safe-area-inset-top)) max(1.2rem, env(safe-area-inset-left)) 2.8rem max(1.2rem, env(safe-area-inset-right)); overflow-x: hidden; }

/* mobile top profile row */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: .8rem;
  padding: calc(max(0.8rem, env(safe-area-inset-top))) max(1.2rem, env(safe-area-inset-left)) 0.8rem max(1.2rem, env(safe-area-inset-right));
  background: linear-gradient(180deg, rgba(0,0,0,.55), rgba(0,0,0,0));
}
.topbar .nav-arrows { display: none; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--accent);
  color: var(--on-accent); font-weight: 800; display: flex; align-items: center; justify-content: center;
  font-size: 1rem; border: none; flex-shrink: 0;
}
.account-menu { position: relative; }
.account-dropdown {
  display: none; position: absolute; top: 46px; left: 0;
  background: var(--elev2); border-radius: var(--radius); min-width: 170px;
  box-shadow: 0 8px 24px rgba(0,0,0,.5); z-index: 60; overflow: hidden; padding: 4px;
}
.account-menu.open .account-dropdown { display: block; }
.account-dropdown a { display: block; padding: .7rem .8rem; font-size: .9rem; border-radius: 4px; color: var(--fg); }
.account-dropdown a:hover { background: var(--elev-hover); }

/* ===================== HOME ===================== */
.section { margin: 2.2rem 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 1.2rem; }
.section-head h2 { margin: 0; font-size: 1.35rem; font-weight: 800; display: flex; align-items: center; gap: .55rem; }
.search-type-dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; flex-shrink: 0; }
.section-head .show-all { color: var(--muted); font-size: .75rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.section-head .show-all:hover { color: var(--fg); }

.shortcut-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .55rem; margin: 1rem 0 2rem; }
.shortcut {
  display: flex; align-items: center; gap: .7rem; background: rgba(255,255,255,.1);
  border-radius: 4px; overflow: hidden; height: 56px; transition: background .2s, transform .15s;
  cursor: pointer;
}
.shortcut:active { transform: scale(0.98); }
.shortcut:hover { background: rgba(255,255,255,.14); }
.shortcut img, .shortcut .sc-art {
  width: 56px; height: 56px; object-fit: cover; flex-shrink: 0; background: var(--elev2);
  display: flex; align-items: center; justify-content: center; color: var(--accent);
  font-size: 1.4rem;
}
.shortcut .sc-name { font-weight: 700; font-size: .8rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; flex: 1; padding-right: .5rem; }

.card-row { display: grid; grid-auto-flow: column; grid-auto-columns: clamp(140px, 40vw, 180px); gap: 1rem; overflow-x: auto; padding: .6rem 0 1rem; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.card-row::-webkit-scrollbar { display: none; }
.media-card { background: transparent; border-radius: 8px; padding: 0; transition: all .2s; cursor: pointer; display: flex; flex-direction: column; min-width: 0; }
.media-card:active { transform: scale(0.98); }
.media-card .mc-art {
  width: 100%; aspect-ratio: 1; border-radius: 8px; object-fit: cover; margin-bottom: 1rem;
  background: var(--elev2); box-shadow: 0 8px 20px rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center; color: var(--accent);
  font-size: 2rem;
}
.media-card.round .mc-art { border-radius: 50%; }
.media-card .mc-title { font-weight: 700; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; min-height: 2.6em; }
.media-card .mc-sub { color: var(--muted); font-size: .8rem; margin-top: .4rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===================== TRACK ROWS ===================== */
.track-list { display: flex; flex-direction: column; gap: .6rem; }
.track-row {
  display: flex; align-items: center; gap: .9rem; padding: 1rem .7rem; border-radius: 8px;
  cursor: pointer; transition: background .15s; user-select: none;
  border-bottom: none;
  background: rgba(255,255,255,.02);
}
.track-row:active { transform: scale(0.99); }
.track-row:hover { background: rgba(255,255,255,.08); }
.track-row .tr-art { width: 52px; height: 52px; border-radius: 6px; object-fit: cover; background: var(--elev2); flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--accent); font-size: 1.4rem; }
.track-row .tr-main { flex: 1; min-width: 0; }
.track-row .tr-title { font-weight: 600; font-size: .98rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-row .tr-sub { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: .3rem; }
.track-row .tr-genre {
  flex-shrink: 0; color: var(--muted); font-size: .78rem; padding: .25rem .65rem;
  border: 1px solid rgba(255,255,255,.15); border-radius: 999px; white-space: nowrap;
}
.track-row .tr-genre:hover { color: var(--fg); border-color: rgba(255,255,255,.35); }
@media (max-width: 640px) { .track-row .tr-genre { display: none; } }
.track-row .tr-actions { display: flex; align-items: center; gap: .4rem; flex-shrink: 0; opacity: 0.7; }
.track-row:hover .tr-actions { opacity: 1; }
.track-row .icon-btn .ico { width: 20px; height: 20px; }

/* ===================== BOTTOM NAV (mobile) ===================== */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex; height: 56px;
  background: linear-gradient(180deg, rgba(10,10,10,.82), rgba(5,5,5,.96) 40%, #050505);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  padding: 8px max(0, env(safe-area-inset-left)) max(12px, env(safe-area-inset-bottom)) max(0, env(safe-area-inset-right));
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--muted); font-size: .65rem; font-weight: 600; min-height: 44px; -webkit-tap-highlight-color: transparent;
}
.nav-item .ico { width: 24px; height: 24px; min-width: 24px; }
.nav-item.active { color: var(--fg); }

/* ===================== PLAYER BAR ===================== */
.player-bar {
  position: fixed; left: 8px; right: 8px; bottom: calc(62px + max(12px, env(safe-area-inset-bottom)) + 8px); z-index: 45;
  background-color: var(--tint);
  background-image: linear-gradient(rgba(0,0,0,.28), rgba(0,0,0,.28));
  border-radius: 6px; overflow: hidden;
  box-shadow: 0 6px 18px rgba(0,0,0,.4);
  transition: background-color .5s ease;
}
.player-bar.empty { display: none; }
.pb-left { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; min-width: 0; }
.pb-left .pb-art { width: 44px; height: 44px; border-radius: 4px; object-fit: cover; background: var(--elev2); flex-shrink: 0; }
.pb-meta { flex: 1; min-width: 0; }
.pb-title { font-weight: 700; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-artist { color: var(--muted); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-left .icon-btn { color: var(--fg); }
.pb-mini-play { margin-left: auto; }
.pb-center, .pb-right { display: none; }
.pb-progress-line { height: 3px; background: rgba(255,255,255,.2); }
.pb-progress-line > span { display: block; height: 100%; width: 0%; background: var(--fg); }

/* scrubber (shared) */
.scrubber { display: flex; align-items: center; gap: .6rem; width: 100%; font-size: .72rem; color: var(--muted); }
.scrubber .bar { flex: 1; height: 4px; background: rgba(255,255,255,.25); border-radius: 2px; position: relative; cursor: pointer; }
.scrubber .bar > .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0%; background: var(--fg); border-radius: 2px; }
.scrubber .bar:hover > .fill { background: var(--accent); }

/* ===================== NOW PLAYING (mobile fullscreen) ===================== */
.now-playing {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column;
  padding: max(1rem, env(safe-area-inset-top)) max(1.2rem, env(safe-area-inset-right)) calc(1.4rem + env(safe-area-inset-bottom)) max(1.2rem, env(safe-area-inset-left));
  background: linear-gradient(180deg, var(--np-grad-top) 0%, #121212 65%, #000 100%);
  transition: background .5s ease;
}
.now-playing.hidden, .queue-sheet.hidden { display: none; }
.np-top { display: flex; align-items: center; justify-content: space-between; color: var(--fg); }
.np-top .np-label { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .85; }
.np-art-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 1.5rem 0; }
.np-art { width: clamp(240px, min(78vw, calc(100vw - 2.4rem)), 360px); aspect-ratio: 1; border-radius: 10px; object-fit: cover; background: var(--elev2); box-shadow: 0 16px 40px rgba(0,0,0,.5); }
.np-headline { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .3rem; }
.np-headline .np-title { font-size: 1.5rem; font-weight: 800; }
.np-headline .np-artist { color: var(--muted); font-size: 1rem; margin-top: .1rem; }
.np-scrubber { margin: 1rem 0 .5rem; }
.np-controls { display: flex; align-items: center; justify-content: space-between; margin-top: .4rem; }
.np-controls .icon-btn { color: var(--fg); }
.np-controls .icon-btn.active { color: var(--accent); }
.np-controls .icon-btn { min-width: 44px; min-height: 44px; }
.np-controls .icon-btn .ico { width: 30px; height: 30px; }
.np-play-big {
  width: 64px; height: 64px; border-radius: 50%; background: var(--fg); color: #000;
  display: flex; align-items: center; justify-content: center; border: none; transition: transform .1s;
}
.np-play-big:hover { transform: scale(1.06); }
.np-play-big .ico { width: 30px; height: 30px; }
.np-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 1.2rem; color: var(--muted); }

/* ===================== QUEUE SHEET ===================== */
.queue-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 110; max-height: 78vh; overflow-y: auto;
  background: var(--bg-elev); border-radius: 14px 14px 0 0; padding: 1rem 1.1rem 2rem;
  box-shadow: 0 -8px 30px rgba(0,0,0,.6);
}
.queue-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.queue-head h3 { margin: 0; }
.queue-item { padding: .7rem .5rem; border-radius: 6px; cursor: pointer; display: flex; gap: .7rem; align-items: center; }
.queue-item:hover { background: rgba(255,255,255,.08); }
.queue-item.active .qi-title { color: var(--accent); }
.qi-title { font-weight: 600; font-size: .92rem; }
.qi-sub { color: var(--muted); font-size: .8rem; }

/* ===================== FORMS ===================== */
input[type="text"], input[type="url"], input[type="password"], textarea, .search-field {
  width: 100%; padding: .8rem 1rem; border-radius: 6px; border: none;
  background: var(--elev2); color: var(--fg); font-size: 1rem; font-family: inherit;
}
input::placeholder, textarea::placeholder { color: var(--muted-dim); }
.search-big {
  display: flex; align-items: center; gap: .6rem; background: #fff; color: #000;
  border-radius: 8px; padding: .9rem 1rem; margin-bottom: 1.6rem; min-height: 44px;
}
.search-big input { background: transparent; color: #000; padding: 0; font-weight: 500; font-size: 1rem; }
.search-big .ico { color: #000; flex-shrink: 0; }
.link-form { display: flex; gap: .5rem; margin: 1.2rem 0; }

.error { background: rgba(241,94,108,.15); color: var(--danger); padding: 1rem 1.2rem; border-radius: 8px; margin-bottom: 1.2rem; font-size: .9rem; border-left: 3px solid var(--danger); }
.empty { color: var(--muted); text-align: center; padding: 4rem 1.5rem; font-size: .95rem; }

/* browse tiles (search) */
.browse-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1rem; }
.browse-tile { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; padding: 1.2rem; font-weight: 800; font-size: 1.1rem; display: flex; align-items: flex-end; min-height: 140px; }

/* status pills (downloads/jobs) */
.status {
  font-size: .8rem; font-weight: 700; padding: .4rem .9rem;
  border-radius: 6px; white-space: nowrap; display: inline-flex; align-items: center; gap: .4rem;
  backdrop-filter: blur(4px);
}
.status-pending { background: rgba(179,179,179,.2); color: var(--muted); }
.status-downloading { background: rgba(230,22,45,.25); color: #ffffff; font-weight: 800; }
.status-done { background: rgba(29,185,84,.25); color: #1db954; font-weight: 800; }
.status-failed { background: rgba(241,94,108,.3); color: var(--danger); font-weight: 800; }
.status-cancelled { background: rgba(179,179,179,.15); color: var(--muted-dim); }
.status-duplicate { background: rgba(230,22,45,.2); color: #ffffff; }

/* Track row status indicators */
.job-track-row.status-done { border-left-color: #1db954; background: rgba(29,185,84,.08); }
.job-track-row.status-downloading { border-left-color: var(--accent); background: rgba(230,22,45,.12); padding: 1rem .6rem; margin-bottom: .4rem; border-radius: 8px; }
.job-track-row.status-failed { border-left-color: var(--danger); background: rgba(241,94,108,.1); }
.job-track-row.status-duplicate { border-left-color: var(--accent); background: rgba(230,22,45,.05); }
.job-track-row.status-pending, .job-track-row.status-queued { border-left-color: var(--muted-dim); background: rgba(179,179,179,.03); }

/* overall job progress bar */
.job-progress { margin: 1.2rem 0 1.6rem; padding: 1rem 0; border-radius: 12px; }
.job-progress-head {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  font-size: .95rem; color: var(--muted); margin-bottom: 1rem;
}
.job-progress-head strong { color: var(--fg); font-size: 1.15rem; font-weight: 700; }
.job-progress-pct { font-weight: 900; color: var(--accent); text-align: right; font-size: 1.4rem; }
.job-progress-bar {
  height: 16px; background: rgba(0,0,0,.6); border-radius: 999px; overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0,0,0,.8), 0 2px 8px rgba(230, 22, 45, 0.4);
  border: 1px solid rgba(230, 22, 45, 0.25);
}
.job-progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-hi));
  border-radius: 999px;
  box-shadow: 0 0 16px rgba(230, 22, 45, 0.7);
}
.job-progress-fill.pulsing {
  animation: jobPulse 1.5s ease-in-out infinite;
}
@keyframes jobPulse { 0%,100% { box-shadow: 0 0 12px rgba(230, 22, 45, 0.6); } 50% { box-shadow: 0 0 20px rgba(230, 22, 45, 0.8); } }

/* per-track indeterminate download bar */
.dl-bar {
  position: relative; height: 6px; background: rgba(255,255,255,.1);
  border-radius: 3px; overflow: hidden; margin-top: .6rem; width: 100%; max-width: 100%;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.5);
}
.dl-bar > span {
  position: absolute; top: 0; bottom: 0; left: 0; width: 30%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hi));
  border-radius: 3px; animation: dlSlide 1.2s ease-in-out infinite;
  box-shadow: 0 0 8px rgba(230, 22, 45, 0.6);
}
@keyframes dlSlide { 0% { left: -30%; } 100% { left: 100%; } }

/* delete / cancel buttons */
.cancel-btn { background: transparent; border: 1px solid var(--muted-dim); color: var(--fg); border-radius: 999px; padding: .5rem 1.2rem; font-weight: 700; font-size: .85rem; }
.cancel-btn:hover { border-color: var(--danger); color: var(--danger); }
.tr-actions .danger:hover { color: var(--danger); }
.job-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.downloads-btn { color: var(--muted); font-weight: 700; }
.downloads-btn:hover { color: var(--fg); }

/* ===================== DESKTOP (Spotify full layout) ===================== */
@media (min-width: 1000px) {
  body { padding: 8px; background: var(--bg); }
  .app-grid {
    gap: 8px;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: 1fr var(--player-h);
    grid-template-areas: "sidebar main" "player player";
    height: calc(100dvh - 16px);
  }
  .app-grid.np-open { grid-template-columns: var(--sidebar-w) 1fr var(--nppanel-w); grid-template-areas: "sidebar main npanel" "player player player"; }

  /* SIDEBAR */
  .sidebar { display: flex; grid-area: sidebar; flex-direction: column; gap: 8px; min-height: 0; }
  .side-nav { background: var(--bg-elev); border-radius: var(--radius); padding: .5rem .3rem; }
  .side-nav .brand { display: flex; align-items: center; gap: .5rem; padding: .8rem 1rem .5rem; font-weight: 900; font-size: 1.15rem; letter-spacing: .14em; }
  .side-nav .brand .brand-mark { width: 26px; height: 26px; color: var(--accent); }
  .side-link { display: flex; align-items: center; gap: 1rem; padding: .7rem 1rem; color: var(--muted); font-weight: 700; border-radius: 4px; }
  .side-link:hover { color: var(--fg); }
  .side-link.active { color: var(--fg); }
  .side-library { background: var(--bg-elev); border-radius: var(--radius); flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
  .side-library-head { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1rem; color: var(--muted); font-weight: 700; }
  .side-library-head:hover { color: var(--fg); }
  .side-library-list { overflow-y: auto; padding: 0 .4rem .6rem; }
  .side-pl { display: flex; align-items: center; gap: .7rem; padding: .5rem; border-radius: 6px; }
  .side-pl:hover { background: var(--elev1); }
  .side-pl .sp-art { width: 46px; height: 46px; border-radius: 5px; object-fit: cover; background: var(--elev2); flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--muted-dim); }
  .side-pl .sp-name { font-weight: 600; font-size: .9rem; }
  .side-pl .sp-sub { color: var(--muted); font-size: .78rem; }

  /* MAIN */
  #content { grid-area: main; border-radius: var(--radius); background: linear-gradient(180deg, #2a2a2a 0%, var(--bg-elev) 260px, var(--bg-elev) 100%); }
  .container { max-width: 1400px; padding: 0 1.5rem 2rem; }
  .topbar { border-radius: var(--radius) var(--radius) 0 0; padding: .8rem 1.5rem; background: rgba(0,0,0,.3); backdrop-filter: blur(8px); justify-content: flex-end; }
  .topbar .nav-arrows { display: flex; gap: .5rem; margin-right: auto; }
  .topbar .nav-arrows .icon-btn { background: rgba(0,0,0,.5); color: var(--fg); }

  .shortcut-grid { grid-template-columns: repeat(4, 1fr); gap: .6rem; }
  .card-row { grid-auto-columns: 180px; }
  .card-row--wrap { display: grid; grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); overflow-x: visible; }

  /* NOW PLAYING PANEL (right) — only when a track is active */
  .np-panel { display: none; grid-area: npanel; flex-direction: column; background: var(--bg-elev); border-radius: var(--radius); overflow-y: auto; padding: 1rem; }
  .app-grid.np-open .np-panel { display: flex; }
  .np-panel .npp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; font-weight: 700; }
  .np-panel .npp-art { width: 100%; aspect-ratio: 1; border-radius: 8px; object-fit: cover; background: var(--elev2); margin-bottom: 1rem; }
  .np-panel .npp-title { font-size: 1.4rem; font-weight: 800; }
  .np-panel .npp-artist { color: var(--muted); margin-top: .2rem; }

  /* PLAYER BAR full width */
  .player-bar { position: static; grid-area: player; left: auto; right: auto; bottom: auto;
    background: transparent; box-shadow: none; border-radius: 0;
    display: grid; grid-template-columns: 30% 40% 30%; align-items: center; gap: 1rem; padding: 0 1rem; }
  .player-bar.empty { display: grid; }
  .pb-left { padding: 0; }
  .pb-left .pb-art { width: 56px; height: 56px; }
  .pb-mini-play, .pb-progress-line { display: none; }
  .pb-center { display: flex; flex-direction: column; align-items: center; gap: .4rem; }
  .pb-transport { display: flex; align-items: center; gap: 1.1rem; }
  .pb-transport .icon-btn { color: var(--muted); }
  .pb-transport .icon-btn:hover { color: var(--fg); }
  .pb-transport .icon-btn.active { color: var(--accent); }
  .pb-play-btn { width: 40px; height: 40px; border-radius: 50%; background: var(--fg); color: #000; display: flex; align-items: center; justify-content: center; border: none; transition: transform .1s; }
  .pb-play-btn:hover { transform: scale(1.06); }
  .pb-play-btn .ico { width: 20px; height: 20px; }
  .pb-right { display: flex; align-items: center; justify-content: flex-end; gap: .6rem; }
  .volume-control { display: flex; align-items: center; gap: .5rem; }
  .volume-bar { width: 90px; height: 4px; background: rgba(255,255,255,.25); border-radius: 2px; position: relative; cursor: pointer; }
  .volume-bar > .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; background: var(--fg); border-radius: 2px; }
  .volume-bar:hover > .fill { background: var(--accent); }

  /* hide mobile-only chrome */
  .bottom-nav { display: none; }
  .topbar .account-menu { display: block; }
  #content { padding-bottom: 1rem; }
}

/* ===================== SUPPORT BUTTON ===================== */
.support-btn {
  position: fixed; top: calc(max(16px, env(safe-area-inset-top)) + 8px); right: calc(max(16px, env(safe-area-inset-right)) + 8px); z-index: 999;
  width: 52px; height: 52px; border-radius: 50%; border: none;
  background: #e6162d !important; color: #fff !important; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(230, 22, 45, 0.5);
  transition: transform .2s, box-shadow .2s, opacity .3s;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit; font-size: 16px;
  padding: 0; margin: 0;
}
.support-btn svg { color: #fff !important; fill: #fff !important; }
.support-btn:hover { transform: scale(1.1); box-shadow: 0 6px 16px rgba(230, 22, 45, 0.7); }
.support-btn:active { transform: scale(0.95); }
.support-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.support-btn.loading { animation: supportPulse .8s ease-in-out infinite; }
@keyframes supportPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.support-btn .ico { width: 24px; height: 24px; }

.support-toast {
  position: fixed; top: max(70px, calc(env(safe-area-inset-top) + 60px)); left: 50%; transform: translateX(-50%);
  z-index: 1000; background: var(--elev2); color: var(--fg);
  padding: .8rem 1rem; border-radius: 8px; border: 1px solid var(--elev1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  font-size: .9rem; font-weight: 600; white-space: nowrap;
  animation: slideDown .3s ease;
}
.play-all-btn {
  flex-shrink: 0; width: 54px; height: 54px; border-radius: 50%; border: none;
  background: var(--accent); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(230, 22, 45, .45);
  transition: transform .12s, box-shadow .2s, background .2s;
}
.play-all-btn:hover { background: var(--accent-hi); transform: scale(1.06); }
.play-all-btn:active { transform: scale(.95); }
.play-all-btn svg { width: 26px; height: 26px; margin-left: 2px; }

.support-toast.hidden { display: none; }
@keyframes slideDown { from { opacity: 0; transform: translateX(-50%) translateY(-20px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* Support note modal */
.support-modal {
  position: fixed; inset: 0; z-index: 1001;
  background: rgba(0, 0, 0, .6); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 1.2rem;
  animation: supportFade .2s ease;
}
.support-modal.hidden { display: none; }
@keyframes supportFade { from { opacity: 0; } to { opacity: 1; } }
.support-sheet {
  width: 100%; max-width: 440px; background: var(--bg-elev, #17171c);
  border: 1px solid var(--border, #2a2a2a); border-radius: 16px;
  padding: 1.4rem; box-shadow: 0 20px 50px rgba(0, 0, 0, .6);
}

@media (min-width: 1000px) {
  .support-btn { top: 16px; right: 24px; width: 50px; height: 50px; }
  .support-toast { top: 80px; }
}

/* hide desktop sidebar profile on mobile handled by default (sidebar display:none) */
@media (max-width: 999px) {
  .app-grid.np-open { grid-template-columns: 1fr; }
}

/* ===== Friends & Messaging ===== */
.nav-badge { background: var(--accent); color: #fff; font-weight: 800; font-size: .72rem;
  padding: .05rem .45rem; border-radius: 99px; margin-left: .3rem; }
.avatar-dot { position: absolute; top: -2px; right: -2px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }
.account-menu .avatar { position: relative; }

.friend-avatar { width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #7a0a17); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.3rem;
  text-decoration: none; }
.friend-section-label { font-size: .75rem; text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--muted); margin-bottom: .5rem; font-weight: 700; }
.pl-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .9rem;
  background: var(--elev2, #1f1f26); border-radius: 99px; color: var(--fg); text-decoration: none;
  font-size: .9rem; font-weight: 600; }
.pl-chip:hover { background: var(--elev1, #2a2a33); }
.pl-chip .ico { width: 16px; height: 16px; color: var(--accent); }

/* Playlists index — framed list rows (support ticket #5) */
.pl-create { display: flex; gap: .6rem; align-items: center; margin-bottom: 1.4rem; }
.pl-create-input { flex: 1; min-width: 0; padding: .75rem 1rem; border-radius: var(--radius);
  border: 1px solid var(--elev2); background: var(--elev1); color: var(--fg); font-size: 1rem; }
.pl-create-input::placeholder { color: var(--muted-dim); }
.pl-create-input:focus { outline: none; border-color: var(--accent); }
.pl-create button[type="submit"] { flex: 0 0 auto; }

.pl-list { display: flex; flex-direction: column; gap: .6rem; }
.pl-row { display: flex; align-items: center; gap: .9rem; padding: .7rem .8rem;
  background: var(--elev1); border-radius: 10px; text-decoration: none; color: var(--fg);
  transition: background .15s; }
.pl-row:hover { background: var(--elev-hover); }
.pl-row:active { background: var(--elev2); }
.pl-row-art { flex: 0 0 auto; width: 48px; height: 48px; border-radius: 8px;
  background: var(--elev2); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pl-row-art .ico { width: 22px; height: 22px; color: var(--accent); }
.pl-row-art-img { width: 100%; height: 100%; border-radius: 8px; object-fit: cover; }
.pl-row-art .cover-collage { width: 100%; height: 100%; }
.pl-row-meta { flex: 1; min-width: 0; }
.pl-row-title { font-weight: 700; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-row-sub { color: var(--muted); font-size: .82rem; margin-top: .15rem; }
.pl-row-chevron { flex: 0 0 auto; color: var(--muted-dim); display: flex; }
.pl-row-chevron .ico { width: 18px; height: 18px; }

.convo-row { display: flex; align-items: center; gap: .8rem; padding: .7rem .8rem;
  border-radius: 12px; text-decoration: none; color: var(--fg); background: var(--card, #141419); }
.convo-row:hover { background: var(--elev1, #1f1f26); }
.convo-row.unread { border-left: 3px solid var(--accent); }
.convo-row .friend-avatar { width: 44px; height: 44px; font-size: 1.1rem; }
.convo-preview { display: block; color: var(--muted); font-size: .85rem; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; max-width: 60vw; }

/* Conversation thread */
.convo-container { display: flex; flex-direction: column; height: calc(100vh - 120px); max-height: 100%; }
.convo-head { display: flex; align-items: center; gap: .8rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border, #262630); }
.convo-thread { flex: 1; overflow-y: auto; padding: 1rem .2rem; display: flex; flex-direction: column; gap: .5rem; }
.msg-row { display: flex; }
.msg-row.mine { justify-content: flex-end; }
.msg-bubble { max-width: 78%; padding: .6rem .8rem; border-radius: 16px; background: var(--elev2, #22222b); }
.msg-row.mine .msg-bubble { background: var(--accent); color: #fff; }
.msg-text { white-space: pre-wrap; word-break: break-word; line-height: 1.4; }
.msg-time { font-size: .68rem; opacity: .6; margin-top: .25rem; text-align: right; }
.msg-bubble .shared-track { background: rgba(0,0,0,.25); border-radius: 10px; margin: .3rem 0; padding: .4rem; cursor: pointer; min-width: 210px; }
.msg-bubble .shared-track .tr-art { width: 42px; height: 42px; border-radius: 6px; }
.shared-play { margin-left: auto; color: currentColor; }
.shared-playlist { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: inherit;
  background: rgba(0,0,0,.25); border-radius: 10px; padding: .5rem .6rem; margin: .3rem 0; min-width: 200px; }
.shared-playlist .ico { color: var(--accent); width: 26px; height: 26px; }

.convo-compose { display: flex; gap: .5rem; padding-top: .8rem; border-top: 1px solid var(--border, #262630); }
.convo-compose input { flex: 1; padding: .8rem 1rem; border-radius: 99px; border: 1px solid var(--border, #2a2a33);
  background: var(--bg); color: var(--fg); font-family: inherit; font-size: .95rem; }
.convo-send { border-radius: 50%; width: 46px; height: 46px; padding: 0; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; }

/* Share modal */
.share-modal { position: fixed; inset: 0; z-index: 1001; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; padding: 1.2rem; }
.share-modal.hidden { display: none; }
.share-sheet { width: 100%; max-width: 400px; background: var(--bg-elev, #17171c);
  border: 1px solid var(--border, #2a2a2a); border-radius: 16px; padding: 1.3rem; box-shadow: 0 20px 50px rgba(0,0,0,.6); }
.share-friend-list { display: flex; flex-direction: column; gap: .4rem; margin: 1rem 0; max-height: 50vh; overflow-y: auto; }
.share-friend { display: flex; align-items: center; gap: .7rem; padding: .6rem .7rem; border-radius: 10px;
  background: var(--elev2, #1f1f26); border: none; color: var(--fg); cursor: pointer; font-size: .95rem; font-weight: 600; text-align: left; width: 100%; }
.share-friend:hover { background: var(--accent); color: #fff; }
.share-friend .friend-avatar { width: 36px; height: 36px; font-size: 1rem; }

/* ===== Settings ===== */
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 0; border-bottom: 1px solid var(--border, #1f1f26); cursor: pointer; }
.setting-name { font-weight: 700; display: block; }
.setting-desc { display: block; color: var(--muted); font-size: .84rem; margin-top: .2rem; line-height: 1.4; }
.settings-input { padding: .7rem .9rem; border-radius: 8px; border: 1px solid var(--border, #2a2a33);
  background: var(--bg); color: var(--fg); font-family: inherit; font-size: .95rem; width: 100%; }

.switch { appearance: none; -webkit-appearance: none; width: 48px; height: 28px; border-radius: 99px;
  background: var(--elev2, #2a2a2a); position: relative; cursor: pointer; flex-shrink: 0; transition: background .2s; }
.switch:checked { background: var(--accent); }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; transition: transform .2s; }
.switch:checked::after { transform: translateX(20px); }

/* Larger-text accessibility mode */
html.big-text { font-size: 18.5px; }

/* Support ticket number */
.ticket-no { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .8rem; font-weight: 700;
  background: var(--elev2, #242424); color: var(--accent); padding: .12rem .5rem; border-radius: 6px; letter-spacing: .5px; }

/* ===== Track row actions: inline on desktop, bottom-sheet on mobile (MP-00004/7) ===== */
.row-menu-btn { display: none; flex-shrink: 0; }
.action-label { display: none; }

/* Mobile: hide inline buttons and use the ⋯ button, which opens a bottom sheet.
   The inline buttons stay in the DOM (the sheet triggers them), so long song
   names get the full row width and taps can never fall through to a row. */
@media (max-width: 999px) {
  .row-menu-btn { display: inline-flex; }
  .track-row .tr-actions { display: none; }
}

/* Bottom action sheet (mobile track options) */
.track-sheet { position: fixed; inset: 0; z-index: 1002; display: flex; align-items: flex-end;
  background: rgba(0,0,0,.55); animation: supportFade .18s ease; }
.track-sheet.hidden { display: none; }
.track-sheet-panel { width: 100%; background: var(--elev2, #1c1c23); border-radius: 18px 18px 0 0;
  padding: .5rem .6rem calc(1rem + env(safe-area-inset-bottom)); box-shadow: 0 -12px 40px rgba(0,0,0,.6);
  animation: sheetUp .2s ease; }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.track-sheet-title { font-weight: 800; font-size: 1.05rem; padding: .7rem 1rem .3rem; color: var(--fg);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-item { display: flex; align-items: center; gap: 1rem; width: 100%; min-height: 54px;
  padding: 0 1rem; border: none; background: transparent; color: var(--fg); font-size: 1.02rem;
  font-weight: 600; border-radius: 10px; text-align: left; }
.sheet-item:active { background: rgba(255,255,255,.08); }
.sheet-item.danger { color: var(--danger); }
.sheet-item svg { width: 22px; height: 22px; flex-shrink: 0; }

/* Desktop: no ⋯, actions inline as before. */
@media (min-width: 1000px) {
  .row-menu-btn { display: none; }
  .track-row .tr-actions { display: flex; }
  .action-label { display: none; }
}

/* Download-whole-playlist button */
.playlist-dl-btn { display: inline-flex; align-items: center; gap: .45rem; width: auto;
  padding: .5rem .9rem; border-radius: 99px; background: var(--elev2, #242424); color: var(--fg);
  min-height: 40px; font-weight: 700; font-size: .85rem; }
.playlist-dl-btn:hover { background: var(--elev-hover, #2a2a2a); color: var(--fg); }
.playlist-dl-btn .ico { width: 18px; height: 18px; }
.playlist-dl-btn:disabled { opacity: .7; }

/* ===== Upgrade overlay (old insecure address) ===== */
.upgrade-overlay { position: fixed; inset: 0; z-index: 3000; background: #000;
  display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.upgrade-overlay.hidden { display: none; }
.upgrade-card { max-width: 380px; text-align: center; background: var(--elev2, #1c1c23);
  border: 1px solid rgba(255,255,255,.08); border-radius: 20px; padding: 2rem 1.6rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.upgrade-mark { width: 64px; height: 64px; margin: 0 auto 1rem; border-radius: 16px;
  background: rgba(230,22,45,.15); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.upgrade-mark svg { width: 36px; height: 36px; }
.upgrade-card h2 { margin: 0 0 .5rem; font-size: 1.5rem; }
.upgrade-card p { color: var(--muted); font-size: .95rem; line-height: 1.5; margin: 0 0 1.4rem; }
.upgrade-btn { display: inline-block; text-decoration: none; }
.upgrade-note { color: var(--muted-dim, #7a7a7a); font-size: .78rem; margin-top: .9rem; }

/* ===== Install app banner (secure site) ===== */
.install-banner { position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--player-h, 84px) + 90px + env(safe-area-inset-bottom)); z-index: 900;
  display: flex; align-items: center; gap: .8rem; background: var(--elev2, #1c1c23);
  border: 1px solid rgba(255,255,255,.1); border-radius: 99px; padding: .5rem .6rem .5rem 1.1rem;
  box-shadow: 0 10px 30px rgba(0,0,0,.5); max-width: 92vw; }
.install-banner.hidden { display: none; }
.install-text { font-weight: 700; font-size: .9rem; white-space: nowrap; }
.install-btn { padding: .5rem 1.2rem; font-size: .9rem; }
.install-close { background: none; border: none; color: var(--muted); font-size: 1.4rem; line-height: 1; padding: 0 .3rem; }
@media (min-width: 1000px) { .install-banner { bottom: calc(var(--player-h, 84px) + 20px); } }

/* ===== iOS install hint ===== */
.ios-install { position: fixed; left: 0; right: 0;
  bottom: calc(var(--player-h, 84px) + 90px + env(safe-area-inset-bottom)); z-index: 900;
  display: flex; justify-content: center; padding: 0 1rem; }
.ios-install.hidden { display: none; }
.ios-install-inner { display: flex; align-items: center; gap: .8rem; max-width: 92vw;
  background: var(--elev2, #1c1c23); border: 1px solid rgba(255,255,255,.1); border-radius: 14px;
  padding: .7rem .7rem .7rem 1.1rem; box-shadow: 0 10px 30px rgba(0,0,0,.5);
  font-size: .88rem; line-height: 1.4; }
.ios-install-inner b { color: var(--accent); }
@media (min-width: 1000px) { .ios-install { display: none; } }

/* ===== Native feel: disable browser pull-to-refresh / rubber-band ===== */
html, body { overscroll-behavior: none; }

/* ===== Install modal (login page) ===== */
.install-modal { position: fixed; inset: 0; z-index: 4000; display: flex; align-items: center;
  justify-content: center; padding: 1.5rem; background: rgba(0,0,0,.72);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: imFade .18s ease; }
.install-modal.hidden { display: none; }
@keyframes imFade { from { opacity: 0; } to { opacity: 1; } }
.install-modal-card { width: 100%; max-width: 360px; text-align: center;
  background: var(--elev2, #1c1c23); border: 1px solid rgba(255,255,255,.08);
  border-radius: 22px; padding: 2rem 1.6rem 1.4rem; box-shadow: 0 24px 70px rgba(0,0,0,.65);
  animation: imUp .22s ease; }
@keyframes imUp { from { transform: translateY(16px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
.install-modal-logo { width: 72px; height: 72px; margin: 0 auto 1rem; border-radius: 18px;
  background: rgba(230,22,45,.12); display: flex; align-items: center; justify-content: center; }
.install-modal-logo .ico { width: 40px; height: 40px; color: var(--accent); }
.install-modal-title { font-size: 1.5rem; font-weight: 800; margin: 0 0 .5rem; }
.install-modal-desc { color: var(--muted); font-size: .95rem; line-height: 1.55; margin: 0 0 1.3rem; }
.install-modal-desc b { color: var(--fg); }
.install-modal-desc .ios-share { color: var(--accent); font-weight: 800; }
.install-modal-actions { display: flex; flex-direction: column; gap: .6rem; }
.install-modal-btn { width: 100%; }
.install-modal-dismiss { display: block; width: 100%; margin-top: .9rem; background: none;
  border: none; color: var(--muted); font-size: .9rem; font-weight: 600; padding: .5rem; }
.install-modal-dismiss:hover { color: var(--fg); }

/* Playlist "Downloaded" state */
.playlist-dl-btn.done { background: rgba(40,199,111,.15); color: #28c76f; }
.playlist-dl-btn.done:hover { background: rgba(40,199,111,.25); color: #28c76f; }
.playlist-dl-btn.done .ico { color: #28c76f; }

/* Clickable artist/album names inside track rows */
.tr-link { color: var(--muted); }
.tr-link:hover { color: var(--fg); text-decoration: underline; }

/* Artist / album profile hero */
.profile-hero { display: flex; gap: 1.6rem; align-items: flex-end; padding: 1.2rem 0 1.4rem; }
.profile-hero .ph-art {
  width: 184px; height: 184px; object-fit: cover; flex-shrink: 0;
  background: var(--elev2); box-shadow: 0 4px 28px rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center; color: var(--accent);
}
.profile-hero .ph-art .ico { width: 48px; height: 48px; }
.profile-hero.artist .ph-art { border-radius: 50%; }
.profile-hero.album .ph-art { border-radius: 8px; }
.profile-hero .ph-kicker { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.profile-hero .ph-name { margin: .35rem 0 .7rem; font-size: clamp(1.9rem, 6vw, 3.3rem); font-weight: 900; line-height: 1.05; }
.profile-hero .ph-meta { color: var(--muted); font-size: .9rem; }
.profile-hero .ph-meta a { color: var(--fg); font-weight: 700; }
.profile-hero .ph-meta a:hover { text-decoration: underline; }
.profile-hero .chips { margin: .2rem 0 0; }
.tracklist-num { width: 1.6rem; text-align: right; color: var(--muted); font-size: .9rem; flex-shrink: 0; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .profile-hero { flex-direction: column; align-items: flex-start; gap: 1.1rem; }
  .profile-hero .ph-art { width: 150px; height: 150px; }
}

/* ===================== SPOTIFY-STYLE HOME TOPBAR ===================== */
.home-topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: .7rem;
  margin: 0 calc(-1 * max(1.2rem, env(safe-area-inset-left))) .4rem;
  padding: calc(max(0.8rem, env(safe-area-inset-top))) max(1.2rem, env(safe-area-inset-left)) .7rem;
  background: linear-gradient(180deg, rgba(0,0,0,.72), rgba(0,0,0,.35));
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.home-topbar .chips { margin: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.home-topbar .chips::-webkit-scrollbar { display: none; }
/* Home renders its own avatar+chips header, so hide the generic topbar there
   (mobile only — desktop keeps its nav arrows / account menu). */
@media (max-width: 999px) {
  .topbar--hide-mobile { display: none; }
}

/* horizontally scrolling chip row (Library filters, Home filters) */
.chips--scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips--scroll::-webkit-scrollbar { display: none; }
.chips--scroll .chip { flex-shrink: 0; white-space: nowrap; }
.chip.active-accent { background: var(--accent); color: #fff; }

/* ===================== LIBRARY LIST ROWS (Spotify "Your Library") ===================== */
.lib-head { display: flex; align-items: center; gap: .8rem; margin: .4rem 0 1rem; }
.lib-head h1 { margin: 0; font-size: 1.5rem; flex: 1; }
.lib-toolbar { display: flex; align-items: center; justify-content: space-between; margin: .2rem 0 .6rem; color: var(--muted); }
.lib-toolbar .lib-sort { display: inline-flex; align-items: center; gap: .45rem; font-size: .85rem; font-weight: 700; color: var(--fg); background: none; border: none; padding: .4rem 0; }
.lib-toolbar .lib-sort .ico { width: 16px; height: 16px; }

.lib-list { display: flex; flex-direction: column; gap: .35rem; }
.lib-row {
  display: flex; align-items: center; gap: .85rem; padding: .45rem .3rem;
  border-radius: 6px; color: var(--fg); cursor: pointer; transition: background .15s;
  -webkit-tap-highlight-color: transparent;
}
.lib-row:hover { background: rgba(255,255,255,.06); }
.lib-row:active { background: rgba(255,255,255,.1); }
.lib-art {
  width: 60px; height: 60px; border-radius: 4px; object-fit: cover; flex-shrink: 0;
  background: var(--elev2); display: flex; align-items: center; justify-content: center;
  color: var(--muted); overflow: hidden;
}
.lib-art.round { border-radius: 50%; }
.cover-collage { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.cover-collage img { width: 100%; height: 100%; object-fit: cover; }
.lib-art--liked { background: linear-gradient(135deg, #e6162d, #5a0a14); color: #fff; }
.lib-main { flex: 1; min-width: 0; }
.lib-title { font-weight: 600; font-size: .98rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-sub { color: var(--muted); font-size: .82rem; margin-top: .25rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: .3rem; }
.lib-sub .pin { color: var(--accent); display: inline-flex; }
.lib-sub .pin .ico { width: 14px; height: 14px; }

/* grid view toggle */
.lib-list.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem .8rem; }
.lib-list.grid .lib-row { flex-direction: column; align-items: flex-start; gap: .5rem; padding: 0; background: none; }
.lib-list.grid .lib-art { width: 100%; height: auto; aspect-ratio: 1; }
.lib-list.grid .lib-title { font-size: .85rem; }
.lib-list.grid .lib-sub { font-size: .75rem; }
@media (min-width: 1000px) { .lib-list.grid { grid-template-columns: repeat(6, 1fr); } }

/* ===================== PLAYLIST / LIKED HERO (Spotify-style) ===================== */
.pl-hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: .6rem 0 .4rem; }
.pl-hero-art {
  width: clamp(170px, 55vw, 240px); aspect-ratio: 1; border-radius: 8px; object-fit: cover;
  background: var(--elev2); box-shadow: 0 16px 40px rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center; color: var(--muted); overflow: hidden;
}
.pl-hero-art-wrap { position: relative; margin-bottom: 1.1rem; display: inline-flex; }
.pl-cover-upload { position: absolute; bottom: .5rem; right: .5rem; }
.pl-cover-upload-btn { position: relative; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); cursor: pointer; }
.pl-cover-upload-btn input[type="file"] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.pl-hero-name { margin: 0 0 .3rem; font-size: clamp(1.5rem, 6vw, 2.2rem); font-weight: 900; line-height: 1.1; }
.pl-name-form { width: 100%; }
input.pl-hero-name-input {
  display: block; width: 100%; max-width: 100%; background: transparent; color: inherit;
  border: 1px solid transparent; border-radius: 6px; padding: .1rem .3rem; margin: 0 0 .3rem -.3rem;
  font-family: inherit; text-align: inherit;
}
input.pl-hero-name-input:hover { border-color: rgba(255,255,255,.2); }
input.pl-hero-name-input:focus { outline: none; border-color: var(--accent); background: rgba(255,255,255,.05); }
.pl-hero-meta { color: var(--muted); font-size: .85rem; }
.pl-hero-actions { display: flex; align-items: center; justify-content: space-between; width: 100%; margin: .7rem 0 .4rem; }
.pl-hero-actions-left { display: flex; align-items: center; gap: .3rem; }
@media (min-width: 1000px) {
  .pl-hero { align-items: flex-start; text-align: left; }
  .pl-hero-art { width: 184px; }
}

/* ===================== MIX CARDS (Your top mixes) ===================== */
.mix-card { position: relative; }
.mix-card .mc-art { border-radius: 8px 8px 0 0; margin-bottom: 0; }
.mix-card .mc-bar { height: 6px; border-radius: 0 0 2px 2px; background: var(--accent); margin-bottom: .8rem; }
.mix-card:nth-child(2n) .mc-bar { background: #3d91f4; }
.mix-card:nth-child(3n) .mc-bar { background: #f4c63d; }
.mix-card:nth-child(4n) .mc-bar { background: #27ae60; }
.mix-card .mc-badge {
  position: absolute; top: 8px; left: 8px; font-size: .62rem; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase; background: rgba(0,0,0,.55);
  padding: .2rem .5rem; border-radius: 4px; color: #fff;
}
