/* ================================================================
   CLASIFICACIÓN DE LOS JUEGOS  (/juegos/clasificacion)
   ================================================================
   Concepto: MARCADOR DE SALÓN RECREATIVO. La página no celebra a quien
   va primero, RETA al que llega: la marca del líder se presenta enorme,
   como el "high score" de una máquina, y todo empuja a intentar batirla.

   El motivo es que la clasificación arranca en frío. Un podio de tres
   huecos con un solo jugador se ve roto y desanima; un récord solitario
   presentado como reto funciona igual de bien con 1 jugador que con 100,
   y mejora a medida que entra gente.

   Usa la identidad del sitio: display Bricolage en los números grandes,
   esquinas recortadas de carta (12px 4px), barrido foil y la Pokéball
   del subrayado de sección. Nada de gradientes de relleno ni glows.
   ================================================================ */

.rank-page {
    max-width: 1040px;
    margin: 0 auto;
    padding: 26px 15px 60px;
}

/* --- Cabecera ------------------------------------------------- */
.rank-head {
    margin: 18px 0 30px;
}

.rank-kicker {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--primary);
    margin: 0 0 6px;
}

.rank-head h1 {
    font-size: clamp(30px, 5vw, 44px);
    line-height: 1.08;
    margin: 0 0 14px;
    color: var(--text-main);
}

.rank-head p {
    color: var(--text-muted);
    font-size: 15.5px;
    line-height: 1.65;
    max-width: 62ch;
    margin: 0;
}

.rank-head p a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.rank-head p a:hover {
    border-bottom-color: var(--primary);
}

/* --- Selector de juego ---------------------------------------- */
/* Pastillas no: una fila de fichas con filo inferior, más de marcador
   y menos de formulario. La activa se marca con la barra roja del
   sistema, la misma del subrayado de sección. */
.rank-games {
    display: flex;
    gap: 4px;
    margin: 0 0 26px;
    border-bottom: 2px solid var(--border-color);
}

.rank-game-tab {
    appearance: none;
    background: none;
    border: 0;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    padding: 12px 20px;
    font-family: var(--font-display, inherit);
    font-size: 16.5px;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.18s ease, border-color 0.18s ease;
}

.rank-game-tab:hover {
    color: var(--text-main);
}

.rank-game-tab[aria-selected="true"] {
    color: var(--text-main);
    border-bottom-color: var(--primary);
}

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

/* --- La marca a batir ----------------------------------------- */
.rank-challenge {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 26px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px 4px 12px 4px;
    padding: 28px 30px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

/* Filo de luz superior: la misma profundidad que las tarjetas TCG */
.rank-challenge::before {
    content: '';
    position: absolute;
    top: 0;
    left: 8%;
    right: 8%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
    pointer-events: none;
}

@media (max-width: 760px) {
    .rank-challenge {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
        gap: 16px;
        padding: 26px 20px;
    }
}

.rank-challenge-label {
    position: absolute;
    top: 0;
    left: 0;
    background: var(--primary);
    color: #fff;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 5px 12px 5px 14px;
    border-radius: 12px 0 12px 0;
}

.rank-holder {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    margin-top: 10px;
}

.rank-holder img {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
    flex-shrink: 0;
}

.rank-holder-name {
    font-family: var(--font-display, inherit);
    font-size: 21px;
    font-weight: 800;
    color: var(--text-main);
    text-decoration: none;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-holder-name:hover {
    color: var(--primary);
}

.rank-holder-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 3px;
}

/* El número: el momento grande de la página */
.rank-record {
    text-align: center;
    line-height: 1;
    margin-top: 8px;
}

.rank-record strong {
    display: block;
    font-family: var(--font-display, inherit);
    font-size: clamp(52px, 9vw, 82px);
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
}

.rank-record span {
    display: block;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 8px;
}

.rank-cta {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    font-size: 15px;
    text-decoration: none;
    padding: 14px 24px;
    border-radius: 10px 3px 10px 3px;
    white-space: nowrap;
    transition: background 0.18s ease;
    margin-top: 10px;
}

.rank-cta:hover {
    background: var(--primary-hover, #b91c1c);
}

/* --- Aviso de "aún sois pocos" -------------------------------- */
.rank-note {
    font-size: 13.5px;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px dashed var(--border-color);
    border-radius: 10px 3px 10px 3px;
    padding: 13px 18px;
    margin-bottom: 28px;
}

.rank-note strong {
    color: var(--text-main);
}

/* --- Selector de periodo (solo si los periodos difieren) ------- */
.rank-periods {
    display: flex;
    gap: 18px;
    margin: 26px 0 12px;
    font-size: 13.5px;
}

.rank-period {
    appearance: none;
    background: none;
    border: 0;
    padding: 4px 0;
    color: var(--text-muted);
    font-weight: 700;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.rank-period[aria-selected="true"] {
    color: var(--text-main);
    border-bottom-color: var(--primary);
}

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

/* --- Tabla ---------------------------------------------------- */
.rank-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 12px 4px 12px 4px;
    background: var(--bg-card);
}

.rank-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 520px;
}

.rank-table caption {
    text-align: left;
    padding: 16px 20px 10px;
    font-size: 13px;
    color: var(--text-muted);
}

.rank-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.rank-table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14.5px;
    color: var(--text-main);
    vertical-align: middle;
}

.rank-table tbody tr:last-child td {
    border-bottom: 0;
}

.rank-table tbody tr:hover td {
    background: var(--bg-card-hover, rgba(127, 127, 127, 0.06));
}

.rank-num {
    font-family: var(--font-display, inherit);
    font-weight: 800;
    font-size: 15px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    width: 54px;
}

/* Los tres primeros llevan color de metal en el número, sin medallas ni
   emojis: basta el tono para leer la jerarquía de un vistazo. */
.rank-num[data-medal="1"] { color: #c9a227; }
.rank-num[data-medal="2"] { color: #8c8f94; }
.rank-num[data-medal="3"] { color: #a9743c; }

.rank-player {
    display: flex;
    align-items: center;
    gap: 11px;
}

.rank-player img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.rank-player a {
    color: var(--text-main);
    font-weight: 700;
    text-decoration: none;
}

.rank-player a:hover {
    color: var(--primary);
}

.rank-c { text-align: center; }
.rank-r { text-align: right; }

.rank-score {
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.rank-muted {
    color: var(--text-muted);
    font-size: 13px;
}

/* --- Estado vacío --------------------------------------------- */
.rank-empty {
    text-align: center;
    padding: 44px 24px;
    background: var(--bg-card);
    border: 1px dashed var(--border-color);
    border-radius: 12px 4px 12px 4px;
}

.rank-empty p {
    color: var(--text-muted);
    margin: 0 0 18px;
    font-size: 15px;
}

/* --- Bloque de contenido (SEO) -------------------------------- */
.rank-info {
    margin-top: 54px;
    padding-top: 34px;
    border-top: 1px solid var(--border-color);
}

.rank-info h2 {
    font-size: 22px;
    margin: 0 0 14px;
    color: var(--text-main);
    position: relative;
    display: inline-block;
}

.rank-info section + section {
    margin-top: 34px;
}

.rank-info p {
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.72;
    max-width: 68ch;
    margin: 0 0 12px;
}

.rank-info ul {
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.72;
    max-width: 68ch;
    margin: 0 0 12px;
    padding-left: 20px;
}

.rank-info li { margin-bottom: 7px; }

.rank-info strong { color: var(--text-main); }

.rank-info a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.rank-info a:hover { text-decoration: underline; }

/* --- Entrada escalonada --------------------------------------- */
.rank-head      { animation: riseIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both; }
.rank-games     { animation: riseIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.08s both; }
.rank-challenge { animation: riseIn 0.55s cubic-bezier(0.16, 1, 0.3, 1) 0.16s both; }

@media (prefers-reduced-motion: reduce) {
    .rank-head, .rank-games, .rank-challenge {
        animation: none;
    }
}
