* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comic Sans MS', 'Chalkboard', 'Arial Rounded MT Bold', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 30px;
    padding: 30px;
    max-width: 600px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
}

header h1 {
    color: #e91e63;
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

header h2 {
    color: #9c27b0;
    font-size: 1.3em;
    margin-bottom: 20px;
}

/* Pantallas */
.pantalla {
    display: none;
}

.pantalla.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Pantalla de inicio */
.bienvenida {
    margin-bottom: 25px;
}

.mensaje-grande {
    font-size: 1.4em;
    color: #673ab7;
    margin-bottom: 15px;
}

.tablas-selector {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-top: 20px;
}

.tabla-btn {
    padding: 15px 10px;
    font-size: 0.9em;
    font-weight: bold;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.tabla-btn:nth-child(1) { background: #ff6b6b; color: white; }
.tabla-btn:nth-child(2) { background: #feca57; color: #333; }
.tabla-btn:nth-child(3) { background: #48dbfb; color: #333; }
.tabla-btn:nth-child(4) { background: #ff9ff3; color: #333; }
.tabla-btn:nth-child(5) { background: #54a0ff; color: white; }
.tabla-btn:nth-child(6) { background: #5f27cd; color: white; }
.tabla-btn:nth-child(7) { background: #00d2d3; color: #333; }
.tabla-btn:nth-child(8) { background: #ff6b81; color: white; }
.tabla-btn:nth-child(9) { background: #26de81; color: #333; }
.tabla-btn:nth-child(10) { background: #fd79a8; color: white; }

.tabla-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

/* Botón Super Examen */
.super-examen-area {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px dashed #e0e0e0;
}

.btn-super-examen {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    padding: 20px 40px;
    font-size: 1.3em;
    border-radius: 25px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 auto;
    box-shadow: 0 5px 20px rgba(240, 147, 251, 0.4);
    animation: brillar 2s ease-in-out infinite;
}

.btn-super-examen .subtexto {
    font-size: 0.6em;
    font-weight: normal;
    margin-top: 5px;
    opacity: 0.9;
}

.btn-super-examen:hover {
    transform: scale(1.08);
    box-shadow: 0 10px 40px rgba(240, 147, 251, 0.6);
}

@keyframes brillar {
    0%, 100% { box-shadow: 0 5px 20px rgba(240, 147, 251, 0.4); }
    50% { box-shadow: 0 5px 30px rgba(245, 87, 108, 0.6); }
}

/* Visualización gráfica */
.visualizacion-grafica {
    background: linear-gradient(135deg, #e0f7fa 0%, #b2ebf2 100%);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.grafico-grupos {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    max-width: 100%;
}

.grupo {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    max-width: 80px;
    justify-content: center;
}

.elemento {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: aparecer 0.3s ease forwards;
    opacity: 0;
}

@keyframes aparecer {
    from { opacity: 0; transform: scale(0); }
    to { opacity: 1; transform: scale(1); }
}

.grafico-ecuacion {
    font-size: 1.5em;
    font-weight: bold;
    color: #00796b;
    background: white;
    padding: 10px 20px;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.grafico-ecuacion .numero {
    color: #e91e63;
}

/* Pantalla de aprendizaje */
#titulo-tabla {
    color: #673ab7;
    font-size: 2em;
    margin-bottom: 20px;
}

#numero-tabla {
    color: #e91e63;
}

.contenido-tabla {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8eb 100%);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.multiplicacion {
    padding: 12px;
    background: white;
    border-radius: 12px;
    font-size: 1.2em;
    color: #333;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.multiplicacion:hover {
    transform: scale(1.05);
    background: #fff3e0;
}

.multiplicacion.iluminada {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    transform: scale(1.1);
    box-shadow: 0 5px 20px rgba(252, 182, 159, 0.5);
    border: 3px solid #e91e63;
    animation: pulsar 0.5s ease-in-out;
}

@keyframes pulsar {
    0%, 100% { transform: scale(1.1); }
    50% { transform: scale(1.15); }
}

.multiplicacion .resultado {
    color: #e91e63;
    font-weight: bold;
}

/* Botones principales */
.btn-principal {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.2em;
    border-radius: 25px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    transition: all 0.3s ease;
    margin: 10px;
}

.btn-principal:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.btn-secundario {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
    padding: 12px 25px;
    font-size: 1em;
    border-radius: 25px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    transition: all 0.3s ease;
    margin: 10px;
}

.btn-secundario:hover {
    background: #667eea;
    color: white;
}

/* Pantalla de preguntas */
.pregunta-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 15px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 15px;
    color: white;
    font-weight: bold;
}

#puntuacion {
    font-size: 1.2em;
}

.pregunta-contenido {
    padding: 30px;
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    border-radius: 20px;
    margin-bottom: 20px;
}

.pregunta-texto {
    font-size: 1.8em;
    color: #333;
    margin-bottom: 25px;
}

#num1, #num2 {
    color: #e91e63;
    font-weight: bold;
    font-size: 1.1em;
}

.respuesta-area {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

#respuesta-input {
    width: 150px;
    padding: 15px;
    font-size: 1.8em;
    text-align: center;
    border: 3px solid #667eea;
    border-radius: 15px;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
    background: white;
    color: #333;
}

#respuesta-input::placeholder {
    color: #aaa;
    font-size: 0.6em;
}

#respuesta-input:focus {
    border-color: #e91e63;
    box-shadow: 0 0 20px rgba(233, 30, 99, 0.3);
}

.feedback {
    margin-top: 20px;
    padding: 15px;
    border-radius: 15px;
    font-size: 1.3em;
    font-weight: bold;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feedback.correcto {
    background: #d4edda;
    color: #155724;
    animation: celebrar 0.5s ease;
}

.feedback.incorrecto {
    background: #f8d7da;
    color: #721c24;
    animation: shake 0.5s ease;
}

@keyframes celebrar {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.oculto {
    display: none !important;
}

/* Pantalla de resultados */
.resultado-contenido {
    padding: 30px;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    border-radius: 20px;
    margin-bottom: 20px;
}

#resultado-titulo {
    font-size: 2em;
    color: #673ab7;
    margin-bottom: 20px;
}

.estrellas {
    font-size: 3em;
    margin: 20px 0;
}

#resultado-mensaje {
    font-size: 1.3em;
    color: #333;
    margin-bottom: 15px;
}

#resultado-puntos {
    font-size: 1.5em;
    color: #e91e63;
    font-weight: bold;
}

.resultado-botones {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

/* Footer */
/* Input de nombre */
.nombre-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

#nombre-input {
    width: 250px;
    padding: 15px;
    font-size: 1.5em;
    text-align: center;
    border: 3px solid #e91e63;
    border-radius: 15px;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
}

#nombre-input:focus {
    border-color: #9c27b0;
    box-shadow: 0 0 20px rgba(156, 39, 176, 0.3);
}

#nombre-input::placeholder {
    color: #ccc;
}

/* Botón de voz */
.btn-voz {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border: none;
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 1em;
    cursor: pointer;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.2);
    font-family: inherit;
    transition: all 0.3s ease;
    z-index: 1000;
}

.btn-voz:hover {
    transform: scale(1.1);
}

footer {
    margin-top: 30px;
    color: #999;
    font-size: 0.9em;
}

/* Responsive */
@media (max-width: 500px) {
    .container {
        padding: 20px;
        border-radius: 20px;
    }

    header h1 {
        font-size: 1.8em;
    }

    .tablas-selector {
        grid-template-columns: repeat(2, 1fr);
    }

    .contenido-tabla {
        grid-template-columns: 1fr;
    }

    .pregunta-texto {
        font-size: 1.4em;
    }

    .respuesta-area {
        flex-direction: column;
    }

    #respuesta-input {
        width: 100%;
        max-width: 200px;
    }
}

/* Animación de confeti */
.confeti {
    position: fixed;
    width: 10px;
    height: 10px;
    background: #f00;
    animation: caer 3s linear forwards;
    pointer-events: none;
}

@keyframes caer {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}
