* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Courier New', Courier, monospace;
}

body {
    background-color: #2b2b2b;
    color: #333;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.container {
    width: 94vw;
    margin: 0 auto;
    background-color: #f0f0f0;
    box-shadow: 0 0 1.56vw rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.history-section {
    background-color: #cc0000;
    color: #fff;
    padding: 2.5vh 2vw;
    border-bottom: 0.6vh solid #8b0000;
    flex-shrink: 0;
}

.history-section h1 {
    font-size: 5vw;
    margin-bottom: 1.2vh;
    text-transform: uppercase;
    letter-spacing: 0.15vw;
}

.history-section p {
    font-size: 2.5vw;
    line-height: 1.6;
}

.pokemon-list {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 0.8vw;
    padding: 2.5vh 1.5vw;
    background-color: #dcdcdc;
    overflow-y: auto;
    flex: 1;
    align-content: start;
}

.list-btn {
    background-color: #fff;
    border: 0.15vw solid #999;
    border-radius: 0.3vw;
    padding: 1.4vh 0.4vw;
    cursor: pointer;
    font-weight: bold;
    font-size: 2.3vw;
    transition: all 0.2s;
}

.list-btn:hover {
    background-color: #ffcc00;
    border-color: #cc9900;
    transform: scale(1.05);
}

.pokemon-list::-webkit-scrollbar {
    width: 0.6vw;
}
.pokemon-list::-webkit-scrollbar-track {
    background: #c0c0c0;
}
.pokemon-list::-webkit-scrollbar-thumb {
    background-color: #666;
    border-radius: 0.3vw;
}

/* ================= MODAL DE RESPONSIVIDADE ESTRUTURAL ABSOLUTA ================= */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.pokedex-card {
    background-image: url('../assets/pokedex-modal.png');
    
    /* Forçamos a imagem a cobrir 100% do bloco. 
       Isso funciona perfeitamente pois o bloco terá a mesma proporção da imagem.
    */
    background-size: 100% 100%; 
    background-repeat: no-repeat;
    background-position: center;
    background-color: transparent;
    
    /* Engenharia Central: 
       A largura nunca passará de 90vw (para não vazar nas laterais de celulares).
       A altura nunca passará de 85vh (para não vazar no topo/rodapé).
       As contas (380/560) cravam o aspect-ratio original independente da tela.
    */
    width: min(90vw, 85vh * (380 / 560));
    height: min(90vw * (560 / 380), 85vh);
    
    position: relative;
    user-select: none;
    overflow: hidden;
}

/* Tela Superior (Imagem do Pokémon) */
.image-container {
    position: absolute;
    top: 10.71%; 
    left: 50%;
    transform: translateX(-50%);
    width: 53.68%; 
    height: 32.85%; 
    background-color: #1a1a1a;
    border-radius: min(1.5vh, 2vw);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.image-container img {
    height: 90%;
    width: 90%;
    object-fit: contain;
    image-rendering: pixelated;
}

/* Tela Inferior (Informações do Pokémon) */
.pokemon-info {
    position: absolute;
    top: 46.42%;
    left: 50%;
    transform: translateX(-50%);
    width: 53.68%; 
    height: 31.07%; 
    background-color: #1a1a1a;
    color: #4af626;
    padding: min(1.5vh, 2.5vw);
    border-radius: min(1.5vh, 2vw);
    
    /* A fonte se ajusta dependendo de qual métrica é o gargalo da tela */
    font-size: min(1.6vh, 3.2vw); 
    
    overflow-y: auto;
    text-align: left;
}

.pokemon-info h2 {
    font-size: min(2vh, 4vw);
    margin-bottom: 0.8vh;
    border-bottom: 0.15vh solid #4af626;
    padding-bottom: 0.3vh;
    color: #4af626;
}

.pokemon-info p {
    margin-bottom: 0.6vh;
}

/* Scrollbar interno da tela de texto */
.pokemon-info::-webkit-scrollbar {
    width: min(0.4vh, 1vw);
}
.pokemon-info::-webkit-scrollbar-track {
    background: #1a1a1a;
}
.pokemon-info::-webkit-scrollbar-thumb {
    background-color: #4af626;
    border-radius: 0.2vh;
}

/* Área de Controle dos Botões Físicos */
.nav-controls {
    position: absolute;
    bottom: 8.92%;
    left: 50%;
    transform: translateX(-50%);
    width: 53.68%; 
    height: 11.07%; 
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Botões invisíveis mapeados */
.nav-btn {
    background-color: rgba(0, 0, 0, 0);
    border: none;
    cursor: pointer;
    transition: background-color 0.1s ease;
}

.nav-btn.prev {
    width: 26.47%; 
    height: 80.64%; 
    border-radius: min(1.5vh, 2vw);
}

.nav-btn.close {
    width: 30.39%; 
    height: 100%;
    border-radius: 50%;
}

.nav-btn.next {
    width: 26.47%;
    height: 80.64%;
    border-radius: min(1.5vh, 2vw);
}

.nav-btn:active {
    background-color: rgba(255, 255, 255, 0.2);
}

.nav-btn:disabled {
    cursor: not-allowed;
    background-color: rgba(0, 0, 0, 0.4);
}

/* ================= TRAVA DE ORIENTAÇÃO PARA MODO PAISAGEM ================= */
@media (orientation: landscape) {
    .modal-overlay::after {
        content: "A Pokédex opera nativamente em modo Retrato (Portrait). Rotacione o dispositivo.";
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background-color: #2b2b2b;
        color: #4af626;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 3vw;
        font-weight: bold;
        text-align: center;
        padding: 4vw;
        z-index: 2000;
        font-family: 'Courier New', Courier, monospace;
    }
    
    /* Esconde a pokédex fisicamente enquanto em paisagem para não haver interações perdidas */
    .pokedex-card {
        display: none;
    }
}
