//* =========================================
   ESTILOS MINIJUEGOS (Actualizado)
   ========================================= */

/* --- HUB DE MINIJUEGOS --- */
.minigames-hub {
    display: flex;
    gap: 30px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 50px;
}

.game-select-card {
    background-color: var(--component-bg);
    border: 1px solid #444;
    border-radius: 15px;
    width: 300px;
    padding: 30px;
    text-align: center;
    text-decoration: none;
    color: var(--primary-text-color);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-select-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    border-color: var(--accent-color);
}

.game-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.game-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #FFDE00;
    margin-bottom: 10px;
}

/* =========================================
   VOLTORB FLIP (DISEÑO MEJORADO)
   ========================================= */
.voltorb-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.game-container {
    background-color: var(--component-bg);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    border: 4px solid #444;
    text-align: center;
    position: relative;
    max-width: 650px; /* Aumentado para acomodar el tablero más grande */
    width: 100%;
}

.game-container h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: #f1c40f;
    text-shadow: 2px 2px 0px #c0392b;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Toolbar */
.toolbar {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 15px;
}

.tool {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 15px;
    background: #333;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    min-width: 70px;
}

.tool.active {
    background: #f1c40f;
    border-color: #f39c12;
    transform: scale(1.05);
}

.tool.active .icon, .tool.active .label {
    color: #2c3e50;
    font-weight: bold;
}

.icon { font-size: 1.6rem; margin-bottom: 2px; }
.label { font-size: 0.8rem; text-transform: uppercase; color: #ccc; }

/* Grid - TABLERO MÁS GRANDE */
.grid {
    display: grid;
    /* Aumentado de 60px a 75px */
    grid-template-columns: repeat(6, 75px);
    grid-template-rows: repeat(6, 75px);
    gap: 10px; /* Un poco más de espacio entre casillas */
    background-color: #1a1a1a; /* Fondo un poco más oscuro */
    padding: 20px;
    border-radius: 15px;
    margin: 0 auto 20px auto;
    width: fit-content;
}

/* Casillas */
.cell {
    width: 75px;  /* Aumentado */
    height: 75px; /* Aumentado */
    /* VERDE MÁS OSCURO */
    background: linear-gradient(145deg, #196f3d, #145a32); 
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    font-size: 28px; /* Texto más grande */
    position: relative;
    transition: all 0.2s ease;
    box-shadow: 0 5px #0b5345; /* Sombra más oscura */
    color: white;
}

.cell:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.cell:active {
    transform: translateY(2px);
    box-shadow: 0 2px #0b5345;
}

/* Casilla Revelada */
.cell.revealed {
    background: #ecf0f1;
    color: #2c3e50;
    cursor: default;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
    transform: none;
}

/* Imagen de Voltorb */
.cell.voltorb {
    background-image: url('/img/voltorb.png');
    background-size: 80%;
    background-repeat: no-repeat;
    background-position: center;
    background-color: #c0392b; /* Rojo oscuro para la explosión */
    color: transparent; 
}

/* Marcas */
.cell[data-mark="💣"]::after {
    content: "";
    position: absolute;
    top: 4px; right: 4px;
    width: 20px; height: 20px;
    background-image: url('/img/voltorb.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 3px;
    z-index: 20;
}

.cell[data-mark]:not([data-mark="💣"])::after {
    content: attr(data-mark);
    position: absolute;
    top: 4px; right: 4px;
    font-size: 14px;
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 2px 5px;
    border-radius: 3px;
}

/* Pistas (Hints) - AHORA EN ROJO */
.cell.hint {
    /* Gradiente Rojo */
    background: linear-gradient(145deg, #c0392b, #922b21);
    box-shadow: 0 5px #641e16; /* Sombra roja oscura */
    cursor: default;
    flex-direction: column;
    font-size: 16px;
    color: #fff;
}

.cell.hint:hover { transform: none; filter: none; }

.cell.hint hr { width: 80%; border: 0.5px solid rgba(255,255,255,0.4); margin: 4px 0; }

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4); /* Fondo oscuro semi-transparente */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.3s ease;
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    background: #2c3e50;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    max-width: 500px;
    border: 3px solid #e74c3c;
    color: white;
}

.overlay-content h2 {
    margin-top: 0;
    color: #ffcb05; /* Color amarillo Pokémon */
}

.overlay-content p {
    line-height: 1.6;
    margin-bottom: 20px;
}

#status {
    background: rgba(0,0,0,0.3);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    color: white;
    font-size: 1.1rem;
}
.hidden { display: none !important; }


/* =========================================
   GUESS THE POKEMON (Estilos preservados)
   ========================================= */

.guess-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.game-card {
    background: var(--component-bg);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    text-align: center;
    width: 380px;
    color: var(--primary-text-color);
    border: 1px solid #444;
}

.game-card h1 {
    color: #FFDE00;
    margin-bottom: 20px;
}

/* Fondo GRIS OSCURO para ver mejor Pokémon blancos */
#image-container {
    width: 250px;
    height: 250px;
    margin: 20px auto;
    background: radial-gradient(circle, #777777 0%, #333333 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 8px solid #222;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
}

#image-container::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 8px;
    background-color: rgba(0,0,0,0.1);
    top: 50%;
    transform: translateY(-50%);
    z-index: 0;
    pointer-events: none;
}

#pokemon-img {
    width: 90%;
    height: 90%;
    image-rendering: pixelated; 
    transition: all 0.3s ease;
    z-index: 1;
}

#pokemon-img.hidden { display: none; }

.pixel-level-5 { filter: blur(25px) brightness(0); width: 100%; }
.pixel-level-4 { filter: blur(15px); width: 100%; }
.pixel-level-3 { filter: blur(8px); width: 100%; }
.pixel-level-2 { filter: blur(4px); width: 100%; }
.pixel-level-1 { filter: blur(0px); width: 100%; }

.game-card input {
    padding: 12px;
    width: 80%;
    margin-bottom: 15px;
    background-color: #333;
    border: 1px solid #555;
    color: white;
    border-radius: 5px;
}

.game-card input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.button-group {
    margin-top: 15px;
    min-height: 40px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.guess-btn {
    padding: 10px 25px;
    background-color: #3b4cca;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 20px;
    font-weight: bold;
    text-transform: uppercase;
    transition: 0.2s;
}

.guess-btn:hover { background-color: #2a3a8a; }

.reset-btn {
    padding: 10px 25px;
    background-color: #d32f2f;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 20px;
    font-weight: bold;
    text-transform: uppercase;
    transition: 0.2s;
}

.reset-btn:hover { background-color: #b71c1c; }


/* =========================================
   AJUSTES GLOBALES
   ========================================= */

/* Contenedor del botón volver alineado al centro */
.back-btn-container {
    width: 100%;
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
    box-sizing: border-box;
    display: flex;
    justify-content: flex-start;
}

/* =========================================
   OPTIMIZACIÓN MÓVIL (MINIJUEGOS)
   ========================================= */

@media (max-width: 600px) {
    /* HUB DE JUEGOS */
    .minigames-hub {
        flex-direction: column;
        align-items: center;
    }
    
    .game-select-card {
        width: 100%;
        max-width: 320px;
    }

    /* VOLTORB FLIP - RESPONSIVE */
    .game-container {
        padding: 15px;
        width: 100%;
    }

    .game-container h1 {
        font-size: 1.8rem; /* Título más pequeño */
    }

    /* Hacemos el grid flexible */
    .grid {
        grid-template-columns: repeat(6, 1fr); /* 6 columnas iguales */
        grid-template-rows: repeat(6, 1fr);
        gap: 4px; /* Menos hueco */
        padding: 10px;
        width: 100%; /* Ocupa todo el ancho */
        height: auto;
        aspect-ratio: 1 / 1; /* Mantiene proporción cuadrada */
    }

    .cell {
        width: auto; /* Que se adapte */
        height: auto;
        aspect-ratio: 1 / 1; /* Celdas cuadradas */
        font-size: 1.2rem; /* Número más pequeño */
        border-radius: 4px;
    }

    /* Toolbar más compacta */
    .toolbar {
        gap: 10px;
        flex-wrap: wrap;
    }
    
    .tool {
        min-width: 50px;
        padding: 8px;
    }
    
    .icon { font-size: 1.2rem; }
    .label { display: none; } /* Ocultamos texto en móvil */
}


/* =========================================
   OPTIMIZACIÓN MÓVIL (MINIJUEGOS)
   ========================================= */

@media (max-width: 768px) {
    /* 1. HUB DE JUEGOS: Apilar las tarjetas una encima de otra */
    .minigames-hub {
        flex-direction: column;
        align-items: center;
        margin-top: 30px;
    }

    .game-select-card {
        width: 100%;
        max-width: 340px; /* Un poco más ancho para aprovechar pantalla */
    }

    /* 2. VOLTORB FLIP: Tablero Flexible */
    .game-container {
        padding: 15px; /* Menos relleno para ganar espacio */
        width: 100%;
        max-width: 100%;
        border-width: 2px; /* Borde más fino */
    }

    .game-container h1 {
        font-size: 1.8rem; /* Título más pequeño */
        margin-bottom: 15px;
    }

    /* EL GRID: Cambiamos píxeles fijos por fracciones (fr) */
    .grid {
        grid-template-columns: repeat(6, 1fr); /* 6 columnas flexibles */
        grid-template-rows: repeat(6, 1fr);
        gap: 4px; /* Hueco más pequeño entre casillas */
        padding: 10px;
        width: 100%; /* Ocupa todo el ancho disponible */
        box-sizing: border-box;
    }

    /* LAS CASILLAS: Se adaptan al hueco */
    .cell {
        width: auto; 
        height: auto;
        aspect-ratio: 1 / 1; /* Mantiene la forma cuadrada siempre */
        font-size: 1.1rem; /* Números más pequeños */
        border-radius: 4px;
    }

    /* TOOLBAR: Herramientas más compactas */
    .toolbar {
        flex-wrap: wrap; /* Si no caben, bajan de línea */
        gap: 10px;
        padding: 10px;
    }

    .tool {
        min-width: 50px;
        padding: 8px 5px;
    }

    .tool .icon { font-size: 1.3rem; }
    .tool .label { font-size: 0.7rem; } /* Texto pequeñito */
}

/* =========================================
   OPTIMIZACIÓN PARA MÓVILES (MINIJUEGOS)
   ========================================= */

@media (max-width: 768px) {
    /* --- 1. VOLTORB FLIP --- */
    .game-container {
        padding: 10px;
        width: 100%;
        max-width: 100%; /* Aprovechar toda la pantalla */
        border-width: 2px;
    }

    .game-container h1 {
        font-size: 1.5rem; /* Título más pequeño */
        margin-bottom: 10px;
    }

    /* Tablero Flexible: Cambiamos px fijos por fracciones */
    .grid {
        display: grid;
        grid-template-columns: repeat(6, 1fr); /* 6 columnas flexibles */
        grid-template-rows: repeat(6, 1fr);
        gap: 3px; /* Hueco pequeñito */
        padding: 5px;
        width: 100%; /* Ancho total */
        height: auto; /* Altura automática */
        box-sizing: border-box;
    }

    /* Casillas que se encogen */
    .cell {
        width: auto;
        height: auto;
        aspect-ratio: 1 / 1; /* Mantiene la forma cuadrada siempre */
        font-size: 1rem; /* Números más pequeños */
        border-radius: 4px;
    }

    /* Barra de herramientas adaptable */
    .toolbar {
        flex-wrap: wrap; /* Si no caben, bajan de línea */
        gap: 5px;
        padding: 8px;
    }
    .tool {
        min-width: 45px;
        padding: 5px;
    }
    .tool .icon { font-size: 1.2rem; }
    .tool .label { display: none; } /* Ocultamos texto en móvil para ganar espacio */

    /* --- 2. ADIVINA POKÉMON --- */
    .game-card {
        width: 95%; /* Ocupa el 95% de la pantalla, no 380px fijos */
        padding: 1rem; /* Menos relleno */
        margin: 0 auto;
    }

    #image-container {
        width: 200px; /* Imagen un poco más pequeña */
        height: 200px;
        margin: 15px auto;
    }
}
