/* Variables y configuración base */
:root {
    --color-primary: #FF6B6B;
    --color-secondary: #4ECDC4;
    --color-accent: #FFE66D;
    --color-background: #F7F9FC;
    --color-text: #2D3436;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background-image: url('../imagenes/fondo.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    min-height: 100vh;
    padding-top: 80px;
}

/* Menú principal */
.menu-principal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    padding: 15px 0;
    box-shadow: var(--shadow-md);
    z-index: 1000;
}

.logo h1 {
    color: white;
    font-size: 24px;
    text-align: center;
    font-family: 'Comic Sans MS', cursive;
}

/* Contenedor de juegos */
.juegos-container {
    max-width: 1100px;
    margin: 40px auto;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

/* Tarjetas de juego */
.juego-card {
    background: white;
    border-radius: 12px;
    padding: 10px;
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.juego-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.juego-icon {
    font-size: 48px;
}

.juego-buttons {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

/* Pantallas del juego */
.pantalla {
    display: none;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Área de juego */
#juego-principal {
    background: rgb(235, 207, 207);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
}

.juego-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* Pista e imagen */
.pista-container {
    text-align: center;
    margin: 20px 0;
}

.pista-container img {
    max-width: 200px;
    height: auto;
    border-radius: 8px;
    margin-bottom: 10px;
}

/* Contenedores de letras */
.palabra-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.letras-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

/* Letras y espacios */
.letra {
    width: 50px;
    height: 50px;
    background: var(--color-accent);
    border: 2px solid #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    font-weight: bold;
    cursor: move;
    user-select: none;
}

.espacio-letra {
    width: 50px;
    height: 50px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
}

/* Puntuación */
.puntuacion-container {
    background: white;
    padding: 15px 25px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-around;
    margin: 20px auto;
    max-width: 400px;
}

.puntos, .estadisticas {
    font-size: 1.2em;
    font-weight: 600;
}

/* Botones */
.btn-jugar, .btn-instrucciones {
    padding: 10px 25px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    min-width: 120px;
}

.btn-jugar {
    background: var(--color-primary);
    color: white;
    text-decoration: none;
    font-size: 16px;
}

.btn-instrucciones {
    background: var(--color-accent);
    color: var(--color-text);
}

.btn-volver {
    background: var(--color-secondary);
    color: rgb(12, 12, 12);
    padding: 8px 20px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    display: block;
    margin: 20px auto;
}

/* Estados */
.letra.seleccionada {
    opacity: 0.5;
    cursor: not-allowed;
}

.espacio-letra.hover {
    border-color: var(--color-secondary);
    border-style: solid;
}

/* Responsive */
@media (max-width: 768px) {
    .juegos-container {
        grid-template-columns: 1fr;
    }

    .juego-buttons {
        flex-direction: column;
        width: 100%;
    }

    .btn-jugar, .btn-instrucciones {
        width: 100%;
        
    }

    .letra, .espacio-letra {
        width: 40px;
        height: 40px;
        font-size: 1.2em;
    }

    .puntuacion-container {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
}

/* Selección de nivel */
.nivel-container, .categoria-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;
    text-align: center;
}

.niveles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.btn-nivel {
    background: rgb(91, 212, 208);
    padding: 30px;
    border: none;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform 0.2s;
    
}

.btn-nivel:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.nivel-descripcion {
    display: block;
    font-size: 0.9em;
    color: #0a0a0a;
    margin-top: 5px;
}

/* Categorías */
.categorias-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.categoria-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform 0.2s;
}

.categoria-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.categoria-icon {
    font-size: 2em;
    margin-bottom: 10px;
}

/* Modal de instrucciones */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.modal-contenido {
    background-color: white;
    padding: 25px;
    border-radius: 15px;
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.modal-header h2 {
    margin: 0;
    color: var(--color-primary);
    font-size: 1.8em;
}

.cerrar-modal {
    font-size: 28px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    transition: color 0.3s ease;
    padding: 5px 10px;
}

.cerrar-modal:hover {
    color: var(--color-primary);
}

.modal-body {
    margin-bottom: 20px;
}

.instrucciones p {
    margin-bottom: 15px;
    line-height: 1.6;
    font-size: 1.1em;
    color: #333;
}

.modal-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.btn-continuar {
    background-color: var(--color-primary);
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-continuar:hover {
    background-color: var(--color-secondary);
    transform: translateY(-2px);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 480px) {
    .modal-contenido {
        width: 95%;
        padding: 20px;
    }

    .modal-header h2 {
        font-size: 1.5em;
    }

    .instrucciones p {
        font-size: 1em;
    }

    .btn-continuar {
        width: 100%;
        padding: 15px;
    }
}

/* Modal de logros */
#logro-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.insignias-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.insignia-modal {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 12px;
}

.insignia-icono {
    font-size: 2em;
    margin-bottom: 10px;
}

/* Ajustes responsive para modales */
@media (max-width: 768px) {
    .insignias-grid {
        grid-template-columns: 1fr;
    }
}

/* Script para cerrar modal al hacer clic fuera */
.modal-instrucciones, #logro-modal {
    cursor: pointer;
}

.modal-contenido {
    cursor: default;
}

.espacio-letra {
    cursor: pointer;
    transition: background-color 0.2s;
}

.espacio-letra:hover {
    background-color: #f0f0f0;
}

.espacio-letra:active {
    background-color: #e0e0e0;
}

/* Indicador visual de que se puede hacer clic */
.espacio-letra:not(:empty)::after {
    content: '×';
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--color-primary);
    color: white;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    font-size: 12px;
    line-height: 16px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.espacio-letra:not(:empty):hover::after {
    opacity: 1;
}

/* Estilos para las notificaciones */
.notificacion {
    position: fixed;
    top: 100px; /* Cambiado para que aparezca más abajo del header */
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 30px;
    border-radius: 25px;
    color: white;
    font-weight: bold;
    z-index: 1000;
    animation: slideIn 0.5s ease-out;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.notificacion.exito {
    background-color: #4CAF50;
}

.notificacion.error {
    background-color: #f44336;
}

.notificacion.fadeOut {
    animation: fadeOut 0.3s ease-out forwards;
}

@keyframes slideIn {
    from {
        top: -100px;
        opacity: 0;
    }
    to {
        top: 100px;
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
}