/* ======================================================
   Estadísticas — página pública por servidor
   Usa las variables del design system (landing.css);
   nexus.css las pisa a violeta al final de la cascada.
   ====================================================== */

#stats {
  --st-ink: var(--foreground);
  --st-ink-dim: rgba(239, 233, 255, .62);
  --st-ink-faint: rgba(239, 233, 255, .38);

  position: relative;
  min-height: 100vh;
  padding: 120px 0 60px;
  color: var(--st-ink);
  overflow: hidden;
}

/* Aura de fondo */
.stats-aura {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(600px 320px at 50% -60px, rgba(155, 110, 255, .16), transparent 70%),
    radial-gradient(900px 500px at 85% 10%, rgba(109, 40, 217, .08), transparent 70%),
    radial-gradient(700px 400px at 10% 30%, rgba(155, 110, 255, .05), transparent 70%);
}

#stats .container {
  position: relative;
  width: 95%;
  max-width: 1200px;
  margin: 0 auto;
}

/* El display:flex de algunos bloques pisa el display:none del atributo hidden */
#stats [hidden] {
  display: none !important;
}

/* ------------------------------------------------------
   Hero
   ------------------------------------------------------ */

.stats-hero {
  text-align: center;
  margin-bottom: 28px;
}

.stats-title {
  font-family: var(--font-serif);
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: .02em;
  background: linear-gradient(120deg, var(--st-ink) 10%, var(--gold-light) 45%, var(--gold) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--gold-light);
}

.stats-title-rule {
  width: 170px;
  height: 1px;
  margin: 14px auto 16px;
  background: linear-gradient(90deg, transparent, rgba(183, 156, 255, .7), transparent);
}

.stats-sub {
  max-width: 580px;
  margin: 0 auto;
  font-size: .95rem;
  color: var(--st-ink-dim);
}

/* ------------------------------------------------------
   Tabs de servidor
   ------------------------------------------------------ */

.stats-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 14px;
}

.stats-tab {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(155, 110, 255, .25);
  background: rgba(155, 110, 255, .05);
  color: var(--st-ink-dim);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .2s, background .2s, color .2s, box-shadow .2s, transform .2s;
}

.stats-tab:hover:not(.active) {
  border-color: rgba(183, 156, 255, .5);
  color: var(--st-ink);
  transform: translateY(-1px);
}

.stats-tab.active {
  background: linear-gradient(135deg, #a78bfa 0%, #6d28d9 100%);
  border-color: rgba(183, 156, 255, .6);
  color: #0c0618;
  box-shadow: 0 0 24px rgba(155, 110, 255, .35);
}

.stats-tab-online {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(7, 5, 12, .35);
  color: inherit;
}

.stats-tab:not(.active) .stats-tab-online {
  background: rgba(155, 110, 255, .1);
}

.stats-tab-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6fe08a;
  box-shadow: 0 0 8px rgba(111, 224, 138, .8);
  animation: st-pulse 2.2s ease-in-out infinite;
}

/* ------------------------------------------------------
   Línea de actualización / mensajes
   ------------------------------------------------------ */

.stats-updated {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-bottom: 26px;
  font-size: 12px;
  color: var(--st-ink-faint);
}

.stats-updated-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(155, 110, 255, .8);
  animation: st-pulse 2.2s ease-in-out infinite;
}

.stats-msg {
  text-align: center;
  padding: 70px 0;
  font-size: .95rem;
  color: var(--st-ink-dim);
}

/* ------------------------------------------------------
   Contador regresivo (servidor bloqueado)
   ------------------------------------------------------ */

.stats-cd {
  position: relative;
  max-width: 660px;
  margin: 30px auto 40px;
  padding: 52px 34px 42px;
  text-align: center;
  border-radius: 20px;
  border: 1px solid rgba(155, 110, 255, .25);
  background:
    radial-gradient(500px 260px at 50% -80px, rgba(155, 110, 255, .18), transparent 70%),
    linear-gradient(160deg, rgba(155, 110, 255, .08), rgba(155, 110, 255, .02) 60%);
  background-color: var(--dark-surface);
  box-shadow: 0 20px 60px rgba(109, 40, 217, .18);
  overflow: hidden;
  animation: st-rise .5s ease both;
}

/* Orbe de energia detras de los numeros */
.stats-cd-orb {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 340px;
  height: 340px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(155, 110, 255, .22), rgba(109, 40, 217, .08) 45%, transparent 70%);
  filter: blur(6px);
  animation: st-cd-breathe 3.2s ease-in-out infinite;
  pointer-events: none;
}

.stats-cd-title {
  position: relative;
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.3;
  color: var(--st-ink);
  margin-bottom: 10px;
}

.stats-cd-sub {
  position: relative;
  font-size: .95rem;
  font-style: italic;
  color: var(--st-ink-dim);
  margin-bottom: 30px;
}

.stats-cd-title span {
  background: linear-gradient(120deg, var(--gold-light), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--gold-light);
}

.stats-cd-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  max-width: 520px;
  margin: 0 auto 26px;
}

.stats-cd-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 18px 8px 14px;
  border-radius: 14px;
  border: 1px solid rgba(155, 110, 255, .28);
  background: linear-gradient(180deg, rgba(155, 110, 255, .1), rgba(12, 6, 24, .55));
  box-shadow: inset 0 -8px 18px rgba(109, 40, 217, .2), 0 4px 18px rgba(7, 5, 12, .5);
}

.stats-cd-num {
  font-size: 2.7rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #efe9ff 20%, var(--gold-light) 70%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--gold-light);
  text-shadow: 0 0 26px rgba(155, 110, 255, .4);
}

.stats-cd-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--st-ink-faint);
}

.stats-cd-date {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--st-ink-dim);
}

@keyframes st-cd-breathe {
  0%, 100% { opacity: .7; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
}

/* Tab bloqueada */
.stats-tab--locked {
  opacity: .85;
}

.stats-tab-lockicon {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  color: var(--gold-light);
}

@media (max-width: 520px) {
  .stats-cd {
    padding: 38px 16px 30px;
  }

  .stats-cd-num {
    font-size: 1.9rem;
  }

  .stats-cd-title {
    font-size: 1.2rem;
  }
}

/* ------------------------------------------------------
   Skeleton de carga (shimmer)
   ------------------------------------------------------ */

#stats-loading {
  padding: 4px 0 40px;
}

.stats-skel {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(155, 110, 255, .1);
  background: rgba(155, 110, 255, .05);
}

.stats-skel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(155, 110, 255, .13) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: st-shimmer 1.4s ease-in-out infinite;
}

.stats-skel-kpis {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-bottom: 14px;
}

.stats-skel-kpi {
  height: 96px;
  flex: 1 1 190px;
  min-width: 150px;
  max-width: calc((100% - 4 * 14px) / 5);
}

.stats-skel-block {
  height: 280px;
}

/* Fade-in del contenido al cambiar de servidor */
.st-enter {
  animation: st-rise .45s ease both;
}

/* ------------------------------------------------------
   Base de tarjetas
   ------------------------------------------------------ */

.stats-kpi,
.stats-card {
  position: relative;
  border-radius: 14px;
  border: 1px solid rgba(155, 110, 255, .16);
  background:
    linear-gradient(160deg, rgba(155, 110, 255, .09), rgba(155, 110, 255, .02) 55%, rgba(155, 110, 255, 0));
  background-color: var(--dark-surface);
  transition: border-color .25s, box-shadow .25s, transform .25s;
  animation: st-rise .5s ease both;
}

.stats-kpi:hover,
.stats-card:hover {
  border-color: rgba(183, 156, 255, .38);
  box-shadow: 0 8px 30px rgba(109, 40, 217, .18);
  transform: translateY(-2px);
}

/* ------------------------------------------------------
   KPIs
   ------------------------------------------------------ */

.stats-kpis {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-bottom: 14px;
}

.stats-kpi {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  padding: 18px 20px;
  flex: 1 1 190px;
  min-width: 190px;
  max-width: calc((100% - 4 * 14px) / 5);
}

.stats-kpi:nth-child(2) { animation-delay: .04s; }
.stats-kpi:nth-child(3) { animation-delay: .08s; }
.stats-kpi:nth-child(4) { animation-delay: .12s; }
.stats-kpi:nth-child(5) { animation-delay: .16s; }
.stats-kpi:nth-child(6) { animation-delay: .2s; }
.stats-kpi:nth-child(7) { animation-delay: .24s; }
.stats-kpi:nth-child(8) { animation-delay: .28s; }
.stats-kpi:nth-child(9) { animation-delay: .32s; }
.stats-kpi:nth-child(10) { animation-delay: .36s; }

.stats-kpi-icon {
  display: inline-flex;
  color: var(--gold-light);
  opacity: .75;
  transition: opacity .2s, transform .2s;
}

.stats-kpi:hover .stats-kpi-icon {
  opacity: 1;
  transform: translateY(-2px);
}

.stats-kpi-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--st-ink-faint);
}

.stats-kpi-value {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--st-ink);
}

.stats-kpi--hero .stats-kpi-value {
  background: linear-gradient(120deg, var(--gold-light), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--gold-light);
}

.stats-kpi-sub {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gold-light);
}

/* Mini avatar del dueño del record (1x nativo) */
.stats-kpi-head {
  display: block;
  image-rendering: pixelated;
  border-radius: 5px;
  border: 1px solid rgba(155, 110, 255, .3);
  background: rgba(155, 110, 255, .1);
  padding: 1px;
}

/* ------------------------------------------------------
   Tarjetas de gráficos y tops
   ------------------------------------------------------ */

.stats-charts {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

/* 3 columnas en desktop: menos filas de tarjetas, mas info por fila */
.stats-tops {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

@media (max-width: 1100px) {
  .stats-tops {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.stats-card {
  padding: 20px 22px;
}

/* Tabla general de mejores jugadores, a ancho completo */
.stats-card--wide {
  margin-bottom: 14px;
}

/* Barra de filtros de la tabla general */
.stats-filterbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.stats-filterbar .stats-card-title {
  margin-bottom: 0;
}

.stats-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stats-filter {
  appearance: none;
  -webkit-appearance: none;
  padding: 7px 30px 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(155, 110, 255, .25);
  background: rgba(155, 110, 255, .06)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23b79cff' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E")
    no-repeat right 12px center;
  color: var(--st-ink-dim);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .2s, background-color .2s, color .2s, box-shadow .2s;
}

.stats-filter:hover {
  border-color: rgba(183, 156, 255, .5);
  color: var(--st-ink);
}

.stats-filter:focus-visible {
  outline: none;
  border-color: rgba(183, 156, 255, .7);
  box-shadow: 0 0 0 3px rgba(155, 110, 255, .2);
}

.stats-filter.active {
  background-color: rgba(155, 110, 255, .18);
  border-color: rgba(183, 156, 255, .65);
  color: var(--st-ink);
  box-shadow: 0 0 14px rgba(155, 110, 255, .25);
}

.stats-filter option {
  background: #0c0618;
  color: #efe9ff;
}

/* Buscador de nick: mismo pill que los selects, con lupa en vez de chevron */
.stats-search {
  width: 170px;
  padding-right: 14px;
  padding-left: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23b79cff' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E");
  background-position: left 12px center;
  cursor: text;
}

.stats-search::placeholder {
  color: var(--st-ink-faint);
}

.stats-search::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

/* Version compacta para las titlebars de los tops chicos */
.stats-search--mini {
  width: 140px;
  padding-top: 5px;
  padding-bottom: 5px;
  font-size: 12px;
}

/* Paginador de la tabla general */
.stats-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 14px;
}

.stats-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(155, 110, 255, .28);
  background: rgba(155, 110, 255, .07);
  color: var(--st-ink-dim);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: border-color .2s, background-color .2s, color .2s, box-shadow .2s;
}

.stats-page-btn:hover:not(:disabled) {
  border-color: rgba(183, 156, 255, .6);
  color: var(--st-ink);
  box-shadow: 0 0 12px rgba(155, 110, 255, .25);
}

.stats-page-btn:disabled {
  opacity: .3;
  cursor: default;
}

.stats-page-info {
  min-width: 60px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--st-ink-dim);
}

/* Fila de "sin datos" cuando un filtro no tiene resultados */
.stats-table td.stats-table-empty {
  text-align: center;
  padding: 26px 10px;
  color: var(--st-ink-faint);
}

/* Headers ordenables (Nivel / Bajas / Oro) */
.stats-table th.col-sort {
  cursor: pointer;
  user-select: none;
  transition: color .15s;
}

.stats-table th.col-sort:hover {
  color: var(--st-ink);
}

.stats-table th.col-sort::after {
  content: "\2195";
  margin-left: 5px;
  font-size: 10px;
  opacity: .35;
}

.stats-table th.col-sort.sorted-desc::after {
  content: "\25BC";
  opacity: 1;
  color: var(--gold-light);
}

.stats-table th.col-sort.sorted-asc::after {
  content: "\25B2";
  opacity: 1;
  color: var(--gold-light);
}

/* Columna clan de la tabla general */
.stats-table td.col-clan {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stats-card-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-sans);
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--st-ink);
  margin-bottom: 14px;
}

.stats-card-title::before {
  content: "";
  width: 3px;
  height: 15px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--gold-light), var(--gold-dark));
  flex-shrink: 0;
}

.stats-card-title--spaced {
  margin-top: 26px;
}

/* ------------------------------------------------------
   Barras de distribución (una serie)
   ------------------------------------------------------ */

.stats-bar-row {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}

.stats-bar-label {
  font-size: 12.5px;
  color: var(--st-ink-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stats-bar-track {
  display: block;
  height: 14px;
  border-radius: 0 4px 4px 0;
  background: rgba(155, 110, 255, .08);
  overflow: hidden;
}

.stats-bar-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(90deg, #6d28d9, #9b6eff);
  transition: width .8s cubic-bezier(.22, .61, .36, 1);
}

.stats-bar-value {
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--st-ink);
  text-align: right;
  white-space: nowrap;
}

.stats-bar-value em {
  font-style: normal;
  font-weight: 400;
  font-size: 11px;
  color: var(--st-ink-faint);
  margin-left: 6px;
}

/* ------------------------------------------------------
   Tablas de tops
   ------------------------------------------------------ */

/* Sin scrollbar: los nombres largos se cortan con ellipsis */
.stats-table-wrap {
  overflow: hidden;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.stats-table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  text-align: left;
  color: var(--st-ink-faint);
  padding: 8px 10px;
  border-bottom: 1px solid rgba(155, 110, 255, .18);
  white-space: nowrap;
}

.stats-table td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(155, 110, 255, .06);
}

.stats-table tbody tr:last-child td {
  border-bottom: none;
}

.stats-table tbody tr {
  transition: background .15s;
}

.stats-table tbody tr:hover {
  background: rgba(155, 110, 255, .05);
}

/* Datos centrados: solo Personaje queda a la izquierda */
.stats-table th.col-num,
.stats-table td.col-num {
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stats-table th.col-rank,
.stats-table td.col-rank,
.stats-table th.col-mid,
.stats-table td.col-muted,
.stats-table td.col-clan {
  text-align: center;
}

.stats-table td.col-name {
  font-weight: 600;
  color: var(--st-ink);
  white-space: nowrap;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Cabeza del personaje: pixel art del juego renderizado x3 */
.stats-headbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  vertical-align: middle;
  padding: 4px;
  border-radius: 10px;
  background:
    radial-gradient(120% 90% at 50% 100%, rgba(155, 110, 255, .22), rgba(155, 110, 255, .05) 70%);
  border: 1px solid rgba(155, 110, 255, .28);
  box-shadow: 0 0 10px rgba(155, 110, 255, .12), inset 0 -6px 12px rgba(109, 40, 217, .18);
  transition: border-color .2s, box-shadow .2s, transform .2s;
}

.stats-head {
  display: block;
  zoom: 2;
  image-rendering: pixelated;
  /* Outline oscuro que sigue la silueta del sprite (via canal alpha) + glow violeta */
  filter:
    drop-shadow(1px 0 0 rgba(10, 5, 20, .9))
    drop-shadow(-1px 0 0 rgba(10, 5, 20, .9))
    drop-shadow(0 1px 0 rgba(10, 5, 20, .9))
    drop-shadow(0 -1px 0 rgba(10, 5, 20, .9))
    drop-shadow(0 2px 3px rgba(155, 110, 255, .35));
  transition: filter .2s;
}

.stats-table tbody tr:hover .stats-headbox {
  border-color: rgba(183, 156, 255, .65);
  box-shadow: 0 0 18px rgba(155, 110, 255, .4), inset 0 -6px 12px rgba(109, 40, 217, .25);
  transform: scale(1.05);
}

.stats-table tbody tr:hover .stats-head {
  filter:
    drop-shadow(1px 0 0 rgba(10, 5, 20, .9))
    drop-shadow(-1px 0 0 rgba(10, 5, 20, .9))
    drop-shadow(0 1px 0 rgba(10, 5, 20, .9))
    drop-shadow(0 -1px 0 rgba(10, 5, 20, .9))
    drop-shadow(0 0 5px rgba(183, 156, 255, .75));
}

/* Mismo tratamiento, mas suave, para el mini avatar del KPI */
.stats-kpi-head {
  filter:
    drop-shadow(0 1px 0 rgba(10, 5, 20, .8))
    drop-shadow(0 0 3px rgba(155, 110, 255, .4));
}

/* Sin imagen (cabeza 0 o 404): marco vacio del tamano esperado para alinear */
.stats-headbox--empty {
  width: 54px;
  height: 64px;
  opacity: .5;
}

.stats-name {
  vertical-align: middle;
}

.stats-table td.col-muted {
  color: var(--st-ink-dim);
  white-space: nowrap;
}

.stats-table td.col-accent {
  color: var(--gold-light);
  font-weight: 600;
}

.stats-table th.col-rank {
  width: 42px;
}

/* Medallas de ranking */
.stats-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--st-ink-dim);
  background: rgba(155, 110, 255, .08);
  border: 1px solid rgba(155, 110, 255, .16);
}

/* Medallas clasicas: oro, plata, bronce */
.stats-rank--1 {
  background: linear-gradient(135deg, #fde68a, #d97706);
  border-color: rgba(251, 191, 36, .8);
  color: #1c1204;
  box-shadow: 0 0 14px rgba(251, 191, 36, .45);
}

.stats-rank--2 {
  background: linear-gradient(135deg, #f1f5f9, #94a3b8);
  border-color: rgba(226, 232, 240, .7);
  color: #10141c;
  box-shadow: 0 0 10px rgba(226, 232, 240, .25);
}

.stats-rank--3 {
  background: linear-gradient(135deg, #e8a05c, #8a4b12);
  border-color: rgba(217, 119, 6, .6);
  color: #1c0f02;
  box-shadow: 0 0 10px rgba(217, 119, 6, .3);
}

/* Podio: tinte sutil en las primeras 3 filas */
.stats-table tbody tr.stats-row--1 {
  background: linear-gradient(90deg, rgba(251, 191, 36, .08), transparent 65%);
}

.stats-table tbody tr.stats-row--2 {
  background: linear-gradient(90deg, rgba(226, 232, 240, .05), transparent 65%);
}

.stats-table tbody tr.stats-row--3 {
  background: linear-gradient(90deg, rgba(217, 119, 6, .06), transparent 65%);
}

.stats-table tbody tr.stats-row--1:hover,
.stats-table tbody tr.stats-row--2:hover,
.stats-table tbody tr.stats-row--3:hover {
  background-color: rgba(155, 110, 255, .05);
}

/* Entrada escalonada de las filas */
.stats-row {
  animation: st-row-in .35s ease both;
}

.stats-row:nth-child(2) { animation-delay: .03s; }
.stats-row:nth-child(3) { animation-delay: .06s; }
.stats-row:nth-child(4) { animation-delay: .09s; }
.stats-row:nth-child(5) { animation-delay: .12s; }
.stats-row:nth-child(6) { animation-delay: .15s; }
.stats-row:nth-child(7) { animation-delay: .18s; }
.stats-row:nth-child(8) { animation-delay: .21s; }
.stats-row:nth-child(9) { animation-delay: .24s; }
.stats-row:nth-child(10) { animation-delay: .27s; }

/* Badges de division ranked (MMR) */
.stats-div {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
  border: 1px solid;
}

.stats-div--hierro   { color: #9ca3af; border-color: rgba(156, 163, 175, .35); background: rgba(156, 163, 175, .08); }
.stats-div--bronce   { color: #e8a05c; border-color: rgba(217, 119, 6, .4);    background: rgba(217, 119, 6, .08); }
.stats-div--plata    { color: #e2e8f0; border-color: rgba(226, 232, 240, .35); background: rgba(226, 232, 240, .07); }
.stats-div--oro      { color: #fbbf24; border-color: rgba(251, 191, 36, .45);  background: rgba(251, 191, 36, .08); }
.stats-div--platino  { color: #5eead4; border-color: rgba(94, 234, 212, .4);   background: rgba(94, 234, 212, .07); }
.stats-div--diamante { color: #60a5fa; border-color: rgba(96, 165, 250, .45);  background: rgba(96, 165, 250, .08); }
.stats-div--leyenda  {
  color: #c084fc;
  border-color: rgba(192, 132, 252, .6);
  background: rgba(192, 132, 252, .1);
  box-shadow: 0 0 12px rgba(155, 110, 255, .35);
}

/* Colores por faccion (tabla general) */
.stats-table td.stats-status-1 { color: #7dd3fc; }  /* Imperial: celeste */
.stats-table td.stats-status-2 { color: #9ca3af; }  /* Renegado: gris */
.stats-table td.stats-status-3 { color: #ef4444; }  /* Caos: rojo */
.stats-table td.stats-status-4 { color: #60a5fa; }  /* Sagrada: azul */
.stats-table td.stats-status-5 { color: #fbbf24; }  /* Republicano: amarillo anaranjado */
.stats-table td.stats-status-6 { color: #f97316; }  /* Miliciano: naranja fuerte */

/* ------------------------------------------------------
   Animaciones
   ------------------------------------------------------ */

@keyframes st-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

@keyframes st-shimmer {
  to { transform: translateX(100%); }
}

@keyframes st-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes st-row-in {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
  .stats-kpi,
  .stats-card,
  .stats-row,
  .st-enter,
  .stats-cd,
  .stats-cd-orb {
    animation: none;
  }
  .stats-tab-dot,
  .stats-updated-dot,
  .stats-skel::after {
    animation: none;
  }
  .stats-bar-fill {
    transition: none;
  }
}

/* ------------------------------------------------------
   Responsive
   ------------------------------------------------------ */

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

@media (max-width: 720px) {
  #stats {
    padding-top: 100px;
  }

  .stats-title {
    font-size: 1.8rem;
  }

  .stats-kpis {
    gap: 10px;
  }

  .stats-kpi {
    padding: 14px 16px;
    min-width: 145px;
    max-width: calc((100% - 10px) / 2);
  }

  .stats-kpi-value {
    font-size: 1.5rem;
  }

  .stats-charts,
  .stats-tops {
    gap: 10px;
  }

  .stats-tops {
    grid-template-columns: 1fr;
  }

  .stats-card {
    padding: 16px;
  }

  .stats-bar-row {
    grid-template-columns: 92px 1fr auto;
    gap: 8px;
  }

  .stats-table {
    font-size: 12.5px;
  }

  .stats-table th,
  .stats-table td {
    padding-left: 6px;
    padding-right: 6px;
  }

  .stats-table td.col-name {
    max-width: 90px;
  }

  /* Tabla general en mobile: se ocultan Clan (col 3), Faccion (col 5) y
     Battle Rank (col 9) para que Personaje / Clase / Nivel / Bajas / Oro
     entren comodos */
  .stats-card--wide .stats-table th:nth-child(3),
  .stats-card--wide .stats-table td:nth-child(3),
  .stats-card--wide .stats-table th:nth-child(5),
  .stats-card--wide .stats-table td:nth-child(5),
  .stats-card--wide .stats-table th:nth-child(9),
  .stats-card--wide .stats-table td:nth-child(9) {
    display: none;
  }

  /* Filtros apilados: titulo arriba, controles a lo ancho */
  .stats-filterbar {
    flex-direction: column;
    align-items: stretch;
  }

  .stats-filterbar .stats-card-title {
    justify-content: flex-start;
  }

  .stats-filters {
    width: 100%;
  }

  .stats-filter {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
  }

  .stats-search,
  .stats-search--mini {
    flex: 1 1 100%;
    width: 100%;
  }

  /* Cabezas mas compactas en pantallas chicas */
  .stats-headbox {
    padding: 3px;
    margin-right: 7px;
  }
}
