:root {
  color-scheme: dark;
  --ink: #f7f8ff;
  --muted: #9ca4c9;
  --void: #070917;
  --panel: rgba(16, 19, 48, .74);
  --line: rgba(178, 190, 255, .18);
  --cyan: #68efff;
  --violet: #9e7bff;
  --pink: #fa78c8;
  --gold: #ffd570;
  --success: #62f0b7;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 70% -12%, #31236c 0, transparent 28rem),
    radial-gradient(circle at 5% 72%, #113e67 0, transparent 34rem),
    var(--void);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, a { font: inherit; }
a { color: inherit; }

.star-field,
.star-field::before,
.star-field::after {
  position: fixed;
  z-index: -3;
  inset: 0;
  pointer-events: none;
  content: "";
}

.star-field {
  opacity: .7;
  background-image: radial-gradient(#fff 1px, transparent 1.8px), radial-gradient(#77d8ff 1px, transparent 1.4px);
  background-position: 0 0, 58px 97px;
  background-size: 137px 149px, 211px 223px;
}

.star-field::before {
  opacity: .32;
  background: linear-gradient(115deg, transparent 0 46%, rgba(91, 235, 255, .14) 49%, transparent 52%);
}

.aurora {
  position: fixed;
  z-index: -2;
  width: 42rem;
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(64px);
  opacity: .18;
  pointer-events: none;
}

.aurora-one { top: 18%; left: -22rem; background: var(--cyan); }
.aurora-two { top: 54%; right: -20rem; background: var(--pink); }

.ranking-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 26px 0 44px;
}

.site-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; }

.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; letter-spacing: .08em; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: .84rem; }
.brand small { margin-top: 2px; color: var(--muted); font-size: .58rem; font-weight: 700; }

.brand-orbit { display: grid; width: 46px; height: 46px; place-items: center; }
.brand-orbit img { width: 46px; height: 46px; object-fit: contain; filter: drop-shadow(0 0 13px rgba(104, 239, 255, .32)); }

.back-link {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #d9ddfa;
  font-size: .78rem;
  font-weight: 750;
  text-decoration: none;
  transition: border-color .2s ease, color .2s ease, background .2s ease;
}
.back-link:hover, .back-link:focus-visible { border-color: var(--cyan); color: #07101c; background: var(--cyan); outline: none; }

.ranking-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin: 34px 2px 14px; }
.eyebrow { margin: 0 0 9px; color: #c1b7ff; font-size: .7rem; font-weight: 850; letter-spacing: .15em; }
h1 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.55rem); letter-spacing: -.06em; line-height: .98; }
.intro-description { margin: 8px 0 0; color: #9ba4c9; font-size: .82rem; line-height: 1.45; }

.refresh-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  cursor: pointer;
  border: 1px solid rgba(104, 239, 255, .55);
  border-radius: 12px;
  color: var(--cyan);
  background: rgba(5, 10, 28, .42);
  font-size: .78rem;
  font-weight: 800;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.refresh-button:hover, .refresh-button:focus-visible { transform: translateY(-2px); background: rgba(104, 239, 255, .13); box-shadow: 0 10px 24px rgba(104, 239, 255, .18); outline: none; }
.refresh-button[disabled] { cursor: wait; opacity: .68; }
.refresh-button[disabled] span { display: inline-block; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 16px; }
.metric-card { min-height: 116px; padding: 20px 22px; border: 1px solid var(--line); border-radius: 18px; background: rgba(13, 17, 43, .58); box-shadow: inset 0 1px rgba(255, 255, 255, .04); }
.metric-card span { display: block; color: var(--muted); font-size: .65rem; font-weight: 850; letter-spacing: .11em; }
.metric-card strong { display: block; margin: 7px 0 3px; font-size: clamp(1.8rem, 3vw, 2.35rem); letter-spacing: -.055em; }
.metric-card small { color: #8790b8; font-size: .72rem; }
.metric-card.highlight { border-color: rgba(255, 213, 112, .42); background: linear-gradient(120deg, rgba(90, 57, 39, .5), rgba(20, 18, 44, .66)); }
.metric-card.highlight strong { color: var(--gold); text-shadow: 0 0 20px rgba(255, 213, 112, .22); }

.ranking-content { margin-top: 0; }
.ranking-board { overflow: hidden; border: 1px solid var(--line); border-radius: 24px; background: rgba(10, 13, 34, .74); box-shadow: 0 26px 80px rgba(0, 0, 0, .25), inset 0 1px rgba(255, 255, 255, .06); }
.podium-section { padding: 20px; border-top: 1px solid var(--line); background: linear-gradient(90deg, rgba(104, 239, 255, .04), rgba(158, 123, 255, .08), rgba(250, 120, 200, .04)); }
.podium-section h2 { margin: 0 0 12px; color: #dce1fb; font-size: .78rem; letter-spacing: .05em; }
.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.podium-card { position: relative; display: flex; align-items: center; gap: 12px; min-width: 0; padding: 14px; border: 1px solid rgba(255, 255, 255, .08); border-radius: 15px; background: rgba(3, 5, 18, .32); }
.podium-card:first-child { order: 2; border-color: rgba(255, 213, 112, .45); background: linear-gradient(120deg, rgba(255, 213, 112, .12), rgba(3, 5, 18, .38)); }
.podium-card:nth-child(2) { order: 1; }
.podium-card:nth-child(3) { order: 3; }
.podium-rank { display: grid; flex: 0 0 auto; width: 33px; height: 33px; place-items: center; border-radius: 11px; background: rgba(104, 239, 255, .11); color: var(--cyan); font-size: .8rem; font-weight: 900; }
.podium-card:first-child .podium-rank { background: rgba(255, 213, 112, .16); color: var(--gold); }
.podium-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; font-weight: 800; }
.podium-points { margin-top: 3px; color: var(--muted); font-size: .68rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 660px; }
thead { background: rgba(6, 8, 24, .72); }
th { padding: 13px 15px; color: #929bc4; font-size: .64rem; font-weight: 850; letter-spacing: .09em; text-align: left; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 26px; }
th:last-child, td:last-child { padding-right: 26px; text-align: right; }
td { padding: 15px; border-top: 1px solid rgba(178, 190, 255, .09); color: #d7dcf6; font-size: .84rem; }
tbody tr { transition: background .18s ease; }
tbody tr:hover { background: rgba(104, 239, 255, .055); }
.rank-number { display: inline-grid; width: 28px; height: 28px; place-items: center; border-radius: 9px; color: #c3cbf1; background: rgba(172, 185, 255, .1); font-size: .72rem; font-weight: 850; }
tr:first-child .rank-number { color: #261c02; background: var(--gold); box-shadow: 0 0 20px rgba(255, 213, 112, .3); }
.player-cell { font-weight: 820; }
.player-cell small { display: block; margin-top: 3px; overflow: hidden; color: #8d96be; font-size: .68rem; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.event-count { color: #aeb7de; font-variant-numeric: tabular-nums; }
.point-cell { color: var(--cyan); font-size: 1rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.point-cell small { margin-left: 2px; color: #98a2ca; font-size: .65rem; font-weight: 750; }

.loading-state, .empty-state, .error-state { display: grid; min-height: 320px; place-items: center; align-content: center; gap: 14px; padding: 40px; border: 1px solid var(--line); border-radius: 24px; color: var(--muted); text-align: center; background: rgba(10, 13, 34, .66); }
.loading-state p, .empty-state p, .error-state p { max-width: 440px; margin: 0; line-height: 1.6; }
.loading-orbit { width: 44px; height: 44px; border: 3px solid rgba(104, 239, 255, .17); border-top-color: var(--cyan); border-right-color: var(--violet); border-radius: 50%; animation: spin 1s linear infinite; }
.empty-state strong, .error-state strong { color: var(--ink); font-size: 1.05rem; }
.error-state { border-color: rgba(250, 120, 200, .32); }

.site-footer { display: flex; justify-content: space-between; gap: 16px; padding: 20px 4px 0; color: #7f88ae; font-size: .68rem; line-height: 1.5; }
.site-footer span:last-child { text-align: right; }

@media (max-width: 720px) {
  .ranking-shell { width: min(100% - 24px, 1180px); padding-top: 14px; }
  .ranking-intro { align-items: flex-start; margin-top: 23px; }
  .metrics { grid-template-columns: 1fr; gap: 9px; }
  .metric-card { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "label value" "note value"; min-height: 0; padding: 15px 17px; }
  .metric-card span { grid-area: label; align-self: end; }
  .metric-card strong { grid-area: value; margin: 0; align-self: center; }
  .metric-card small { grid-area: note; }
  .podium { grid-template-columns: 1fr; padding: 13px; }
  .podium-card:first-child, .podium-card:nth-child(2), .podium-card:nth-child(3) { order: initial; }
  th:first-child, td:first-child { padding-left: 18px; }
  th:last-child, td:last-child { padding-right: 18px; }
  .site-footer { flex-direction: column; gap: 5px; padding-bottom: 16px; }
  .site-footer span:last-child { text-align: left; }
}

@media (max-width: 430px) {
  .brand small { display: none; }
  .back-link { padding: 8px 10px; font-size: .7rem; }
  .ranking-intro { gap: 14px; }
  h1 { font-size: 2rem; }
  .intro-description { max-width: 210px; }
  .refresh-button { padding: 10px 11px; font-size: .7rem; }
}
