.rankings-page {
  padding: 0;
}

.rankings-page .top-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  padding-inline: max(20px, calc((100% - var(--s1-content)) / 2));
  border-bottom: 1px solid var(--s1-line);
  background: rgba(16, 19, 16, .96);
  backdrop-filter: blur(12px);
}

.rankings-main {
  width: min(1400px, calc(100% - 40px));
  margin: 0 auto;
  padding: 42px 0 72px;
}

.rankings-page h1 {
  margin: 0 0 24px;
  color: var(--s1-text);
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1.12;
  text-align: center;
  text-wrap: balance;
}

.season-window {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 28px;
  padding: 10px 18px;
  border: 1px solid var(--s1-line);
  border-radius: 999px;
  background: var(--s1-panel);
  color: #d5ddd5;
  font-size: 1rem;
  text-align: center;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .24);
}

.tab-container {
  display: flex;
  width: min(620px, 100%);
  margin: 0 auto 24px;
  padding: 4px;
  gap: 4px;
  border: 1px solid var(--s1-line);
  border-radius: 10px;
  background: #0d100d;
}

.tab-button {
  min-width: 0;
  min-height: 44px;
  flex: 1;
  padding: 8px 18px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--s1-muted);
  font: 800 .95rem/1.2 "DotGothic16", sans-serif;
  cursor: pointer;
}

.tab-button:hover {
  background: var(--s1-panel);
  color: var(--s1-text);
}

.tab-button[aria-selected="true"],
.tab-button.active {
  background: linear-gradient(135deg, var(--s1-green), #3aaa56);
  color: #071109;
  box-shadow: 0 8px 22px rgba(85, 223, 114, .18);
}

.tab-content {
  width: 100%;
}

.tab-content[hidden] {
  display: none;
}

.members-container,
.ranking-container {
  width: 100%;
  margin: 0 0 22px;
  padding: clamp(18px, 3vw, 28px);
  overflow: hidden;
  border: 1px solid var(--s1-line);
  border-radius: 12px;
  background: linear-gradient(160deg, var(--s1-panel-soft), var(--s1-panel));
  box-shadow: 0 16px 42px rgba(0, 0, 0, .22);
}

.members-container {
  text-align: center;
}

.rankings-page h2 {
  margin: 0 0 18px;
  padding: 0 0 9px 13px;
  border-bottom: 1px solid var(--s1-line);
  border-left: 4px solid var(--s1-gold);
  color: var(--s1-gold);
  font-size: clamp(1.2rem, 3vw, 1.55rem);
  line-height: 1.35;
}

.members-title {
  padding-left: 0 !important;
  border-left: 0 !important;
  color: var(--s1-blue) !important;
  text-align: center;
}

.member-grid {
  display: flex;
  margin-top: 20px;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(18px, 4vw, 34px);
}

.member {
  min-width: 130px;
  text-align: center;
}

.member-avatar {
  display: block;
  width: auto;
  height: 190px;
  margin: 0 auto;
  filter: drop-shadow(5px 7px 0 rgba(0, 0, 0, .42));
  image-rendering: pixelated;
}

.member-name {
  margin-top: 10px;
  font-size: 1.04rem;
  font-weight: 800;
}

.member-name.red { color: #ff7272; }
.member-name.cyan { color: #69e5f2; }
.member-name.yellow { color: #ffe367; }
.member-name.green { color: #68e985; }
.member-name.magenta { color: #ed7af0; }

.summary-copy {
  margin: 0;
  line-height: 1.72;
}

.ranking-category {
  margin-top: 26px;
  overflow-x: auto;
}

.ranking-category:first-of-type {
  margin-top: 0;
}

.ranking-category h3 {
  margin: 0 0 10px;
  color: var(--s1-green);
  font-size: 1rem;
}

.rankings-page table {
  width: 100%;
  min-width: 620px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--s1-line);
  border-radius: 8px;
  background: rgba(0, 0, 0, .12);
  font-size: .89rem;
  white-space: nowrap;
}

.rankings-page th,
.rankings-page td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--s1-line);
  text-align: left;
  vertical-align: middle;
}

.rankings-page th {
  background: #111511;
  color: var(--s1-muted);
  font-size: .78rem;
  letter-spacing: .03em;
}

.rankings-page tr:last-child td {
  border-bottom: 0;
}

.vertical-rank th:nth-child(1),
.vertical-rank td:nth-child(1) { width: 15%; }
.vertical-rank th:nth-child(2),
.vertical-rank td:nth-child(2) { width: 42%; }
.vertical-rank th:nth-child(3),
.vertical-rank td:nth-child(3) { width: 43%; }
.horizontal-rank th,
.horizontal-rank td { width: 25%; }

.vertical-rank tbody tr:nth-child(1) td,
.horizontal-rank tbody td:nth-child(2) {
  color: #ffd75e;
  font-weight: 800;
}

.vertical-rank tbody tr:nth-child(2) td,
.horizontal-rank tbody td:nth-child(3) {
  color: #d7dfdc;
  font-weight: 800;
}

.vertical-rank tbody tr:nth-child(3) td,
.horizontal-rank tbody td:nth-child(4) {
  color: #dd995f;
  font-weight: 800;
}

.player-cell {
  display: flex;
  align-items: center;
  gap: 9px;
}

.player-cell img {
  width: 26px;
  height: 26px;
  border: 1px solid #090b09;
  border-radius: 3px;
  image-rendering: pixelated;
}

.note {
  margin: 22px 0 0;
  color: var(--s1-muted);
  font-size: .86rem;
  text-align: center;
}

.gallery-title {
  margin-bottom: 8px !important;
  padding-left: 0 !important;
  border-left: 0 !important;
  color: var(--s1-green) !important;
  font-size: clamp(1.6rem, 4vw, 2.25rem) !important;
  text-align: center;
}

.date-divider {
  width: 100%;
  margin: 38px 0 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--s1-line);
  color: var(--s1-green);
  font-size: 1.16rem;
  font-weight: 800;
}

.gallery-grid {
  display: grid;
  width: 100%;
  padding: 0;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.gallery-item {
  position: relative;
  aspect-ratio: 16 / 9;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--s1-line);
  border-radius: 9px;
  background: #0b0e0b;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .26);
  cursor: zoom-in;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.gallery-item:hover,
.gallery-item:focus-within {
  border-color: var(--s1-green);
  box-shadow: 0 18px 38px rgba(0, 0, 0, .4);
  transform: translateY(-3px);
}

.gallery-image {
  display: block;
  width: 100%;
  height: 100%;
  background: #0b0e0b;
  object-fit: cover;
  transition: filter .2s ease, opacity .2s ease, transform .25s ease;
}

.gallery-item:hover .gallery-image {
  transform: scale(1.025);
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  inset: 0;
  padding: 70px 84px;
  align-items: center;
  justify-content: center;
  background: rgba(2, 4, 2, .94);
  user-select: none;
}

.modal.active {
  display: flex;
}

body.modal-open {
  overflow: hidden;
}

.modal-content {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 100px);
  border: 1px solid var(--s1-line);
  border-radius: 6px;
  background: #090b09;
  box-shadow: 0 0 42px rgba(0, 0, 0, .72);
  object-fit: contain;
  transition: filter .2s ease, opacity .2s ease;
}

.modal-content.is-loading {
  filter: blur(6px);
  opacity: .35;
}

.close-modal,
.nav-button {
  position: absolute;
  z-index: 1001;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 50%;
  background: rgba(10, 14, 10, .78);
  color: #fff;
  cursor: pointer;
}

.close-modal {
  top: 18px;
  right: 22px;
  width: 46px;
  height: 46px;
  font-size: 32px;
  line-height: 1;
}

.nav-button {
  top: 50%;
  width: 52px;
  height: 52px;
  padding: 0;
  font-size: 30px;
  transform: translateY(-50%);
}

.nav-button.prev { left: 20px; }
.nav-button.next { right: 20px; }
.close-modal:hover,
.nav-button:hover { border-color: var(--s1-green); color: var(--s1-green); }

@media (max-width: 700px) {
  .rankings-main {
    width: min(100% - 24px, 1400px);
    padding-top: 30px;
  }

  .season-window {
    border-radius: 8px;
    font-size: .86rem;
  }

  .members-container,
  .ranking-container {
    padding: 16px;
  }

  .member-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .member {
    min-width: 0;
  }

  .member-avatar {
    height: 150px;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .modal {
    padding: 62px 12px 76px;
  }

  .nav-button {
    top: auto;
    bottom: 14px;
    transform: none;
  }

  .nav-button.prev { left: calc(50% - 62px); }
  .nav-button.next { right: calc(50% - 62px); }
}
