#site-footer .footer-leaderboard-button {
  display: inline-flex;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  align-self: center;
  align-items: center;
  justify-content: center;
  margin-left: 1px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fbbf24;
  line-height: 1;
  cursor: pointer;
  transition:
    color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

#site-footer .footer-leaderboard-button:hover {
  color: #fff4c2;
  background: rgba(251, 191, 36, 0.13);
  transform: translateY(-1px);
}

#site-footer .footer-leaderboard-button:focus-visible {
  outline: 2px solid #fbbf24;
  outline-offset: 2px;
}

#site-footer .footer-leaderboard-button .material-symbols-outlined {
  display: block;
  font-size: 19px;
  line-height: 1;
  font-variation-settings: 'FILL' 1;
}

.community-leaderboard-dialog {
  width: min(760px, calc(100vw - 32px));
  max-width: 760px;
  max-height: min(820px, calc(100dvh - 32px));
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #172033;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.3);
}

.community-leaderboard-dialog::backdrop {
  background: rgba(15, 23, 42, 0.62);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.community-leaderboard-shell {
  display: grid;
  max-height: min(820px, calc(100dvh - 32px));
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.community-leaderboard-header {
  display: grid;
  width: auto;
  height: auto;
  min-height: 0;
  grid-template-columns: 48px minmax(0, 1fr) 36px;
  gap: 14px;
  align-items: center;
  padding: 22px 24px;
  border: 0;
  background: #172033;
  color: #ffffff;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.community-leaderboard-icon {
  display: inline-flex;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fbbf24;
  color: #172033;
  font-size: 27px;
  font-variation-settings: 'FILL' 1;
}

.community-leaderboard-heading {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.community-leaderboard-heading small {
  color: #fbbf24;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.community-leaderboard-heading strong {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.35rem;
  line-height: 1.2;
}

.community-leaderboard-heading > span {
  color: #cbd5e1;
  font-size: 0.83rem;
  line-height: 1.4;
}

.community-leaderboard-close {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  cursor: pointer;
}

.community-leaderboard-close:hover {
  background: rgba(255, 255, 255, 0.16);
}

.community-leaderboard-close:focus-visible {
  outline: 2px solid #fbbf24;
  outline-offset: 2px;
}

.community-leaderboard-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0 24px;
  border-bottom: 1px solid #dbe2ea;
  background: #f8fafc;
}

.community-leaderboard-tabs button {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: #64748b;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 750;
  cursor: pointer;
}

.community-leaderboard-tabs button.is-active {
  border-bottom-color: #2563eb;
  color: #173b72;
}

.community-leaderboard-tabs button:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: -4px;
}

.community-leaderboard-tabs .material-symbols-outlined {
  font-size: 20px;
}

.community-leaderboard-body {
  min-height: 360px;
  overflow: auto;
  padding: 24px;
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 transparent;
}

.community-leaderboard-body::-webkit-scrollbar {
  width: 6px;
}

.community-leaderboard-body::-webkit-scrollbar-thumb {
  border-radius: 6px;
  background: #94a3b8;
}

.community-ranking-loading,
.community-ranking-empty {
  display: flex;
  min-height: 310px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  color: #64748b;
  text-align: center;
}

.community-ranking-empty .material-symbols-outlined {
  font-size: 34px;
  color: #94a3b8;
}

.community-ranking-empty p {
  max-width: 360px;
  margin: 0;
  font-size: 0.86rem;
}

.community-podium {
  display: grid;
  grid-template-areas: 'second first third';
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  margin-bottom: 24px;
}

.community-podium-place {
  display: flex;
  min-width: 0;
  min-height: 142px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 9px;
  padding: 16px 10px;
  border: 1px solid #dbe2ea;
  border-radius: 8px;
  background: #ffffff;
  text-align: center;
}

.community-podium-place.rank-1 {
  grid-area: first;
  min-height: 164px;
  border-color: #f2c94c;
  background: #fffbea;
}

.community-podium-place.rank-2 {
  grid-area: second;
  background: #f8fafc;
}

.community-podium-place.rank-3 {
  grid-area: third;
  border-color: #d4a574;
  background: #fff8f2;
}

.community-podium-place > strong {
  width: 100%;
  overflow: hidden;
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.community-rank {
  display: inline-flex;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #e8eef6;
  color: #334155;
  font-size: 0.78rem;
  font-weight: 800;
}

.community-rank--medal {
  width: 42px;
  height: 42px;
  color: #172033;
}

.community-rank--medal.rank-1 {
  background: #fbbf24;
}

.community-rank--medal.rank-2 {
  background: #dbe2ea;
}

.community-rank--medal.rank-3 {
  background: #ddb892;
}

.community-rank--medal .material-symbols-outlined {
  font-size: 24px;
  font-variation-settings: 'FILL' 1;
}

.community-ranking-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.community-ranking-row {
  display: grid;
  min-height: 58px;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 9px 4px;
  border-top: 1px solid #e2e8f0;
}

.community-ranking-name {
  min-width: 0;
  overflow: hidden;
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.community-ranking-stats {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  color: #64748b;
  font-size: 0.76rem;
  white-space: nowrap;
}

.community-ranking-stats strong {
  color: #172033;
  font-size: 0.86rem;
}

.community-podium-place .community-ranking-stats {
  align-items: center;
  flex-direction: column;
  gap: 2px;
  white-space: normal;
}

.community-ranking-points {
  color: #1d4ed8;
}

.community-donation-masked {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid #a7d7bd;
  border-radius: 999px;
  background: #edf9f2;
  color: #16734a;
  font-weight: 800;
}

.community-leaderboard-privacy {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-top: 1px solid #dbe2ea;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.75rem;
  line-height: 1.4;
}

.community-leaderboard-privacy .material-symbols-outlined {
  flex: 0 0 auto;
  color: #16734a;
  font-size: 19px;
}

@media (max-width: 640px) {
  #site-footer .footer-leaderboard-button {
    width: 27px;
    height: 27px;
    flex-basis: 27px;
  }

  .community-leaderboard-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }

  .community-leaderboard-shell {
    max-height: calc(100dvh - 16px);
  }

  .community-leaderboard-header {
    grid-template-columns: 40px minmax(0, 1fr) 34px;
    gap: 10px;
    padding: 16px;
  }

  .community-leaderboard-icon {
    width: 40px;
    height: 40px;
    font-size: 23px;
  }

  .community-leaderboard-heading strong {
    font-size: 1.08rem;
  }

  .community-leaderboard-heading > span {
    font-size: 0.74rem;
  }

  .community-leaderboard-tabs {
    padding: 0 8px;
  }

  .community-leaderboard-tabs button {
    min-height: 48px;
    padding: 0 6px;
    font-size: 0.78rem;
  }

  .community-leaderboard-body {
    min-height: 300px;
    padding: 16px 12px;
  }

  .community-podium {
    gap: 6px;
  }

  .community-podium-place {
    min-height: 132px;
    padding: 12px 5px;
  }

  .community-podium-place.rank-1 {
    min-height: 150px;
  }

  .community-podium-place > strong {
    font-size: 0.76rem;
  }

  .community-ranking-row {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 8px;
    padding: 10px 2px;
  }

  .community-ranking-row .community-ranking-stats {
    grid-column: 2;
    justify-content: flex-start;
  }

  .community-ranking-stats {
    gap: 9px;
    font-size: 0.68rem;
  }

  .community-leaderboard-privacy {
    padding: 9px 14px;
    font-size: 0.68rem;
  }
}
