:root {
  color-scheme: light dark;
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #17181a;
  --muted: #5d6168;
  --line: #e2e2de;
  --accent: #0b7a4b;
  --accent-text: #ffffff;
  --focus: #1a5fd0;
  --track: #ecece8;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1112;
    --surface: #181b1d;
    --text: #ececea;
    --muted: #9ba0a6;
    --line: #2a2e31;
    --accent: #3ddc97;
    --accent-text: #06231a;
    --focus: #7aa9ff;
    --track: #24282b;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
}

.wrap {
  width: min(100% - 2rem, 72rem);
  margin-inline: auto;
}

a { color: inherit; text-underline-offset: 0.2em; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

main:focus { outline: none; }

.skip {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  padding: 0.5rem 0.75rem;
  background: var(--accent);
  color: var(--accent-text);
  border-radius: var(--radius);
  z-index: 10;
}

.skip:focus { top: 0.5rem; }

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.header-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 0.75rem;
}

.brand {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.site-header ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-header nav a {
  display: block;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
}

.site-header nav a:hover { color: var(--text); }

.site-header nav a[aria-current="page"] {
  background: var(--accent);
  color: var(--accent-text);
}

main { padding-block: 1.5rem 3rem; }

h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2.1rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.empty { color: var(--muted); }

.site-footer {
  padding-block: 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
}

h2 {
  margin: 2rem 0 0.75rem;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.plain { margin: 0; padding: 0; list-style: none; }

.note { margin: -0.5rem 0 1rem; color: var(--muted); }

.tiles + .note { margin-top: 0.85rem; }

.eyebrow {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

/* now playing */
.now {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) * 1.4);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 8px 24px rgb(0 0 0 / 0.04);
}

.now[hidden] { display: none; }

.now-art {
  flex: none;
  width: 96px;
  height: 96px;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--line);
}

.now-art[hidden] { display: none; }

.now-body { min-width: 0; flex: 1; }

.now-track {
  margin: 0.15rem 0 0;
  font-size: 1.25rem;
  font-weight: 650;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.now-meta { margin: 0.1rem 0 0.6rem; color: var(--muted); }

.now-bar {
  display: block;
  width: 100%;
  height: 6px;
  appearance: none;
  border: 0;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
}

.now-bar::-webkit-progress-bar { background: var(--line); }
.now-bar::-webkit-progress-value { background: var(--accent); }
.now-bar::-moz-progress-bar { background: var(--accent); }

.now-time {
  margin: 0.3rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* stat tiles */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: 0.75rem;
  margin: 0;
}

.tile {
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.tile dt {
  font-size: 0.8rem;
  color: var(--muted);
}

.tile dd {
  margin: 0.15rem 0 0;
  font-size: 1.5rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* rows: thumb plus two lines of text */
.row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.list .row {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
}

.list time {
  flex: none;
  font-size: 0.85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.grow { min-width: 0; flex: 1; }

.thumb {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--line);
}

.title, .sub {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title { font-weight: 550; }

.sub { font-size: 0.85rem; color: var(--muted); }

/* tables */
.data {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.data th, .data td {
  padding: 0.4rem 0.75rem;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}

.data thead th {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.data tbody tr:last-child td { border-bottom: 0; }

.data td { font-variant-numeric: tabular-nums; }

.data tbody tr:hover {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.data .num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.data td:first-child, .data th:first-child { max-width: 0; width: 100%; }

.ranked td:first-child, .ranked th:first-child {
  width: 2.5rem;
  max-width: none;
}

.ranked td:nth-child(2) { max-width: 0; width: 100%; }

.rank { color: var(--muted); }

.bar {
  display: block;
  width: var(--w);
  height: 3px;
  margin-top: 0.3rem;
  border-radius: 99px;
  background: var(--accent);
  opacity: 0.55;
}

.data time { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* filters and pagination */
.filters ul, .pager ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.6rem;
  padding: 0;
  list-style: none;
}

.filters a, .pager a {
  display: block;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  text-decoration: none;
}

.filters a:hover, .pager a:hover { border-color: var(--accent); }

.filters a[aria-current], .pager a[aria-current] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.pager { margin: 1rem 0; }

.pager li[aria-hidden] { padding: 0.25rem 0.2rem; color: var(--muted); }

.filters { margin-bottom: 1rem; }

@media (max-width: 40rem) {
  .col-album, .col-dur { display: none; }
  .now-art { width: 72px; height: 72px; }
  .data th, .data td { padding-inline: 0.5rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .data tbody tr, .filters a, .pager a {
    transition: background-color 0.12s, border-color 0.12s;
  }
}

/* stats page */
h3 {
  margin: 1.75rem 0 0.5rem;
  font-size: 1rem;
}

.tile .hint {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--muted);
}

.charts {
  display: grid;
  gap: 0 2rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
}

.chart { margin: 0 0 2rem; }

.chart figcaption {
  margin-bottom: 0.6rem;
  font-weight: 600;
}

.chart-note {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.bars {
  display: grid;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  gap: 2px;
}

.bar-col {
  display: grid;
  grid-template-rows: 9rem 1.3rem;
  min-width: 0;
}

.bar-fill {
  align-self: end;
  justify-self: center;
  width: min(100%, 24px);
  height: var(--h);
  background: var(--accent);
  border-radius: 4px 4px 0 0;
}

.bar-col:hover .bar-fill { opacity: 0.75; }

.bar-tick {
  display: flex;
  justify-content: center;
  padding-top: 0.2rem;
  font-size: 0.7rem;
  line-height: 1;
  white-space: nowrap;
  color: var(--muted);
}

.bars {
  background:
    linear-gradient(var(--line), var(--line))
    0 calc(100% - 1.3rem) / 100% 1px no-repeat;
}

.heat {
  display: grid;
  grid-template-columns: 2.4rem repeat(var(--n), minmax(0, 1fr));
  gap: 2px;
  align-items: center;
}

.heat-label, .heat-tick {
  font-size: 0.7rem;
  color: var(--muted);
}

.heat-tick { display: flex; justify-content: center; white-space: nowrap; }

.heat-cell {
  height: 1.5rem;
  border-radius: 3px;
  background: color-mix(
    in srgb, var(--accent) calc(var(--v) * 100%), var(--track)
  );
}

.heat-key {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.6rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.heat-ramp {
  width: 6rem;
  height: 0.5rem;
  border-radius: 99px;
  background: linear-gradient(to right, var(--track), var(--accent));
}

.table-view { margin-top: 0.75rem; font-size: 0.9rem; }

.table-view summary {
  display: inline-block;
  cursor: pointer;
  color: var(--muted);
  border-radius: 4px;
}

.table-view summary:hover { color: var(--text); }

.scroll { overflow-x: auto; margin-top: 0.5rem; }

/* record tables: columns shrink to content, one column takes the rest */
.scroll .data th, .scroll .data td {
  width: 1%;
  max-width: none;
  white-space: nowrap;
}

.scroll .data th.grow, .scroll .data td.grow {
  width: 100%;
  white-space: normal;
}

.grow .title, .grow .sub { white-space: normal; }

/* history: columns share the width by content and text wraps */
.fit th, .fit td, .fit th:first-child, .fit td:first-child {
  width: auto;
  max-width: none;
}

.fit .title, .fit .sub { white-space: normal; overflow-wrap: anywhere; }

.fit td { vertical-align: middle; }
