/* --- BASE COMÚN (Todos los modos) --- */
body {
    margin: 0;
    padding: 0;
    background-image: url('../imagen/fondo_pokemon.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    min-height: 100vh;
    font-family: Arial, sans-serif;
    color: white;
    text-align: center;
    padding: 0 10px;
}

/* --- BLOQUEO DE SCROLL EN EL INDEX --- */
/* Se aplica cuando el body no tiene un modo de juego definido o es 'home' */
body:not([data-mode]), body[data-mode="home"] {
    overflow: hidden;
    height: 100vh;
}

h1 {
    font-size: clamp(1.8rem, 5vw, 3rem);
    margin-bottom: clamp(10px, 3vh, 20px);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

/* --- CONTENEDOR DE IMAGEN (Adaptativo) --- */
#pokemon-img-container {
    width: clamp(150px, 40vw, 200px);
    height: clamp(150px, 40vw, 200px);
    margin: 20px auto;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 15px;
    border: 3px solid #ffcb05;
}

#pokemon-img {
    max-width: 90%;
    max-height: 90%;
    display: none; 
}

body[data-mode="sprite"] #pokemon-img {
    display: block;
    image-rendering: pixelated;
}

/* --- FORMULARIO E INPUTS --- */
input#pokemon-input {
    padding: 12px;
    width: clamp(200px, 90%, 250px);
    border-radius: 8px;
    border: none;
    font-size: 1rem;
    box-sizing: border-box;
}

button {
    padding: 12px 25px;
    font-size: 1em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    margin: 5px;
}

#submit-btn {
    background-color: #28a745;
    color: white;
}

button:not(#submit-btn) {
    background-color: #ffcb05;
    color: #2d2d2d;
}

button:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

/* --- AUTOCOMPLETE --- */
#suggestions {
    margin: 0 auto;
    max-height: 150px;
    overflow-y: auto;
    width: clamp(200px, 90%, 250px);
    background-color: rgba(0, 0, 0, 0.9);
    border-radius: 0 0 8px 8px;
    text-align: left;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
}

#suggestions div {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #333;
}

#suggestions div:hover {
    background-color: #444;
}

/* --- MODO INDEX (Home) --- */
.button-container {
    display: flex;
    flex-direction: column;
    gap: clamp(10px, 3vh, 20px);
    align-items: center;
    margin-top: clamp(20px, 8vh, 50px);
    width: 100%;
}

.game-button {
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Ajuste para teléfonos: ocupa el 95% del ancho, máximo 400px en escritorio */
    width: clamp(280px, 95%, 400px);
    /* Botones más altos para facilitar el toque táctil */
    padding: clamp(16px, 4.5vw, 22px);
    background-color: #ffcb05;
    color: #2d2d2d;
    border-radius: 12px;
    font-weight: bold;
    /* Fuente que crece según la pantalla */
    font-size: clamp(1.1rem, 4.5vw, 1.35rem);
    transition: 0.3s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    box-sizing: border-box;
}

.game-button:hover {
    transform: scale(1.03);
    filter: brightness(1.1);
}

.game-button:active {
    transform: scale(0.97); /* Efecto de clic en móvil */
}

/* --- TABLA DE ATRIBUTOS (Modos Classic/Infinite) --- */
#attribute-labels, .attempt-row {
    display: grid;
    grid-template-columns: repeat(8, clamp(80px, 15vw, 110px));
    justify-content: start;
    gap: 8px;
    margin-top: 10px;
    margin-left: auto;
    margin-right: auto;
    width: fit-content; /* Obliga al contenedor a ajustarse al tamaño de las columnas */
    justify-content: center;
}

.attribute {
    padding: clamp(5px, 2vh, 15px) 5px;
    background-color: rgba(255,255,255,0.1);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    word-break: break-word;
    font-size: clamp(0.7em, 2vw, 0.85em);
}

/* --- MODO DESCRIPCIÓN --- */
#description-box {
    background: rgba(0,0,0,0.6);
    padding: clamp(10px, 4vw, 20px);
    border-radius: 10px;
    width: clamp(280px, 95%, 600px);
    margin: 20px auto;
    border-left: 5px solid #ffcb05;
    box-sizing: border-box;
    font-size: clamp(0.9rem, 3.5vw, 1.1rem);
}

/* --- AJUSTE ESPECIAL PARA MÓVILES (Scroll en la tabla) --- */
@media (max-width: 900px) {
    #attribute-labels, .attempt-row {
        justify-content: start;
        overflow-x: auto;
        padding-bottom: 10px;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Ocultar barra de scroll estética */
    #attribute-labels::-webkit-scrollbar, 
    .attempt-row::-webkit-scrollbar {
        display: none;
    }
}