/* ── Sparq × Streamer University tracker ───────────────────────────────────
   Sparq: green-black base, mint growth accent, Zalando Sans SemiExpanded.
   SU: crimson + gold collegiate identity, Graduate display type.           */
:root {
  --ink: #0a100f;            /* page plane (Sparq green-black) */
  --surface-1: #101716;      /* cards / chart surface */
  --surface-2: #17201e;
  --chalk: #ece9dc;          /* primary ink */
  --chalk-2: #b3b2a4;        /* secondary ink */
  --muted: #86857a;
  --gold: #f0b429;           /* SU gold */
  --gold-deep: #c98500;
  --crimson: #b3242b;        /* SU crimson */
  --crimson-deep: #7c0a12;
  --mint: #7fe0a7;           /* Sparq growth green */
  --mint-deep: #35c06f;
  --live: #e33d3d;
  --down: #e66767;
  --hairline: rgba(236,233,220,.09);
  --grid: rgba(236,233,220,.07);
  --disp: 'Graduate', serif;
  --body: 'Zalando Sans SemiExpanded', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ink);
  background-image:
    radial-gradient(1200px 500px at 70% -10%, rgba(127,224,167,.045), transparent 60%),
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(255,255,255,.006) 3px 4px);
  color: var(--chalk);
  font-family: var(--body);
  font-size: 14.5px;
  line-height: 1.45;
}
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }

/* ── Masthead ── */
.masthead { border-bottom: 1px solid var(--hairline); background: linear-gradient(180deg, rgba(127,224,167,.035), transparent); }
.masthead-inner {
  max-width: 1180px; margin: 0 auto; padding: 30px 24px 24px;
  display: flex; flex-wrap: wrap; gap: 28px; align-items: center; justify-content: space-between;
}
.crest { display: flex; gap: 20px; align-items: center; }
.crest-img { width: 92px; height: 92px; object-fit: contain; filter: drop-shadow(0 4px 14px rgba(0,0,0,.5)); }
.presents { display: flex; align-items: baseline; gap: 8px; margin-bottom: 7px; }
.presents .sparq-mark { height: 15px; width: auto; display: inline-block; opacity: .95; }
.presents span {
  font-size: 10px; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); font-weight: 500;
}
.crest-text h1 {
  font-family: var(--disp); font-weight: 400; font-size: 27px; line-height: 1.04;
  margin: 0; letter-spacing: .5px; text-transform: uppercase;
}
.crest-sub { color: var(--chalk-2); font-size: 12px; margin-top: 6px; letter-spacing: .12em; text-transform: uppercase; }
.masthead-stats { display: flex; gap: 34px; flex-wrap: wrap; }
.mstat-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.mstat-value { font-family: var(--mono); font-size: 24px; font-weight: 600; }
.mstat-value.gold { color: var(--gold); }
.pennant-strip { height: 9px; background:
  repeating-linear-gradient(90deg,
    var(--gold) 0 26px, var(--surface-2) 26px 52px,
    var(--crimson) 52px 78px, var(--surface-2) 78px 104px);
  opacity: .6;
}

/* ── Milestone ticker ── */
.ticker {
  overflow: hidden; border-bottom: 1px solid var(--hairline);
  background: rgba(16,23,22,.75); white-space: nowrap; position: relative;
}
.ticker-track {
  display: inline-flex; gap: 44px; padding: 9px 0;
  animation: tick 60s linear infinite; will-change: transform;
}
.ticker:hover .ticker-track { animation-play-state: paused; }
@keyframes tick { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.tick-item { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--chalk-2); }
.tick-item b { color: var(--chalk); font-weight: 700; }
.tick-item .em { font-style: normal; }
.tick-item .val { font-family: var(--mono); color: var(--mint); font-weight: 600; }

/* ── Layout ── */
main { max-width: 1180px; margin: 0 auto; padding: 12px 24px 80px; }
section { margin-top: 42px; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; margin-bottom: 14px; }
.section-head h2 {
  font-family: var(--disp); font-weight: 400; font-size: 19px; margin: 0;
  letter-spacing: .8px; text-transform: uppercase;
}
.section-note { color: var(--muted); font-size: 13px; }
.card { background: var(--surface-1); border: 1px solid var(--hairline); border-radius: 10px; }
.multi-link {
  font-family: var(--mono); font-size: 13px; font-weight: 600; letter-spacing: .22em;
  text-transform: uppercase; color: var(--gold); margin-left: auto;
  border-bottom: 2px solid var(--gold-deep); padding-bottom: 2px;
}
.multi-link:hover { text-decoration: none; color: #ffd35c; border-bottom-color: #ffd35c; }
.live-actions { display: flex; gap: 18px; margin-left: auto; }
.live-actions .multi-link { margin-left: 0; }

/* ── Live strip ── */
.live-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--live);
  animation: pulse 1.6s ease-in-out infinite; margin-right: 6px; }
@keyframes pulse { 50% { opacity: .35; } }
.live-count-note { color: var(--muted); font-size: 12.5px; margin-left: 6px; font-family: var(--body); letter-spacing: 0; text-transform: none; }
.live-featured { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 860px) { .live-featured { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .live-featured { grid-template-columns: 1fr; } }
.live-card {
  display: flex; gap: 12px; align-items: center; min-width: 0;
  background: var(--surface-1); border: 1px solid var(--hairline); border-radius: 10px;
  padding: 10px 12px 10px 10px; cursor: pointer; transition: border-color .15s, transform .15s;
}
.live-card:hover { border-color: var(--live); transform: translateY(-1px); }
.live-card img { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--live); flex: none; }
.live-card > div { min-width: 0; }
.live-card .lc-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-card .lc-meta { font-size: 12px; color: var(--chalk-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-card .lc-viewers { font-family: var(--mono); font-size: 12px; color: var(--live); font-weight: 600; }
/* expanded: the live list scrolls inside its own window; the page scrolls outside it */
.live-window.expanded {
  max-height: 520px; overflow-y: auto; padding-right: 6px;
  scrollbar-width: thin; scrollbar-color: var(--gold-deep) transparent;
  -webkit-mask-image: linear-gradient(180deg, #000 92%, transparent);
          mask-image: linear-gradient(180deg, #000 92%, transparent);
}
.live-window.expanded::-webkit-scrollbar { width: 8px; }
.live-window.expanded::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 4px; }
.live-window.expanded::-webkit-scrollbar-thumb:hover { background: var(--gold-deep); }
.live-more {
  margin-top: 12px; width: 100%; padding: 12px;
  background: var(--surface-1); border: 1px solid var(--hairline); border-radius: 10px;
  color: var(--chalk-2); font-size: 13px; font-weight: 700; letter-spacing: .04em;
}
.live-more:hover { color: var(--chalk); border-color: var(--gold-deep); }

/* ── Podium ── */
.podium {
  display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 14px; align-items: end;
  max-width: 860px; margin: 0 auto; padding-top: 26px;
}
.pod { text-align: center; cursor: pointer; }
.pod .pod-avatar { position: relative; display: inline-block; margin-bottom: 10px; }
.pod .pod-avatar img {
  border-radius: 50%; object-fit: cover; display: block;
  border: 3px solid var(--medal); box-shadow: 0 6px 24px rgba(0,0,0,.5);
}
.pod.p1 .pod-avatar img { width: 96px; height: 96px; }
.pod.p2 .pod-avatar img, .pod.p3 .pod-avatar img { width: 72px; height: 72px; }
.pod .medal {
  position: absolute; bottom: -6px; right: -8px; font-size: 26px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.6));
}
.pod .pod-live { position: absolute; top: -4px; left: -10px; }
.pod .pod-name { font-weight: 800; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pod .pod-gain { font-family: var(--mono); font-weight: 700; font-size: 19px; color: var(--mint); margin-top: 2px; }
.pod .pod-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.pod .pod-col {
  margin-top: 12px; border-radius: 8px 8px 0 0; position: relative;
  background: linear-gradient(180deg, var(--medal) 0%, color-mix(in srgb, var(--medal) 24%, var(--surface-1)) 90%);
  display: grid; place-items: center;
  animation: rise .7s cubic-bezier(.2,.9,.3,1) both;
  transform-origin: bottom;
}
@keyframes rise { from { transform: scaleY(0); } }
.pod .pod-col .num {
  font-family: var(--disp); font-size: 44px; color: rgba(10,16,15,.82);
  text-shadow: 0 1px 0 rgba(255,255,255,.22);
}
.pod.p1 { --medal: var(--gold); }
.pod.p2 { --medal: #c8cdd4; }
.pod.p3 { --medal: #cd8f52; }
.pod.p1 .pod-col { height: 150px; }
.pod.p2 .pod-col { height: 106px; animation-delay: .12s; }
.pod.p3 .pod-col { height: 82px; animation-delay: .2s; }
.podium-empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 30px 0; }

/* ── Race ── */
.race-controls { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.replay-btn {
  background: var(--mint-deep); color: #06231a; font-weight: 800; letter-spacing: .04em;
  border: none; border-radius: 7px; padding: 7px 14px; font-size: 12.5px;
}
.replay-btn:hover { background: var(--mint); }
.replay-btn.playing { background: var(--crimson); color: #fff; }
#raceScrub { width: 180px; accent-color: var(--mint-deep); }
.race-time { font-family: var(--mono); font-size: 12px; color: var(--chalk-2); min-width: 118px; text-align: right; }
.race-time.live { color: var(--live); font-weight: 700; }
.race { position: relative; padding: 14px 18px; overflow: hidden; }
.race-row {
  position: absolute; left: 18px; right: 18px; height: 40px;
  display: flex; align-items: center; gap: 10px;
  transition: transform .55s cubic-bezier(.25,.8,.3,1);
  cursor: pointer;
}
.race-row .rr-rank { font-family: var(--disp); font-size: 14px; color: var(--muted); width: 22px; text-align: center; flex: none; }
.race-row img { width: 28px; height: 28px; border-radius: 50%; flex: none; }
.race-row .rr-name { font-size: 12.5px; font-weight: 700; width: 150px; flex: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.race-row .rr-barwrap { flex: 1; height: 18px; position: relative; }
.race-row .rr-bar {
  position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--mint-deep) 55%, var(--surface-1)), var(--mint-deep));
  transition: width .55s cubic-bezier(.25,.8,.3,1); min-width: 3px;
}
.race-row.first .rr-bar { background: linear-gradient(90deg, color-mix(in srgb, var(--gold) 55%, var(--surface-1)), var(--gold)); }
.race-row .rr-val {
  position: absolute; left: calc(var(--w) + 8px); top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--mint);
  transition: left .55s cubic-bezier(.25,.8,.3,1); white-space: nowrap;
}
.race-row.first .rr-val { color: var(--gold); }
.race-empty { text-align: center; color: var(--muted); padding: 30px 0; }

/* ── Leaderboard ── */
.board { overflow: hidden; }
.board-row, .board-head {
  display: grid;
  grid-template-columns: 64px 56px minmax(150px,1.4fr) 105px 105px 115px 85px minmax(90px,.9fr) 74px;
  gap: 10px; align-items: center; padding: 9px 16px;
}
.board-head {
  font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--hairline); position: sticky; top: 0; background: var(--surface-1); z-index: 2;
}
.board-row { border-bottom: 1px solid rgba(236,233,220,.045); cursor: pointer; transition: background .12s; }
.board-row:hover { background: var(--surface-2); }
.board-row:last-child { border-bottom: none; }
.rankcell { display: flex; align-items: center; justify-content: center; gap: 6px; }
.rank { font-family: var(--disp); font-size: 17px; color: var(--muted); }
.rank.r1 { color: var(--gold); }
.rmove { font-family: var(--mono); font-size: 10px; font-weight: 700; }
.rmove.up { color: var(--mint); }
.rmove.down { color: var(--down); }
.rmove.flat { color: var(--muted); }
.hsort {
  background: none; border: none; padding: 0; color: var(--muted);
  font: inherit; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
  text-align: left; display: inline-flex; align-items: center; gap: 3px;
}
.hsort.num { justify-content: flex-end; }
.hsort:hover { color: var(--chalk); }
.hsort .arr { color: var(--gold); font-size: 9px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); object-fit: cover; }
.who { min-width: 0; }
.name-line { display: flex; align-items: center; gap: 5px; min-width: 0; }
.who .name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who .role { font-size: 11px; color: var(--muted); text-transform: capitalize; }
.favorite-btn {
  flex: 0 0 auto; appearance: none; border: 0; background: none; padding: 0; cursor: pointer;
  color: var(--muted); font-size: 18px; line-height: 1; transition: color .15s, transform .15s;
}
.favorite-btn:hover, .favorite-btn.saved { color: var(--gold); }
.favorite-btn:hover { transform: scale(1.12); }
.num { font-family: var(--mono); font-size: 13.5px; text-align: right; color: var(--chalk-2); }
.num.gain { font-weight: 600; color: var(--mint); }
.num.gain.neg { color: var(--down); }
.num.pct { font-weight: 500; }
.board-head, .board-head .hsort { font-family: var(--mono); }
.board-head .hsort { font-size: 13.5px; color: var(--chalk-2); }
.spark svg { display: block; }
.livecell { text-align: center; }
.badge-live {
  font-size: 10px; font-weight: 800; letter-spacing: .08em; color: #fff; background: var(--live);
  border-radius: 4px; padding: 3px 7px; display: inline-block;
}
.badge-kick { font-size: 10px; font-weight: 800; letter-spacing: .06em; color: #0a100f; background: #53fc18; border-radius: 4px; padding: 3px 6px; display: inline-block; }
.badge-tiktok { font-size: 10px; font-weight: 800; letter-spacing: .06em; color: #fff; background: #010101; border: 1px solid #25f4ee; border-radius: 4px; padding: 2px 6px; display: inline-block; }
.badge-youtube { font-size: 10px; font-weight: 800; letter-spacing: .06em; color: #fff; background: #cc0000; border-radius: 4px; padding: 3px 6px; display: inline-block; }
.board-more { width: 100%; background: none; border: none; border-top: 1px solid var(--hairline); color: var(--gold); padding: 12px; font-size: 13px; font-weight: 600; letter-spacing: .04em; }
.board-more:hover { background: var(--surface-2); }
.board-empty { padding: 40px; text-align: center; color: var(--muted); }

/* ── Controls ── */
.controls { display: flex; gap: 10px; flex-wrap: wrap; margin-left: auto; }
.favorites-toggle {
  border: 1px solid var(--hairline); border-radius: 8px; background: var(--surface-1); color: var(--chalk-2);
  padding: 7px 11px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.favorites-toggle:hover, .favorites-toggle.on { border-color: var(--gold-deep); color: var(--gold); }
.seg { display: inline-flex; border: 1px solid var(--hairline); border-radius: 8px; overflow: hidden; background: var(--surface-1); }
.seg button {
  background: none; border: none; color: var(--chalk-2); padding: 7px 13px; font-size: 12.5px; font-weight: 600;
}
.seg button.on { background: var(--gold); color: var(--ink); }
.seg button:not(.on):hover { color: var(--chalk); }
.new-badge { display: inline-block; margin-left: 4px; padding: 3px 5px; border-radius: 3px; background: var(--crimson); color: #fff; font: 700 9px/1 var(--mono); letter-spacing: .08em; vertical-align: 1px; }
.seg button.on .new-badge { background: var(--ink); color: var(--gold); }
#search {
  background: var(--surface-1); border: 1px solid var(--hairline); border-radius: 8px;
  color: var(--chalk); padding: 7px 12px; font-family: inherit; font-size: 13px; width: 190px;
}
#search:focus { outline: none; border-color: var(--gold-deep); }

/* ── Untracked ── */
.untracked { display: flex; flex-wrap: wrap; gap: 10px; }
.ut-card {
  display: flex; align-items: center; gap: 10px; background: var(--surface-1);
  border: 1px solid var(--hairline); border-radius: 8px; padding: 8px 14px; font-size: 13px;
}
.ut-card .ut-name { font-weight: 600; }
.ut-card .ut-why { color: var(--muted); font-size: 11.5px; }

/* ── Drawer ── */
.drawer-scrim { position: fixed; inset: 0; background: rgba(6,10,9,.66); z-index: 40; backdrop-filter: blur(2px); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(680px, 96vw); z-index: 50;
  background: var(--surface-1); border-left: 1px solid var(--hairline);
  box-shadow: -30px 0 60px rgba(0,0,0,.45); overflow-y: auto;
  animation: slidein .22s ease-out;
}
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } }
.drawer-close {
  position: sticky; top: 10px; margin-left: 14px; z-index: 2;
  background: var(--surface-2); color: var(--chalk); border: 1px solid var(--hairline);
  border-radius: 50%; width: 34px; height: 34px; font-size: 18px; line-height: 1;
}
.drawer-body { padding: 4px 28px 40px; }
.d-head { display: flex; gap: 16px; align-items: center; margin-bottom: 4px; }
.d-head img { width: 64px; height: 64px; border-radius: 50%; }
.d-head .d-sparq-logo { width: 76px; height: auto; margin-left: auto; border-radius: 0; opacity: .92; }
.d-head h3 { font-family: var(--disp); font-weight: 400; font-size: 24px; margin: 0; letter-spacing: .5px; }
.d-head .role { color: var(--muted); text-transform: capitalize; font-size: 13px; }
.d-tabs { display: flex; gap: 8px; margin: 20px 0 2px; }
.d-tabs button { border: 1px solid var(--hairline); border-radius: 999px; background: transparent; color: var(--muted); font: 600 11px var(--mono); letter-spacing: .08em; padding: 7px 12px; text-transform: uppercase; }
.d-tabs button.active { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.d-tabs button.unavailable { color: var(--muted); opacity: .48; cursor: not-allowed; }
.d-stats { display: flex; gap: 26px; flex-wrap: wrap; margin: 18px 0 6px; }
.viewer-context { margin-top: 18px; color: var(--gold); font: 600 10px var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.d-stats.since-joining { margin-top: 7px; }
.d-stat .l { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.d-stat .v { font-family: var(--mono); font-size: 21px; font-weight: 600; }
.d-stat .v.up { color: var(--mint); }
.d-chart { margin-top: 14px; }
.d-chart svg { width: 100%; height: auto; display: block; }
.d-chart { position: relative; }
.d-chart svg { touch-action: none; }
.chart-tooltip { position: absolute; z-index: 1; min-width: 112px; padding: 7px 9px; border: 1px solid var(--hairline); border-radius: 6px; background: var(--surface-2); box-shadow: 0 8px 20px rgba(0,0,0,.32); color: var(--chalk); font: 600 10px/1.35 var(--mono); pointer-events: none; transform: translate(-50%, -100%); white-space: nowrap; }
.chart-tooltip[hidden] { display: none; }
.chart-tooltip .value { color: var(--mint); font-size: 12px; }
.d-live { margin-top: 22px; }
.d-live .now { font-size: 13px; color: var(--chalk-2); margin: 8px 0 12px; }
.watch-btn {
  display: inline-block; background: var(--live); color: #fff; font-weight: 800; letter-spacing: .04em;
  border: none; border-radius: 8px; padding: 11px 20px; font-size: 14px;
}
.watch-btn:hover { filter: brightness(1.1); }
.player-wrap { margin-top: 14px; aspect-ratio: 16/9; background: #000; border-radius: 8px; overflow: hidden; }
.player-wrap iframe { width: 100%; height: 100%; border: none; }
.d-link { margin-top: 18px; font-size: 13px; }

/* ── Tooltip ── */
.tooltip {
  position: fixed; z-index: 60; pointer-events: none;
  background: #070c0b; border: 1px solid var(--hairline); border-radius: 8px;
  padding: 10px 12px; font-size: 12.5px; box-shadow: 0 8px 24px rgba(0,0,0,.5); max-width: 280px;
}

@media (max-width: 860px) {
  .board-row, .board-head { grid-template-columns: 48px 44px minmax(110px,1.3fr) 96px 80px 64px; }
  .board-head :nth-child(4), .board-row .baseline,
  .board-head :nth-child(8), .board-row .spark { display: none; }
  .board-head :nth-child(7), .board-row .pctcell { display: none; }
  .masthead-stats { gap: 20px; }
  .race-row .rr-name { width: 96px; }
  .podium { grid-template-columns: 1fr 1.15fr 1fr; gap: 8px; }
}

@media (max-width: 560px) {
  /* Keep the wordmark separate so long creator names retain the full header row. */
  .d-head { position: relative; display: grid; grid-template-columns: 64px minmax(0, 1fr); padding-top: 31px; }
  .d-head > div { min-width: 0; }
  .d-head .d-sparq-logo { position: absolute; top: 0; right: 0; width: 70px; }
  .d-head h3 { font-size: 22px; overflow-wrap: anywhere; }

  /* Keep the leaderboard readable without horizontal scrolling on phones. */
  .board-row, .board-head {
    grid-template-columns: 42px 36px minmax(0, 1fr) 72px 52px;
    gap: 8px;
    padding: 9px 8px;
  }
  .board-head :nth-child(5),
  .board-row > .num:not(.baseline):not(.gain):not(.pctcell) { display: none; }
  .avatar { width: 32px; height: 32px; }
  .rankcell { gap: 2px; }
  .rmove { font-size: 9px; }
  .who .role { font-size: 10px; }
  .num { font-size: 12px; }
  .badge-live { font-size: 9px; padding: 3px 5px; }
}
