/* Public results board. Read on a phone in a dark room, so the champion moment
   and the final score carry the visual weight; the score breakdown is present
   but deliberately quiet. */
:root {
  color-scheme: dark;
  --stage: #08070e;
  --surface: #130f1e;
  --surface-2: #1b1628;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --ink: #f6f4fb;
  --ink-soft: #d5d0e4;
  --muted: #928ca6;
  --teal: #21d3cd;
  --purple: #c01fd6;
  --gold: #f2c94c;
  --silver: #cfd6e4;
  --bronze: #d69963;
  --grad: linear-gradient(100deg, #c01fd6 0%, #7b2bd6 26%, #18bfc6 62%, #2adf8c 100%);
  --grad-gold: linear-gradient(120deg, #ffe79a 0%, #f2c94c 45%, #e0a53c 100%);
  --radius: 20px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 0 60px;
  background: var(--stage);
  color: var(--ink);
  font-family: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Header ---- */
.results-head {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  padding: 34px 20px 14px;
  text-align: center;
}
/* The ambient glow lives on the header, not the body: a body-wide glow sat
   behind the sticky section mask and showed through as a hard dark rectangle.
   Kept full-bleed and behind the header content, fading out before the list. */
.results-head::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 100vw;
  height: 100%;
  transform: translateX(-50%);
  background: radial-gradient(120% 90% at 50% 12%, rgba(123, 43, 214, 0.22), transparent 62%);
  pointer-events: none;
  z-index: -1;
}

.results-logo {
  display: block;
  width: min(500px, 92vw);
  height: auto;
  margin: 0 auto;
}

.results-sub {
  max-width: 400px;
  margin: 6px auto 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

/* Live status. The pulsing dot doubles as the "results are updating" signal, so
   it hides itself when the message is empty (the success-is-silent state). */
.results-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.results-state:not(:empty) { margin-top: 16px; }
.results-state::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 0 rgba(33, 211, 205, 0.5);
  animation: live-pulse 2s ease-out infinite;
}
.results-state:empty::before { display: none; }
.results-state.error { color: #ff6a9a; }
.results-state.error::before { background: #ff6a9a; animation: none; }
@keyframes live-pulse {
  70% { box-shadow: 0 0 0 8px rgba(33, 211, 205, 0); }
  100% { box-shadow: 0 0 0 0 rgba(33, 211, 205, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .results-state::before { animation: none; }
}

/* ---- Layout ---- */
.results-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 14px;
}

.results-list {
  display: grid;
  gap: 34px;
}

/* Section = Pole Art / Pole Exotic */
.section-head {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 16px 6px 12px;
  background: linear-gradient(var(--stage) 68%, transparent);
}
.section-head span {
  display: block;
  margin-bottom: 4px;
  color: var(--teal);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.section-head h2 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Group = one category + division leaderboard */
.group {
  margin-top: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 18px 40px -30px rgba(0, 0, 0, 0.9);
}

.group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px 13px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.group-head span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.group-head strong {
  display: block;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.group-count {
  flex: none;
  align-self: center;
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---- Result row ---- */
.result-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 14px;
  padding: 16px 18px;
}
.result-row + .result-row {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Rank badge */
.result-rank {
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.02);
  color: var(--ink-soft);
  font-size: 1.15rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* Body: name + score on top, breakdown underneath */
.result-body { min-width: 0; }

.result-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.result-name {
  min-width: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: break-word;
}

/* The final score is the hero — big serif, right-aligned, teal by default and
   metallic for the medalists. */
.result-final {
  flex: none;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.9rem;
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: -0.01em;
  color: var(--teal);
  font-variant-numeric: tabular-nums;
}
.result-final small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-family: "Hanken Grotesk", sans-serif;
  font-size: 0.54rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: right;
}

/* Breakdown strip — the component averages, present but quiet. */
.breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin-top: 11px;
}
.bd {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  background: rgba(8, 7, 14, 0.4);
  white-space: nowrap;
}
.bd b {
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.bd i {
  color: var(--ink-soft);
  font-style: normal;
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---- Medal treatments ---- */
.medal-gold, .medal-silver, .medal-bronze { position: relative; }
.medal-gold::before, .medal-silver::before, .medal-bronze::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
}
.medal-gold::before { background: var(--grad-gold); }
.medal-silver::before { background: linear-gradient(120deg, #eef1f7, #b7bfce); }
.medal-bronze::before { background: linear-gradient(120deg, #eec19a, #c8824f); }

.medal-gold { background: linear-gradient(100deg, rgba(242, 201, 76, 0.10), transparent 70%); }
.medal-silver { background: linear-gradient(100deg, rgba(207, 214, 228, 0.07), transparent 70%); }
.medal-bronze { background: linear-gradient(100deg, rgba(214, 153, 99, 0.08), transparent 70%); }

.medal-gold .result-rank {
  border: none;
  background: var(--grad-gold);
  color: #3a2a05;
  box-shadow: 0 6px 18px -6px rgba(242, 201, 76, 0.55);
}
.medal-silver .result-rank {
  border: none;
  background: linear-gradient(135deg, #f2f4f9, #c2c9d6);
  color: #2c313b;
}
.medal-bronze .result-rank {
  border: none;
  background: linear-gradient(135deg, #f0c69f, #c9834f);
  color: #3a230f;
}

/* Champion gets the gradient score. Falls back to solid gold where
   background-clip: text is unsupported. */
.medal-gold .result-final {
  background: var(--grad-gold);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--gold);
}
.medal-silver .result-final { color: var(--silver); }
.medal-bronze .result-final { color: var(--bronze); }

/* ---- Empty / footer ---- */
.empty {
  padding: 56px 20px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
  text-align: center;
}

.results-foot {
  margin-top: 40px;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}
.results-foot p { margin: 0; }

@media (max-width: 400px) {
  .results-main { padding-inline: 10px; }
  .result-row { grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding: 15px 15px; }
  .result-rank { width: 40px; height: 40px; font-size: 1.02rem; border-radius: 12px; }
  .result-final { font-size: 1.7rem; }
  .result-name { font-size: 1rem; }
}
