/* Leaderboard page: board picker, podium, your rank, search, ranked list.
   Colours come from /assets/site.css; only the medal metals are literal. */

.lb {
  flex: 1 0 auto;
  background-image: radial-gradient(circle, var(--desk-dot) 1px, transparent 1.5px);
  background-size: 20px 20px;
}

.lb-vh {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Medal metals: used by the podium steps, the list's top-3 badges and the "Nth place" chip */
.spot-1, .medal-1 { --medal: #f2c14e; --medal-hi: #ffe391; --medal-lo: #cf8f1c; --medal-ink: #5f3b02; }
.spot-2, .medal-2 { --medal: #cfd6e0; --medal-hi: #f1f4f8; --medal-lo: #97a3b4; --medal-ink: #333b48; }
.spot-3, .medal-3 { --medal: #dc9460; --medal-hi: #f3bf93; --medal-lo: #a65f2e; --medal-ink: #4a2308; }

/* ---------- Heading and board picker ---------- */
.lb-head { padding-block: 44px 24px; }
.lb-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 32px;
}
.lb-eyebrow {
  margin: 0 0 12px;
  font: 600 12px/1.2 "Martian Mono", ui-monospace, Menlo, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.lb-head h1 {
  margin: 0 0 10px;
  font: 400 clamp(28px, 7vw, 56px)/1 "Bungee", "Arial Black", Impact, sans-serif;
  letter-spacing: 0.01em;
}
.lb-intro { margin: 0; max-width: 46ch; font-size: 17px; line-height: 1.5; color: var(--muted); }

.lb-total {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0;
  padding: 12px 16px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--win);
}
.lb-total.is-pending { visibility: hidden; }
.lb-total-num {
  font: 400 clamp(26px, 4vw, 38px)/1 "Bungee", "Arial Black", Impact, sans-serif;
  font-variant-numeric: tabular-nums;
}
.lb-total-label {
  font: 600 12px/1 "Martian Mono", ui-monospace, Menlo, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.lb-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-top: 28px;
}
.lb-games {
  display: inline-flex;
  max-width: 100%;
  gap: 4px;
  padding: 4px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--win);
}
.lb-game {
  padding: 10px 16px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: 400 14px/1 "Bungee", "Arial Black", Impact, sans-serif;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.lb-game:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 7%, transparent); }
.lb-game[aria-pressed="true"] { background: var(--btn); color: var(--btn-ink); }

.lb-levels { display: flex; flex-wrap: wrap; gap: 6px; animation: levels-in 0.22s ease-out; }
.lb-level {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 13px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--win);
  color: var(--ink);
  font: 600 12px/1 "Martian Mono", ui-monospace, Menlo, monospace;
  cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}
.lb-level:hover { border-color: var(--ink); }
.lb-level[aria-pressed="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 22%, var(--win));
}
.lb-level[aria-pressed="true"]::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.lb-play { margin-left: auto; padding: 11px 16px; }

/* ---------- The window ---------- */
.lb-main { padding-bottom: 56px; }
.lb-window {
  overflow: hidden;
  border: 1.5px solid var(--win-line);
  border-radius: 14px;
  background: var(--win);
  box-shadow: var(--win-shadow);
}
.lb-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  background: var(--bar);
  color: var(--bar-ink);
}
.lb-bar h2 {
  margin: 0;
  min-width: 0;
  font: 400 13px/1.2 "Bungee", "Arial Black", Impact, sans-serif;
  letter-spacing: 0.08em;
}
.lb-bar-meta {
  font: 600 11px/1 "Martian Mono", ui-monospace, Menlo, monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bar-muted);
  white-space: nowrap;
}

/* ---------- The stage: dark board with the podium standing on its bottom edge ---------- */
.stage {
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: end;
  min-height: 384px;
  padding: 48px 16px 0;
  overflow: hidden;
  border-bottom: 3px solid var(--accent);
  background-color: var(--field);
  background-image:
    radial-gradient(ellipse 46% 80% at 50% 0%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 72%),
    linear-gradient(var(--field-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--field-line) 1px, transparent 1px);
  background-size: auto, 24px 24px, 24px 24px;
  color: var(--bar-ink);
  transition: opacity 0.2s ease;
}
/* Soft spotlight beams from above the winner */
.stage::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: -20%;
  right: -20%;
  top: -30%;
  bottom: 0;
  background: conic-gradient(at 50% 0%,
    transparent 0deg 150deg,
    color-mix(in srgb, var(--tile) 9%, transparent) 158deg,
    transparent 166deg 174deg,
    color-mix(in srgb, var(--tile) 11%, transparent) 180deg,
    transparent 186deg 194deg,
    color-mix(in srgb, var(--tile) 9%, transparent) 202deg,
    transparent 210deg 360deg);
  transform-origin: 50% 0;
  animation: beams 9s ease-in-out infinite alternate;
  pointer-events: none;
}
.stage.is-busy { opacity: 0.55; }
.stage-msg {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  font: 600 12px/1 "Martian Mono", ui-monospace, Menlo, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bar-muted);
  animation: fade-in 0.2s ease 0.3s both;
}

.podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  width: 100%;
  max-width: 660px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}
.spot {
  --spot-av: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}
/* The markup runs 1, 2, 3 for screen readers; the podium shows 2, 1, 3 */
.spot-1 { order: 2; --spot-av: 88px; --step-h: 140px; --num: 64px; }
.spot-2 { order: 1; --step-h: 104px; --num: 50px; }
.spot-3 { order: 3; --step-h: 78px; --num: 42px; }

.spot-player {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 100%;
  padding: 0 8px 14px;
  text-align: center;
  animation: drop-in 0.55s cubic-bezier(0.3, 1.25, 0.5, 1) both;
}
.spot-3 .spot-player { animation-delay: 0.55s; }
.spot-2 .spot-player { animation-delay: 0.7s; }
.spot-1 .spot-player { animation-delay: 0.9s; }

.spot-av {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--spot-av);
  height: var(--spot-av);
  margin-bottom: 10px;
}
/* A metal outline that follows any avatar shape (rounded picture or octagon) */
.spot-frame {
  display: grid;
  filter:
    drop-shadow(2px 0 0 var(--medal)) drop-shadow(-2px 0 0 var(--medal))
    drop-shadow(0 2px 0 var(--medal)) drop-shadow(0 -2px 0 var(--medal))
    drop-shadow(0 8px 14px rgba(0, 0, 0, 0.45));
}
.spot-1 .spot-frame {
  filter:
    drop-shadow(2.5px 0 0 var(--medal)) drop-shadow(-2.5px 0 0 var(--medal))
    drop-shadow(0 2.5px 0 var(--medal)) drop-shadow(0 -2.5px 0 var(--medal))
    drop-shadow(0 0 16px rgba(242, 193, 78, 0.55));
}
.spot-open-av {
  display: grid;
  place-items: center;
  width: var(--spot-av);
  height: var(--spot-av);
  clip-path: polygon(29.29% 0, 70.71% 0, 100% 29.29%, 100% 70.71%, 70.71% 100%, 29.29% 100%, 0 70.71%, 0 29.29%);
  background: color-mix(in srgb, var(--bar-ink) 10%, transparent);
  color: var(--bar-muted);
  font: 400 calc(var(--spot-av) * 0.4)/1 "Bungee", "Arial Black", Impact, sans-serif;
}

.spot-name {
  display: -webkit-box;
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow-wrap: anywhere;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.25;
}
.spot-1 .spot-name { font-size: 17px; }
.spot.is-open .spot-name { color: var(--bar-muted); font-weight: 600; }
.spot-score { display: grid; justify-items: center; gap: 3px; margin: 3px 0 0; }
.spot-score-main { font: 400 19px/1 "Bungee", "Arial Black", Impact, sans-serif; }
.spot-1 .spot-score-main { font-size: 23px; color: var(--medal-hi); }
.spot-score-sub,
.spot-plays {
  margin: 0;
  font: 400 11.5px/1.3 "Martian Mono", ui-monospace, Menlo, monospace;
  color: var(--bar-muted);
}

/* The steps */
.step {
  position: relative;
  width: 100%;
  height: var(--step-h);
  padding-top: 10px;
  animation: step-rise 0.6s cubic-bezier(0.2, 0.85, 0.25, 1) both;
}
.spot-3 .step { animation-delay: 0.05s; }
.spot-2 .step { animation-delay: 0.15s; }
.spot-1 .step { animation-delay: 0.25s; }
/* Top surface, seen from slightly above */
.step::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 11px;
  background: color-mix(in srgb, var(--medal-hi) 65%, #ffffff);
  clip-path: polygon(6% 0, 94% 0, 100% 100%, 0 100%);
}
.step-face {
  position: relative;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(180deg, var(--medal-hi) 0, var(--medal) 24%, var(--medal-lo) 100%);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.5),
    inset 6px 0 0 rgba(255, 255, 255, 0.16),
    inset -6px 0 0 rgba(0, 0, 0, 0.12);
}
.step-num {
  display: block;
  padding-top: 12px;
  text-align: center;
  font: 400 var(--num)/1 "Bungee", "Arial Black", Impact, sans-serif;
  color: var(--medal-ink);
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.4);
}
/* A shine that sweeps across the gold step every few seconds */
.spot-1 .step-face::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 55%;
  background: linear-gradient(100deg, transparent 0%, rgba(255, 255, 255, 0.65) 50%, transparent 100%);
  transform: translateX(-160%) skewX(-14deg);
  animation: shine 5s ease-in-out 1.6s infinite;
}

/* Crown and sparkles over first place */
.crown {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: calc(var(--spot-av) * -0.3);
  width: calc(var(--spot-av) * 0.56);
  height: auto;
  translate: -50% 0;
  rotate: -9deg;
  overflow: visible;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.4));
  animation: crown-drop 0.6s cubic-bezier(0.3, 1.4, 0.5, 1) 1.2s both;
}
.crown-body { fill: #ffd24a; stroke: #8a5a00; stroke-width: 2.5; stroke-linejoin: round; }
.crown-band { fill: #eab22a; stroke: #8a5a00; stroke-width: 2.5; stroke-linejoin: round; }
.crown-gem { fill: #e3262f; stroke: #8a5a00; stroke-width: 2; }
.crown-tip { fill: #fff1b8; stroke: #8a5a00; stroke-width: 2; }

.sparkle {
  position: absolute;
  z-index: 1;
  width: var(--s, 12px);
  height: var(--s, 12px);
  color: #fff1b8;
  pointer-events: none;
  animation: twinkle 2.6s ease-in-out infinite both;
}
.sparkle path { fill: currentColor; }
.sparkle-1 { --s: 15px; left: -30%; top: 8%; animation-delay: 1.5s; }
.sparkle-2 { --s: 11px; right: -28%; top: 30%; animation-delay: 2.1s; }
.sparkle-3 { --s: 9px; left: -18%; bottom: 2%; animation-delay: 2.6s; }
.sparkle-4 { --s: 12px; right: -14%; top: -16%; animation-delay: 1.8s; }

/* "You" chip; on the podium it sits on the bottom edge of the avatar */
.you-chip {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--tile-ink);
  font: 600 10px/1 "Martian Mono", ui-monospace, Menlo, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.spot-player .you-chip {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: calc(var(--spot-av) - 9px);
  translate: -50% 0;
  box-shadow: 0 0 0 2px var(--field);
}

/* ---------- Body under the stage ---------- */
.lb-body { display: grid; gap: 20px; padding: 20px; }

/* Your rank */
.me {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  min-height: 82px;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--desk) 35%, var(--win));
}
.me.is-ranked {
  border-color: color-mix(in srgb, var(--accent) 65%, var(--line));
  background: color-mix(in srgb, var(--accent) 10%, var(--win));
}
.me-main { flex: 1 1 140px; min-width: 0; }
.me-label {
  margin: 0 0 5px;
  font: 600 11px/1 "Martian Mono", ui-monospace, Menlo, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.me-text { margin: 0; font-weight: 600; }
.me-rank { margin: 0; font-weight: 600; color: var(--muted); }
.me-num {
  margin: 0 2px;
  font: 400 28px/1 "Bungee", "Arial Black", Impact, sans-serif;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.me-meta {
  margin: 5px 0 0;
  font: 400 12.5px/1.4 "Martian Mono", ui-monospace, Menlo, monospace;
  color: var(--muted);
}
.me-meta:empty { display: none; }
.me .cta { padding: 11px 16px; }
.me-ghost {
  display: grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  clip-path: polygon(29.29% 0, 70.71% 0, 100% 29.29%, 100% 70.71%, 70.71% 100%, 29.29% 100%, 0 70.71%, 0 29.29%);
  background: color-mix(in srgb, var(--ink) 10%, transparent);
  color: var(--muted);
  font: 400 20px/1 "Bungee", "Arial Black", Impact, sans-serif;
}
.me-medal {
  padding: 7px 11px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--medal-hi), var(--medal));
  color: var(--medal-ink);
  font: 600 11px/1 "Martian Mono", ui-monospace, Menlo, monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Search and status */
.lb-results { display: grid; gap: 14px; }
.lb-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px 24px;
}
.lb-search { flex: 1 1 260px; max-width: 380px; margin: 0; }
.lb-search-box { position: relative; }
.lb-mag {
  position: absolute;
  left: 12px;
  top: 50%;
  translate: 0 -50%;
  color: var(--muted);
  pointer-events: none;
}
.lb-search .input { padding-left: 38px; padding-right: 46px; }
.lb-search .input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.lb-clear {
  position: absolute;
  right: 4px;
  top: 50%;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  translate: 0 -50%;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.lb-clear:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 8%, transparent); }
.lb-status {
  margin: 0;
  min-height: 1.4em;
  padding-bottom: 12px;
  font: 400 12.5px/1.4 "Martian Mono", ui-monospace, Menlo, monospace;
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* The ranked list */
.lb-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: opacity 0.15s ease;
}
.lb-table[aria-busy="true"] { opacity: 0.55; transition-delay: 0.2s; }
.lb-list { margin: 0; padding: 0; list-style: none; }
.lb-row-head,
.row {
  position: relative;
  display: grid;
  grid-template-columns: 56px 32px minmax(0, 1fr) 11rem 4.5rem;
  grid-template-areas: "rank av name score plays";
  align-items: center;
  column-gap: 14px;
  padding: 10px 16px;
}
.lb-row-head {
  padding-block: 10px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--desk) 45%, var(--win));
  font: 600 11px/1 "Martian Mono", ui-monospace, Menlo, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.h-rank { grid-area: rank; }
.h-player { grid-column: av-start / name-end; }
.h-score { grid-area: score; text-align: right; }
.h-plays { grid-area: plays; text-align: right; }

.row + .row { border-top: 1px solid var(--line); }
.row-rank {
  grid-area: rank;
  font: 400 17px/1 "Bungee", "Arial Black", Impact, sans-serif;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.row-av { grid-area: av; display: grid; }
.row-name {
  grid-area: name;
  min-width: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.row-name .you-chip { margin-left: 8px; vertical-align: 2px; }
.row-score { grid-area: score; text-align: right; }
.row-score-main { font: 400 16px/1 "Bungee", "Arial Black", Impact, sans-serif; }
.row-score-sub {
  margin-left: 4px;
  font: 400 12px/1.3 "Martian Mono", ui-monospace, Menlo, monospace;
  color: var(--muted);
}
.row-plays {
  grid-area: plays;
  text-align: right;
  font: 400 13px/1.3 "Martian Mono", ui-monospace, Menlo, monospace;
  color: var(--muted);
}
/* "plays" is spelled out on phones, where the column header is hidden */
.row-plays-unit {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Top-3 players in search results get a metal octagon */
.row.medal .row-rank-num {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  clip-path: polygon(29.29% 0, 70.71% 0, 100% 29.29%, 100% 70.71%, 70.71% 100%, 29.29% 100%, 0 70.71%, 0 29.29%);
  background: linear-gradient(180deg, var(--medal-hi), var(--medal) 45%, var(--medal-lo));
  color: var(--medal-ink);
  font-size: 16px;
}

.row.is-me {
  background: color-mix(in srgb, var(--accent) 13%, var(--win));
  box-shadow: inset 4px 0 0 var(--accent);
}
.row.is-flash { animation: row-flash 1.8s ease-out; }
.row:focus-visible { outline-offset: -3px; }

/* Loading placeholders */
.skel {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--ink) 7%, transparent) 25%,
    color-mix(in srgb, var(--ink) 14%, transparent) 50%,
    color-mix(in srgb, var(--ink) 7%, transparent) 75%);
  background-size: 300% 100%;
  animation: skel 1.3s linear infinite;
}
.row.is-skel { padding-block: 16px; }
.skel-rank { width: 26px; }
.skel-av { width: 32px; height: 32px; border-radius: 9px; }
.skel-name { width: 58%; }
.row.is-skel:nth-child(2n) .skel-name { width: 42%; }
.row.is-skel:nth-child(3n) .skel-name { width: 66%; }
.skel-score { width: 70px; justify-self: end; }
.skel-plays { width: 26px; justify-self: end; }

/* Empty board and errors */
.lb-notice-wrap:empty { display: none; }
.lb-notice {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 32px 16px;
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  text-align: center;
}
.lb-notice p { margin: 0; }
.lb-notice-title { font: 400 18px/1.25 "Bungee", "Arial Black", Impact, sans-serif; }
.lb-notice-text { color: var(--muted); max-width: 46ch; }
.lb-notice-error { border-style: solid; border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }
.lb-notice-error .lb-notice-title { color: var(--bad); }

/* Pages */
.lb-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.lb-pager .cta { padding: 11px 16px; transition: opacity 0.15s ease, transform 0.12s ease, border-color 0.12s ease; }
.lb-pager.is-busy .cta { opacity: 0.5; cursor: progress; transition-delay: 0.2s; }
.lb-pager .cta[aria-disabled="true"] { opacity: 0.4; cursor: not-allowed; transform: none; border-color: var(--line); }
.lb-page {
  font: 600 12px/1.3 "Martian Mono", ui-monospace, Menlo, monospace;
  color: var(--muted);
  text-align: center;
}

.cta:disabled { opacity: 0.55; cursor: progress; transform: none; }
.lb-noscript { margin: 0; color: var(--muted); }

/* ---------- Animation ---------- */
@keyframes step-rise {
  from { transform: translateY(100%); }
  to { transform: none; }
}
@keyframes drop-in {
  0% { opacity: 0; transform: translateY(-40px); }
  55% { opacity: 1; transform: translateY(5px); }
  78% { transform: translateY(-2px); }
  100% { opacity: 1; transform: none; }
}
@keyframes crown-drop {
  0% { opacity: 0; translate: -50% -34px; rotate: -32deg; }
  60% { opacity: 1; translate: -50% 3px; rotate: 4deg; }
  100% { opacity: 1; translate: -50% 0; rotate: -9deg; }
}
@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(0.2) rotate(0deg); }
  45% { opacity: 1; transform: scale(1) rotate(45deg); }
  70% { opacity: 0.2; transform: scale(0.5) rotate(80deg); }
}
@keyframes shine {
  0% { transform: translateX(-160%) skewX(-14deg); }
  28%, 100% { transform: translateX(320%) skewX(-14deg); }
}
@keyframes beams {
  from { transform: rotate(-3deg); }
  to { transform: rotate(3deg); }
}
@keyframes levels-in {
  from { opacity: 0; transform: translateX(-6px); }
  to { opacity: 1; transform: none; }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes skel {
  from { background-position: 100% 0; }
  to { background-position: 0 0; }
}
@keyframes row-flash {
  0%, 35% { background-color: color-mix(in srgb, var(--accent) 42%, var(--win)); }
  100% { background-color: color-mix(in srgb, var(--accent) 13%, var(--win)); }
}

/* ---------- Narrow screens ---------- */
@media (max-width: 720px) {
  .lb-play { margin-left: 0; }
  .stage { min-height: 312px; padding: 40px 8px 0; }
  .spot { --spot-av: 50px; }
  .spot-1 { --spot-av: 66px; --step-h: 108px; --num: 46px; }
  .spot-2 { --step-h: 80px; --num: 36px; }
  .spot-3 { --step-h: 60px; --num: 30px; }
  .spot-player { padding: 0 4px 12px; }
  .spot-name { font-size: 13.5px; }
  .spot-1 .spot-name { font-size: 15px; }
  .spot-score-main { font-size: 16px; }
  .spot-1 .spot-score-main { font-size: 19px; }
  .spot-score-sub, .spot-plays { font-size: 10.5px; }
}

/* The list drops its column header and stacks plays under the name */
@media (max-width: 640px) {
  .lb-row-head { display: none; }
  .row {
    grid-template-columns: 40px 32px minmax(0, 1fr) auto;
    grid-template-areas:
      "rank av name score"
      "rank av plays score";
    column-gap: 10px;
    row-gap: 2px;
    padding: 10px 12px;
  }
  .row-plays { text-align: left; font-size: 11.5px; }
  .row-plays-unit { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
  .row-score { max-width: 8rem; }
  .row-score-sub { display: block; margin: 4px 0 0; font-size: 11px; }
  .row.medal .row-rank-num { width: 30px; height: 30px; font-size: 14px; }
  .row-rank { font-size: 15px; }
  .row.is-skel { grid-template-areas: "rank av name score"; }
  .skel-plays { display: none; }
  .skel-score { width: 52px; }
}

@media (max-width: 560px) {
  .lb-head { padding-block: 32px 20px; }
  .lb-intro { font-size: 16px; }
  .lb-body { gap: 16px; padding: 14px; }
  .lb-search { max-width: none; }
  .lb-status { padding-bottom: 0; }
  .lb-pager .cta { padding: 10px 12px; }
}

@media (max-width: 400px) {
  .stage { padding-inline: 4px; }
  .spot { --spot-av: 44px; }
  .spot-1 { --spot-av: 58px; --step-h: 96px; --num: 40px; }
  .spot-2 { --step-h: 70px; --num: 30px; }
  .spot-3 { --step-h: 52px; --num: 26px; }
  .spot-player { padding-inline: 2px; }
  .spot-name { font-size: 12.5px; }
  .spot-1 .spot-name { font-size: 13.5px; }
  .me-num { font-size: 24px; }
  .lb-game { padding: 10px 11px; font-size: 12.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .stage::before,
  .stage-msg,
  .step,
  .spot-player,
  .crown,
  .spot-1 .step-face::after,
  .lb-levels,
  .skel,
  .row.is-flash { animation: none; }
  .sparkle { animation: none; opacity: 0.85; }
  .spot-1 .step-face::after { display: none; }
  .stage, .lb-game, .lb-level, .lb-table, .lb-pager .cta { transition: none; }
}
