.ranking-page {
  max-width: 1400px;
  margin: 0 auto;
  padding-block: 2rem;
}


.ranking-header {
  text-align: center;
}

.year-title {
  font-size: 1.75rem;
  font-weight: bold;
  color: #22a5e5;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.server-title {
  font-size: 2rem;
  font-weight: 900;
  color: #ffbd30;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-shadow: 0 0 20px rgba(255, 189, 48, 0.5);
  margin: 0.5rem auto 0;
  display: block;
  text-align: center !important;
  width: 100%;
}

.server-selection {
  margin-top: 1.5rem;
  margin-bottom: 1.25rem;
  text-align: center;
}

.server-buttons {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.server-btn {
  padding: 0.625rem 1.75rem;
  font-size: 0.9375rem;
  font-weight: 700;
  text-transform: uppercase;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 1px;
}

.server-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.4);
}

.server-btn.active {
  background: linear-gradient(135deg, rgba(34, 165, 229, 0.9), rgba(34, 165, 229, 0.6));
  border-color: rgba(34, 165, 229, 0.8);
  box-shadow: 0 8px 20px rgba(34, 165, 229, 0.4);
}

.search-section {
  margin-top: 0;
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: center;
  width: 100%;
}

.search-form {
  display: flex;
  gap: 0.75rem;
  width: 100%;
  max-width: 600px;
  align-items: center;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  font-size: 1rem;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 0.625rem 0.875rem 0.625rem 2.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #fff;
  outline: none;
  transition: all 0.3s ease;
  letter-spacing: 0.5px;
}

.search-input::placeholder {
  color: #9ca3af;
  font-weight: 500;
  text-transform: uppercase;
}

.search-input:focus {
  border-color: #22a5e5;
  box-shadow: 0 0 0 3px rgba(34, 165, 229, 0.2);
}

.search-btn {
  padding: 0.625rem 1.5rem;
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  background: linear-gradient(135deg, #22a5e5, #1e90c8);
  border: none;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.search-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(34, 165, 229, 0.4);
}

.info-section {
  margin: 0 0 1.5rem 0;
}

.info-box {
  background: linear-gradient(135deg, rgba(34, 165, 229, 0.15), rgba(34, 165, 229, 0.08));
  border-left: 4px solid #22a5e5;
  border-radius: 8px;
  padding: 0.625rem 0.875rem;
  color: #e5e7eb;
  line-height: 1.4;
  text-align: left;
  font-size: 0.8125rem;
}

.info-box p {
  margin: 0 0 0.25rem 0;
}

.info-box p:last-child {
  margin-bottom: 0;
}

.forum-link {
  color: #22a5e5;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
}

.forum-link:hover {
  color: #34d399;
  text-decoration: underline;
}

.loading {
  text-align: center;
  padding: 3rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.2rem;
}

.loading-spinner {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  border: 3px solid rgba(34, 165, 229, 0.3);
  border-top-color: #22a5e5;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===================== GRADE (montada pelo js/rankings.js) =====================
   .rankings-grid > .rank-group (h2) > .rank-group-grid > .ranking-card (h3 + top 10) */

.ranking-page .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Chips de categoria: barra fixa logo abaixo da navbar enquanto a grade rola. */
.rank-chips {
  position: sticky;
  top: var(--rank-chips-top, 0px);
  z-index: 20;
  margin: 0 -0.5rem 1rem;
  padding: 0.5rem;
  background: rgba(1, 17, 26, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.rank-chips-track {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.rank-chips-track::-webkit-scrollbar {
  display: none;
}

.rank-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.4rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: #e5e7eb;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.rank-chip:hover {
  color: #fff;
  border-color: rgba(34, 165, 229, 0.7);
}

.rank-chip:focus-visible,
.card-expand:focus-visible {
  outline: 2px solid #ffbd30;
  outline-offset: 2px;
}

.rank-chip.active {
  background: #22a5e5;
  border-color: #22a5e5;
  color: #01111a;
}

.rankings-grid {
  margin-bottom: 3rem;
}

.rank-group {
  padding: 0;
  margin-bottom: 2rem;
  scroll-margin-top: 140px;
}

.rank-group[hidden] {
  display: none;
}

.rank-group-title {
  font-size: 1.375rem;
  color: #ffbd30;
  margin: 0 0 0.875rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 189, 48, 0.25);
  text-align: left;
}

/* auto-fill + alinhado à esquerda: a última linha não fica com cards órfãos centralizados */
.rank-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
  align-items: start;
}

.rank-empty {
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  padding: 2rem 0;
}

.ranking-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
  border-radius: 12px;
  padding: 0.75rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  min-width: 0;
  text-align: left;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.625rem;
  padding: 0.25rem;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(8, 31, 46, 0.9), rgba(12, 44, 66, 0.8));
  border-bottom: 2px solid rgba(34, 165, 229, 0.3);
}

.card-title-img {
  flex: 0 0 auto;
  width: 96px;
  height: 64px;
  object-fit: contain;
  object-position: center;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.card-heading {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.ranking-card .card-title {
  /* fonte de título do site (h3 = Minecraft, global.css) */
  font-size: 1.3rem;
  color: #fff;
  margin: 0;
  line-height: 1.2;
}

.card-metric {
  font-size: 0.75rem;
  font-weight: 600;
  color: #22a5e5;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.players-list {
  display: flex;
  flex-direction: column;
  gap: 0.3125rem;
}

.players-header {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 0.375rem;
  padding: 0.3125rem 0.5rem;
  background: linear-gradient(135deg, rgba(34, 165, 229, 0.2), rgba(34, 165, 229, 0.1));
  border-radius: 6px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #22a5e5;
  letter-spacing: 0.5px;
  margin-bottom: 0.125rem;
}

.players-header > div:first-child {
  text-align: center;
}

.players-header > div:last-child {
  text-align: right;
}

.player-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 0.375rem;
  padding: 0.3125rem 0.5rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 0.875rem;
}

/* Podium */
.player-row.first {
  background: linear-gradient(135deg, rgba(255, 189, 48, 0.30), rgba(255, 189, 48, 0.18));
  border-color: rgba(255, 189, 48, 0.5);
}

.player-row.second {
  background: linear-gradient(135deg, rgba(212, 212, 212, 0.30), rgba(212, 212, 212, 0.18));
  border-color: rgba(212, 212, 212, 0.5);
}

.player-row.third {
  background: linear-gradient(135deg, rgba(187, 95, 48, 0.30), rgba(187, 95, 48, 0.18));
  border-color: rgba(187, 95, 48, 0.5);
}

/* Resultado da busca por nick */
.player-row.my-position {
  background: rgba(0, 255, 0, 0.1);
  border-top: 1px dashed #666;
}

.player-row.my-position .nick-cell {
  color: #00ff00;
  font-weight: 700;
}

.player-row.empty-row {
  grid-template-columns: 1fr;
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
}

.pos-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.podium-icon {
  font-size: 1rem;
}

.nick-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.val-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* "Ver top 10": só no celular (abaixo). */
.card-expand {
  display: none;
  width: 100%;
  margin-top: 0.5rem;
  min-height: 40px;
  padding: 0.5rem;
  border: 1px solid rgba(34, 165, 229, 0.45);
  border-radius: 8px;
  background: transparent;
  color: #22a5e5;
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
}

.card-expand:hover {
  background: rgba(34, 165, 229, 0.12);
}

@media (max-width: 640px) {
  .card-expand {
    display: block;
  }

  .ranking-card.is-collapsed .row-extra {
    display: none;
  }

  .card-title-img {
    width: 72px;
    height: 48px;
  }

  .ranking-card .card-title {
    font-size: 1.2rem;
  }

  .rank-group-title {
    font-size: 1.2rem;
  }

  .rank-group-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

/* Controles em uma barra no desktop: servidor à esquerda, busca à direita (só CSS; markup do rankings.php inalterado). */
@media (min-width: 992px) {
  .ranking-page {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 1.5rem;
    align-items: center;
  }

  .ranking-page > * {
    grid-column: 1 / -1;
  }

  .ranking-page > .server-selection {
    grid-column: 1;
    margin: 1.5rem 0 1rem;
  }

  .ranking-page > .search-section {
    grid-column: 2;
    justify-content: flex-end;
    margin: 1.5rem 0 1rem;
  }

  .ranking-page > .search-section .search-form {
    max-width: 480px;
  }
}

/* ===================== RESPONSIVO (controles) ===================== */

@media (max-width: 992px) {
  .server-btn {
    padding: 0.75rem 1.75rem;
    font-size: 0.875rem;
  }

  .search-form {
    flex-direction: column;
    gap: 0.75rem;
  }

  .search-btn {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .ranking-page {
    padding: 1rem 0.75rem;
  }

  .year-title {
    font-size: 1.5rem;
  }

  .server-title {
    font-size: 1.75rem;
  }

  .server-selection {
    margin: 1.25rem 0 1rem;
  }

  .search-section {
    margin-bottom: 1rem;
  }

  .server-btn {
    padding: 0.625rem 1.5rem;
    font-size: 0.8125rem;
  }

  .search-input {
    font-size: 0.8125rem;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
  }

  .search-btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.8125rem;
  }

  .info-box {
    padding: 0.75rem;
    font-size: 0.8125rem;
  }
}

/* Celular e tablet: busca e botão lado a lado (economiza uma linha) */
@media (min-width: 360px) and (max-width: 992px) {
  .search-form {
    flex-direction: row;
  }

  .search-btn {
    width: auto;
  }
}

@media (max-width: 576px) {
  .ranking-page {
    padding: 0.875rem 0.5rem;
  }

  .year-title {
    font-size: 1.25rem;
  }

  .server-title {
    font-size: 1.5rem;
  }

  .server-btn {
    padding: 0.5rem 1.25rem;
    font-size: 0.75rem;
  }

  .search-icon {
    font-size: 0.875rem;
    left: 0.75rem;
  }

  .search-input {
    padding: 0.625rem 0.75rem 0.625rem 2.25rem;
    font-size: 0.75rem;
  }

  .search-btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.75rem;
  }

  .ranking-card {
    padding: 0.625rem;
  }
}

/* Ultra-small ≤360px */
@media (max-width: 360px) {
  .ranking-page {
    padding: 0.5rem 0.25rem;
  }

  .year-title {
    font-size: 1rem;
    letter-spacing: 1px;
  }

  .server-title {
    font-size: 1.2rem;
    letter-spacing: 1px;
  }

  .server-btn {
    padding: 0.4rem 0.875rem;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
  }

  .search-input {
    padding: 0.5rem 0.625rem 0.5rem 2rem;
    font-size: 0.7rem;
  }

  .search-btn {
    padding: 0.5rem 1rem;
    font-size: 0.7rem;
  }

  .players-header,
  .player-row {
    grid-template-columns: 34px 1fr auto;
    font-size: 0.8rem;
  }
}
