.leaderboard {
  margin-top: clamp(18px, 3vw, 28px);
  padding: clamp(16px, 3vw, 26px);
  border-color: #ccded0;
  background: radial-gradient(ellipse at 100% 0%, #e0efe4a8, transparent 68%), var(--paper);
  scroll-margin-top: 1rem;
}

.leaderboard-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: .7rem 1.5rem;
  margin-bottom: .9rem;
}

.leaderboard-rule { margin-top: .24rem; color: var(--muted); font-size: .89rem; }
.leaderboard-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem .9rem; }

.leaderboard-switch {
  display: flex;
  flex-wrap: wrap;
  gap: .2rem;
  padding: 3px;
  border: 1px solid #b4cabb;
  border-radius: 8px;
  background: #f4f8f1;
}

.leaderboard-switch button {
  min-height: 36px;
  padding: .26rem .68rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: .85rem;
  font-weight: 650;
}

.leaderboard-switch button:hover { color: var(--ink); background: #e2efe4; }
.leaderboard-switch button[aria-pressed="true"] { color: #fff; background: var(--accent); }
.leaderboard-contributors { color: var(--accent-dark); font-size: .86rem; font-weight: 650; text-underline-offset: .2em; }
.leaderboard-results { overflow-x: auto; border-radius: 8px; }
.leaderboard-results table { width: 100%; border-collapse: collapse; }
.leaderboard-results th, .leaderboard-results td { text-align: right; padding: .56rem .76rem; }
.leaderboard-results thead th {
  color: var(--muted);
  background: #eaf2e9;
  font-size: .81rem;
  font-weight: 680;
}

.leaderboard-results th:nth-child(2), .leaderboard-results td:nth-child(2), .leaderboard-results th[scope="row"] { text-align: left; }
.leaderboard-results th:first-child, .leaderboard-results td:first-child { text-align: center; width: 3.6rem; }
.leaderboard-results tbody tr { border-top: 1px solid var(--line); }
.leaderboard-results tbody tr:hover { background: #edf5ee; }
.leaderboard-results tbody th { font-weight: 660; }
.leaderboard-results tbody td { font-variant-numeric: tabular-nums; }
.leaderboard-results a { color: var(--accent-dark); text-underline-offset: .2em; overflow-wrap: anywhere; }
.leaderboard-results td strong { color: var(--accent-dark); }

.leaderboard-rank {
  display: inline-grid;
  min-width: 1.6rem;
  padding: .12rem .25rem;
  place-items: center;
  border-radius: 1rem;
  background: #e9f0e7;
  color: #3b5c4d;
  font-size: .81rem;
  font-weight: 690;
}

.leaderboard-first .leaderboard-rank { color: #75461b; background: #f7ebd8; }
.leaderboard-recent {
  display: inline-block;
  width: .43rem;
  height: .43rem;
  margin-inline: .28rem .1rem;
  border-radius: 50%;
  background: #946030;
  vertical-align: middle;
}
.leaderboard-status { color: var(--muted); font-size: .89rem; }
.leaderboard-results:not(:empty) + .leaderboard-status { margin-top: .6rem; }
.leaderboard [data-leaderboard-retry] { margin-top: .6rem; }

@media (max-width: 560px) {
  .leaderboard-results th, .leaderboard-results td { padding: .5rem .28rem; font-size: .79rem; }
  .leaderboard-results thead th { font-size: .72rem; }
  .leaderboard-results th:first-child, .leaderboard-results td:first-child { width: auto; }
}
