:root {
  color-scheme: light dark;
  --bg: #fbfbfa;
  --fg: #1a1a19;
  --muted: #6f6f68;
  --faint: #a8a8a0;
  --line: #d8d8d4;
  --accent: #2f6f4f;
  --warn: #8a5a1a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16171a; --fg: #ececea; --muted: #9a9a97; --faint: #55575c;
    --line: #2c2e33; --accent: #7fc3a0; --warn: #d7a45c;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.6 var(--sans); }
article { max-width: 40rem; margin: 0 auto; padding: 3rem 1.25rem 6rem; }
a { color: var(--accent); }

.kicker { font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin: 0; }
.rule-thick { border: none; border-top: 2px solid var(--fg); margin: .7rem 0 1.1rem; }
.lede {
  font-family: var(--serif); font-size: 1.85rem; line-height: 1.28;
  letter-spacing: -0.015em; font-weight: 400; margin: 0 0 .5rem;
}
.byline { color: var(--muted); font-size: .82rem; margin: 0 0 1.5rem; }

.banner {
  border: 1px solid var(--warn); border-radius: 4px; padding: .7rem .9rem;
  margin-bottom: 1.5rem; color: var(--warn); font-size: .82rem;
}

.tiles { margin-bottom: 2rem; }
.tile { border: 1px solid var(--line); border-radius: 3px; padding: .7rem .8rem; }
.tile .value { font-size: 1.4rem; font-weight: 500; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tile .label { color: var(--muted); font-size: .64rem; text-transform: uppercase; letter-spacing: .1em; }

.aside { border-left: 2px solid var(--accent); padding: .55rem .9rem; font-size: .84rem; color: var(--muted); margin: 0 0 2.5rem; }

/* Figures sit on the page ground — no cards, no shadows. */
figure { margin: 3.5rem 0 0; }
/* Figure titles are headings, not micro-labels. Uppercase at .66rem was too
   quiet to anchor a figure and made the artwork rows read as floating. */
.fignum {
  font-family: var(--serif);
  font-size: 1.12rem;
  line-height: 1.3;
  letter-spacing: -0.005em;
  text-transform: none;
  color: var(--accent);
  margin-bottom: .85rem;
}
.cap { font-family: var(--serif); font-size: .86rem; line-height: 1.5; color: var(--muted); margin-top: .6rem; }
.chart { min-width: 0; }
/* The rank table is the only thing here that can exceed the column. */
#timeline { overflow-x: auto; }
/* Controls: the browser default select is a grey lozenge that fights the
   editorial type. Reset the appearance and draw our own. */
.controls { display: flex; gap: 1.25rem; margin-bottom: .9rem; flex-wrap: wrap; }
.controls label {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .64rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.controls select {
  appearance: none; -webkit-appearance: none;
  font: inherit; font-size: .82rem; letter-spacing: 0; text-transform: none;
  color: var(--fg); background-color: transparent;
  border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  padding: .2rem 1.35rem .2rem .1rem; cursor: pointer;
  /* Chevron drawn inline so there is no image request and it recolours with
     the theme via currentColor-equivalent token substitution. */
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right .5rem center, right .25rem center;
  background-size: .26rem .26rem, .26rem .26rem;
  background-repeat: no-repeat;
  transition: border-color .15s;
}
.controls select:hover { border-bottom-color: var(--accent); }
.controls select:focus-visible { outline: none; border-bottom-color: var(--accent); box-shadow: 0 1px 0 var(--accent); }
/* The dropdown list itself is OS-drawn; give it a readable ground in dark mode. */
.controls select option { background: var(--bg); color: var(--fg); }

/* Movers table: the rank chart became unreadable at 53 overlapping lines, so
   the primary view is a table. Nothing overlaps and every entry is named. */
.movers { width: 100%; border-collapse: collapse; font-size: .875rem; }
.movers thead th {
  text-align: left; font-size: .62rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); font-weight: 500; padding: 0 .5rem .45rem 0;
  border-bottom: 1px solid var(--fg);
}
.movers td { padding: .32rem .5rem .32rem 0; border-bottom: 1px solid var(--line); }
.movers tbody tr:hover { background: color-mix(in srgb, var(--line) 30%, transparent); }
.movers .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.movers thead .num { text-align: right; }
.movers .pos { color: var(--faint); width: 2.5rem; }
.movers .name { width: 100%; }
.movers .trend { width: 76px; line-height: 0; color: var(--muted); }
.movers tbody tr:hover .trend { color: var(--accent); }
.movers .up { color: var(--accent); }
.movers .down { color: var(--warn); }
.movers .flat, .movers .new { color: var(--faint); }
.movers .new { font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; }
.spark { display: block; overflow: visible; }

/* An unready figure keeps its slot. Framed, empty, never faked. */
.awaiting { border: 1px dashed var(--line); border-radius: 3px; min-height: 6rem; }
.awaiting-note { color: var(--warn); font-family: var(--serif); font-size: .86rem; margin-top: .6rem; }

/* Day-one state of Figure 1: a real ranking, since there is no movement yet. */
.ranking { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.ranking li { display: flex; gap: .9rem; padding: .3rem 0; border-bottom: 1px solid var(--line); }
.ranking .pos { color: var(--faint); min-width: 1.6rem; text-align: right; font-variant-numeric: tabular-nums; }

.colophon { margin-top: 4rem; padding-top: 1.2rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; }
.colophon p { margin: 0 0 .5rem; }

.btn {
  font: inherit; cursor: pointer; color: var(--bg); background: var(--accent);
  border: none; border-radius: 3px; padding: .6rem 1.1rem; letter-spacing: .01em;
}
.btn:hover { filter: brightness(1.08); }
code { font-size: .92em; background: color-mix(in srgb, var(--line) 45%, transparent); padding: .05em .3em; border-radius: 2px; }

/* Ascending / fading sit side by side on wide screens and stack on narrow. */
.two-up { display: grid; grid-template-columns: 1fr 1fr; gap: 1.75rem; }
@media (max-width: 34rem) { .two-up { grid-template-columns: 1fr; gap: 1.25rem; } }
.colhead {
  font-size: .64rem; letter-spacing: .1em; text-transform: uppercase;
  margin: 0 0 .4rem; font-weight: 500;
}
.colhead.up { color: var(--accent); }
.colhead.down { color: var(--warn); }
.movers .faint { color: var(--faint); }
.movers td[colspan] { color: var(--faint); font-style: italic; }

/* --- Verdict: a position on a named spectrum, not a coefficient --- */
.verdict {
  font-family: var(--serif); font-size: 1.05rem; line-height: 1.45;
  margin: 0 0 1rem; color: var(--fg);
}
.gauge {
  position: relative; height: 5px; border-radius: 3px;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--accent) 35%, var(--line)),
    color-mix(in srgb, var(--warn) 65%, var(--line)));
}
.gauge i {
  position: absolute; top: -6px; width: 3px; height: 17px;
  background: var(--fg); border-radius: 2px;
  /* Keep the marker inside the track at the extremes. */
  transform: translateX(-1.5px);
}
.gauge-ends {
  display: flex; justify-content: space-between; margin-top: .45rem;
  font-size: .64rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.gauge-sub { font-size: .8rem; color: var(--muted); margin: .7rem 0 0; }

/* --- Artwork rows: Spotify's own visual language --- */
.rowhead {
  font-size: .72rem; letter-spacing: .09em; text-transform: uppercase;
  margin: 0 0 .8rem; font-weight: 600;
}
.rowhead.up { color: var(--accent); }
.rowhead.down { color: var(--warn); margin-top: 2rem; }
.faces { display: flex; flex-wrap: wrap; gap: 1rem 1.1rem; }
.face {
  margin: 0; text-align: center;
  flex: 0 1 4.1rem; min-width: 0;
}
.face a { display: block; border-radius: 50%; }
.face img {
  width: 3.6rem; height: 3.6rem; border-radius: 50%; object-fit: cover;
  display: block; margin: 0 auto .45rem; background: var(--line);
  transition: transform .15s;
}
.face a:hover img { transform: scale(1.06); }
.face figcaption {
  font-size: .72rem; line-height: 1.25; color: var(--fg);
  overflow-wrap: break-word; hyphens: auto;
}
/* Faded: the visual grammar of "no longer playing this". */
.face.faded img { filter: grayscale(1); opacity: .45; }
.face.faded figcaption { color: var(--muted); }
.no-art {
  display: block; width: 3.6rem; height: 3.6rem; border-radius: 50%;
  margin: 0 auto .45rem; background: var(--line);
}

/* --- Genre tags --- */
.pills { display: flex; flex-wrap: wrap; gap: .4rem; }
.pill {
  font-size: .82rem; padding: .22rem .7rem; border-radius: 1rem; cursor: help;
}
.pill.up { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.pill.down {
  background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn);
  text-decoration: line-through; text-decoration-thickness: 1px;
}
.pending { color: var(--muted); font-style: italic; font-size: .85rem; margin: 0; }

/* Album covers are square; artist portraits are circles. Same grid. */
.face.square img, .face.square .no-art { border-radius: 3px; }
.face.square a { border-radius: 3px; }
/* Song titles need more room than an artist name, and carry a performer under. */
.face.square { flex-basis: 5.2rem; }
.face .sub { display: block; color: var(--muted); font-size: .66rem; margin-top: .1rem; }
.face.faded .sub { color: var(--faint); }

.unlocks-block { margin: 3.5rem 0 0; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.unlocks {
  margin: 0; font-family: var(--serif); font-size: .92rem;
  color: var(--muted); line-height: 1.55;
}

/* --- Playing the record --- */
.run { display: flex; gap: 1.1rem; align-items: flex-start; }
.run-art { flex: 0 0 auto; border-radius: 3px; display: block; }
.run-art img { width: 6rem; height: 6rem; border-radius: 3px; object-fit: cover; display: block; background: var(--line); transition: transform .15s; }
.run-art:hover img { transform: scale(1.03); }
.run-body { min-width: 0; }
.run-lede { font-family: var(--serif); font-size: 1.02rem; line-height: 1.45; margin: 0 0 .45rem; }
.run-lede strong { font-weight: 600; }
.run-tracks { font-size: .8rem; color: var(--muted); margin: 0; line-height: 1.5; overflow-wrap: break-word; }
.run-others { font-size: .8rem; color: var(--muted); margin: 1rem 0 0; }
.no-art.big { width: 6rem; height: 6rem; border-radius: 3px; }

/* --- How new is your music --- */
.era-lede { font-family: var(--serif); font-size: 1.02rem; line-height: 1.45; margin: 0 0 1.2rem; }
.era-chart { display: flex; align-items: flex-end; gap: .5rem; height: 5rem; }
.era-bar { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; text-align: center; }
.era-bar span {
  display: block; background: var(--accent); border-radius: 2px 2px 0 0;
  /* A single-song decade still needs to be visible. */
  min-height: 3px;
}
.era-bar em {
  font-style: normal; font-size: .62rem; letter-spacing: .06em; color: var(--muted);
  margin-top: .4rem;
}
