/* ==========================================================================
   Leaderboard — period controls, podium and ranked list.
   ========================================================================== */

.countdown:empty { display: none; }

.countdown {
  text-align: center;
  color: var(--text-muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* -------------------------------------------------------------- podium */
.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  padding: 18px 0 8px;
}

.podium__slot {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--text);
}

/* First place sits higher than the other two. */
.podium__slot--first {
  margin-bottom: 5px;
}

.podium__crown {
  font-size: 22px;
  line-height: 1;
}

.podium__face {
  position: relative;
  display: inline-flex;
}

/* Medal colours ride on the face's ring. */
.podium--gold .podium__face::before,
.podium--silver .podium__face::before,
.podium--bronze .podium__face::before {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 15px;
  border: 3px solid currentColor;
}

/* The medal colour travels as a custom property. Using currentColor for the
   badge background does not work: the badge sets its own `color` for the
   numeral, so currentColor would resolve to that instead of the medal. */
.podium--gold {
  --medal: var(--gold);
  color: var(--medal);
}

.podium--silver {
  --medal: #cbd5e1;
  color: var(--medal);
}

.podium--bronze {
  --medal: #d98244;
  color: var(--medal);
}

.podium__rank {
  position: absolute;
  left: 50%;
  bottom: -10px;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--medal, var(--surface-hover));
  border: 2px solid var(--bg);
  color: var(--bg);
  font-size: 13px;
  font-weight: 800;
}

.podium__face > .avatar + .podium__rank {
  left: -3px;
  transform: none;
}

.page--leaderboard .avatar,
.page--leaderboard .avatar__media,
.podium__cover {
  border-radius: 10px;
}

.podium__cover {
  display: grid;
  place-items: center;
  flex: none;
  overflow: hidden;
  background: linear-gradient(145deg, hsl(var(--cover-hue, 265) 65% 48%), hsl(calc(var(--cover-hue, 265) + 45) 60% 30%));
  font-size: 26px;
}

.podium__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.podium__name {
  margin-top: 6px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

.podium__score {
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-raised);
  color: var(--accent-soft);
  font-size: 12px;
  font-weight: 700;
}

/* ---------------------------------------------------------- ranked list */
.rank-list {
  display: flex;
  flex-direction: column;
}

.rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 6px;
  background: none;
  border: 0;
  border-top: 1px solid var(--border-soft);
  color: inherit;
  text-align: left;
}

.rank-row:first-child {
  border-top: 0;
}

.rank-row:hover {
  background: var(--surface-hover);
}

.rank-row__rank {
  width: 22px;
  flex: none;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.rank-row__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.rank-row__name {
  font-size: 14.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-row__sub {
  font-size: 12px;
  color: var(--text-dim);
}

.rank-row__score {
  flex: none;
  color: var(--accent-soft);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.page.page--leaderboard {
  min-height: 100dvh;
}
.page--leaderboard .page-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
}
.page--leaderboard .page-head .icon-button { justify-self: start; }
.podium--gold .podium__face { filter: drop-shadow(0 0 7px #f5b63966); }
.rank-list:not(:empty) { padding-inline: 8px; border-radius: 12px; background: var(--surface); }
