/* Configuración General */
body {
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #e0f7fa, #fff9c4);
    font-family: 'Comic Sans MS', 'Chalkboard SE', 'Arial', sans-serif;
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

header {
    text-align: center;
    padding: 30px 20px;
}

header h1 {
    font-size: 2.8rem;
    color: #ff5722;
    text-shadow: 2px 2px #ffe082;
    margin-bottom: 10px;
}

header p {
    font-size: 1.2rem;
    color: #555;
    max-width: 700px;
}

/* Contenedor de las Tarjetas */
.contenedor-animales {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 1200px;
    padding: 20px;
    margin-bottom: 20px;
}

/* Tarjetas Interactivas */
.tarjeta-animal {
    background: rgba(255, 255, 255, 0.85);
    border: 4px solid #fff;
    border-radius: 25px;
    padding: 20px;
    width: 200px;
    text-align: center;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s;
}

/* Efecto Hover */
.tarjeta-animal:hover {
    transform: scale(1.08) rotate(1.5deg);
    box-shadow: 0 15px 25px rgba(0,0,0,0.15);
    background: #ffffff;
}

/* Colores de bordes dinámicos al pasar el cursor */
.tarjeta-animal:nth-child(1):hover { border-color: #ffb74d; } /* León */
.tarjeta-animal:nth-child(2):hover { border-color: #4fc3f7; } /* Elefante */
.tarjeta-animal:nth-child(3):hover { border-color: #aed581; } /* Mono */
.tarjeta-animal:nth-child(4):hover { border-color: #81c784; } /* Rana */
.tarjeta-animal:nth-child(5):hover { border-color: #ff7043; } /* Perro */
.tarjeta-animal:nth-child(6):hover { border-color: #ba68c8; } /* Gato */
.tarjeta-animal:nth-child(7):hover { border-color: #fff176; } /* Pato */
.tarjeta-animal:nth-child(8):hover { border-color: #4db6ac; } /* Delfín */
.tarjeta-animal:nth-child(9):hover { border-color: #b0bec5; } /* Koala */
.tarjeta-animal:nth-child(10):hover { border-color: #ffd54f; } /* Guepardo */
.tarjeta-animal:nth-child(11):hover { border-color: #bcaaa4; } /* Erizo */
.tarjeta-animal:nth-child(12):hover { border-color: #7986cb; } /* Búho */
.tarjeta-animal:nth-child(13):hover { border-color: #00acc1; } /* Tiburón */
.tarjeta-animal:nth-child(14):hover { border-color: #f06292; } /* Pulpo */
.tarjeta-animal:nth-child(15):hover { border-color: #29b6f6; } /* Ballena */
.tarjeta-animal:nth-child(16):hover { border-color: #78909c; } /* Araña */
.tarjeta-animal:nth-child(17):hover { border-color: #d4e157; } /* Escorpión */
.tarjeta-animal:nth-child(18):hover { border-color: #fdd835; } /* Abeja */
.tarjeta-animal:nth-child(19):hover { border-color: #f48fb1; } /* Mariposa */
.tarjeta-animal:nth-child(20):hover { border-color: #a1887f; } /* Hormiga */

.icono {
    font-size: 4.2rem;
    margin-bottom: 5px;
    animation: flotar 3s ease-in-out infinite alternate;
}

.tarjeta-animal h2 {
    margin: 10px 0 2px 0;
    color: #2c3e50;
    font-size: 1.5rem;
}

.tipo {
    font-size: 0.9rem;
    color: #ff5722;
    font-weight: bold;
    margin: 0 0 10px 0;
}

.habitat {
    font-size: 0.85rem;
    color: #555;
    background: #f1f8e9;
    padding: 6px 10px;
    border-radius: 15px;
    margin: 5px 0 0 0;
    font-weight: bold;
}

.habitat span {
    font-weight: normal;
    color: #2e7d32;
}

/* Animación de flotado */
@keyframes flotar {
    0% { transform: translateY(0); }
    100% { transform: translateY(-6px); }
}

/* === ESTILOS DEL QUIZ === */
.contenedor-quiz {
    background: rgba(255, 255, 255, 0.9);
    border: 5px dashed #4fc3f7;
    border-radius: 25px;
    padding: 30px;
    text-align: center;
    max-width: 600px;
    width: 90%;
    margin: 0 auto 50px auto;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.contenedor-quiz h2 {
    color: #29b6f6;
    font-size: 2.2rem;
    margin-top: 0;
}

#pregunta-quiz {
    font-size: 1.3rem;
    color: #ff5722;
    font-weight: bold;
    margin-bottom: 25px;
    font-style: italic;
}

.cuadricula-opciones {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.boton-opcion {
    background: #fff9c4;
    border: 3px solid #fbc02d;
    border-radius: 15px;
    padding: 15px;
    font-size: 1.2rem;
    font-family: inherit;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
}

.boton-opcion:hover {
    background: #fff59d;
    transform: scale(1.05);
}

.boton-opcion.incorrecto {
    background: #ffcdd2;
    border-color: #ef5350;
    animation: temblar 0.4s;
}

.boton-opcion.correcto {
    background: #c8e6c9;
    border-color: #66bb6a;
}

@keyframes temblar {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}

#mensaje-quiz {
    font-size: 1.2rem;
    font-weight: bold;
    margin-top: 20px;
    min-height: 25px;
    color: #ef5350;
}

/* Ventanas Emergentes (Modales) */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.contenido-modal {
    background: white;
    padding: 30px;
    border-radius: 30px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    border: 6px solid #ffca28;
}

#modal-icono {
    font-size: 5rem;
    margin-bottom: 10px;
}

#modal-titulo {
    font-size: 2.2rem;
    margin: 5px 0;
    color: #ff5722;
}

#modal-habitat {
    font-size: 1.1rem;
    font-weight: bold;
    color: #2e7d32;
    background: #e8f5e9;
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
    margin: 10px 0;
}

#modal-texto {
    font-size: 1.2rem;
    line-height: 1.5;
    color: #444;
    margin-top: 15px;
}

#cerrar-modal {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 2.5rem;
    cursor: pointer;
    color: #aaa;
}

#cerrar-modal:hover {
    color: #333;
}

/* === MODAL DE VICTORIA === */
.contenido-modal.victoria {
    border-color: #66bb6a;
    background: #e8f5e9;
}

.icono-victoria {
    font-size: 6rem;
    animation: saltar 1s infinite alternate;
}

#boton-jugar-nuevo {
    background: #66bb6a;
    color: white;
    border: none;
    padding: 15px 25px;
    font-size: 1.2rem;
    border-radius: 15px;
    cursor: pointer;
    margin-top: 15px;
    font-weight: bold;
    font-family: inherit;
    transition: background 0.2s;
}

#boton-jugar-nuevo:hover {
    background: #4caf50;
}

@keyframes saltar {
    0% { transform: translateY(0); }
    100% { transform: translateY(-20px); }
}

.oculto {
    display: none !important;
}