/* Publicidades Fusco - Ranking 2026 (Versão Full Scroll Corrigida) */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.ranking-screen {
    font-family: 'Montserrat', sans-serif;
    background-color: #1a1a1a;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* Impede o scroll na página inteira, queremos apenas na lista */
}

.canvas-1080-1920 {
    container-type: inline-size;
    width: 95vw;
    /* IMPORTANTE: Altura fixa para permitir que o scroll interno funcione */
    height: 95vh; 
    max-width: 1080px;
    max-height: 1920px;
    aspect-ratio: 1080 / 1920;
    background-color: #0B0E41; /* Vermelho Fusco */
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
    border-radius: 15px;
    position: relative;
}

.container-ranking {
    padding: 6% 6% 4% 6%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden; 
}

.ranking-header {
    text-align: center;
    color: white;
    margin-bottom: 25px;
    flex-shrink: 0; /* Impede que o topo suma ou diminua */
}

.ranking-logo {
    width: 25cqw;
    max-width: 220px;
    margin-bottom: 15px;
}

.subtitle {
    font-size: clamp(0.9rem, 3cqw, 1.8rem);
    letter-spacing: 5px;
    opacity: 0.9;
    text-transform: uppercase;
}

.main-title {
    font-size: clamp(2rem, 8cqw, 4rem);
    font-weight: 900;
}

/* LISTA DE RANKING - AQUI ACONTECE A MÁGICA */
.leaderboard {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    
    /* Ativa a rolagem interna */
    overflow-y: auto; 
    padding-right: 12px; 
    
    /* Fix para Firefox/Chrome: garante que o container não cresça além do pai */
    min-height: 0; 
    
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* ESTILIZAÇÃO DA BARRA DE ROLAGEM */
.leaderboard::-webkit-scrollbar {
    width: 10px;
}

.leaderboard::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
}

.leaderboard::-webkit-scrollbar-thumb {
    background: #ffffff;
    border-radius: 10px;
    border: 2px solid #ed5540;
}

/* LINHA DE RANKING (CARD BLACK) */
.ranking-row {
    background: #000000;
    color: white;
    display: flex;
    align-items: center;
    padding: clamp(15px, 2.5cqw, 25px);
    border-radius: 15px;
    border-left: 8px solid white;
    
    /* CRÍTICO: Impede que os cards encolham para tentar caber na tela. 
       Isso força a barra de rolagem a aparecer quando houver muitos jogadores. */
    flex-shrink: 0; 
}

/* DESTAQUES DO PÓDIO */
.gold { border-left-color: #FFD700; background: linear-gradient(90deg, #000 75%, #4a3d00); }
.silver { border-left-color: #C0C0C0; background: linear-gradient(90deg, #000 75%, #2b2b2b); }
.bronze { border-left-color: #CD7F32; background: linear-gradient(90deg, #000 75%, #3d2510); }

.position {
    font-size: clamp(1.2rem, 4cqw, 2.5rem);
    font-weight: 900;
    width: clamp(50px, 8cqw, 75px);
    color: #ed5540;
}

.gold .position { color: #FFD700; }

.player-name {
    flex-grow: 1;
    font-size: clamp(0.9rem, 3cqw, 1.8rem);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 15px;
}

.player-stats {
    text-align: right;
    display: flex;
    flex-direction: column;
}

.time {
    font-size: clamp(1.2rem, 3.5cqw, 2.2rem);
    font-weight: 900;
    color: #fff;
}

.moves {
    font-size: clamp(0.7rem, 1.8cqw, 1.1rem);
    opacity: 0.7;
}

/* RODAPÉ */
.ranking-footer {
    text-align: center;
    color: white;
    padding-top: 20px;
    flex-shrink: 0; /* Impede o rodapé de sumir em telas menores */
}

.ranking-footer p {
    font-size: clamp(0.6rem, 2cqw, 0.9rem);
    margin-bottom: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 700;
}

.btn-back {
    background: white;
    color: #ed5540;
    border: none;
    padding: clamp(12px, 2vh, 20px) clamp(30px, 5cqw, 60px);
    border-radius: 50px;
    font-weight: 900;
    font-size: clamp(1rem, 3cqw, 1.4rem);
    cursor: pointer;
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
    transition: 0.3s;
}

.btn-back:active {
    transform: scale(0.95);
}

.no-data {
    text-align: center;
    color: white;
    font-style: italic;
    margin-top: 50px;
    font-size: 1.2rem;
}

/* Ajuste específico para Laptops/Monitores */
@media (max-aspect-ratio: 9/16) {
    .canvas-1080-1920 {
        height: 96vh;
        width: auto;
    }
}