* {
    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;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 900px;
}

.screen {
    display: none;
    animation: fadeIn 0.5s ease-in;
}

.screen.active {
    display: block;
}

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

/* Pantalla de inicio - Estilo Gaming */
#startScreen {
    position: relative;
    overflow: hidden;
}

/* Fondo de partículas animadas */
.particles-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(118, 75, 162, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 30%);
    animation: particlesMove 20s ease-in-out infinite;
}

@keyframes particlesMove {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(20px, -20px) scale(1.1); }
}

.welcome-card {
    position: relative;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.9) 100%);
    border-radius: 30px;
    padding: 60px 40px;
    text-align: center;
    box-shadow: 
        0 30px 80px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        0 0 100px rgba(102, 126, 234, 0.3);
    border: 3px solid rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    animation: cardPulse 3s ease-in-out infinite;
}

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

/* Logo del cerebro con efectos */
.game-logo {
    position: relative;
    display: inline-block;
    margin-bottom: 30px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

.brain-icon {
    font-size: 6rem;
    display: block;
    filter: drop-shadow(0 10px 30px rgba(102, 126, 234, 0.6));
    animation: pulse 2s ease-in-out infinite;
    position: relative;
    z-index: 2;
}

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

.glow-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.4) 0%, transparent 70%);
    border-radius: 50%;
    animation: glow 2s ease-in-out infinite;
    z-index: 1;
}

@keyframes glow {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.5;
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0.8;
    }
}

/* Título del juego con animación de palabras */
.game-title {
    color: #4c5fd7;
    font-size: 2.8rem;
    margin-bottom: 20px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 3px;
    line-height: 1.3;
    text-shadow: 
        2px 2px 0px rgba(102, 126, 234, 0.3),
        4px 4px 8px rgba(0, 0, 0, 0.2);
    filter: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.title-word {
    display: inline-block;
    animation: wordBounce 1s ease-out forwards;
    opacity: 0;
}

.title-word:nth-child(1) { animation-delay: 0.1s; }
.title-word:nth-child(2) { animation-delay: 0.2s; }
.title-word:nth-child(3) { animation-delay: 0.3s; }
.title-word:nth-child(4) { animation-delay: 0.4s; }

@keyframes wordBounce {
    0% {
        transform: translateY(-50px);
        opacity: 0;
    }
    60% {
        transform: translateY(10px);
        opacity: 1;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.subtitle {
    color: #555;
    font-size: 1.2rem;
    margin-bottom: 40px;
    line-height: 1.6;
    animation: fadeInUp 1s ease-out 0.6s forwards;
    opacity: 0;
    font-weight: 500;
}

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

/* Botones */
.btn {
    padding: 15px 40px;
    font-size: 1.1rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    margin: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

/* Botón de inicio estilo videojuego */
.btn-game {
    position: relative;
    padding: 20px 60px;
    font-size: 1.4rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 4px solid #fff;
    border-radius: 15px;
    box-shadow: 
        0 15px 35px rgba(102, 126, 234, 0.6),
        0 5px 15px rgba(0, 0, 0, 0.3),
        inset 0 -5px 15px rgba(0, 0, 0, 0.2),
        inset 0 2px 5px rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
    overflow: hidden;
    animation: buttonBounce 1s ease-out 0.8s forwards, buttonPulse 2s ease-in-out 1.8s infinite;
    opacity: 0;
    transform: scale(0.8);
}

@keyframes buttonBounce {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    60% {
        transform: scale(1.1);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes buttonPulse {
    0%, 100% {
        box-shadow: 
            0 15px 35px rgba(102, 126, 234, 0.6),
            0 5px 15px rgba(0, 0, 0, 0.3),
            inset 0 -5px 15px rgba(0, 0, 0, 0.2),
            inset 0 2px 5px rgba(255, 255, 255, 0.5);
    }
    50% {
        box-shadow: 
            0 20px 45px rgba(102, 126, 234, 0.8),
            0 8px 20px rgba(0, 0, 0, 0.4),
            inset 0 -5px 15px rgba(0, 0, 0, 0.2),
            inset 0 2px 5px rgba(255, 255, 255, 0.5);
    }
}

.btn-game .btn-text {
    position: relative;
    z-index: 2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.btn-game .btn-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shine 3s ease-in-out infinite;
    z-index: 1;
}

@keyframes shine {
    0% { left: -100%; }
    50%, 100% { left: 100%; }
}

.btn-game:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 
        0 25px 50px rgba(102, 126, 234, 0.8),
        0 10px 25px rgba(0, 0, 0, 0.4),
        inset 0 -5px 15px rgba(0, 0, 0, 0.3),
        inset 0 2px 5px rgba(255, 255, 255, 0.6);
    border-color: #ffe600;
}

.btn-game:active {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 10px 25px rgba(102, 126, 234, 0.6),
        0 5px 15px rgba(0, 0, 0, 0.3),
        inset 0 -5px 15px rgba(0, 0, 0, 0.3);
}

/* Texto "Presiona para comenzar" parpadeante */
.press-start {
    margin-top: 30px;
    color: #667eea;
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 3px;
    animation: blink 1.5s ease-in-out infinite, fadeInUp 1s ease-out 1s forwards;
    opacity: 0;
}

@keyframes blink {
    0%, 50%, 100% { opacity: 1; }
    25%, 75% { opacity: 0.3; }
}

/* Animación de partículas flotantes */
@keyframes floatParticle {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.6;
    }
    25% {
        transform: translate(30px, -50px) scale(1.2);
        opacity: 0.8;
    }
    50% {
        transform: translate(-20px, -100px) scale(0.8);
        opacity: 0.4;
    }
    75% {
        transform: translate(40px, -70px) scale(1.1);
        opacity: 0.7;
    }
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
    transform: translateY(-2px);
}

/* Barra de progreso */
.progress-bar {
    display: flex;
    justify-content: space-between;
    background: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.stage {
    flex: 1;
    text-align: center;
    padding: 15px;
    border-radius: 10px;
    font-weight: 600;
    color: #999;
    background: #f5f5f5;
    margin: 0 5px;
    transition: all 0.3s ease;
}

.stage.completed {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.stage.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: scale(1.1);
}

/* Info de etapa */
.stage-info {
    background: white;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.stage-info h2 {
    color: #667eea;
    margin-bottom: 10px;
}

.stage-info p {
    color: #666;
    line-height: 1.6;
}

/* Estadísticas del juego */
.game-stats {
    display: flex;
    justify-content: space-between;
    background: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.stat {
    text-align: center;
}

.stat-label {
    color: #999;
    font-size: 0.9rem;
}

.stat-value {
    color: #667eea;
    font-size: 1.5rem;
    font-weight: bold;
    display: block;
    margin-top: 5px;
}

/* Área de desafío */
.challenge-area {
    background: white;
    padding: 40px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    min-height: 400px;
}

.challenge-title {
    color: #333;
    font-size: 1.5rem;
    margin-bottom: 30px;
    text-align: center;
}

/* Drag and Drop */
.drag-drop-container {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.drag-items, .drop-zones {
    flex: 1;
    min-width: 250px;
}

.drag-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    margin: 10px 0;
    border-radius: 10px;
    cursor: move;
    transition: all 0.3s ease;
    text-align: center;
}

.drag-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.drag-item.dragging {
    opacity: 0.5;
}

.drop-zone {
    background: #f5f5f5;
    padding: 20px;
    margin: 10px 0;
    border-radius: 10px;
    border: 2px dashed #ddd;
    min-height: 60px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.drop-zone.drag-over {
    background: #e3f2fd;
    border-color: #667eea;
}

.drop-zone.filled {
    background: #c8e6c9;
    border-color: #4caf50;
}

.drop-zone.incorrect {
    background: #ffcdd2;
    border-color: #f44336;
}

.drop-zone-label {
    font-weight: 600;
    color: #666;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.drop-zone .drag-item {
    font-size: 0.95rem;
    padding: 10px;
    position: relative;
}

.drop-zone .drag-item:hover {
    opacity: 0.8;
    transform: translateY(-1px);
}

.drop-zone .drag-item:hover::after {
    content: "✕";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    font-weight: bold;
}

/* Quiz (Verdadero/Falso y Opción Múltiple) */
.quiz-question {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 30px;
    text-align: center;
    line-height: 1.6;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.quiz-option {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-size: 1.1rem;
}

.quiz-option:hover {
    background: #e3f2fd;
    border-color: #667eea;
    transform: translateX(5px);
}

.quiz-option.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.quiz-option.correct {
    background: #4caf50;
    color: white;
    border-color: #4caf50;
}

.quiz-option.incorrect {
    background: #f44336;
    color: white;
    border-color: #f44336;
}

/* Secuencia */
.sequence-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-height: 200px;
    position: relative;
}

.sequence-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
    user-select: none;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.sequence-item:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.sequence-item.dragover {
    border: 3px solid #4caf50;
    background: linear-gradient(135deg, #667eea 0%, #4caf50 100%);
    transform: scale(1.02);
}

.sequence-item[draggable="true"]:active {
    cursor: grabbing;
    z-index: 100;
}

.sequence-number {
    background: rgba(255, 255, 255, 0.3);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    pointer-events: none;
}

.sequence-item span:not(.sequence-number) {
    flex: 1;
    pointer-events: none;
}

.submit-btn {
    margin-top: 20px;
    padding: 15px 40px;
    font-size: 1.1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    width: 100%;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

/* Feedback */
.feedback {
    background: white;
    padding: 20px;
    border-radius: 15px;
    margin-top: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    display: none;
}

.feedback.show {
    display: block;
    animation: slideIn 0.5s ease;
}

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

.feedback.correct {
    background: #c8e6c9;
    color: #2e7d32;
}

.feedback.incorrect {
    background: #ffcdd2;
    color: #c62828;
}

/* Pantalla final */
.end-card {
    background: white;
    border-radius: 20px;
    padding: 50px 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.end-card h1 {
    color: #667eea;
    margin-bottom: 30px;
}

.final-score {
    margin: 30px 0;
}

.final-score p {
    color: #666;
    font-size: 1.2rem;
}

.final-score h2 {
    color: #667eea;
    font-size: 4rem;
    margin-top: 10px;
}

.learning-summary {
    background: #f5f5f5;
    padding: 30px;
    border-radius: 15px;
    margin: 30px 0;
    text-align: left;
}

.learning-summary h3 {
    color: #667eea;
    margin-bottom: 20px;
    text-align: center;
}

.learning-summary ul {
    list-style: none;
}

.learning-summary li {
    padding: 10px 0;
    border-bottom: 1px solid #ddd;
    color: #666;
    line-height: 1.6;
}

.learning-summary li:last-child {
    border-bottom: none;
}

.learning-summary li:before {
    content: "✓ ";
    color: #4caf50;
    font-weight: bold;
    margin-right: 10px;
}

.end-buttons {
    margin-top: 30px;
}

/* Exploración libre */
.explore-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-height: 80vh;
    overflow-y: auto;
}

.explore-card h1 {
    color: #667eea;
    margin-bottom: 30px;
    text-align: center;
}

.explore-content {
    margin-bottom: 30px;
}

.explore-stage {
    background: #f5f5f5;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 20px;
}

.explore-stage h3 {
    color: #667eea;
    margin-bottom: 15px;
}

.explore-stage p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 10px;
}

.explore-stage ul {
    list-style: none;
    margin-top: 15px;
}

.explore-stage li {
    padding: 8px 0;
    color: #555;
    line-height: 1.5;
}

.explore-stage li:before {
    content: "• ";
    color: #667eea;
    font-weight: bold;
    margin-right: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .welcome-card, .end-card, .explore-card {
        padding: 30px 20px;
    }

    /* Responsive para pantalla de inicio gaming */
    .brain-icon {
        font-size: 4rem;
    }

    .game-title {
        font-size: 2rem;
        letter-spacing: 1px;
    }

    .subtitle {
        font-size: 1rem;
    }

    .btn-game {
        padding: 15px 40px;
        font-size: 1.1rem;
        letter-spacing: 1px;
    }

    .press-start {
        font-size: 0.85rem;
        letter-spacing: 2px;
    }

    .progress-bar {
        flex-wrap: wrap;
    }

    .stage {
        flex: 1 1 30%;
        margin: 5px;
    }

    .drag-drop-container {
        flex-direction: column;
    }

    .challenge-area {
        padding: 20px;
    }

    .final-score h2 {
        font-size: 3rem;
    }
}

/* Animación de puntos ganados */
@keyframes pointsEarned {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    50% {
        transform: translateY(-20px) scale(1.2);
    }
    100% {
        transform: translateY(-40px) scale(1);
        opacity: 0;
    }
}

.points-animation {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    font-weight: bold;
    color: #4caf50;
    animation: pointsEarned 1s ease-out;
    pointer-events: none;
    z-index: 1000;
}

