/* ChessEscape — Ranking Mundial (compartido por los 10 idiomas) */
/* ChessEscape — Ranking Mundial (compartido por los 10 idiomas).
   Se carga después de /css/site.css: la barra superior, el pie y la base de la página vienen de allí.
   Aquí solo va lo propio del ranking, dentro de main.rk. */
:root {
  --me: rgba(232, 196, 104, 0.14);
  --silver: #cfd6e4;
  --bronze: #d99a62;
}

.rk { font-size: 15px; line-height: 1.5; }

/* --- Encabezado --- */
.rk .hero { padding: 34px 0 22px; }
.rk .hero .sub {
  margin: 0;
  font-family: inherit;
  font-style: normal;
  color: var(--muted);
}
.rk .notice {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 18px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-2);
  font-size: 0.88rem;
  color: var(--text);
}
.rk .notice .upd { color: var(--muted); }

/* --- Tu posición --- */
.mine {
  margin: 8px 0 28px;
  padding: 18px 20px;
  border: 1px solid rgba(232, 196, 104, 0.45);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--card-2), var(--card));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.mine .label {
  margin: 0 0 6px;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}
.mine .who {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  margin-bottom: 14px;
}
.mine .who .name {
  font-size: 1.5rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.mine .who .pos {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.mine .who .id { font-size: 0.85rem; color: var(--muted); }
.mine .msg { margin: 0; color: var(--muted); }
.mine .goto {
  margin-top: 14px;
  padding: 8px 14px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: transparent;
  color: var(--gold);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.mine .goto:hover { background: var(--me); }

.summary {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}
.summary .cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.summary .cell img { width: 30px; height: 30px; }
.summary .cell .score-tag {
  height: 30px;
  display: flex;
  align-items: center;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
}

/* --- Lista --- */
.count {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.88rem;
}
.board {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--card);
}
.row {
  display: grid;
  grid-template-columns: 3.4rem minmax(0, 1fr) 7rem repeat(6, 4.4rem);
  align-items: center;
  gap: 0 6px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.row.head {
  border-top: 0;
  background: var(--bg-2);
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.row.head img { width: 24px; height: 24px; display: block; margin: 0 auto; }
.row .rank { font-weight: 700; color: var(--muted); }
.row .player { min-width: 0; }
.row .player .n {
  display: block;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row .player .id { display: block; font-size: 0.75rem; color: var(--muted); }
.row .score { text-align: right; font-weight: 700; color: var(--gold-soft); }
.row .stat { text-align: center; }
.row .stat img { display: none; }
.row.head .stat img { display: block; }

.row.top1 .rank, .row.top2 .rank, .row.top3 .rank {
  display: inline-grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  color: #1a1206;
}
.row.top1 .rank { background: var(--gold); }
.row.top2 .rank { background: var(--silver); }
.row.top3 .rank { background: var(--bronze); }
.row.me {
  background: var(--me);
  box-shadow: inset 3px 0 0 var(--gold);
}
.row.flash { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: rgba(232, 196, 104, 0.4); } }

.state {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
}

/* --- Celular: cada jugador es una tarjeta --- */
@media (max-width: 760px) {
  .row.head { display: none; }
  .row {
    grid-template-columns: 2.6rem minmax(0, 1fr) auto;
    grid-template-areas:
      "rank player score"
      "stats stats stats";
    gap: 8px 10px;
    padding: 12px;
  }
  .row .rank { grid-area: rank; }
  .row .player { grid-area: player; }
  .row .score { grid-area: score; font-size: 1.05rem; }
  .row .stats {
    grid-area: stats;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
  }
  .row .stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 0.85rem;
  }
  .row .stat img { display: block; width: 22px; height: 22px; }

  .summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .summary .cell.score-cell { grid-column: span 3; flex-direction: row; justify-content: center; gap: 10px; font-size: 1.2rem; }
  .summary .cell.score-cell .score-tag { height: auto; }
}

@media (min-width: 761px) {
  .row .stats { display: contents; }
}
