:root {
  --bg: #0f0f14;
  --panel: #1a1a23;
  --panel-2: #23232f;
  --text: #f1f1f5;
  --muted: #9a9aab;
  --accent: #1ed760;
  --accent-2: #8b5cf6;
  --error: #ff6b6b;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
}
a { color: inherit; }
img { display: block; background: var(--panel-2); }
main { max-width: 1100px; margin: 0 auto; padding: 0 16px 48px; }

/* Header */
.top {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 14px 24px; background: #000; position: sticky; top: 0; z-index: 2;
}
.brand { text-decoration: none; display: flex; }

/* Logo */
.logo { display: inline-flex; align-items: center; gap: .45em; line-height: 1; white-space: nowrap; }
.logo img { width: 1.6em; height: 1.6em; background: none; flex: none; }
.wordmark { font-weight: 800; letter-spacing: -.02em; color: var(--text); }
.wordmark b {
  font-weight: 800;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.logo-small { font-size: 1.15rem; }
.logo-large { font-size: clamp(1.8rem, 6vw, 2.6rem); }
.logo-hero { font-size: clamp(2.2rem, 8vw, 4rem); }
.hero { max-width: 1100px; margin: 40px auto 0; padding: 0 16px; display: flex; justify-content: center; }
.top nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.top nav a {
  text-decoration: none; color: var(--muted); padding: 6px 12px; border-radius: 999px; font-size: .95rem;
}
.top nav a:hover { color: var(--text); }
.top nav a.active { background: var(--panel-2); color: var(--text); }
.who { display: flex; align-items: center; gap: 10px; color: var(--muted); min-width: 0; }
.who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

button, select, input {
  font: inherit; color: var(--text); background: var(--panel-2);
  border: 1px solid #33334a; border-radius: 8px; padding: 6px 10px;
}
button { cursor: pointer; }
button[type=submit] { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }
.who button { background: transparent; color: var(--muted); border-color: #33334a; font-weight: 400; }

/* Period filter */
.filter {
  max-width: 1100px; margin: 24px auto 8px; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper h2 { margin: 0; font-size: 1.1rem; min-width: 8ch; text-align: center; }
.stepper a, .stepper span {
  width: 34px; height: 34px; display: grid; place-items: center; font-size: 1.5rem;
  text-decoration: none; border-radius: 50%;
}
.stepper a { background: var(--panel-2); }
.stepper a:hover { background: var(--accent); color: #000; }
#period-form { display: flex; gap: 8px; flex-wrap: wrap; }

.headline {
  font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.05; margin: 24px 0 28px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  padding-bottom: .12em; /* room for descenders, which background-clip would cut off */
}
.error { background: #3a1c1c; color: var(--error); padding: 12px 16px; border-radius: var(--radius); }
.empty { color: var(--muted); font-size: 1.1rem; }

/* Overview */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 28px; }
.tile {
  background: var(--panel); border-radius: var(--radius); padding: 20px;
  display: flex; flex-direction: column; justify-content: flex-end; min-height: 120px;
}
.tile.big {
  grid-column: 1 / -1; min-height: 180px;
  background: linear-gradient(135deg, #14532d, #4c1d95);
}
.tile .value { font-size: 2.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.tile.big .value { font-size: clamp(3rem, 9vw, 5.5rem); line-height: 1; }
.tile .label { color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-size: .8rem; }
.tile.big .label { color: #e5e5ef; font-size: 1rem; }

.highlights { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.card { background: var(--panel); border-radius: var(--radius); padding: 18px 20px; }
.card h3 { margin: 0 0 12px; font-size: 1rem; }
.card h3 a { text-decoration: none; }
.card h3 a:hover { color: var(--accent); }
.card h3 a::after { content: " ›"; color: var(--muted); }
.mini { list-style: none; margin: 0; padding: 0; counter-reset: n; }
.mini li {
  display: flex; align-items: center; gap: 12px; padding: 6px 0; counter-increment: n;
}
.mini li::before { content: counter(n); color: var(--muted); width: 1.2em; text-align: right; font-variant-numeric: tabular-nums; }
.mini img { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; flex: none; }
.mini .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini small { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.mini .n, .card .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.decade .value { font-size: 2.6rem; font-weight: 800; margin: 0; color: var(--accent); }
.decade .n { margin: 4px 0 12px; }

.round { border-radius: 50% !important; }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.thumbs img { width: 52px; height: 52px; border-radius: 6px; object-fit: cover; }

/* Ranked lists */
.ranked { list-style: none; margin: 0; padding: 0; }
.ranked li {
  display: grid; grid-template-columns: 2.4em auto 1fr auto; align-items: center; gap: 16px;
  padding: 10px 14px; border-radius: var(--radius);
}
.ranked li:nth-child(odd) { background: var(--panel); }
.ranked li:not(:has(.cover)) { grid-template-columns: 2.4em 1fr auto; }
.rank { font-size: 1.3rem; font-weight: 700; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.cover { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; }
.info { min-width: 0; }
.title { font-weight: 600; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title a { text-decoration: none; }
.title a:hover { text-decoration: underline; }
.sub { color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 4px; background: var(--panel-2); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.nums { text-align: right; color: var(--muted); font-size: .85rem; display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
.nums span:first-child { white-space: nowrap; }
.nums strong { color: var(--text); font-size: 1.15rem; }

.ranked li.first {
  background: linear-gradient(135deg, #14532d, #4c1d95); padding: 20px; margin-bottom: 8px;
}
.ranked li.first .rank { color: var(--text); font-size: 2rem; }
.ranked li.first .cover { width: 160px; height: 160px; border-radius: 12px; box-shadow: 0 10px 30px #0008; }
.ranked li.first .title { font-size: 1.6rem; white-space: normal; }
.ranked li.first .sub { color: #e5e5ef; white-space: normal; }
.ranked li.first .bar span { background: #fff; }
.ranked li.first .nums { color: #e5e5ef; }
.ranked.genres .title, .ranked.decades .title, .ranked.weekdays .title { font-size: 1.3rem; }
.more { text-align: center; margin-top: 20px; }

/* Day of the week chart */
.weekchart {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; align-items: end;
  background: var(--panel); border-radius: var(--radius); padding: 20px 20px 14px; margin-bottom: 20px;
}
.weekchart .day { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.weekchart .col { height: 160px; width: 100%; max-width: 56px; display: flex; align-items: flex-end; }
.weekchart .col span { width: 100%; min-height: 2px; background: var(--accent); border-radius: 6px 6px 2px 2px; opacity: .55; }
.weekchart .best .col span { opacity: 1; background: linear-gradient(var(--accent), var(--accent-2)); }
.weekchart .n { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.weekchart .d { font-weight: 600; }
.weekchart .best .n, .weekchart .best .d { color: var(--text); }

/* Song of the month */
.months { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.months li { background: var(--panel); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.months .month { font-weight: 700; text-decoration: none; margin-bottom: 8px; color: var(--accent); }
.months .month:hover { text-decoration: underline; }
.months .cover { width: 100%; height: auto; aspect-ratio: 1; margin-bottom: 10px; }
.months .title { white-space: normal; }
.months .n { color: var(--muted); font-size: .85rem; margin-top: 6px; font-variant-numeric: tabular-nums; }
.months .n strong { color: var(--text); }

/* Login */
.login {
  max-width: 380px; margin: 12vh auto 0; background: var(--panel); border-radius: var(--radius);
  padding: 32px; display: flex; flex-direction: column; gap: 14px;
}
.login h1 { margin: 0 0 4px; }
.login p { margin: 0; color: var(--muted); }
.login label { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; color: var(--muted); }
.login button { margin-top: 8px; padding: 10px; }
.login label.remember { flex-direction: row; align-items: center; gap: 10px; color: var(--text); font-size: .95rem; cursor: pointer; }
.login label.remember input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }

/* Below this the menu no longer fits next to the logo: give it its own scrollable row. */
@media (max-width: 960px) {
  .top { padding: 10px 16px 6px; gap: 6px 12px; }
  .top nav {
    order: 3; flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    margin: 0 -16px; padding: 0 16px 4px;
  }
  .top nav::-webkit-scrollbar { display: none; }
  .top nav a { white-space: nowrap; padding: 8px 12px; }
  .who { margin-left: auto; }
}

@media (max-width: 700px) {
  main { padding: 0 12px 40px; }
  .top { padding: 10px 12px 6px; }
  .top nav { margin: 0 -12px; padding: 0 12px 4px; }

  .filter { margin-top: 16px; padding: 0 12px; flex-direction: column; align-items: stretch; gap: 12px; }
  .stepper { justify-content: space-between; }
  .stepper a, .stepper span { width: 44px; height: 44px; }
  #period-form > * { flex: 1 1 auto; min-height: 44px; }
  #period-form button { flex: 0 0 auto; }

  .hero { margin-top: 24px; }
  .headline { margin: 16px 0 20px; }
  .tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .tile { padding: 16px; min-height: 100px; }
  .tile .value { font-size: 1.9rem; }
  .tile.big { min-height: 140px; }
  .highlights { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 16px; }

  .ranked li { gap: 10px; padding: 10px 8px; grid-template-columns: 1.6em auto minmax(0, 1fr) auto; }
  .ranked li:not(:has(.cover)) { grid-template-columns: 1.6em minmax(0, 1fr) auto; }
  .rank { font-size: 1.05rem; }
  .cover { width: 52px; height: 52px; }
  .title { font-size: 1rem; }
  .sub { font-size: .85rem; }
  .nums { font-size: .8rem; }
  .nums strong { font-size: 1rem; }
  .thumbs img { width: 44px; height: 44px; }
  .weekchart { gap: 4px; padding: 14px 10px 10px; }
  .weekchart .col { height: 120px; }
  .weekchart .n { font-size: .75rem; }
  .months { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .months li { padding: 10px; }

  .ranked li.first { grid-template-columns: 1.6em minmax(0, 1fr) auto; padding: 14px; }
  .ranked li.first .cover { grid-row: 1; grid-column: 1 / -1; width: 100%; height: auto; aspect-ratio: 1; max-width: 360px; justify-self: center; }
  .ranked li.first .rank { font-size: 1.6rem; }
  .ranked li.first .title { font-size: 1.3rem; }

  .login { margin: 8vh 12px 0; padding: 24px; }
}

@media (max-width: 380px) {
  .who span { display: none; }
  .tile .value { font-size: 1.6rem; }
  .nums span:not(:first-child) { display: none; }
}

/* Badges */
.intro { color: var(--muted); margin: -12px 0 24px; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.badge { margin: 0; background: var(--panel); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.badge img { width: 100%; height: auto; background: #0f0f14; }
.badge figcaption { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.badge figcaption > span { color: var(--muted); font-size: .9rem; }
.badge .actions { display: flex; gap: 8px; margin-top: auto; padding-top: 10px; flex-wrap: wrap; align-items: center; }
.badge .actions button { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }
.badge .actions button.share { background: var(--panel-2); color: var(--text); border-color: #33334a; }
.badge .actions button:disabled { opacity: .6; cursor: wait; }
.badge .actions a { color: var(--muted); padding: 6px 4px; }
@media (max-width: 700px) {
  .badges { grid-template-columns: 1fr; }
  .badge .actions > * { min-height: 44px; }
}
