/* ------------------------------------------------------------------ tokens */
:root {
  color-scheme: light;
  --page: #f4f4f1;
  --surface: #ffffff;
  --surface-2: #f6f6f3;
  --surface-3: #ecebe6;
  --border: rgba(11, 11, 11, 0.09);
  --border-strong: rgba(11, 11, 11, 0.16);
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #7d7b75;
  --grid: #e8e7e1;
  --axis: #c3c2b7;
  --accent: #138a3e;          /* data marks: bars, lines */
  --accent-hi: #0d6d30;       /* hovered mark */
  --accent-ui: #138a3e;       /* buttons, active nav */
  --accent-ink: #0f7a35;      /* accent-colored text */
  --accent-wash: rgba(19, 138, 62, 0.10);
  --on-accent: #ffffff;
  --heat-0: #f0efea;
  --up: #0f7a35;
  --down: #c03535;
  --new: #2a78d6;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
  --shadow-pop: 0 12px 40px rgba(0,0,0,.18);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* Display settings: text, image and spacing scale; content width. */
  --fs: 1;
  --img: 1;
  --sp: 1;
  --maxw: 1320px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0b0b0b;
    --surface: #161616;
    --surface-2: #1d1d1c;
    --surface-3: #262625;
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.14);
    --text: #ffffff;
    --text-2: #c3c2b7;
    --muted: #8f8d86;
    --grid: #272725;
    --axis: #3a3a37;
    --accent: #1aae4f;
    --accent-hi: #1ed760;
    --accent-ui: #1ed760;
    --accent-ink: #1ed760;
    --accent-wash: rgba(30, 215, 96, 0.10);
    --on-accent: #04140a;
    --heat-0: #1f1f1e;
    --up: #1ed760;
    --down: #f06b6b;
    --new: #5aa2f0;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
    --shadow-pop: 0 16px 48px rgba(0,0,0,.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0b0b0b;
  --surface: #161616;
  --surface-2: #1d1d1c;
  --surface-3: #262625;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #ffffff;
  --text-2: #c3c2b7;
  --muted: #8f8d86;
  --grid: #272725;
  --axis: #3a3a37;
  --accent: #1aae4f;
  --accent-hi: #1ed760;
  --accent-ui: #1ed760;
  --accent-ink: #1ed760;
  --accent-wash: rgba(30, 215, 96, 0.10);
  --on-accent: #04140a;
  --heat-0: #1f1f1e;
  --up: #1ed760;
  --down: #f06b6b;
  --new: #5aa2f0;
  --shadow: 0 1px 2px rgba(0,0,0,.3);
  --shadow-pop: 0 16px 48px rgba(0,0,0,.6);
}

/* ------------------------------------------------------------------ base */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--text);
  font: calc(14px * var(--fs))/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a.link:hover, .link:hover { text-decoration: underline; text-underline-offset: 2px; }
button { font: inherit; color: inherit; }
svg { display: block; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.secondary { color: var(--text-2); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
:focus-visible { outline: 2px solid var(--accent-ui); outline-offset: 2px; border-radius: 4px; }

/* ------------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: calc(20px * var(--sp));
  padding: calc(20px * var(--sp)) calc(14px * var(--sp));
  border-right: 1px solid var(--border);
  background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px; font-weight: 700; font-size: calc(15px * var(--fs)); }
.brand svg { width: 28px; height: 28px; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text small { font-size: calc(10.5px * var(--fs)); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.brand-bg { fill: var(--accent); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 10px;
  color: var(--text-2); font-weight: 550;
  transition: background .15s, color .15s;
}
.nav a svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-wash); color: var(--accent-ink); }
.sidebar-foot { margin-top: auto; padding: 0 calc(10px * var(--sp)); font-size: calc(12px * var(--fs)); color: var(--muted); line-height: 1.6; }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: calc(16px * var(--sp));
  padding: calc(12px * var(--sp)) calc(32px * var(--sp));
  background: color-mix(in srgb, var(--page) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-actions { display: flex; align-items: center; gap: calc(10px * var(--sp)); margin-left: auto; }

.view { padding: calc(28px * var(--sp)) calc(32px * var(--sp)) calc(64px * var(--sp)); max-width: var(--maxw); width: 100%; margin: 0 auto; outline: none; transition: opacity .2s; }
.view.is-loading { opacity: .45; pointer-events: none; }

/* ------------------------------------------------------------------ controls */
.seg {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--surface-3); border-radius: 999px;
}
.seg button {
  border: 0; background: none; cursor: pointer;
  padding: 6px 14px; border-radius: 999px;
  font-size: calc(13px * var(--fs)); font-weight: 600; color: var(--text-2);
  transition: background .15s, color .15s;
}
.seg button:hover { color: var(--text); }
.seg button[aria-checked="true"], .seg button.on {
  background: var(--surface); color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.icon-btn {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  color: var(--text-2);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:disabled { opacity: .35; cursor: default; }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); font-weight: 650; font-size: calc(13px * var(--fs)); cursor: pointer;
  transition: transform .1s, background .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.97); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--accent-ui); color: var(--on-accent); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
select.select {
  appearance: none; -webkit-appearance: none;
  padding: 8px 34px 8px 14px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 14px;
  font: inherit; font-weight: 600; color: var(--text); cursor: pointer;
}

/* ------------------------------------------------------------------ search */
.search { position: relative; flex: 1; max-width: 460px; }
.search > svg { position: absolute; left: 14px; top: 50%; translate: 0 -50%; width: 17px; height: 17px; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; pointer-events: none; }
.search input {
  width: 100%; padding: 10px 40px 10px 40px;
  border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.search input::-webkit-search-cancel-button { display: none; }
.search input:focus { outline: none; border-color: var(--accent-ui); box-shadow: 0 0 0 3px var(--accent-wash); }
.search kbd {
  position: absolute; right: 12px; top: 50%; translate: 0 -50%;
  font: 600 calc(11px * var(--fs)) var(--font); color: var(--muted);
  border: 1px solid var(--border-strong); border-radius: 5px; padding: 1px 6px;
}
.search input:focus ~ kbd { display: none; }
.search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-pop); padding: 6px; max-height: 70vh; overflow: auto;
}
.search-results h4 { margin: 8px 10px 4px; font-size: calc(11px * var(--fs)); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.search-results .empty { padding: 14px; color: var(--muted); }
.sr-item { display: flex; align-items: center; gap: 12px; padding: 7px 10px; border-radius: 9px; cursor: pointer; }
.sr-item.sel, .sr-item:hover { background: var(--surface-2); }
.sr-item .t { font-weight: 600; }
.sr-item .s { font-size: calc(12px * var(--fs)); color: var(--muted); }
.sr-item .r { margin-left: auto; font-size: calc(12px * var(--fs)); color: var(--muted); }

/* ------------------------------------------------------------------ cards & layout */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: calc(16px * var(--sp)); flex-wrap: wrap; margin-bottom: calc(22px * var(--sp)); }
.page-head h1 { font-size: calc(30px * var(--fs)); font-weight: 800; }
.page-head .sub { color: var(--text-2); margin-top: 4px; }
.eyebrow { font-size: calc(12px * var(--fs)); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.grid { display: grid; gap: calc(18px * var(--sp)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: calc(18px * var(--sp)); }
.mt { margin-top: calc(18px * var(--sp)); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: calc(20px * var(--sp)); min-width: 0;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: calc(12px * var(--sp)); margin-bottom: calc(14px * var(--sp)); }
.card-head h2 { font-size: calc(16px * var(--fs)); font-weight: 700; }
.card-head .sub { color: var(--muted); font-size: calc(12.5px * var(--fs)); margin-top: 2px; }
.card-head .actions { display: flex; gap: calc(6px * var(--sp)); align-items: center; flex-shrink: 0; }
.tbl-toggle { border: 0; background: none; cursor: pointer; font-size: calc(12px * var(--fs)); font-weight: 600; color: var(--muted); padding: 4px 8px; border-radius: 6px; }
.tbl-toggle:hover { color: var(--text); background: var(--surface-2); }
.tbl-toggle[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent-wash); }

/* ------------------------------------------------------------------ stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(calc(165px * var(--fs)), 1fr)); gap: calc(12px * var(--sp)); }
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: calc(14px * var(--sp)) calc(16px * var(--sp)); min-width: 0;
}
.tile .label { font-size: calc(12.5px * var(--fs)); color: var(--text-2); font-weight: 500; }
.tile .value { font-size: calc(24px * var(--fs)); font-weight: 700; margin-top: 4px; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .value small { font-size: calc(14px * var(--fs)); font-weight: 600; color: var(--text-2); margin-left: 3px; letter-spacing: 0; }
.tile .foot { font-size: calc(12px * var(--fs)); color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.delta-up { color: var(--up); font-weight: 600; }
.delta-down { color: var(--down); font-weight: 600; }

/* ------------------------------------------------------------------ hero (overview) */
.hero {
  position: relative; overflow: hidden;
  border-radius: 20px; padding: calc(32px * var(--sp));
  background:
    radial-gradient(1200px 400px at 0% 0%, var(--accent-wash), transparent 60%),
    var(--surface);
  border: 1px solid var(--border);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: calc(28px * var(--sp)); align-items: end;
}
.hero-figure { font-size: calc(64px * var(--fs)); font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.hero-figure small { font-size: calc(22px * var(--fs)); font-weight: 650; letter-spacing: -0.01em; color: var(--text-2); margin-left: calc(8px * var(--sp)); }
.hero-sub { margin-top: calc(12px * var(--sp)); color: var(--text-2); font-size: calc(15px * var(--fs)); max-width: 560px; }
.hero-stats { display: grid; grid-template-columns: repeat(2, auto); gap: calc(14px * var(--sp)) calc(32px * var(--sp)); }
.hero-stats .v { font-size: calc(22px * var(--fs)); font-weight: 750; letter-spacing: -0.02em; }
.hero-stats .l { font-size: calc(12px * var(--fs)); color: var(--muted); }

/* ------------------------------------------------------------------ art */
.art {
  position: relative; flex-shrink: 0; overflow: hidden;
  width: var(--s, 40px); height: var(--s, 40px);
  border-radius: max(4px, calc(var(--s, 40px) * 0.08));
  background: var(--ph, var(--surface-3));
  display: grid; place-items: center;
  color: rgba(255,255,255,.85); font-weight: 700; font-size: calc(var(--s, 40px) * 0.34);
  letter-spacing: -0.02em; user-select: none;
}
.art.round { border-radius: 50%; }
.art img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .3s;
}
.art img.loaded { opacity: 1; }

/* ------------------------------------------------------------------ ranked lists */
.rank-list { display: flex; flex-direction: column; }
.rank-row {
  display: grid; grid-template-columns: calc(30px * var(--fs)) calc(38px * var(--fs)) calc(44px * var(--img)) minmax(0, 1fr) minmax(calc(70px * var(--fs)), calc(150px * var(--fs)));
  align-items: center; gap: calc(12px * var(--sp));
  padding: calc(7px * var(--sp)) calc(8px * var(--sp)); margin: 0 calc(-8px * var(--sp)); border-radius: 10px;
  transition: background .12s;
}
.rank-row:hover { background: var(--surface-2); }
.rank-row .rk { font-size: calc(16px * var(--fs)); font-weight: 750; text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; }
.rank-row.top3 .rk { color: var(--text); }
.rank-row .info { min-width: 0; }
.rank-row .title { font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.rank-row .artist { font-size: calc(12.5px * var(--fs)); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.rank-row .meter { display: flex; flex-direction: column; gap: 5px; align-items: flex-end; }
.rank-row .meter .vals { font-size: calc(12.5px * var(--fs)); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rank-row .meter .vals b { font-weight: 700; }
.rank-row .meter .vals span { color: var(--muted); margin-left: calc(6px * var(--sp)); }
.bar-track { width: 100%; height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: var(--accent); }
.rank-row.compact { grid-template-columns: calc(22px * var(--fs)) calc(40px * var(--img)) minmax(0, 1fr) auto; }
.rank-row.compact.no-art { grid-template-columns: calc(22px * var(--fs)) minmax(0, 1fr) auto; }
.rank-row.nomove { grid-template-columns: calc(30px * var(--fs)) calc(44px * var(--img)) minmax(0, 1fr) minmax(calc(70px * var(--fs)), calc(150px * var(--fs))); }

[data-tip] { cursor: help; }
.move { font-size: calc(11.5px * var(--fs)); font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
.move.up { color: var(--up); }
.move.down { color: var(--down); }
.move.same { color: var(--muted); }
.badge {
  display: inline-block; font-size: calc(10px * var(--fs)); font-weight: 800; letter-spacing: .05em;
  padding: 2px 6px; border-radius: 5px;
}
.badge.new { color: var(--new); background: color-mix(in srgb, var(--new) 14%, transparent); }
.badge.re { color: var(--text-2); background: var(--surface-3); }

.show-more { display: flex; justify-content: center; margin-top: calc(12px * var(--sp)); }

/* ------------------------------------------------------------------ period nav */
.period-bar { display: flex; align-items: center; gap: calc(10px * var(--sp)); flex-wrap: wrap; }
.period-nav { display: flex; align-items: center; gap: 8px; }
.period-title { display: flex; align-items: center; gap: calc(8px * var(--sp)); }
.period-title h1 { min-width: 0; }

/* ------------------------------------------------------------------ album grid */
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(104px * var(--img)), 1fr)); gap: calc(14px * var(--sp)); }
.album { min-width: 0; }
.album .art { width: 100%; height: auto; aspect-ratio: 1; --s: 120px; border-radius: 10px; }
.album .t { font-weight: 620; font-size: calc(13px * var(--fs)); margin-top: calc(8px * var(--sp)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.album .s { font-size: calc(12px * var(--fs)); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ #1 grid */
.ones { display: grid; grid-template-columns: calc(44px * var(--fs)) repeat(12, minmax(0, 1fr)); gap: calc(6px * var(--sp)); align-items: center; }
.ones .yl { font-size: calc(12px * var(--fs)); font-weight: 700; color: var(--text-2); text-align: right; padding-right: calc(6px * var(--sp)); font-variant-numeric: tabular-nums; }
.ones .ml { font-size: calc(11px * var(--fs)); color: var(--muted); text-align: center; }
.ones .cell { aspect-ratio: 1; border-radius: 6px; background: var(--surface-2); }
.ones a.cell { display: block; transition: transform .15s, box-shadow .15s; }
.ones a.cell .art { width: 100%; height: 100%; --s: 60px; border-radius: 6px; }
.ones a.cell:hover, .ones a.cell:focus-visible { transform: scale(1.12); box-shadow: var(--shadow-pop); position: relative; z-index: 2; }

/* ------------------------------------------------------------------ hbars */
.hbars { display: flex; flex-direction: column; gap: calc(10px * var(--sp)); }
.hbar { display: grid; grid-template-columns: calc(110px * var(--fs)) minmax(0, 1fr) calc(90px * var(--fs)); gap: calc(12px * var(--sp)); align-items: center; }
.hbar .l { font-size: calc(13px * var(--fs)); font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .v { font-size: calc(12.5px * var(--fs)); text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; }
.hbar .bar-track { height: 8px; }
a.hbar { border-radius: 8px; padding: 3px calc(6px * var(--sp)); margin: -3px calc(-6px * var(--sp)); }
a.hbar:hover { background: var(--surface-2); }

/* ------------------------------------------------------------------ charts */
.chart { position: relative; width: 100%; }
.chart svg { overflow: visible; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .base-line { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .tick { fill: var(--muted); font-size: calc(11px * var(--fs)); font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--accent); transition: fill .1s, opacity .15s; }
.chart .bar.hl { fill: var(--accent-hi); }
.chart .bar.dim { opacity: .35; }
.chart .bar.sel { fill: var(--accent-hi); }
.chart.clickable .hit { cursor: pointer; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--accent); opacity: .1; }
.chart .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart .dot.hl { fill: var(--accent-hi); }
.chart .xhair { stroke: var(--text-2); stroke-width: 1; opacity: .5; shape-rendering: crispEdges; }
.chart .hit { fill: transparent; }
.chart svg:focus { outline: none; }
.chart svg:focus-visible { outline: 2px solid var(--accent-ui); outline-offset: 4px; border-radius: 6px; }
.chart-empty { display: grid; place-items: center; color: var(--muted); font-size: calc(13px * var(--fs)); }

.heat .cell { transition: opacity .1s; }
.heat .cell:hover { stroke: var(--text); stroke-width: 1.5; }
.heat-legend { display: flex; align-items: center; gap: calc(6px * var(--sp)); font-size: calc(11.5px * var(--fs)); color: var(--muted); margin-top: calc(10px * var(--sp)); justify-content: flex-end; }
.heat-legend i { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }

.tip {
  position: fixed; z-index: 100; pointer-events: none;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 10px;
  box-shadow: var(--shadow-pop);
  padding: 9px 12px; font-size: calc(12.5px * var(--fs)); max-width: calc(280px * var(--fs));
  transition: opacity .08s;
}
.tip .tv { font-size: calc(15px * var(--fs)); font-weight: 750; letter-spacing: -0.01em; }
.tip .tl { color: var(--text-2); }
.tip .tm { color: var(--muted); font-size: calc(11.5px * var(--fs)); margin-top: 2px; }
.tip .trow { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.tip .trow .art { --s: 36px; }

/* ------------------------------------------------------------------ data tables */
.table-wrap { overflow-x: auto; margin: 0 calc(-20px * var(--sp)); padding: 0 calc(20px * var(--sp)); }
table.data { width: 100%; border-collapse: collapse; font-size: calc(13px * var(--fs)); }
table.data th {
  text-align: left; font-size: calc(11.5px * var(--fs)); font-weight: 650; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
  padding: calc(8px * var(--sp)) calc(10px * var(--sp)); border-bottom: 1px solid var(--border); white-space: nowrap;
  position: sticky; top: 0; background: var(--surface);
}
table.data th.r, table.data td.r { text-align: right; }
table.data th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
table.data th button:hover { color: var(--text); }
table.data th button.on { color: var(--accent-ink); }
table.data td { padding: calc(8px * var(--sp)) calc(10px * var(--sp)); border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr:hover td { background: var(--surface-2); }
table.data td.num, table.data td.r { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-track { display: flex; align-items: center; gap: calc(12px * var(--sp)); min-width: 220px; }
.cell-track .t { font-weight: 600; }
.cell-track .s { font-size: calc(12px * var(--fs)); color: var(--text-2); }
.cell-track > div { min-width: 0; }
.listen-bar { display: flex; align-items: center; gap: calc(8px * var(--sp)); min-width: 120px; }
.listen-bar .bar-track { width: 70px; flex-shrink: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: calc(11.5px * var(--fs)); font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.chip svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.chip.skip { color: var(--down); background: color-mix(in srgb, var(--down) 12%, transparent); }
.chip.done { color: var(--up); background: color-mix(in srgb, var(--up) 12%, transparent); }

.toolbar { display: flex; gap: calc(10px * var(--sp)); align-items: center; flex-wrap: wrap; margin-bottom: calc(14px * var(--sp)); }
.toolbar input.filter {
  flex: 1; min-width: 200px; max-width: 360px;
  padding: 9px 14px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit;
}
.toolbar input.filter:focus { outline: none; border-color: var(--accent-ui); box-shadow: 0 0 0 3px var(--accent-wash); }

/* ------------------------------------------------------------------ detail header */
.detail-head {
  position: relative; overflow: hidden; isolation: isolate;
  border-radius: 20px; padding: calc(28px * var(--sp));
  border: 1px solid var(--border);
  display: flex; gap: calc(28px * var(--sp)); align-items: flex-end;
  background: var(--surface);
}
.detail-head .backdrop {
  position: absolute; inset: -40px; z-index: -1;
  background-size: cover; background-position: center;
  filter: blur(50px) saturate(1.5); opacity: .45;
  transform: scale(1.2);
}
.detail-head::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, transparent 0%, color-mix(in srgb, var(--surface) 70%, transparent) 100%);
}
.detail-head .art { --s: 200px; box-shadow: 0 16px 40px rgba(0,0,0,.35); border-radius: 12px; }
.detail-head .art.round { border-radius: 50%; }
.detail-head .meta { min-width: 0; flex: 1; }
.detail-head h1 { font-size: calc(clamp(28px, 4.2vw, 52px) * var(--fs)); font-weight: 850; letter-spacing: -0.035em; line-height: 1.05; margin: calc(6px * var(--sp)) 0 calc(10px * var(--sp)); overflow-wrap: anywhere; }
.detail-head .by { font-size: calc(15px * var(--fs)); color: var(--text-2); }
.detail-head .by a { color: var(--text); font-weight: 650; }
.detail-head .actions { display: flex; gap: calc(10px * var(--sp)); margin-top: calc(18px * var(--sp)); flex-wrap: wrap; }
.embed { margin-top: calc(16px * var(--sp)); border-radius: 12px; overflow: hidden; }
.embed iframe { display: block; width: 100%; border: 0; }

.pill-stats { display: flex; flex-wrap: wrap; gap: calc(8px * var(--sp)); margin-top: calc(14px * var(--sp)); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: calc(6px * var(--sp)) calc(16px * var(--sp)); font-size: calc(13px * var(--fs)); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 550; }

.error-card { text-align: center; padding: calc(60px * var(--sp)) calc(20px * var(--sp)); color: var(--text-2); }
.error-card h2 { margin-bottom: calc(8px * var(--sp)); color: var(--text); }

.spinner { width: 28px; height: 28px; border: 3px solid var(--surface-3); border-top-color: var(--accent-ui); border-radius: 50%; animation: spin .8s linear infinite; margin: calc(120px * var(--sp)) auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.fade-in { animation: fadeIn .25s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1100px) {
  .g-main, .g3 { grid-template-columns: minmax(0, 1fr); }
  .hero { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; top: 0; z-index: 30; height: auto;
    flex-direction: row; align-items: center; gap: calc(8px * var(--sp)); padding: calc(8px * var(--sp)) calc(16px * var(--sp));
    border-right: 0; border-bottom: 1px solid var(--border);
    overflow-x: auto;
  }
  .brand span, .sidebar-foot { display: none; }
  .brand { padding: 4px; }
  .nav { flex-direction: row; }
  .nav a { padding: 7px 10px; font-size: calc(13px * var(--fs)); gap: 6px; }
  .nav a svg { display: none; }
  .topbar { position: static; padding: calc(10px * var(--sp)) calc(16px * var(--sp)); flex-wrap: wrap; }
  .search { max-width: none; flex-basis: 100%; order: 2; }
  .search kbd { display: none; }
  .topbar-actions { margin-left: 0; width: 100%; justify-content: space-between; }
  .view { padding: calc(20px * var(--sp)) calc(16px * var(--sp)) calc(48px * var(--sp)); }
  .g2 { grid-template-columns: minmax(0, 1fr); }
  .hero { padding: calc(22px * var(--sp)); }
  .hero-figure { font-size: calc(48px * var(--fs)); }
  .detail-head { flex-direction: column; align-items: flex-start; padding: calc(20px * var(--sp)); }
  .detail-head .art { --s: 140px; }
  .rank-row { grid-template-columns: calc(24px * var(--fs)) calc(34px * var(--fs)) calc(40px * var(--img)) minmax(0, 1fr); }
  .rank-row.nomove { grid-template-columns: calc(24px * var(--fs)) calc(40px * var(--img)) minmax(0, 1fr); }
  .rank-row .meter { grid-column: 3 / -1; align-items: stretch; }
  .rank-row .meter .vals { text-align: left; }
  .rank-row.nomove .meter { grid-column: 2 / -1; }
  .ones { grid-template-columns: 34px repeat(12, minmax(0, 1fr)); gap: 3px; }
  .ones .ml { font-size: calc(9px * var(--fs)); }
  .hbar { grid-template-columns: 80px minmax(0, 1fr) 70px; }
  .card { padding: calc(16px * var(--sp)); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile .value { font-size: calc(20px * var(--fs)); }
  .table-wrap { margin: 0 calc(-16px * var(--sp)); padding: 0 calc(16px * var(--sp)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ------------------------------------------------------------------ small controls */
.seg-sm button { padding: 5px 11px; font-size: calc(12px * var(--fs)); }
select.select-sm { padding: 5px 30px 5px 12px; font-size: calc(12.5px * var(--fs)); background-position: right 10px center; }

/* ------------------------------------------------------------------ bump chart */
.bump { --bump-ink: color-mix(in srgb, var(--text-2) 45%, var(--surface)); display: grid; grid-template-columns: minmax(0, 1fr) calc(270px * var(--fs)); gap: calc(20px * var(--sp)); align-items: start; }
.bump .series .line { fill: none; stroke: var(--bump-ink); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; opacity: .9; transition: opacity .15s, stroke .15s; }
.bump .series .pt { fill: var(--accent); stroke: var(--surface); stroke-width: 2; visibility: hidden; }
.bump .series .pt.solo { visibility: visible; fill: var(--bump-ink); }
.bump .series .badge-mark circle { fill: var(--surface-3); stroke: var(--surface); stroke-width: 2; }
.bump .series .badge-mark text { fill: var(--text-2); font-size: calc(10px * var(--fs)); font-weight: 750; }
.bump .series { transition: opacity .15s; }
.bump.has-active .series:not(.on) { opacity: .55; }
.bump .series .badge-mark.clash { visibility: hidden; }
.bump .series.on .badge-mark.clash { visibility: visible; }
.bump .series.on .line { stroke: var(--accent); stroke-width: 2.5; opacity: 1; }
.bump .series.on .pt { visibility: visible; fill: var(--accent); }
.bump .series.on .badge-mark circle { fill: var(--accent); }
.bump .series.on .badge-mark text { fill: var(--on-accent); }
.bump-legend { display: flex; flex-direction: column; gap: 2px; }
.bump-item {
  display: flex; align-items: center; gap: calc(10px * var(--sp)); padding: 5px calc(8px * var(--sp)); border-radius: 9px;
  cursor: pointer; transition: background .12s; min-width: 0;
}
.bump-item:hover, .bump-item.on { background: var(--surface-2); }
.bump-item[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--accent-ui); }
.bump-item .art { --s: 30px; }
.bump-item .t { font-weight: 620; font-size: calc(13px * var(--fs)); }
.bump-item .s { font-size: calc(11.5px * var(--fs)); color: var(--muted); }
.bump-num {
  display: inline-grid; place-items: center; flex-shrink: 0;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface-3); color: var(--text-2);
  font-size: calc(10.5px * var(--fs)); font-weight: 750; font-variant-numeric: tabular-nums;
}
.bump-item.on .bump-num, .tip-rank.on .bump-num { background: var(--accent-ui); color: var(--on-accent); }
.bump-go { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: var(--muted); flex-shrink: 0; }
.bump-go:hover { color: var(--text); background: var(--surface-3); }
.bump-go svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.tip-ranks { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; min-width: 200px; }
.tip-rank { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 8px; align-items: center; color: var(--text-2); }
.tip-rank b { color: var(--text); font-variant-numeric: tabular-nums; }
.tip-rank.on { color: var(--text); font-weight: 650; }
.tip-rank .bump-num { width: 18px; height: 18px; font-size: calc(9.5px * var(--fs)); }

/* ------------------------------------------------------------------ calendar */
.cal-scroll { overflow-x: auto; }
.cal .cell:hover { stroke: var(--text); stroke-width: 1.5; }
.cal a:focus-visible .cell { stroke: var(--accent-ui); stroke-width: 2; }
.cal-foot { display: flex; flex-wrap: wrap; align-items: center; gap: calc(6px * var(--sp)) calc(22px * var(--sp)); margin-top: calc(12px * var(--sp)); font-size: calc(12.5px * var(--fs)); color: var(--text-2); }
.cal-foot b { color: var(--text); font-weight: 650; }
.cal-foot .heat-legend { margin-top: 0; }

/* ------------------------------------------------------------------ day timeline */
tr.session-row td { background: var(--surface-2); font-size: calc(12.5px * var(--fs)); padding-top: calc(10px * var(--sp)); padding-bottom: calc(10px * var(--sp)); }
table.data tbody tr.session-row:hover td { background: var(--surface-2); }
tr.faint td { opacity: .55; }
.album-link { color: inherit; }

@media (max-width: 1100px) {
  .bump { grid-template-columns: minmax(0, 1fr); }
  .bump-legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

/* ------------------------------------------------------------------ year picker & section heads */
.period-picker { display: inline-flex; align-items: center; gap: calc(10px * var(--sp)); flex-wrap: wrap; }
.picker { display: inline-flex; align-items: center; gap: 6px; }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn.sm svg { width: 15px; height: 15px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: calc(12px * var(--sp)); flex-wrap: wrap; margin: calc(6px * var(--sp)) 0 calc(12px * var(--sp)); }
.section-head h2 { font-size: calc(19px * var(--fs)); font-weight: 750; }
.section-head .sub { color: var(--muted); font-size: calc(12.5px * var(--fs)); margin-top: 2px; }
.toolbar-right { display: flex; align-items: center; gap: calc(8px * var(--sp)); margin-left: auto; }

/* ------------------------------------------------------------------ settings panel */
.settings-wrap { position: relative; }
.settings-panel {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 50;
  width: 360px; max-width: calc(100vw - 32px);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 16px;
  box-shadow: var(--shadow-pop); padding: 16px 18px 12px;
  font-size: 14px;
}
.settings-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.settings-head h3 { font-size: 15px; font-weight: 750; }
.set-row { padding: 12px 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.set-label { font-size: 13px; font-weight: 650; }
.set-hint { font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 1px; }
.set-seg { display: flex; }
.set-seg button { flex: 1; }
.settings-foot { display: flex; justify-content: flex-end; border-top: 1px solid var(--border); padding-top: 10px; }
.settings-foot .btn:disabled { opacity: .4; cursor: default; }
@media (max-width: 860px) {
  .settings-wrap { position: static; }
  .settings-panel { position: fixed; left: 16px; right: 16px; top: 72px; width: auto; max-width: none; max-height: calc(100vh - 90px); overflow: auto; }
  .topbar-actions { gap: 8px; }
  #metric-toggle { margin-right: auto; }
}

/* ------------------------------------------------------------------ welcome & import */
.no-data .nav, .no-data .search, .no-data #metric-toggle { display: none; }
.no-data .topbar { justify-content: flex-end; }
.welcome { max-width: 920px; margin: 0 auto; }
.welcome-hero { text-align: center; padding: calc(28px * var(--sp)) 0 calc(24px * var(--sp)); }
.welcome-hero h1 { font-size: calc(clamp(32px, 5vw, 52px) * var(--fs)); font-weight: 850; letter-spacing: -0.035em; line-height: 1.05; }
.welcome-hero .lede { font-size: calc(17px * var(--fs)); color: var(--text-2); max-width: 620px; margin: 14px auto 0; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: calc(40px * var(--sp)) 24px; border-radius: 20px; cursor: pointer;
  border: 2px dashed var(--border-strong); background: var(--surface);
  transition: border-color .15s, background .15s, transform .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent-ui); background: var(--accent-wash); }
.dropzone.over { transform: scale(1.01); }
.dz-icon { width: 40px; height: 40px; color: var(--accent-ink); margin-bottom: 4px; }
.dz-title { font-size: calc(19px * var(--fs)); font-weight: 750; }
.dz-sub { color: var(--text-2); font-size: calc(13.5px * var(--fs)); }
.dz-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }
.dz-error {
  margin-top: 14px; padding: 10px 14px; border-radius: 10px; max-width: 560px;
  color: var(--down); background: color-mix(in srgb, var(--down) 12%, transparent); font-weight: 550;
}
.prose p { margin: 0 0 10px; color: var(--text-2); }
.prose p:last-child { margin-bottom: 0; }
.steps { margin: 0; padding-left: 20px; color: var(--text-2); display: flex; flex-direction: column; gap: 8px; }
.steps b { color: var(--text); }
a.accent { color: var(--accent-ink); font-weight: 600; }
.welcome-note { text-align: center; font-size: calc(12.5px * var(--fs)); margin-top: 18px; }
.importing { max-width: 560px; margin: 60px auto; text-align: center; padding: 32px; }
.importing h2 { font-size: calc(20px * var(--fs)); margin-bottom: 18px; }
.progress-track { height: 8px; border-radius: 8px; background: var(--surface-3); overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent-ui); border-radius: 8px; transition: width .25s ease-out; }
.progress-label { margin-top: 12px; font-size: calc(13px * var(--fs)); color: var(--text-2); font-variant-numeric: tabular-nums; min-height: 1.4em; }
.set-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.danger { color: var(--down); }
.btn.danger:hover { background: color-mix(in srgb, var(--down) 10%, transparent); }
@media (max-width: 860px) {
  .no-data .topbar-actions { justify-content: flex-end; }
}

/* ------------------------------------------------------------------ demo mode */
.demo-cta { text-align: center; margin: 14px 0 0; color: var(--text-2); font-size: calc(14px * var(--fs)); }
.link-btn { border: 0; background: none; padding: 0; cursor: pointer; font: inherit; font-weight: 650; color: var(--accent-ink); }
.link-btn:hover { text-decoration: underline; text-underline-offset: 2px; }
.demo-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap;
  margin-bottom: calc(18px * var(--sp)); padding: 12px 16px; border-radius: 12px;
  background: color-mix(in srgb, var(--new) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--new) 30%, transparent);
  font-size: calc(13.5px * var(--fs)); color: var(--text-2);
}
.demo-banner b { color: var(--text); }
.demo-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.foot-demo { color: var(--new); font-weight: 650; }
.home-link { padding: 0 10px; font-size: calc(12px * var(--fs)); color: var(--muted); text-decoration: none; }
.home-link:hover { color: var(--text); }
@media (max-width: 860px) { .home-link { display: none; } }
