/**
 * smgr/css/pages/trivial_ranking.css — clasificación del "Trivial ACB"
 * portada al chrome "Foco". Mismo recipe que el resto de mini-juegos:
 *   · body { background } del original pasa a .game-scope { background }.
 *   · Todo lo demás va prefijado con ".game-scope " para aislar del sitio.
 *   · @keyframes intactos. Reset de aislamiento (img/button) arriba.
 *   · Se elimina la regla .logo-main del original (chrome del menú antiguo).
 * El original no define variables :root, así que no hay bloque sin scope.
 */

/* ===== Reset de aislamiento (contrarresta rincon.css dentro del juego) ===== */
.game-scope img { max-width: none; }
.game-scope button { font: inherit; }

/* Fondo (antes en body). Solo cubre el área de juego. */
.game-scope { background: #f7fafc; }

.game-scope .ranking-page { max-width: 720px; margin: 20px auto; padding: 0 12px; font-family: Roboto, sans-serif; }
.game-scope .ranking-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 10px 0 18px; }
.game-scope .ranking-header-text { flex: 1; min-width: 0; }
.game-scope .ranking-page h1 { font-size: 24px; color: #2c5282; margin: 0 0 4px; font-weight: 700; }
.game-scope .ranking-page .intro { color: #718096; font-size: 14px; margin: 0; }
.game-scope .btn-play-top {
    flex-shrink: 0; display: inline-flex; align-items: center; gap: 8px;
    background: #2c5282; color: white; padding: 11px 20px; border-radius: 8px;
    font-weight: 600; font-size: 15px; text-decoration: none;
    box-shadow: 0 2px 6px rgba(44,82,130,0.25); transition: all .15s;
}
.game-scope .btn-play-top:hover { background: #2a4365; color: white; text-decoration: none; transform: translateY(-1px); box-shadow: 0 4px 10px rgba(44,82,130,0.3); }
.game-scope .btn-play-top .fa { font-size: 13px; }

/* Unified filter bar — mode + timeframe as consistent segmented pills. */
.game-scope .ranking-filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; align-items: center; }
.game-scope .filter-group { display: inline-flex; background: #f1f5f9; border-radius: 8px; padding: 3px; }
.game-scope .filter-group a {
    padding: 7px 16px; font-size: 13px; font-weight: 500; color: #64748b;
    text-decoration: none; border-radius: 6px; transition: all .15s;
}
.game-scope .filter-group a:hover:not(.active) { color: #2c5282; }
.game-scope .filter-group a.active {
    background: white; color: #2c5282;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.game-scope .filter-group.mode a[href*="m=chill"].active { color: #c2410c; }
.game-scope .ranking-table { width: 100%; background: white; border-collapse: collapse; border-radius: 6px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.game-scope .ranking-table th { background: #2c5282; color: white; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; padding: 10px 14px; text-align: left; font-weight: 500; }
.game-scope .ranking-table td { font-size: 15px; padding: 10px 14px; border-bottom: 1px solid #edf2f7; color: #2d3748; }
.game-scope .ranking-table tr:last-child td { border-bottom: none; }
.game-scope .ranking-table .rank { width: 48px; color: #a0aec0; font-weight: 500; }
.game-scope .ranking-table .rank.top1 { color: #dd6b20; font-weight: 700; }
.game-scope .ranking-table .rank.top2 { color: #a0aec0; font-weight: 700; }
.game-scope .ranking-table .rank.top3 { color: #b7791f; font-weight: 700; }
.game-scope .ranking-table .score { text-align: right; font-weight: 600; color: #2c5282; font-size: 17px; font-variant-numeric: tabular-nums; }
.game-scope .ranking-table .games { text-align: right; color: #718096; font-size: 13px; font-variant-numeric: tabular-nums; }
.game-scope .ranking-table .avg { text-align: right; color: #718096; font-size: 13px; font-variant-numeric: tabular-nums; }
.game-scope .ranking-table tr.me td { background: #ebf4ff; font-weight: 500; }
.game-scope .ranking-table tbody tr { cursor: pointer; transition: background-color .12s; }
.game-scope .ranking-table tbody tr:hover td { background: #f7fafc; }
.game-scope .ranking-table tbody tr.me:hover td { background: #dceefb; }

/* Player stats modal — opens on row click. Backdrop is just a darkened
   layer; the modal centers itself via position-fixed + transform so it
   can't be knocked off-center by flex weirdness from parent stylesheets. */
.game-scope .pstats-backdrop {
    position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55);
    display: none; z-index: 9999;
}
.game-scope .pstats-backdrop.show { display: block; }
.game-scope .pstats-modal {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: white; border-radius: 12px;
    width: min(520px, calc(100vw - 32px));
    max-height: 90vh; overflow: auto;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    font-family: Roboto, sans-serif;
    z-index: 10000;
    animation: pstatsIn .18s ease-out;
}
@keyframes pstatsIn {
    from { transform: translate(-50%, calc(-50% + 8px)); opacity: 0; }
    to   { transform: translate(-50%, -50%);             opacity: 1; }
}
.game-scope .pstats-head {
    padding: 18px 20px 14px; border-bottom: 1px solid #edf2f7;
}
.game-scope .pstats-head-top {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.game-scope .pstats-head h3 { margin: 0; color: #2c5282; font-size: 18px; font-weight: 700; word-break: break-word; }

/* In-modal mode toggle: same segmented-pill language as the main filter
   bar so the affordance reads as familiar. Compact width to fit the header. */
.game-scope .pstats-mode-toggle {
    display: inline-flex; margin-top: 10px;
    background: #f1f5f9; border-radius: 8px; padding: 3px;
}
.game-scope .pstats-mode-toggle a {
    padding: 5px 12px; font-size: 12px; font-weight: 500; color: #64748b;
    text-decoration: none; border-radius: 6px; transition: all .15s; cursor: pointer;
}
.game-scope .pstats-mode-toggle a:hover:not(.active) { color: #2c5282; }
.game-scope .pstats-mode-toggle a.active {
    background: white; color: #2c5282;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.game-scope .pstats-mode-toggle a[data-mode="chill"].active { color: #c2410c; }
.game-scope .pstats-close {
    background: none; border: none; font-size: 22px; line-height: 1; color: #a0aec0;
    cursor: pointer; padding: 0 4px; flex-shrink: 0;
}
.game-scope .pstats-close:hover { color: #2d3748; }
.game-scope .pstats-body { padding: 16px 20px 20px; }
.game-scope .pstats-loading { text-align: center; color: #a0aec0; padding: 28px 0; font-size: 14px; }

.game-scope .pstats-summary {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 18px;
}
.game-scope .pstats-cell {
    background: #f8fafc; border-radius: 8px; padding: 10px 8px; text-align: center;
}
.game-scope .pstats-cell .v { font-size: 18px; font-weight: 700; color: #2c5282; font-variant-numeric: tabular-nums; }
.game-scope .pstats-cell .l { font-size: 11px; color: #718096; text-transform: uppercase; letter-spacing: 0.3px; margin-top: 2px; }
.game-scope .pstats-cell.abandoned .v { color: #b91c1c; }
.game-scope .pstats-cell.abandoned.zero .v { color: #a0aec0; }

.game-scope .pstats-section-title {
    font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px;
    color: #718096; font-weight: 600; margin: 4px 0 8px;
    display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
}
.game-scope .pstats-section-title .overall {
    text-transform: none; letter-spacing: 0;
    color: #2c5282; font-weight: 700; font-size: 13px;
}
.game-scope .pstats-section-title .overall small { color: #a0aec0; font-weight: 400; margin-left: 4px; }
.game-scope .pstats-buckets { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.game-scope .pstats-bucket {
    display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center;
    font-size: 14px; color: #2d3748;
}
.game-scope .pstats-bucket .fa { color: #4a5568; font-size: 13px; text-align: center; }
.game-scope .pstats-bucket .bar {
    position: relative; height: 8px; background: #edf2f7; border-radius: 4px; overflow: hidden;
}
.game-scope .pstats-bucket .bar-fill {
    position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #2c5282, #4a90e2);
    border-radius: 4px;
}
.game-scope .pstats-bucket .bucket-label { display: flex; flex-direction: column; gap: 2px; }
.game-scope .pstats-bucket .bucket-label .name { font-size: 13px; }
.game-scope .pstats-bucket .bucket-acc { font-size: 13px; color: #2c5282; font-weight: 600; min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; }
.game-scope .pstats-bucket .bucket-acc small { color: #a0aec0; font-weight: 400; margin-left: 3px; }

.game-scope .pstats-last5 { display: flex; gap: 6px; flex-wrap: wrap; }
.game-scope .pstats-last5 .game {
    flex: 1 1 calc(20% - 6px); min-width: 56px;
    background: #f8fafc; border-radius: 8px; padding: 10px 6px;
    text-align: center; border: 1px solid #edf2f7;
}
.game-scope .pstats-last5 .game .score {
    font-size: 18px; font-weight: 700; color: #2c5282; font-variant-numeric: tabular-nums;
}
.game-scope .pstats-last5 .game.abandoned { background: #fef2f2; border-color: #fecaca; }
.game-scope .pstats-last5 .game.abandoned .score { color: #b91c1c; }
.game-scope .pstats-last5 .game .when {
    font-size: 10.5px; color: #a0aec0; text-transform: uppercase; letter-spacing: 0.3px; margin-top: 2px;
}
.game-scope .pstats-empty { color: #a0aec0; font-size: 13px; text-align: center; padding: 12px 0; }
.game-scope .pstats-error { color: #b91c1c; background: #fee2e2; border-radius: 6px; padding: 12px 14px; font-size: 13px; }

@media (max-width: 480px) {
    .game-scope .pstats-summary { grid-template-columns: repeat(2, 1fr); }
}
.game-scope .guest-pill {
    display: inline-block; margin-left: 6px;
    padding: 1px 7px; border-radius: 10px;
    font-size: 10.5px; font-weight: 600; letter-spacing: 0.3px;
    background: #fef3c7; color: #854d0e;
    vertical-align: 2px;
}
.game-scope .ranking-empty { text-align: center; padding: 40px 20px; color: #a0aec0; background: white; border-radius: 6px; }
.game-scope .my-rank-card { background: #ebf4ff; border-radius: 6px; padding: 14px 18px; margin-top: 16px; font-size: 14px; color: #2c5282; }
.game-scope .btn-back { display: inline-block; color: #718096; padding: 10px 0; font-size: 13px; text-decoration: none; margin-top: 14px; }
.game-scope .btn-back:hover { color: #2c5282; text-decoration: none; }
@media (max-width: 640px) {
    .game-scope .ranking-table .avg { display: none; }
    .game-scope .ranking-header { flex-direction: column; align-items: stretch; }
    .game-scope .btn-play-top { justify-content: center; }
}
