/* ============================================================
   04 - LEADERBOARD
   Top-3 podium (glass, medal accents, #1 glows) + a clean
   scannable list for ranks 4-15. Frost/ice tokens only;
   per-tier hex passed inline as --tier (DATA). Prefix: .lb-
   ============================================================ */

.lb-eb-ic { width: 16px; height: 16px; flex: 0 0 auto; }

/* head CTA under the sub */
.lb-head-cta { margin-top: 24px; }

/* ============================================================
   Podium
   ============================================================ */
.lb-podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(12px, 2.2vw, 24px);
  padding-top: 34px;                 /* room for medals overlapping card tops */
  margin-bottom: clamp(30px, 4.4vw, 48px);
}

.lb-pod {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  max-width: 300px;
  min-height: 258px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 9px;
  padding: 40px 20px 20px;
}
/* desktop stage order: 2 · 1 · 3 */
.lb-pod-2 { order: 1; }
.lb-pod-1 { order: 2; }
.lb-pod-3 { order: 3; }

/* #1 is taller + a touch bigger */
.lb-pod-1 {
  min-height: 300px;
  padding-top: 48px;
  box-shadow: var(--glow-soft), 0 0 62px -14px rgba(243,208,138,.42);
}
.lb-pod-1:hover {
  box-shadow: var(--glow-soft), 0 0 62px -12px rgba(243,208,138,.6), var(--shadow-md);
}

/* medal disc (rank number), overlapping the top edge */
.lb-pod-rank {
  position: absolute;
  top: 0; left: 50%;
  transform: translate(-50%, -50%);
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 26%, rgba(255,255,255,.75), transparent 58%),
    var(--medal);
  color: #0b1320;
  font-size: 20px; font-weight: 800; line-height: 1;
  border: 2px solid rgba(255,255,255,.55);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,.5);
  z-index: 3;
}
.lb-pod-1 .lb-pod-rank { width: 54px; height: 54px; font-size: 24px; }

/* crown floats above the #1 medal */
.lb-pod-crown {
  position: absolute;
  top: -21px; left: 50%;
  transform: translateX(-50%);
  width: 27px; height: 27px;
  color: var(--gold);
  filter: drop-shadow(0 3px 7px rgba(243,208,138,.75));
}

/* tier icon */
.lb-pod-icon {
  width: 68px; height: 68px;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.5));
}
.lb-pod-1 .lb-pod-icon { width: 88px; height: 88px; }

.lb-pod-name {
  font-size: clamp(16px, 2vw, 20px);
  font-weight: 800;
  color: var(--text);
  line-height: 1.12;
  overflow-wrap: anywhere;
}
.lb-pod-1 .lb-pod-name { font-size: clamp(18px, 2.4vw, 24px); }

.lb-pod-tier {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--tier, var(--text-dim));
}

.lb-pod-elo {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 3px;
}
.lb-pod-elo .tnum {
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.lb-pod-1 .lb-pod-elo .tnum { font-size: clamp(30px, 4.8vw, 44px); }
.lb-elo-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-mute);
}

/* colored pedestal bar (podium step) */
.lb-pod-base {
  margin-top: auto;
  width: 56%;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--medal);
  opacity: .9;
  box-shadow: 0 4px 16px -4px var(--medal);
}
.lb-pod-1 .lb-pod-base { width: 68%; height: 8px; }

/* ============================================================
   List (ranks 4-15)
   ============================================================ */
.lb-list {
  max-width: 760px;
  margin: 0 auto;
}
.lb-tablewrap {
  overflow-x: auto;                  /* never overflow the page on mobile */
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  -webkit-overflow-scrolling: touch;
}
.lb-table {
  width: 100%;
  min-width: 480px;                  /* keeps columns from crushing; wrapper scrolls */
  border-collapse: collapse;
  font-size: 14.5px;
}
.lb-table thead th {
  position: sticky; top: 0;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 15px 18px;
  background: rgba(15,19,32,.6);
  border-bottom: 1px solid var(--hairline-strong);
  white-space: nowrap;
}
.lb-th-elo { text-align: right; }
.lb-th-rank { width: 58px; }

.lb-table tbody td {
  padding: 13px 18px;
  border-top: 1px solid var(--hairline);
  vertical-align: middle;
}
.lb-table tbody tr { transition: background var(--t-fast) var(--e-out); }
.lb-table tbody tr:nth-child(even) { background: rgba(255,255,255,.018); }
.lb-table tbody tr:hover { background: var(--surface-2); }

.lb-td-rank {
  color: var(--text-mute);
  font-weight: 700;
  width: 58px;
}
.lb-td-player {
  color: var(--text);
  font-weight: 600;
  overflow-wrap: anywhere;
}
.lb-td-elo {
  text-align: right;
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}

/* tier chip */
.lb-tier {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 11px 4px 6px;
  border-radius: var(--r-pill);
  border: 1px solid var(--hairline);
  background: var(--surface-2);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .01em;
  color: var(--tier, var(--text-dim));
  white-space: nowrap;
}
.lb-tier-ic {
  width: 18px; height: 18px;
  object-fit: contain;
  flex: 0 0 auto;
}
/* faint tint from the tier colour where supported (neutral fallback above) */
@supports (background: color-mix(in srgb, red, blue)) {
  .lb-tier {
    background: color-mix(in srgb, var(--tier) 12%, transparent);
    border-color: color-mix(in srgb, var(--tier) 30%, transparent);
  }
}

/* footer note */
.lb-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 20px;
  color: var(--text-mute);
  font-size: 13px;
  text-align: center;
}
.lb-note a { color: var(--text-dim); font-weight: 600; }
.lb-note a:hover { color: var(--accent); }
.lb-note-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--safe);
  flex: 0 0 auto;
  box-shadow: 0 0 0 0 rgba(87,217,163,.5);
  animation: lbPing 2.4s var(--e-in-out) infinite;
}
@keyframes lbPing {
  0%   { box-shadow: 0 0 0 0 rgba(87,217,163,.5); }
  70%  { box-shadow: 0 0 0 7px rgba(87,217,163,0); }
  100% { box-shadow: 0 0 0 0 rgba(87,217,163,0); }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 720px) {
  .lb-podium {
    flex-direction: column;
    align-items: stretch;
    gap: 44px;
    padding-top: 36px;
    max-width: 380px;
    margin-left: auto;
    margin-right: auto;
  }
  /* `flex: 1 1 0` sizes the WIDTH while the podium is a row; once it becomes a
     column that basis:0 turns into a HEIGHT and the cards collapse, spilling
     their head/name/ELO out the bottom. Height must come from content here. */
  .lb-pod,
  .lb-pod-1 {
    flex: 0 0 auto;
    max-width: none;
    min-height: 0;
    padding-top: 44px;
  }
  /* #1 first when stacked */
  .lb-pod-1 { order: 0; }
  .lb-pod-2 { order: 1; }
  .lb-pod-3 { order: 2; }
  .lb-pod-base { margin-top: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .lb-note-dot { animation: none; }
}

/* player heads */
.lb-pod-head { border-radius: 16px; object-fit: cover; filter: none; background: var(--bg-2); box-shadow: 0 8px 20px -8px rgba(0,0,0,.55); }
.lb-td-player { white-space: nowrap; }
.lb-head { width: 24px; height: 24px; border-radius: 6px; object-fit: cover; vertical-align: middle; margin-right: 9px; background: var(--surface-2); }
.lb-name { vertical-align: middle; }
