/* Leaderboard layout — four cells: rank, player, win rate, points. */
.lb-table-head,
.lb-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 84px 92px;
  align-items: center;
  gap: 12px;
}

.lb-table-head { padding: 11px 16px; }
.lb-row { padding: 12px 16px; min-height: 64px; }
.lb-h-rank { text-align: center; }
.lb-rank-cell { display: flex; justify-content: center; min-width: 0; }
.lb-player-cell { min-width: 0; }
.lb-player-copy { min-width: 0; }
.lb-player-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-wr-cell { justify-content: flex-end; }
.lb-pts-cell { justify-content: flex-end; text-align: right; }
.lb-pts-cell b { font-variant-numeric: tabular-nums; }

/* Regular ranks keep the compact table rhythm. */
.lb-rank-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid #e2eaf6;
  border-radius: 9px;
  background: #f7faff;
  color: #687a90;
  font-family: var(--font-display, 'Sora', sans-serif);
  font-size: 0.76rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* Top three — inline SVG emblems and a restrained podium row */

.lb-row.is-top .lb-rank-cell.top {
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  background: none;
  background-image: none;
  box-shadow: none;
  color: inherit;
}

.lb-rank-emblem {
  position: relative;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
}

.lb-rank-svg {
  display: block;
  width: 48px;
  height: 48px;
  filter: drop-shadow(0 2px 2px rgba(37, 66, 140, 0.16));
}

.lb-rank-number {
  position: absolute;
  right: -2px;
  bottom: 0;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 2px solid #fff;
  border-radius: 50%;
  font-family: var(--font-display, 'Sora', sans-serif);
  font-size: 0.66rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 5px rgba(37, 66, 140, 0.22);
}

.lb-rank-emblem.gold .lb-rank-number {
  background: #573904;
  color: #ffe6a0;
}

.lb-rank-emblem.silver .lb-rank-number {
  background: #33414f;
  color: #f4f8fc;
}

.lb-rank-emblem.bronze .lb-rank-number {
  background: #592e17;
  color: #ffe3c8;
}

.lb-row.is-top {
  --lb-podium-accent: #d5a024;
  --lb-podium-soft: #fff9ea;
  position: relative;
  min-height: 76px;
  padding-top: 14px;
  padding-bottom: 14px;
  background: linear-gradient(90deg, var(--lb-podium-soft) 0%, #fff 34%);
}

.lb-row.is-top.two {
  --lb-podium-accent: #9aaabc;
  --lb-podium-soft: #f5f8fc;
}

.lb-row.is-top.three {
  --lb-podium-accent: #ba7045;
  --lb-podium-soft: #fdf3ec;
}

.lb-row.is-top::before {
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--lb-podium-accent);
  content: '';
  opacity: 0.9;
}

.lb-row.is-top:hover {
  background: linear-gradient(90deg, var(--lb-podium-soft) 0%, #fbfdff 44%, #fff 100%);
}

.lb-row.is-top .lb-player-copy strong {
  font-size: 0.86rem;
}

.lb-row.is-top.is-me {
  background: linear-gradient(90deg, #e9f2ff 0%, #f7fbff 38%, #fff 100%);
  box-shadow: inset 3px 0 0 var(--royal);
}

.lb-row.is-top.is-me::before {
  display: none;
}

@media (max-width: 767px) {
  .lb-table-head,
  .lb-row { grid-template-columns: 46px minmax(0, 1fr) 52px 54px; gap: 8px; }
  .lb-table-head { padding: 10px 12px; font-size: 0.54rem; }
  .lb-row { padding: 10px 12px; min-height: 58px; }
  .lb-row.is-top { min-height: 66px; padding-top: 11px; padding-bottom: 11px; }
  .lb-rank-emblem { width: 40px; height: 40px; }
  .lb-rank-svg { width: 40px; height: 40px; }
  .lb-rank-number {
    right: -1px;
    width: 17px;
    height: 17px;
    border-width: 1.5px;
    font-size: 0.58rem;
  }
  .lb-rank-num { width: 24px; height: 24px; border-radius: 8px; font-size: 0.7rem; }
  .lb-row.is-top .lb-player-copy strong { font-size: 0.82rem; }
  .lb-pts-cell b { font-size: 0.78rem; }
  .lb-pts-cell small { display: none; }
  .lb-wr-cell b { font-size: 0.7rem; min-width: 0; }
  .lb-wr-bar { width: 18px; }
}

@media (max-width: 359px) {
  .lb-table-head,
  .lb-row { grid-template-columns: 40px minmax(0, 1fr) 48px 48px; gap: 6px; }
  .lb-rank-emblem { width: 36px; height: 36px; }
  .lb-rank-svg { width: 36px; height: 36px; }
  .lb-rank-number { width: 16px; height: 16px; font-size: 0.52rem; }
  .lb-rank-num { width: 22px; height: 22px; border-radius: 7px; font-size: 0.66rem; }
  .lb-wr-bar { display: none; }
}
