/* LegendGF Ranking layout fix v1 (2026-11-21).
 * Scoped to Ranking only. Does not alter ranking queries, global header or language selector.
 */

/* Give all three ranking categories the same desktop heading area. */
.legendgf-ranking-page .rank-hero {
  box-sizing: border-box;
  min-height: 224px;
}

/* Keep Overall/Class, character search, submit and Reset in reserved grid cells.
 * A Reset appearing or disappearing must not resize the other fields. */
@media (min-width: 801px) {
  .legendgf-ranking-page .rank-filters {
    display: grid;
    grid-template-columns: minmax(200px, 260px) minmax(0, 1fr) 118px 54px;
    align-items: end;
    column-gap: 12px;
    row-gap: 12px;
    box-sizing: border-box;
    min-height: 108px;
  }
  .legendgf-ranking-page .rank-filters > .rank-field:first-of-type {
    grid-column: 1;
    grid-row: 1;
  }
  .legendgf-ranking-page .rank-filters > .rank-search {
    grid-column: 2;
    grid-row: 1;
  }
  .legendgf-ranking-page .rank-filters > .rank-apply {
    grid-row: 1;
    width: 118px;
    justify-self: start;
  }
  .legendgf-ranking-page .rank-filters > .rank-field + .rank-apply {
    grid-column: 2;
  }
  .legendgf-ranking-page .rank-filters > .rank-search + .rank-apply {
    grid-column: 3;
  }
  .legendgf-ranking-page .rank-filters > .rank-reset {
    grid-row: 1;
    grid-column: 3;
    align-self: end;
    justify-self: center;
    white-space: nowrap;
  }
  .legendgf-ranking-page .rank-filters > .rank-search ~ .rank-reset {
    grid-column: 4;
  }
}
.legendgf-ranking-page .rank-filters > .rank-field {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.legendgf-ranking-page .rank-filters > .rank-field select,
.legendgf-ranking-page .rank-filters > .rank-field input {
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
}
.legendgf-ranking-page .rank-filters > .rank-apply {
  white-space: nowrap;
}

/* Stable column proportions: values with shorter names or filtering by class
 * no longer cause the entire header and rows to shift horizontally. */
.legendgf-ranking-page .rank-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.legendgf-ranking-page .rank-table th,
.legendgf-ranking-page .rank-table td {
  box-sizing: border-box;
  text-align: center;
  vertical-align: middle;
  white-space: normal;
  overflow-wrap: anywhere;
}
.legendgf-ranking-page .rank-table th {
  line-height: 1.4;
}
.legendgf-ranking-page .rank-table td .rank-player small {
  text-align: center;
}

/* Top 10: Rank, Class, Character, Level, Rebirth. */
.legendgf-ranking-page .rank-table-top10 { min-width: 680px; }
.legendgf-ranking-page .rank-table-top10 th:nth-child(1) { width: 10%; }
.legendgf-ranking-page .rank-table-top10 th:nth-child(2) { width: 19%; }
.legendgf-ranking-page .rank-table-top10 th:nth-child(3) { width: 31%; }
.legendgf-ranking-page .rank-table-top10 th:nth-child(4) { width: 20%; }
.legendgf-ranking-page .rank-table-top10 th:nth-child(5) { width: 20%; }

/* PvP: Rank, Class, Character, Points, MVP, Wins, Losses. */
.legendgf-ranking-page .rank-table-pvp { min-width: 845px; }
.legendgf-ranking-page .rank-table-pvp th:nth-child(1) { width: 9%; }
.legendgf-ranking-page .rank-table-pvp th:nth-child(2) { width: 14%; }
.legendgf-ranking-page .rank-table-pvp th:nth-child(3) { width: 24%; }
.legendgf-ranking-page .rank-table-pvp th:nth-child(4) { width: 15%; }
.legendgf-ranking-page .rank-table-pvp th:nth-child(5) { width: 12%; }
.legendgf-ranking-page .rank-table-pvp th:nth-child(6) { width: 12%; }
.legendgf-ranking-page .rank-table-pvp th:nth-child(7) { width: 14%; }

/* Guild: Rank, Guild, Level, Leader / Founder, Members, Exploit. */
.legendgf-ranking-page .rank-table-guild { min-width: 780px; }
.legendgf-ranking-page .rank-table-guild th:nth-child(1) { width: 9%; }
.legendgf-ranking-page .rank-table-guild th:nth-child(2) { width: 18%; }
.legendgf-ranking-page .rank-table-guild th:nth-child(3) { width: 13%; }
.legendgf-ranking-page .rank-table-guild th:nth-child(4) { width: 28%; }
.legendgf-ranking-page .rank-table-guild th:nth-child(5) { width: 17%; }
.legendgf-ranking-page .rank-table-guild th:nth-child(6) { width: 15%; }

@media (max-width: 800px) {
  .legendgf-ranking-page .rank-hero { min-height: 0; }
  .legendgf-ranking-page .rank-filters {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 12px;
  }
  .legendgf-ranking-page .rank-filters > .rank-field:first-of-type {
    grid-column: 1; grid-row: 1;
  }
  .legendgf-ranking-page .rank-filters > .rank-search {
    grid-column: 1 / -1; grid-row: 2;
  }
  .legendgf-ranking-page .rank-filters > .rank-apply {
    grid-column: 2; grid-row: 1;
    min-width: 112px; width: auto;
    justify-self: stretch;
  }
  .legendgf-ranking-page .rank-filters > .rank-search ~ .rank-apply {
    grid-column: 1; grid-row: 3;
  }
  .legendgf-ranking-page .rank-filters > .rank-reset {
    grid-column: 1 / -1; grid-row: 2;
    justify-self: start;
    padding: 0 4px 2px;
  }
  .legendgf-ranking-page .rank-filters > .rank-search ~ .rank-reset {
    grid-column: 2; grid-row: 3;
    align-self: center;
  }
}
@media (max-width: 460px) {
  .legendgf-ranking-page .rank-filters {
    grid-template-columns: minmax(0, 1fr);
  }
  .legendgf-ranking-page .rank-filters > .rank-field:first-of-type {
    grid-column: 1; grid-row: 1;
  }
  .legendgf-ranking-page .rank-filters > .rank-search {
    grid-column: 1; grid-row: 2;
  }
  .legendgf-ranking-page .rank-filters > .rank-apply,
  .legendgf-ranking-page .rank-filters > .rank-search ~ .rank-apply {
    grid-column: 1; grid-row: 3;
    justify-self: stretch;
  }
  .legendgf-ranking-page .rank-filters > .rank-reset,
  .legendgf-ranking-page .rank-filters > .rank-search ~ .rank-reset {
    grid-column: 1; grid-row: 4;
    justify-self: start;
  }
}

/* v2 - Keep Class, Character Name and Guild Name left-aligned.
 * This exception applies to BOTH headings and values in those columns;
 * numeric statistics and Leader/Founder remain centered. */
.legendgf-ranking-page .rank-table-top10 th:nth-child(2),
.legendgf-ranking-page .rank-table-top10 td:nth-child(2),
.legendgf-ranking-page .rank-table-top10 th:nth-child(3),
.legendgf-ranking-page .rank-table-top10 td:nth-child(3),
.legendgf-ranking-page .rank-table-pvp th:nth-child(2),
.legendgf-ranking-page .rank-table-pvp td:nth-child(2),
.legendgf-ranking-page .rank-table-pvp th:nth-child(3),
.legendgf-ranking-page .rank-table-pvp td:nth-child(3),
.legendgf-ranking-page .rank-table-guild th:nth-child(2),
.legendgf-ranking-page .rank-table-guild td:nth-child(2) {
  text-align: left;
}
.legendgf-ranking-page .rank-table-pvp td:nth-child(3) small {
  text-align: left;
}
