:root {
  color-scheme: dark;
  --bg: #08080a;
  --card: rgba(255, 255, 255, 0.055);
  --card-strong: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.11);
  --text: #f7f7f8;
  --muted: #a1a1aa;
  --quiet: #70717a;
  --blue: #2f80ed;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.06), transparent 32rem),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.ranking-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(18, 18, 22, 0.9) 0%, rgba(8, 8, 10, 0.72) 100%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0%, transparent 44%, rgba(255, 255, 255, 0.04) 100%);
  backdrop-filter: blur(24px) saturate(1.12);
}

.ranking-brand {
  font-size: 15px;
  font-weight: 800;
}

.ranking-home {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  font-size: 12px;
  font-weight: 800;
}

.ranking-page {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 72px;
}

.ranking-tabs,
.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ranking-tabs {
  margin-bottom: 20px;
}

.ranking-tabs.is-compact {
  margin-bottom: 0;
}

.league-tabs {
  margin-bottom: 14px;
}

.ranking-tab,
.category-tabs button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.ranking-tab.is-active,
.category-tabs button.is-active {
  border-color: rgba(47, 128, 237, 0.45);
  background: rgba(47, 128, 237, 0.18);
  color: #9fcbff;
}

.ranking-view {
  display: none;
}

.ranking-view.is-active {
  display: block;
}

.ranking-status {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.ranking-status.is-error {
  color: #ffb4ad;
}

.league-section {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.league-section:first-child {
  margin-top: 0;
}

.league-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.league-title h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.league-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.division-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.division-card,
.player-rank-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.078) 0%, rgba(255, 255, 255, 0.034) 100%),
    var(--card);
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.16);
}

.division-card {
  overflow: hidden;
}

.division-card {
  width: 100%;
}

.division-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.division-title h3 {
  margin: 0;
  font-size: 15px;
}

.division-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.team-table {
  width: 100%;
  border-collapse: collapse;
}

.team-table th,
.team-table td {
  padding: 10px 9px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.065);
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
}

.team-table th {
  color: var(--muted);
  font-weight: 800;
}

.team-table tr:last-child td {
  border-bottom: 0;
}

.team-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.team-cell img,
.team-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex: 0 0 auto;
}

.team-name {
  min-width: 0;
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
}

.run-diff.is-plus {
  color: #7ab5ff;
}

.run-diff.is-minus {
  color: #ffb4ad;
}

.player-ranking-controls {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.player-ranking-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.player-category-section {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.064) 0%, rgba(255, 255, 255, 0.027) 100%),
    var(--card);
}

.player-category-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 7px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
}

.player-category-title h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0;
}

.player-category-title span {
  padding: 4px 7px;
  border: 1px solid rgba(47, 128, 237, 0.3);
  border-radius: 999px;
  background: rgba(47, 128, 237, 0.12);
  color: #9fcbff;
  font-size: 10px;
  font-weight: 900;
}

.player-category-list {
  display: grid;
  gap: 6px;
}

.player-rank-card {
  display: grid;
  grid-template-columns: 26px 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

.player-category-section .player-rank-card {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.player-category-section .player-rank-card.is-leader {
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(47, 128, 237, 0.18), rgba(255, 255, 255, 0.07)),
    rgba(255, 255, 255, 0.035);
}

.player-category-section .player-rank-card:hover {
  background: rgba(255, 255, 255, 0.055);
}

.player-category-section .player-rank-card:focus-visible {
  outline: 2px solid rgba(159, 203, 255, 0.72);
  outline-offset: 2px;
}

.player-category-section .player-rank-card + .player-rank-card {
  border-top: 1px solid rgba(255, 255, 255, 0.075);
}

.player-category-section .player-rank-card.is-leader + .player-rank-card {
  border-top: 0;
}

.player-rank-card.is-leader .rank-number {
  color: #9fcbff;
}

.player-rank-card.is-leader .player-rank-main strong {
  font-size: 13px;
}

.player-rank-card.is-leader .player-rank-value strong {
  color: #9fcbff;
  font-size: 20px;
}

.player-rank-card.is-compact {
  grid-template-columns: 26px minmax(0, 1fr) auto;
}

.rank-number {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.player-photo {
  width: 34px;
  height: 34px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.player-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-rank-main {
  min-width: 0;
}

.player-rank-main strong {
  display: block;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-rank-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.player-rank-meta img {
  width: 14px;
  height: 14px;
  object-fit: contain;
}

.player-rank-value {
  min-width: 46px;
  text-align: right;
}

.player-rank-value strong {
  display: block;
  color: var(--text);
  font-size: 17px;
  line-height: 1;
}

.player-rank-value span {
  display: none;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.support-stats {
  grid-column: 3 / -1;
  display: none;
  flex-wrap: wrap;
  gap: 6px;
}

.player-rank-card.is-compact .support-stats {
  grid-column: 2 / -1;
}

.support-stats span {
  padding: 5px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.skeleton {
  min-height: 74px;
  border-radius: 18px;
  background: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(255,255,255,0.1), rgba(255,255,255,0.04));
  background-size: 220% 100%;
  animation: shimmer 1.2s infinite linear;
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }

  to {
    background-position: -120% 0;
  }
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f7f7f8;
    --card: rgba(255, 255, 255, 0.84);
    --card-strong: #ffffff;
    --line: rgba(0, 0, 0, 0.11);
    --text: #101114;
    --muted: #55565c;
    --quiet: #85868d;
    --shadow: none;
  }

  .ranking-topbar {
    background: rgba(255, 255, 255, 0.86);
  }
}

@media (max-width: 900px) {
  .division-grid {
    grid-template-columns: 1fr;
  }

  .player-ranking-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .ranking-topbar {
    padding: 10px 14px;
  }

  .ranking-page {
    width: 100%;
    padding: 16px 12px 48px;
  }

  .ranking-tabs,
  .category-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }

  .ranking-tab,
  .category-tabs button {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 0 12px;
    font-size: 12px;
  }

  .division-card {
    border-radius: 15px;
  }

  .league-section {
    gap: 10px;
    margin-top: 20px;
  }

  .league-title {
    padding-bottom: 8px;
  }

  .league-title h2 {
    font-size: 16px;
  }

  .division-title {
    padding: 12px;
  }

  .team-table th,
  .team-table td {
    padding: 9px 7px;
    font-size: 11px;
  }

  .team-table .is-desktop {
    display: none;
  }

  .team-cell img,
  .team-logo {
    width: 24px;
    height: 24px;
  }

  .team-name {
    max-width: 118px;
  }

  .player-ranking-list {
    grid-template-columns: 1fr;
  }

  .player-rank-card {
    grid-template-columns: 30px 42px minmax(0, 1fr) auto;
    gap: 9px;
    padding: 12px;
    border-radius: 15px;
  }

  .player-rank-card.is-compact {
    grid-template-columns: 30px minmax(0, 1fr) auto;
  }

  .player-photo {
    width: 42px;
    height: 42px;
  }

  .player-rank-main strong {
    font-size: 14px;
  }

  .player-rank-meta {
    font-size: 11px;
  }

  .player-rank-value {
    min-width: 54px;
  }

  .player-rank-value strong {
    font-size: 20px;
  }

  .support-stats {
    grid-column: 1 / -1;
    padding-left: 39px;
  }

  .player-rank-card.is-compact .support-stats {
    grid-column: 1 / -1;
  }
}
