:root {
  --bg: #121212;
  --surface: #1c1c1e;
  --surface-2: #2a2a2d;
  --text: #f2f2f2;
  --muted: #a0a0a6;
  --accent: #f5a623;
  --accent-ink: #121212;
  --radius: 10px;
  --player-h: 92px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.has-player { padding-bottom: var(--player-h); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:disabled { opacity: .4; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
main:focus { outline: none; }

/* ---------- login ---------- */

body.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-card {
  width: min(340px, 100%); display: grid; gap: 10px; justify-items: stretch;
  background: var(--surface); padding: 28px; border-radius: 16px;
}
.login-card img { justify-self: center; }
.login-card h1 { text-align: center; margin: 4px 0 10px; font-size: 22px; }
.login-card label { color: var(--muted); font-size: 13px; }
input[type=password], input[type=search] {
  width: 100%; padding: 11px 14px; border-radius: 999px; border: 1px solid transparent;
  background: var(--surface-2); color: var(--text); font: inherit;
}
input[type=password] { border-radius: var(--radius); }
input:focus { outline: none; border-color: var(--accent); }
.error { color: #ff6b6b; min-height: 1.2em; margin: 0; font-size: 13px; }
.login-card button, .primary {
  background: var(--accent); color: var(--accent-ink); font-weight: 600;
  padding: 11px 22px; border-radius: 999px;
}

/* ---------- top bar ---------- */

.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px;
  padding: 12px max(16px, calc((100vw - 1200px) / 2)); background: rgba(18, 18, 18, .92);
  backdrop-filter: blur(12px); border-bottom: 1px solid #ffffff10;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; }
.search { flex: 1; max-width: 460px; }
.link { color: var(--muted); font-size: 13px; margin-left: auto; white-space: nowrap; }
.link:hover { color: var(--text); }

main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 40px; }
.page { font-size: 26px; margin: 4px 0 18px; }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }
.loading { display: grid; place-items: center; padding: 80px 0; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--surface-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- shelves & cards ---------- */

.shelf { margin-bottom: 30px; }
.shelf h2 { font-size: 19px; margin: 0 0 12px; }
.row {
  display: grid; grid-auto-flow: column; grid-auto-columns: 160px; gap: 16px;
  overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 6px; scrollbar-width: thin;
}
.row.wide { grid-auto-columns: min(420px, 85vw); }
.card { display: block; text-align: left; scroll-snap-align: start; min-width: 0; padding: 0; }
.art { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: var(--surface-2); }
.art.wide { aspect-ratio: 2 / 1; }
.art.round { border-radius: 50%; }
.card:hover .art { filter: brightness(1.1); }
.card-title { margin-top: 8px; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- album / artist header ---------- */

.hero { display: flex; gap: 24px; align-items: flex-end; margin: 6px 0 26px; }
.art.big { width: 220px; flex: none; box-shadow: 0 10px 30px #0008; }
.hero-text { min-width: 0; }
.eyebrow { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.hero h1 { font-size: clamp(24px, 4vw, 40px); margin: 4px 0 6px; line-height: 1.15; }
.sub { color: var(--muted); }
a.sub:hover { color: var(--text); text-decoration: underline; }
.actions { display: flex; gap: 10px; margin-top: 16px; }
.secondary { background: var(--surface-2); padding: 11px 22px; border-radius: 999px; font-weight: 600; }

/* ---------- track list ---------- */

.tracks { list-style: none; margin: 0; padding: 0; }
.track {
  width: 100%; display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 8px 10px; border-radius: 8px;
}
.track:hover { background: var(--surface); }
.num { width: 22px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.art.tiny { width: 42px; flex: none; border-radius: 5px; }
.t-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.t-title, .t-artist { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-artist { color: var(--muted); font-size: 13px; }
.t-dur { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.tracks li.playing .t-title, .tracks li.playing .num { color: var(--accent); }

/* ---------- player ---------- */

.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; height: var(--player-h);
  display: grid; grid-template-columns: 1fr minmax(0, 520px) 1fr; align-items: center; gap: 16px;
  padding: 10px 16px; background: #1a1a1c; border-top: 1px solid #ffffff14;
}
.player[hidden] { display: none; }
.np { display: flex; align-items: center; gap: 12px; min-width: 0; }
#np-art { width: 56px; height: 56px; border-radius: 6px; object-fit: cover; background: var(--surface-2); flex: none; }
.np-text { min-width: 0; }
.np-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-artist { color: var(--muted); font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.np-artist[href]:hover { color: var(--text); text-decoration: underline; }
.controls { display: grid; gap: 4px; }
.buttons { display: flex; justify-content: center; align-items: center; gap: 14px; }
.icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; color: var(--text); }
.icon svg { width: 24px; height: 24px; fill: currentColor; }
.icon.small svg { width: 19px; height: 19px; }
.icon.small { color: var(--muted); }
.icon[aria-pressed=true] { color: var(--accent); }
.icon.play { width: 42px; height: 42px; background: var(--text); color: var(--bg); }
.icon.play .i-pause, .player.is-playing .icon.play .i-play { display: none; }
.player.is-playing .icon.play .i-pause { display: block; }
.seek { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.seek span { width: 38px; text-align: center; }
input[type=range] { flex: 1; accent-color: var(--accent); height: 4px; cursor: pointer; }
.vol { display: flex; align-items: center; gap: 8px; justify-self: end; width: min(160px, 100%); color: var(--muted); }
.vol svg { width: 20px; height: 20px; fill: currentColor; flex: none; }

@media (max-width: 720px) {
  :root { --player-h: 128px; }
  .top { gap: 10px; }
  .brand span { display: none; }
  .row { grid-auto-columns: 132px; gap: 12px; }
  .hero { flex-direction: column; align-items: flex-start; }
  .art.big { width: 180px; }
  .player { grid-template-columns: 1fr; gap: 6px; padding: 8px 12px; }
  .vol { display: none; }
  .np { order: 0; }
  #np-art { width: 44px; height: 44px; }
}
