:root {
  --bg: #0d0f14;
  --bg-2: #141822;
  --bg-3: #1c2130;
  --line: #262d3d;
  --fg: #e8ecf4;
  --fg-dim: #99a3b8;
  --fg-mute: #67718a;
  --accent: #5b9dff;
  --accent-2: #7c5cff;
  --up: #46c98b;
  --down: #ef6b6b;
  --radius: 12px;
  --bar-h: 88px;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  display: grid;
  grid-template-columns: 252px 1fr;
  grid-template-rows: 1fr auto;
  grid-template-areas:
    "sidebar main"
    "bar     bar";
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow: hidden;
}

button { font: inherit; cursor: pointer; }
.muted { color: var(--fg-mute); }
.small { font-size: 13px; }

/* ---------- sidebar ---------- */
.sidebar {
  grid-area: sidebar;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 14px;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.brand .mark { color: var(--accent); font-size: 22px; }

.who {
  margin-left: auto;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--fg-mute);
  font-size: 11px;
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.who:hover { border-color: var(--accent); color: var(--accent); }

.kv { display: flex; flex-direction: column; gap: 2px; }
.kv b { font-size: 15px; }
.kv span { color: var(--fg-dim); font-size: 13px; }

.token-value {
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  word-break: break-all;
  user-select: all;
}

#token-name {
  flex: 1;
  min-width: 160px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 13px;
  outline: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--fg-dim);
  text-align: left;
}

.nav-item:hover { background: var(--bg-3); color: var(--fg); }
.nav-item.active { background: var(--bg-3); color: var(--fg); }
.nav-ico { color: var(--fg-mute); }

.nav-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--fg-mute);
  padding: 0 11px;
  margin-top: 4px;
}

.primary {
  padding: 10px 14px;
  border: 0;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 600;
}

.primary:hover { filter: brightness(1.1); }

.ghost {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--fg-dim);
  font-size: 13px;
}

.ghost:hover { background: var(--bg-3); color: var(--fg); }
.ghost.wide { display: block; width: 100%; margin-top: 10px; padding: 9px; }

.stations {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  min-height: 0;
}

.station {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--fg-dim);
  text-align: left;
  width: 100%;
}

.station:hover { background: var(--bg-3); color: var(--fg); }

.station.active {
  background: var(--bg-3);
  color: var(--fg);
  box-shadow: inset 2px 0 0 var(--accent);
}

.station .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.station .c { font-size: 11px; color: var(--fg-mute); }

.lib {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  font-size: 13px;
  color: var(--fg-dim);
}

.lib-row { margin-bottom: 3px; }
.lib-row span { color: var(--fg); font-variant-numeric: tabular-nums; }
.lib-row.muted span { color: var(--fg-mute); }

.lib-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

.pill {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff !important;
  font-size: 11px;
  text-align: center;
}

.job { margin-top: 8px; font-size: 12px; color: var(--accent); min-height: 16px; }

/* ---------- main ---------- */
.main {
  grid-area: main;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 28px 32px 36px;
}

.empty { margin: auto; max-width: 430px; text-align: center; }
.empty h1 { margin: 0 0 8px; font-size: 28px; letter-spacing: -0.02em; }
.empty p { color: var(--fg-dim); margin: 0 0 22px; }

/* hero: what's playing, in detail */
.hero {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  align-items: start;
  max-width: 820px;
  flex: 0 0 auto;
}

.art-wrap { position: relative; aspect-ratio: 1; }

.art {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 14px;
  object-fit: cover;
  background: var(--bg-3);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.45);
}

.art-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 56px;
  color: var(--fg-mute);
}

.station-label {
  font-size: 12px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

.hero-txt h2 { margin: 0 0 4px; font-size: 26px; line-height: 1.2; letter-spacing: -0.02em; }
.artist { color: var(--fg-dim); font-size: 17px; }
.album { color: var(--fg-mute); font-size: 14px; margin-top: 2px; }

.sonic-line {
  margin-top: 10px;
  font-size: 12px;
  color: var(--fg-mute);
  font-variant-numeric: tabular-nums;
  min-height: 16px;
}

.rating { display: flex; gap: 2px; margin-top: 8px; }

.star {
  border: 0;
  background: transparent;
  color: var(--line);
  font-size: 19px;
  padding: 0 2px;
  line-height: 1;
}

.star:hover { color: var(--fg-dim); }
.star.on { color: var(--accent); }

.dj-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }

/* lyrics */
.lyrics-box { margin-top: 32px; max-width: 820px; flex: 0 0 auto; }

.lyrics-box h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--fg-mute);
  margin: 0 0 10px;
}

.lyrics {
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;          /* long lines wrap; no horizontal bar */
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  border-left: 2px solid var(--line);
  padding-left: 16px;
  overscroll-behavior: contain;
}

.lyrics::-webkit-scrollbar { width: 8px; }
.lyrics::-webkit-scrollbar-track { background: transparent; }
.lyrics::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}
.lyrics::-webkit-scrollbar-thumb:hover { background: var(--fg-mute); }

.lyric {
  padding: 3px 0;
  color: var(--fg-mute);
  font-size: 15px;
  cursor: pointer;
  transition: color 0.15s, transform 0.15s;
}

.lyric:hover { color: var(--fg-dim); }

.lyric.on {
  color: var(--fg);
  font-weight: 600;
  transform: translateX(3px);
}

.lyric.plain { white-space: pre-wrap; cursor: default; color: var(--fg-dim); }

/* waveform */
.wave-wrap { position: relative; flex: 1; display: flex; align-items: center; }

.wave { width: 100%; height: 34px; display: block; cursor: pointer; }

/* The real input stays for keyboard/a11y, laid over the canvas invisibly. */
.wave-wrap input[type=range] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.why { margin-top: 18px; font-size: 13px; color: var(--fg-dim); }
.why summary { cursor: pointer; color: var(--fg-mute); }
.why ul { margin: 8px 0 0; padding-left: 18px; }

.queue-box { margin-top: 36px; max-width: 820px; flex: 0 0 auto; }

.queue-box h3,
.browse h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--fg-mute);
  margin: 0 0 10px;
}

.history { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }

.history li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  color: var(--fg-dim);
}

.history li b { color: var(--fg); font-weight: 500; }

/* queue rows */
.count {
  color: var(--fg-mute);
  font-weight: 400;
  margin-left: 4px;
  text-transform: none;
  letter-spacing: 0;
}

.ghost.tiny { padding: 2px 8px; font-size: 11px; margin-left: 10px; vertical-align: middle; }

.q-row { align-items: center; }
.q-main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-meta { color: var(--fg-mute); font-variant-numeric: tabular-nums; font-size: 13px; }

.q-btn {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  margin-left: 6px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--fg-mute);
  font-size: 11px;
  line-height: 1;
  padding: 0;
}

.q-btn:hover { border-color: var(--accent); color: var(--accent); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bar-h) + 18px);
  transform: translateX(-50%);
  z-index: 50;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-3);
  color: var(--fg);
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

/* ---------- browse ---------- */
.browse { max-width: 900px; }

.crumbs { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 14px; }

.crumb { border: 0; background: transparent; color: var(--accent); padding: 0; font-size: 14px; }
.crumb:hover { text-decoration: underline; }
.crumb.current { color: var(--fg); cursor: default; }
.crumb-sep { color: var(--fg-mute); }

#lib-filter {
  width: 100%;
  max-width: 320px;
  padding: 9px 12px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-2);
  color: var(--fg);
  font: inherit;
  outline: none;
}

#lib-filter:focus { border-color: var(--accent); }

.lib-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 8px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--fg);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.row:hover { background: var(--bg-2); }
.row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.row.playing { background: var(--bg-3); box-shadow: inset 2px 0 0 var(--accent); }

.row .thumb {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--bg-3);
  flex: 0 0 auto;
}

.row .num {
  width: 26px;
  text-align: right;
  color: var(--fg-mute);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

.row .main-txt { flex: 1; min-width: 0; }
.row .main-txt b { display: block; font-weight: 500; }

.row .main-txt span {
  display: block;
  color: var(--fg-mute);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row .meta { color: var(--fg-mute); font-size: 13px; flex: 0 0 auto; font-variant-numeric: tabular-nums; }

.row .radio-btn {
  flex: 0 0 auto;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--fg-mute);
  font-size: 12px;
}

.row .radio-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- transport bar ---------- */
.bar {
  grid-area: bar;
  height: var(--bar-h);
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(320px, 2fr) minmax(180px, 1fr);
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  background: var(--bg-2);
  border-top: 1px solid var(--line);
}

.bar-now { display: flex; align-items: center; gap: 12px; min-width: 0; }

.bar-art {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-3);
  flex: 0 0 auto;
}

.bar-txt { min-width: 0; }

.bar-txt b {
  display: block;
  font-weight: 500;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-txt span {
  display: block;
  color: var(--fg-mute);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-mid { display: flex; flex-direction: column; align-items: center; gap: 4px; }

.controls { display: flex; align-items: center; gap: 10px; }

.round {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  display: grid;
  place-items: center;
  padding: 0;
}

.round:hover { background: var(--bg-3); }

.round.big {
  width: 44px;
  height: 44px;
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-size: 16px;
}

.round.on-up { border-color: var(--up); box-shadow: 0 0 0 2px rgba(70, 201, 139, 0.25); }
.round.on-down { border-color: var(--down); box-shadow: 0 0 0 2px rgba(239, 107, 107, 0.25); }
.round:disabled { opacity: 0.35; cursor: default; }

.scrub { display: flex; align-items: center; gap: 10px; width: 100%; }

.time {
  font-size: 11px;
  color: var(--fg-mute);
  font-variant-numeric: tabular-nums;
  min-width: 34px;
}

.bar-right { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.vol-ico { color: var(--fg-mute); font-size: 13px; }
.bar-right input[type=range] { max-width: 110px; }

input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-3);
  outline: none;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--fg);
  cursor: pointer;
}

input[type=range]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 50%;
  background: var(--fg);
  cursor: pointer;
}

/* ---------- dialogs ---------- */
dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-2);
  color: var(--fg);
  padding: 0;
  width: min(520px, 92vw);
}

dialog::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(2px); }

.dlg { padding: 20px; }
.dlg h3 { margin: 0 0 12px; font-size: 18px; }

.dlg input[type=search] {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  outline: none;
}

.dlg input[type=search]:focus { border-color: var(--accent); }

.results { max-height: 46vh; overflow-y: auto; margin-top: 12px; }

.result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--fg);
  text-align: left;
}

.result:hover { background: var(--bg-3); }
.result .sub { color: var(--fg-mute); font-size: 12px; }

.group-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--fg-mute);
  margin: 14px 0 4px 12px;
}

menu { display: flex; justify-content: flex-end; gap: 8px; margin: 16px 0 0; padding: 0; }

/* ---------- mobile ----------
 * The sidebar becomes a slide-over drawer rather than a squashed strip: it
 * holds stations plus eight library actions, which cannot survive being folded
 * into a horizontal row. Everything tappable goes to >=44px.
 */
.menu-btn,
.scrim { display: none; }

@media (max-width: 900px) {
  :root { --bar-h: 128px; }

  body {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
    grid-template-areas: "main" "bar";
    /* dvh, not vh: mobile browser chrome hides and shows, and vh doesn't
       follow it — the transport bar ends up under the address bar. */
    height: 100dvh;
    overflow: hidden;
  }

  .menu-btn {
    display: grid;
    place-items: center;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 40;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg-2);
    color: var(--fg);
    font-size: 17px;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: min(310px, 86vw);
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    overflow-y: auto;
    padding-bottom: 28px;
  }

  body.nav-open .sidebar { transform: none; }

  .scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }

  body.nav-open .scrim { opacity: 1; pointer-events: auto; }

  .main { padding: 62px 16px 20px; }

  .hero { grid-template-columns: 1fr; gap: 18px; }
  .art-wrap { max-width: 60vw; margin: 0 auto; }
  .hero-txt { text-align: center; }
  .hero-txt h2 { font-size: 22px; }
  .rating, .dj-row { justify-content: center; }
  .dj-row .ghost { padding: 9px 13px; }

  .queue-box, .lyrics-box, .browse { max-width: none; }
  .lyrics { max-height: 220px; }

  /* Stacked rows: identity, then controls with the scrubber under them.
     The scrubber is a child of .bar-mid, so it cannot be placed in the bar's
     own grid — laying it out absolutely put the waveform on top of the
     transport buttons. Keep it in normal flow instead. */
  .bar {
    grid-template-columns: 1fr;
    grid-template-areas:
      "now"
      "mid";
    height: auto;
    gap: 6px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  }

  .bar-now { grid-area: now; }
  .bar-mid { grid-area: mid; flex-direction: column; gap: 6px; width: 100%; }
  .bar-mid .scrub { width: 100%; }
  .bar-right { display: none; }          /* hardware volume keys handle this */

  .round { width: 44px; height: 44px; font-size: 16px; }
  .round.big { width: 52px; height: 52px; font-size: 18px; }
  .bar-art { width: 46px; height: 46px; }

  /* Comfortable touch targets in lists. */
  .row { padding: 13px 8px; }
  .q-btn { width: 34px; height: 34px; margin-left: 8px; }
  .star { font-size: 24px; padding: 0 4px; }
  .radio-btn { padding: 7px 11px; }
  .history li { padding: 12px 2px; }

  dialog { width: 94vw; }
  .results { max-height: 60vh; }
}

@media (max-width: 420px) {
  .art-wrap { max-width: 74vw; }
  .bar-txt b { font-size: 13px; }
  .dj-row .ghost { font-size: 12px; padding: 8px 10px; }
}

/* ---------- sign-in gate ---------- */
/* Sits above everything, including the player and any open dialog, because
   nothing behind it has data to show until Authentik has answered. */
.signin {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(120% 100% at 50% 0%, var(--bg-2), var(--bg));
}
.signin[hidden] { display: none; }

.signin-card {
  width: min(380px, 100%);
  text-align: center;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 34px 28px;
}

.signin-mark {
  font-size: 34px;
  line-height: 1;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.signin-card h1 { margin: 10px 0 6px; font-size: 26px; letter-spacing: -0.01em; }
.signin-card p { margin: 0 0 18px; }

.signin-btn {
  display: block;
  text-decoration: none;
  text-align: center;
  padding: 12px 14px;
}

#signin-note { margin: 14px 0 0; }

/* ---------- mood / mix / tuning ---------- */
.seg-label {
  margin: 16px 0 6px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-mute);
}
.seg-label:first-of-type { margin-top: 4px; }

.mood-row { display: flex; gap: 8px; }
.mood-row input { flex: 1; min-width: 0; }

.mix-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }

.mini-select {
  flex: 1;
  padding: 6px 8px;
  background: var(--bg-3);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
  font-size: 14px;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-3);
  color: var(--fg-dim);
  font-size: 13px;
}
.chip:hover { color: var(--fg); }
.chip.on {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}

/* Each slider is a labelled block: name + live value, control, then the
   sentence explaining what it actually changes. */
.slider-row { display: block; margin: 12px 0; }
.slider-row > span:first-child {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  margin-bottom: 4px;
}
.slider-row em {
  font-style: normal;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.slider-row input[type="range"] { width: 100%; }
.slider-row > span:last-child { display: block; margin-top: 2px; }

#dlg-bug textarea {
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  background: var(--bg-3);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
  resize: vertical;
}
#bug-context, #bug-result { margin-top: 8px; }

/* The gear only appears on hover/focus so the sidebar stays calm. */
.station { position: relative; }
.station .gear {
  opacity: 0;
  margin-left: 6px;
  padding: 0 4px;
  color: var(--fg-mute);
  transition: opacity 0.12s;
}
.station:hover .gear, .station:focus-within .gear { opacity: 1; }
.station .gear:hover { color: var(--fg); }

/* Touch has no hover, so leave it visible there. */
@media (pointer: coarse) {
  .station .gear { opacity: 0.6; }
}

.chip-n {
  margin-left: 4px;
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

/* ---------- logo ---------- */
/* The mark replaced a text glyph, so it has to sit on the text baseline
   rather than inline-align to the bottom of the line box. */
.brand .mark {
  width: 30px;
  height: auto;
  vertical-align: middle;
  margin-right: 2px;
}

img.signin-mark {
  width: 132px;
  height: auto;
  margin: 0 auto 4px;
  display: block;
  /* No gradient text trick needed now — the artwork carries its own colour. */
  background: none;
  color: inherit;
}

/* ---------- full pages (reports / recap / settings / admin) ---------- */
.page { padding: 22px 26px 90px; overflow-y: auto; }
.page[hidden] { display: none; }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-head h1 { margin: 0; font-size: 26px; letter-spacing: -0.01em; }
.page-actions { display: flex; align-items: center; gap: 8px; }
.page-body { display: flex; flex-direction: column; gap: 16px; }

.panel {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
}
.panel h3 { margin: 0 0 12px; font-size: 15px; }

/* Two columns where there's room, one where there isn't. */
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }

.note { margin: 10px 0 0; }

/* --- stat tiles --- */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.tile-v { font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; }
.tiles.big .tile-v { font-size: 32px; }
.tile-l { font-size: 12px; color: var(--fg-mute); text-transform: uppercase; letter-spacing: 0.05em; }
.tile-s { font-size: 12px; color: var(--fg-dim); }

/* --- bar lists --- */
.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40% auto;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.bar-track { background: var(--bg-3); border-radius: 999px; height: 8px; overflow: hidden; }
.bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.bar-val { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--fg-dim); }

/* --- day / hour / month charts --- */
.spark, .hours, .months { display: flex; align-items: flex-end; gap: 2px; height: 90px; }
.months { gap: 6px; height: 120px; }
.spark-bar, .hour-bar, .month-bar {
  flex: 1;
  min-width: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border-radius: 2px 2px 0 0;
}
.hours-axis {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--fg-mute);
  margin-top: 4px;
}
.month { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.month-bar { width: 100%; margin-top: auto; }
.month-l { font-size: 11px; color: var(--fg-mute); margin-top: 4px; }

/* --- recap cards --- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(150deg, var(--bg-2), var(--bg-3));
}
.card h4 { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--fg-mute); }
.card b { font-size: 18px; }

/* --- tables --- */
.kv-table, .grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.kv-table td { padding: 5px 0; border-bottom: 1px solid var(--line); }
.kv-table td:first-child { color: var(--fg-mute); }
.kv-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }
.grid th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-mute);
  padding: 6px 10px 6px 0;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.grid td { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.plain { list-style: none; margin: 8px 0 0; padding: 0; }
.plain li { padding: 3px 0; font-size: 14px; }
.feed { max-height: 320px; overflow-y: auto; }
.tiny { font-size: 12px; padding: 3px 7px; }

/* --- settings rows --- */
.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.set-row:last-child { border-bottom: 0; }
.set-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.set-ctl { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.set-ctl input[type="range"] { width: 160px; }

/* --- the December nudge --- */
.recap-nudge {
  display: block;
  padding: 9px 12px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}
.recap-nudge[hidden] { display: none; }

/* --- Pandora-style history stack --- */
/* The covers fan out to the LEFT of the current one, so the current art keeps
   its position and the stack reads as "what came before". */
.art-wrap { position: relative; }
.art-stack { position: absolute; inset: 0; pointer-events: none; }
.art-card {
  position: absolute;
  top: 50%;
  right: 100%;
  padding: 0;
  border: 0;
  background: none;
  pointer-events: auto;
  /* --d is 1 for the most recent; each step further back shifts left, shrinks
     and dims, which is what makes it read as depth rather than a row. */
  transform: translate(calc(var(--d) * 22px), -50%) scale(calc(1 - var(--d) * 0.06));
  opacity: calc(1 - var(--d) * 0.18);
  z-index: calc(10 - var(--d));
  transition: transform 0.18s, opacity 0.18s;
}
.art-card img {
  display: block;
  width: 148px;
  height: 148px;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: -8px 0 22px rgba(0, 0, 0, 0.45);
}
.art-card:hover { opacity: 1; transform: translate(calc(var(--d) * 22px - 10px), -50%) scale(1); }

/* No room to fan cards out beside the art on a phone. */
@media (max-width: 900px) { .art-stack { display: none; } }

.want-row { display: flex; align-items: center; gap: 10px; }
.radio-btn.done { opacity: 0.6; }

/* A display rule on a class beats the browser's [hidden] styling, so any
   section given `display: grid/flex` stayed visible after being hidden in JS —
   which is why the player showed through the library and the report pages.
   One global guard is more reliable than remembering it per component. */
[hidden] { display: none !important; }

/* .month-bar sits in a COLUMN flex container, where flex:1 sets the main axis —
   height — and silently overrode the inline height, drawing every month full
   size. The spark and hour bars are in row containers, where flex:1 correctly
   sets width, so only this one needs opting out. */
.month-bar { flex: 0 0 auto; }

/* ---------- centre the now-playing column ---------- */
/* .main is a column flex, so these blocks sat hard against the left edge on a
   wide screen while the player itself looked adrift. They already share a
   max-width, so centring the whole stack keeps them aligned with each other. */
.hero,
.lyrics-box,
.queue-box,
.similar-box {
  margin-inline: auto;
  width: 100%;
}
.browse { margin-inline: auto; width: 100%; }

/* The transport bar's now-playing corner is a link back to the song. */
.bar-now { cursor: pointer; border-radius: 10px; padding: 4px 6px; margin: -4px -6px; }
.bar-now:hover { background: var(--bg-3); }
.bar-now:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* offsetTop is measured from the nearest positioned ancestor. Without this the
   lyric scroll maths was relative to something outside the panel entirely. */
.lyrics { position: relative; }
