/* ── Base ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
  --bg:       #0a0a0a;
  --surface:  #111111;
  --surface2: #1a1a1a;
  --surface3: #222222;
  --accent:   #a259ff;
  --accent-h: #b36fff;
  --text:     #ffffff;
  --muted:    #aaaaaa;
  --faint:    #555555;
  --border:   rgba(255,255,255,0.08);
  --nav-h:    60px;
  --player-h: 80px;
  --bnav-h:   60px;
  --radius:   8px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Roboto Mono', monospace;
  overflow-x: hidden;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, textarea { font-family: inherit; }

/* ── Nav ─────────────────────────────────── */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-h); z-index: 100;
  background: rgba(10,10,10,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px; gap: 32px;
}

.nav-logo {
  font-size: 17px; font-weight: 700;
  letter-spacing: .15em; color: var(--text);
  flex-shrink: 0;
}

.nav-links { display: flex; gap: 4px; }

.nav-link {
  font-size: 13px; color: var(--muted);
  cursor: pointer; padding: 6px 12px;
  border-radius: 20px; transition: all .2s;
}
.nav-link:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.nav-link.active { color: var(--text); }

.nav-right {
  margin-left: auto; display: flex;
  align-items: center; gap: 16px;
}

.search-wrap { position: relative; display: flex; align-items: center; }

.search-icon {
  position: absolute; left: 10px; width: 15px; height: 15px;
  color: var(--faint); pointer-events: none;
}

.search-input {
  background: var(--surface2); border: 1px solid transparent;
  border-radius: 20px; padding: 7px 14px 7px 32px;
  color: var(--text); font-size: 13px; width: 200px;
  outline: none; transition: border-color .2s, width .3s;
}
.search-input:focus { border-color: var(--accent); width: 260px; }
.search-input::placeholder { color: var(--faint); }

.nav-user { display: flex; align-items: center; gap: 12px; }
.nav-username { font-size: 12px; color: var(--muted); }
.nav-signout {
  background: none; border: 1px solid var(--border);
  color: var(--muted); font-size: 12px; padding: 5px 10px;
  border-radius: 4px; cursor: pointer; transition: all .2s;
}
.nav-signout:hover { border-color: var(--faint); color: var(--text); }

/* ── Main ─────────────────────────────────── */
.main {
  padding-top: var(--nav-h);
  padding-bottom: calc(var(--player-h) + 24px);
  min-height: 100vh;
}

/* ── Hero ─────────────────────────────────── */
.hero {
  position: relative; height: 420px;
  display: flex; align-items: flex-end;
  padding: 48px 40px; overflow: hidden;
}

.hero-bg {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, #1a0533 0%, #0d0d1f 45%, #0a0a0a 100%);
  transition: background 1s;
}

.hero-bg-img {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  opacity: 0; transition: opacity 1s;
}
.hero-bg-img.loaded { opacity: 1; }

.hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, #0a0a0a 0%, rgba(10,10,10,0.5) 40%, transparent 80%);
}

.hero-content { position: relative; z-index: 1; max-width: 600px; }

.hero-eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 10px;
}

.hero-title {
  font-size: 52px; font-weight: 700; line-height: 1.05;
  letter-spacing: -.02em; margin-bottom: 8px;
}

.hero-sub { font-size: 16px; color: var(--muted); margin-bottom: 24px; }

.hero-actions { display: flex; gap: 12px; }

/* ── Buttons ─────────────────────────────────── */
.btn {
  padding: 11px 24px; border-radius: 24px; border: none;
  font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .2s; letter-spacing: .02em;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); transform: scale(1.02); }
.btn-secondary { background: rgba(255,255,255,0.1); color: #fff; }
.btn-secondary:hover { background: rgba(255,255,255,0.16); }

/* ── Section headers ─────────────────────────────────── */
.section-header { padding: 32px 32px 16px; }
.section-title { font-size: 18px; font-weight: 600; }

/* ── Rows ─────────────────────────────────── */
.row { margin-bottom: 36px; }

.row-header {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 0 32px; margin-bottom: 16px;
}

.row-title { font-size: 15px; font-weight: 600; }
.row-see-all { font-size: 12px; color: var(--faint); cursor: pointer; transition: color .2s; }
.row-see-all:hover { color: var(--text); }

.row-track {
  display: flex; gap: 16px; padding: 4px 32px 12px;
  overflow-x: auto; scrollbar-width: none;
}
.row-track::-webkit-scrollbar { display: none; }

/* ── Album card ─────────────────────────────────── */
.album-card {
  flex-shrink: 0; width: 160px; cursor: pointer;
}

.album-art-wrap {
  position: relative; aspect-ratio: 1;
  border-radius: var(--radius); overflow: hidden;
  background: var(--surface2); margin-bottom: 10px;
}

.album-art {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .3s, filter .3s;
  display: block;
}
.album-card:hover .album-art { transform: scale(1.04); filter: brightness(.7); }

.album-art-placeholder {
  width: 100%; height: 100%; display: flex; align-items: center;
  justify-content: center; font-size: 48px; color: var(--faint);
  background: var(--surface2);
}

.album-play-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .2s;
}
.album-card:hover .album-play-overlay,
.album-card.is-playing .album-play-overlay { opacity: 1; }
.album-card.is-playing .album-art { transform: scale(1.04); filter: brightness(.7); }

.album-play-btn {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--accent); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(162,89,255,.5);
  transition: transform .15s;
}
.album-play-btn:hover { transform: scale(1.08); }
.album-play-btn svg { width: 20px; height: 20px; fill: white; margin-left: 3px; }

.album-title {
  font-size: 13px; font-weight: 500; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.album-artist {
  font-size: 12px; color: var(--muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Genre grid ─────────────────────────────────── */
.genre-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px; padding: 0 32px 32px;
}

.genre-card {
  aspect-ratio: 1.5; border-radius: 12px;
  display: flex; align-items: flex-end; padding: 15px;
  cursor: pointer;
  overflow: hidden; position: relative; isolation: isolate;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08), 0 1px 2px rgba(0,0,0,.3);
  transition: transform .22s cubic-bezier(.2,.7,.2,1), box-shadow .22s ease;
}
/* depth: soft radial highlight top-right + darken toward the label */
.genre-card::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(120% 90% at 85% 10%, rgba(255,255,255,.28), transparent 55%),
    linear-gradient(0deg, rgba(0,0,0,.42), rgba(0,0,0,0) 55%);
}
.genre-glyph {
  position: absolute; top: 6px; right: 8px; z-index: -1;
  font-size: 46px; line-height: 1;
  opacity: .22; filter: saturate(.7);
  transform: rotate(-8deg);
  transition: transform .28s cubic-bezier(.2,.7,.2,1), opacity .22s ease;
}
.genre-meta { display: flex; flex-direction: column; gap: 2px; }
.genre-name {
  font-size: 16px; font-weight: 700; letter-spacing: .01em;
  text-shadow: 0 1px 3px rgba(0,0,0,.45);
}
.genre-sub {
  font-size: 11px; font-weight: 500; letter-spacing: .03em;
  color: rgba(255,255,255,.82); text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.genre-play {
  position: absolute; right: 12px; bottom: 12px;
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255,255,255,.92); color: #111;
  font-size: 12px; padding-left: 2px;
  opacity: 0; transform: translateY(6px) scale(.85);
  transition: opacity .2s ease, transform .2s cubic-bezier(.2,.7,.2,1);
  box-shadow: 0 4px 12px rgba(0,0,0,.35);
}
.genre-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14), 0 12px 26px rgba(0,0,0,.45);
}
.genre-card:hover .genre-glyph { transform: rotate(0deg) scale(1.12); opacity: .35; }
.genre-card:hover .genre-play { opacity: 1; transform: translateY(0) scale(1); }

/* ── Library tabs ─────────────────────────────────── */
.library-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 32px 16px;
}
.library-tabs { display: flex; gap: 4px; }
.lib-tab {
  background: none; border: none; color: var(--muted); font-family: inherit;
  font-size: 14px; font-weight: 500; padding: 6px 14px; border-radius: 20px;
  cursor: pointer; transition: all .2s;
}
.lib-tab.active { background: var(--surface2); color: var(--text); }
.lib-tab:hover:not(.active) { color: var(--text); }
.btn-sm { padding: 7px 14px; font-size: 12px; }

/* ── Playlist grid ─────────────────────────────────── */
.playlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px; padding: 0 32px 32px;
}
.playlist-card {
  cursor: pointer; border-radius: var(--radius);
  background: var(--surface); padding: 14px;
  transition: background .15s;
}
.playlist-card:hover { background: var(--surface2); }
.playlist-art {
  aspect-ratio: 1; border-radius: 6px; margin-bottom: 10px;
  background: linear-gradient(135deg, var(--surface3), var(--surface2));
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; color: var(--faint); overflow: hidden;
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px;
}
.playlist-art-single { display: flex; align-items: center; justify-content: center; }
.playlist-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.playlist-art-icon { font-size: 40px; color: var(--faint); }
.playlist-name { font-size: 13px; font-weight: 500; margin-bottom: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.playlist-meta { font-size: 11px; color: var(--muted); }

/* ── Track like button ─────────────────────────────────── */
.track-like {
  background: none; border: none; color: var(--faint); cursor: pointer;
  font-size: 15px; padding: 0 6px; transition: color .15s; flex-shrink: 0;
  line-height: 1;
}
.track-like.liked { color: var(--accent); }
.track-like:hover { color: var(--accent); }

/* ── Track more (⋯) button ─────────────────────────────────── */
.track-more {
  background: none; border: none; color: var(--faint); cursor: pointer;
  font-size: 16px; padding: 0 4px; transition: color .15s; flex-shrink: 0;
  opacity: 0; line-height: 1;
}
.track-item:hover .track-more { opacity: 1; }
.track-more:hover { color: var(--text); }

/* ── Context menu ─────────────────────────────────── */
.context-menu {
  position: fixed; z-index: 500;
  background: #1e1e1e; border: 1px solid var(--border);
  border-radius: 10px; padding: 6px; min-width: 180px;
  box-shadow: 0 8px 32px rgba(0,0,0,.6);
}
.context-menu-header {
  font-size: 11px; color: var(--faint); padding: 6px 10px 4px;
  letter-spacing: .05em; text-transform: uppercase; font-weight: 600;
}
.context-menu-item {
  display: block; width: 100%; background: none; border: none;
  color: var(--text); font-family: inherit; font-size: 13px;
  padding: 8px 12px; text-align: left; cursor: pointer; border-radius: 6px;
  transition: background .1s;
}
.context-menu-item:hover { background: rgba(255,255,255,.07); }
.context-menu-new {
  display: block; width: 100%; background: none; border: none;
  border-top: 1px solid var(--border); color: var(--accent);
  font-family: inherit; font-size: 12px; padding: 8px 12px;
  text-align: left; cursor: pointer; margin-top: 4px; border-radius: 0 0 6px 6px;
  transition: background .1s;
}
.context-menu-new:hover { background: rgba(162,89,255,.08); }

/* ── Library / Search grid ─────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 20px; padding: 0 32px 32px;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 20px; padding: 0 32px 32px;
}

/* ── Empty state ─────────────────────────────────── */
.empty-state {
  text-align: center; padding: 80px 32px;
}
.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: .3; }
.empty-title { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.empty-sub { font-size: 13px; color: var(--muted); line-height: 1.6; }

/* ── Modal ─────────────────────────────────── */
.modal-wrap {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: flex-end; justify-content: center;
}
@media (min-width: 600px) {
  .modal-wrap { align-items: center; }
}

.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.7); cursor: pointer;
}

.modal {
  position: relative; z-index: 1;
  background: #161616; border-radius: 16px 16px 0 0;
  width: 100%; max-width: 640px; max-height: 85vh;
  overflow-y: auto; padding-bottom: 24px;
}
@media (min-width: 600px) {
  .modal { border-radius: 16px; max-height: 80vh; }
}

.modal-sm { max-width: 400px; padding: 32px; }

.modal-close {
  position: absolute; top: 12px; right: 12px;
  background: var(--surface2); border: none; color: var(--muted);
  width: 32px; height: 32px; border-radius: 50%;
  cursor: pointer; font-size: 14px; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  transition: color .2s; flex-shrink: 0;
}
.modal-close:hover { color: var(--text); }

/* Album modal */
.album-modal-close-row {
  position: sticky; top: 0; z-index: 2;
  display: flex; justify-content: flex-end;
  padding: 12px 12px 0;
  pointer-events: none;
}
.album-modal-close-row .modal-close {
  position: static; pointer-events: all;
}

.album-modal-hero {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  max-height: 260px; overflow: hidden;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  font-size: 80px; color: var(--faint);
}
.album-modal-hero img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}

.album-modal-body {
  padding: 20px 24px 8px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.album-modal-info h2 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.album-modal-info p { font-size: 13px; color: var(--muted); }
.album-modal-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }

/* Track list */
.track-list { padding: 8px 24px; }

.track-item {
  display: flex; align-items: center; gap: 14px;
  padding: 10px; border-radius: 6px; cursor: pointer;
  transition: background .15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.track-item:hover { background: var(--surface2); }
@media (max-width: 768px) {
  .track-item { padding: 12px 8px; }
}

.profile-sheet {
  position: fixed; inset: 0; z-index: 500;
}
.profile-sheet-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,0.6);
}
.profile-sheet-panel {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: #1a1a1a; border-radius: 20px 20px 0 0;
  padding: 20px 0 calc(16px + env(safe-area-inset-bottom));
}
.profile-sheet-user {
  font-size: 13px; color: var(--muted); padding: 0 24px 16px;
  border-bottom: 1px solid var(--border); margin-bottom: 8px;
}
.profile-sheet-item {
  display: block; width: 100%; padding: 14px 24px;
  background: none; border: none; color: var(--text);
  font-size: 15px; font-family: inherit; text-align: left;
  cursor: pointer; touch-action: manipulation;
}
.profile-sheet-item:hover { background: var(--surface2); }

.discover-row-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; margin-bottom: 16px;
}

/* ── Search / Discover section layout ─────────────────────────── */
/* Give the unified search page a consistent gutter + top breathing
   room, then zero the inner elements' own horizontal padding so
   titles, grids, tabs and request list all align to that gutter. */
#searchSection { padding: 24px 32px 40px; }
#searchSection .row-header,
#searchSection .grid,
#searchSection .track-list { padding-left: 0; padding-right: 0; }
#searchSection .grid { padding-bottom: 24px; }

/* Discover: songs / albums / artists sections stacked on one page */
.discover-group { margin-bottom: 4px; }
.discover-subhead {
  font-size: 13px; font-weight: 600; color: var(--muted);
  letter-spacing: .04em; margin-bottom: 12px;
}

/* ── Artist page ─────────────────────────────────────────────── */
.artist-hero { padding: 28px 32px 8px; }
.artist-back { margin-bottom: 16px; }
.artist-title { font-size: 40px; font-weight: 700; letter-spacing: -.02em; line-height: 1.05; }
.artist-meta { font-size: 13px; color: var(--muted); margin: 8px 0 16px; }
.artist-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.artist-actions .btn { display: inline-flex; }
.artist-block { margin-top: 8px; }

/* thumbnails + subtitle inside track rows (artist page) */
.track-thumb { width: 42px; height: 42px; border-radius: 5px; object-fit: cover; flex-shrink: 0; background: var(--surface2); }
.track-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* the mini-player art/info opens the full Now Playing screen */
#playerBar .player-left { cursor: pointer; }

/* ── Full-screen Now Playing ─────────────────────────────────── */
.now-playing {
  position: fixed; inset: 0; z-index: 400; color: #fff; overflow: hidden;
  display: flex; flex-direction: column;
  animation: npIn .28s cubic-bezier(.2,.7,.2,1);
}
/* while the full-screen player is open, hide the mini player + bottom nav
   (the overlay has its own controls; audio keeps playing regardless) */
body.np-open .player-bar,
body.np-open .bottom-nav { display: none; }
@keyframes npIn { from { transform: translateY(100%); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
.np-bg {
  position: absolute; inset: -60px; z-index: -2;
  background-size: cover; background-position: center;
  filter: blur(70px) saturate(1.5) brightness(.55); transform: scale(1.25);
}
.np-scrim {
  position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(to bottom, rgba(0,0,0,.25), rgba(0,0,0,.55) 55%, rgba(0,0,0,.88));
}
.np-inner {
  flex: 1; display: flex; flex-direction: column; gap: 16px;
  width: 100%; max-width: 480px; margin: 0 auto; min-height: 0;
  padding: max(16px, env(safe-area-inset-top)) 24px calc(26px + env(safe-area-inset-bottom));
}
.np-top { display: flex; align-items: center; gap: 12px; }
.np-icon-btn { background: none; border: none; color: rgba(255,255,255,.85); cursor: pointer; padding: 4px; }
.np-icon-btn svg { width: 26px; height: 26px; display: block; }
.np-icon-btn:hover { color: #fff; }
.np-from { flex: 1; text-align: center; overflow: hidden; }
.np-from-label { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.6); }
.np-from-album {
  background: none; border: none; color: #fff; cursor: pointer; font-family: inherit;
  font-size: 13px; font-weight: 600; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.np-from-album:hover { text-decoration: underline; }
.np-art-wrap { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; }
.np-art {
  width: 100%; max-width: 360px; aspect-ratio: 1; object-fit: cover;
  border-radius: 14px; box-shadow: 0 24px 60px rgba(0,0,0,.55);
}
.np-meta { display: flex; align-items: center; gap: 14px; }
.np-titles { flex: 1; min-width: 0; }
.np-title { font-size: 24px; font-weight: 700; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-artist {
  background: none; border: none; padding: 3px 0 0; cursor: pointer; font-family: inherit;
  font-size: 15px; color: rgba(255,255,255,.75); max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block;
}
.np-artist:hover { color: #fff; text-decoration: underline; }
.np-like { background: none; border: none; cursor: pointer; font-size: 26px; color: rgba(255,255,255,.7); flex-shrink: 0; }
.np-like.liked { color: var(--accent); }
.np-dl { background: none; border: none; cursor: pointer; font-size: 22px; color: rgba(255,255,255,.7); flex-shrink: 0; line-height: 1; }
.np-dl.active { color: var(--accent); }
.np-dl:disabled { opacity: .5; }

/* Downloaded tab: storage usage bar */
.downloaded-bar {
  display: flex; align-items: center; gap: 16px;
  padding: 4px 32px 16px;
}
.downloaded-usage { flex: 1; min-width: 0; }
.downloaded-usage-text { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.downloaded-usage-track { height: 6px; background: var(--surface2); border-radius: 3px; overflow: hidden; }
.downloaded-usage-fill { height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width .3s; }
@media (max-width: 768px) { .downloaded-bar { padding: 4px 16px 14px; } }
.np-scrubber { height: 6px; background: rgba(255,255,255,.22); border-radius: 3px; cursor: pointer; overflow: hidden; }
.np-scrubber-fill { height: 100%; width: 0; background: #fff; border-radius: 3px; }
.np-times { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: rgba(255,255,255,.6); }
.np-controls { display: flex; align-items: center; justify-content: space-between; }
.np-ctrl { background: none; border: none; color: #fff; cursor: pointer; opacity: .85; transition: opacity .15s, transform .15s; }
.np-ctrl svg { width: 28px; height: 28px; display: block; }
.np-ctrl:hover { opacity: 1; }
.np-ctrl.active { color: var(--accent); opacity: 1; }
.np-play { width: 68px; height: 68px; border-radius: 50%; background: #fff; color: #111; display: grid; place-items: center; }
.np-play svg { width: 34px; height: 34px; }
.np-play:hover { transform: scale(1.05); }
.np-count { text-align: center; font-size: 11px; color: rgba(255,255,255,.55); }
/* keep the OS/desktop player usable behind the overlay on wide screens */
@media (min-width: 900px) {
  .np-inner { max-width: 560px; }
  .np-art { max-width: 420px; }
}

@media (max-width: 768px) {
  #searchSection { padding: 12px 16px 40px; }
}
.track-item.playing { color: var(--accent); }

.track-num {
  width: 20px; text-align: center; font-size: 13px;
  color: var(--faint); flex-shrink: 0;
}
.track-item.playing .track-num { color: var(--accent); }

.track-info { flex: 1; min-width: 0; }
.track-name {
  font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.track-artist { font-size: 12px; color: var(--muted); }

.track-dur { font-size: 12px; color: var(--faint); flex-shrink: 0; }

/* ── Player bar ─────────────────────────────────── */
.player-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--player-h); z-index: 200;
  background: rgba(16,16,16,0.98);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px; gap: 20px;
}

.player-left {
  display: flex; align-items: center; gap: 14px;
  min-width: 200px; flex: 1;
}

.player-art {
  width: 52px; height: 52px; border-radius: 6px;
  object-fit: cover; background: var(--surface2); flex-shrink: 0;
}

.player-info { min-width: 0; }
.player-track-title {
  font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.player-track-artist {
  font-size: 12px; color: var(--muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.player-center {
  flex: 2; display: flex; flex-direction: column;
  align-items: center; gap: 6px;
}

.player-btns {
  display: flex; align-items: center; gap: 12px;
}

.player-btn {
  background: none; border: none; color: var(--muted);
  cursor: pointer; padding: 4px;
  display: flex; align-items: center; justify-content: center;
  transition: color .15s, transform .1s;
}
.player-btn svg { width: 18px; height: 18px; }
.player-btn:hover { color: var(--text); transform: scale(1.1); }
.player-btn.active { color: var(--accent); }

.player-btn-play {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--text); color: var(--bg) !important;
}
.player-btn-play svg { width: 20px; height: 20px; fill: var(--bg); }
.player-btn-play:hover { transform: scale(1.06) !important; background: #e0e0e0; }

.player-progress {
  display: flex; align-items: center; gap: 8px;
  width: 100%; max-width: 480px;
}

.player-time {
  font-size: 11px; color: var(--faint);
  font-variant-numeric: tabular-nums; width: 36px;
}
.player-time:last-child { text-align: right; }

.player-scrubber {
  flex: 1; height: 4px;
  background: var(--surface3); border-radius: 2px;
  cursor: pointer; position: relative; overflow: hidden;
}
.player-scrubber::before {
  content: ''; position: absolute; inset: -6px 0;
}
.player-scrubber-fill {
  height: 100%; background: var(--accent); border-radius: 2px;
  pointer-events: none; width: 0%;
  transition: width .1s linear;
}
.player-scrubber:hover .player-scrubber-fill { background: var(--accent-h); }

.player-right {
  display: flex; align-items: center; gap: 8px;
  flex: 1; justify-content: flex-end;
}

.volume-slider {
  width: 80px; accent-color: var(--accent);
  cursor: pointer; height: 4px;
}

/* ── Bottom nav (mobile) ─────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(var(--bnav-h) + env(safe-area-inset-bottom)); z-index: 200;
  background: rgba(10,10,10,0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: none;
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-tab {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  background: none; border: none; color: var(--faint);
  cursor: pointer; font-size: 10px; transition: color .2s;
  padding: 8px 0;
}
.bottom-tab.active { color: var(--text); }
.bottom-tab svg { width: 20px; height: 20px; }

/* Mobile search sheet */
.search-sheet {
  position: fixed; inset: 0; z-index: 400;
}
.search-sheet-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,0.6); cursor: pointer;
}
.search-sheet-panel {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: #161616; border-radius: 20px 20px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  max-height: 90vh; overflow-y: auto;
}
.search-sheet-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface2); border-radius: 10px;
  padding: 10px 14px; margin-bottom: 16px;
}
.search-sheet-input {
  flex: 1; background: none; border: none; color: var(--text);
  font-family: inherit; font-size: 15px; outline: none;
}
.search-sheet-cancel {
  background: none; border: none; color: var(--accent);
  font-family: inherit; font-size: 13px; cursor: pointer;
}

/* ── Skeleton ─────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Mobile progress bar (above player bar) ──────────── */
.player-mobile-progress {
  display: none;
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--surface2);
}
.player-mobile-progress-fill {
  height: 100%; background: var(--accent); width: 0%; transition: width .5s linear;
}

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 768px) {
  .main { padding-bottom: calc(var(--bnav-h) + 64px + env(safe-area-inset-bottom) + 8px); }
  .player-bar {
    bottom: calc(var(--bnav-h) + env(safe-area-inset-bottom)); height: 64px;
    padding: 0 12px; gap: 10px;
    position: fixed;
  }
  .player-center { display: none; }
  .player-left { flex: 1; min-width: 0; }
  .player-right { display: none; }
  .player-mobile-progress { display: block; }

  .player-mobile-controls {
    display: flex; align-items: center; gap: 4px; flex-shrink: 0;
  }
  .player-mobile-controls .player-btn {
    width: 40px; height: 40px; min-width: 40px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  .player-mobile-controls .player-btn-play {
    width: 44px; height: 44px; min-width: 44px;
  }
  .player-art { width: 44px; height: 44px; flex-shrink: 0; }
  .player-track-title { font-size: 12px; }
  .player-artist-btn { font-size: 11px; }

  .bottom-nav { display: flex; }
  .nav-links { display: none; }
  .search-wrap { display: none; }
  .nav-signout { display: none; }
  .nav-username { display: none; }

  .hero { height: 320px; padding: 32px 20px; }
  .hero-title { font-size: 36px; }

  .row-track { padding: 4px 16px 12px; }
  .row-header { padding: 0 16px; }
  .album-card { width: 140px; }

  .genre-grid { padding: 0 16px 32px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .grid, .library-grid { padding: 0 16px 32px; grid-template-columns: repeat(2, 1fr); }
  .section-header { padding: 24px 16px 12px; }
}

/* Mobile-only search input inside searchSection */
.mobile-search-bar {
  display: none;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 14px;
  margin: 0 0 20px;
}
.mobile-search-bar .search-input {
  border: none; background: none; padding: 12px 0; flex: 1;
}

@media (max-width: 768px) {
  .mobile-search-bar { display: flex; }
}

@media (min-width: 769px) {
  .player-mobile-controls { display: none; }
  .player-mobile-progress { display: none; }
  .mobile-search-bar { display: none; }
}

/* ── Artist link buttons ──────────────────────────────────── */
.album-artist-link, .track-artist-link, .artist-link-btn, .player-artist-btn {
  background: none; border: none; color: var(--muted); font-family: inherit;
  font-size: inherit; cursor: pointer; padding: 0; text-align: left;
  transition: color .15s;
}
.album-artist-link { font-size: 12px; display: block; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.album-artist-link:hover, .track-artist-link:hover, .artist-link-btn:hover { color: var(--text); text-decoration: underline; }
.player-artist-btn { font-size: 12px; color: var(--muted); margin-top: 2px; }
.player-artist-btn:hover { color: var(--text); }

/* ── Player like button ──────────────────────────────────── */
.player-like-btn {
  background: none; border: none; color: var(--faint); cursor: pointer;
  font-size: 16px; padding: 4px; transition: color .15s; flex-shrink: 0;
}
.player-like-btn.liked { color: var(--accent); }
.player-like-btn:hover { color: var(--accent); }
.player-btn.active { color: var(--accent); }

/* ── Sleep dropdown ──────────────────────────────────── */
.sleep-dropdown {
  position: fixed; z-index: 300; bottom: calc(var(--player-h) + 8px); right: 24px;
  background: #1e1e1e; border: 1px solid var(--border);
  border-radius: 10px; padding: 6px; min-width: 160px;
  box-shadow: 0 8px 32px rgba(0,0,0,.6);
}
.sleep-title { font-size: 11px; color: var(--faint); padding: 6px 10px 4px;
  letter-spacing: .05em; text-transform: uppercase; font-weight: 600; }
.sleep-opt {
  display: block; width: 100%; background: none; border: none;
  color: var(--text); font-family: inherit; font-size: 13px;
  padding: 8px 12px; text-align: left; cursor: pointer; border-radius: 6px;
  transition: background .1s;
}
.sleep-opt:hover { background: rgba(255,255,255,.07); }
.sleep-cancel { color: #ef4444 !important; border-top: 1px solid var(--border); margin-top: 4px; border-radius: 0 0 6px 6px; }

/* ── Side panels (queue, lyrics) ──────────────────────────────────── */
.side-panel {
  position: fixed; right: 0; bottom: var(--player-h); top: var(--nav-h);
  width: 340px; z-index: 150;
  background: rgba(14,14,14,0.98); backdrop-filter: blur(24px);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
}
.side-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.side-panel-title { font-size: 14px; font-weight: 600; }
#queueList { overflow-y: auto; flex: 1; padding: 8px; }
#lyricsContent { overflow-y: auto; flex: 1; padding: 24px 20px; }

/* ── Lyrics ──────────────────────────────────── */
.lyrics-placeholder { color: var(--faint); font-size: 13px; text-align: center; padding: 40px 0; }
.lyric-line {
  font-size: 16px; line-height: 1.7; color: var(--faint);
  transition: color .3s, font-size .2s; cursor: default; padding: 2px 0;
}
.lyric-line.lyric-active {
  color: var(--text); font-size: 18px; font-weight: 600;
}

/* ── Modal text input ──────────────────────────────────── */
.modal-text-input {
  width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-family: inherit;
  font-size: 14px; padding: 10px 14px; outline: none; transition: border-color .2s;
}
.modal-text-input:focus { border-color: var(--accent); }
.modal-text-input::placeholder { color: var(--faint); }

/* ── Toast ──────────────────────────────────── */
#toast {
  position: fixed; bottom: calc(var(--player-h) + 16px); left: 50%;
  transform: translateX(-50%) translateY(20px); z-index: 500;
  background: var(--surface2); border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px; padding: 8px 18px; font-size: 13px;
  white-space: nowrap; opacity: 0; transition: all .25s; pointer-events: none;
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Keyboard shortcut hint on player ──────────────────────────────────── */
.player-btn[title]:hover::after {
  content: attr(title); position: absolute; bottom: 110%; left: 50%;
  transform: translateX(-50%); background: #1e1e1e; border: 1px solid var(--border);
  border-radius: 4px; padding: 3px 8px; font-size: 10px; white-space: nowrap;
  pointer-events: none; z-index: 10;
}
.player-btn { position: relative; }

@media (max-width: 768px) {
  .side-panel { width: 100%; top: auto; height: 70vh; border-left: none; border-top: 1px solid var(--border); }
  .sleep-dropdown { bottom: calc(var(--bnav-h) + 64px + env(safe-area-inset-bottom) + 8px); right: 12px; }
  #toast { bottom: calc(var(--bnav-h) + 64px + env(safe-area-inset-bottom) + 16px); }
}
