/* Reset y configuración base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Sistema de pantallas */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* Pantalla de bienvenida */
#welcome-screen h1 {
    text-align: center;
    color: white;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

#welcome-screen p {
    text-align: center;
    color: white;
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.form-card {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    max-width: 400px;
    margin: 0 auto;
}

.form-card label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #444;
}

.form-card input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 1.5rem;
    transition: border-color 0.3s ease;
}

.form-card input:focus {
    outline: none;
    border-color: #667eea;
}

.form-card button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.form-card button:hover {
    transform: translateY(-2px);
}

/* Header del juego */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.95);
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    flex-wrap: wrap;
    gap: 1rem;
}

.student-info, .level-info, .score-info {
    font-weight: 600;
    color: #444;
}

.level-info {
    background: #667eea;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

.score-info {
    color: #f39c12;
}

/* Tarjeta de ejercicio */
.exercise-card {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.exercise-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.exercise-header h2 {
    color: #444;
    font-size: 1.3rem;
}

.progress {
    background: #f8f9fa;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    color: #666;
    font-weight: 600;
}

/* Visualización de la sucesión */
.sequence {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 2rem 0;
    min-height: 60px;
}

.sequence-term {
    background: #f8f9fa;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    padding: 1rem;
    min-width: 60px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    color: #444;
}

.sequence-input {
    background: #fff3cd;
    border: 2px dashed #ffc107;
    color: #856404;
}

.sequence-missing {
    background: #ffe6e6;
    border: 2px dashed #dc3545;
    color: #721c24;
}

/* Sección de respuesta */
.answer-section {
    text-align: center;
    margin-top: 2rem;
}

#input-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}

.answer-input {
    width: 80px;
    padding: 10px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
}

.answer-input:focus {
    outline: none;
    border-color: #667eea;
}

.submit-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40,167,69,0.3);
}

.submit-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Retroalimentación */
.feedback {
    margin-top: 2rem;
    padding: 1.5rem;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    font-size: 1.1rem;
}

.feedback.hidden {
    display: none;
}

.feedback.correct {
    background: #d4edda;
    color: #155724;
    border: 2px solid #c3e6cb;
}

.feedback.incorrect {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #f5c6cb;
}

/* Pantallas de resultados */
.result-card {
    background: white;
    padding: 3rem;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    max-width: 500px;
    margin: 0 auto;
}

.result-card h2 {
    color: #444;
    margin-bottom: 2rem;
    font-size: 2rem;
}

#level-results p, #final-results p {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: #666;
}

.next-btn, .restart-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 2rem;
    transition: all 0.3s ease;
}

.next-btn:hover, .restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102,126,234,0.3);
}

/* Responsivo para móviles */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    #welcome-screen h1 {
        font-size: 2rem;
    }
    
    #welcome-screen p {
        font-size: 1rem;
    }
    
    .form-card {
        padding: 1.5rem;
    }
    
    .header {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .exercise-card {
        padding: 1.5rem;
    }
    
    .exercise-header {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .exercise-header h2 {
        font-size: 1.1rem;
    }
    
    .sequence {
        gap: 0.5rem;
    }
    
    .sequence-term {
        min-width: 50px;
        padding: 0.8rem;
        font-size: 1rem;
    }
    
    .answer-input {
        width: 70px;
    }
    
    .result-card {
        padding: 2rem;
    }
    
    .result-card h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .sequence {
        flex-direction: column;
        align-items: center;
    }
    
    .sequence-term {
        min-width: 80px;
    }
    
    #input-container {
        flex-direction: column;
    }
}