@import url('https://fonts.googleapis.com/css2?family=Comic+Neue:wght@400;700&family=Caveat:wght@400;600&display=swap');

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

body {
    font-family: 'Comic Neue', cursive;
    background: linear-gradient(135deg, #e8f5e8, #d4f1d4);
    overflow: hidden;
    cursor: crosshair;
}

.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: none;
    align-items: center;
    justify-content: center;
}

.screen.active {
    display: flex;
}

/* Animaciones avanzadas */
@keyframes breathing {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); filter: brightness(1.1); }
}

@keyframes pulsing {
    0%, 100% { transform: scale(1); box-shadow: 0 0 10px rgba(76, 175, 80, 0.3); }
    50% { transform: scale(1.05); box-shadow: 0 0 20px rgba(76, 175, 80, 0.6); }
}

@keyframes floating-particles {
    0% { transform: translateY(100vh) translateX(0px) rotate(0deg); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(-100px) translateX(50px) rotate(360deg); opacity: 0; }
}

@keyframes typing-effect {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes rotating-galaxy {
    0% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(90deg) scale(1.05); }
    50% { transform: rotate(180deg) scale(1); }
    75% { transform: rotate(270deg) scale(1.05); }
    100% { transform: rotate(360deg) scale(1); }
}

/* Pantalla Principal Mejorada */
#main-screen {
    background: linear-gradient(45deg, #a8e6cf, #dcedc8, #c8d6e5);
    flex-direction: column;
    position: relative;
}

.laboratory-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.bubbles-enhanced {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(173, 216, 230, 0.8) 12px, transparent 12px),
        radial-gradient(circle at 80% 20%, rgba(144, 238, 144, 0.7) 18px, transparent 18px),
        radial-gradient(circle at 40% 40%, rgba(255, 182, 193, 0.6) 10px, transparent 10px),
        radial-gradient(circle at 60% 70%, rgba(255, 218, 185, 0.5) 15px, transparent 15px);
    animation: bubbleFloat 8s ease-in-out infinite;
}

.equipment-advanced {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0.4;
    background-size: 80px 80px, 100px 100px, 60px 60px, 70px 70px;
    background-position: 10% 20%, 85% 30%, 15% 80%, 75% 75%;
    background-repeat: no-repeat;
}

.floating-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.floating-particles::before,
.floating-particles::after {
    content: '✨';
    position: absolute;
    font-size: 1.5rem;
    animation: floating-particles 12s linear infinite;
}

.floating-particles::before {
    left: 20%;
    animation-delay: -2s;
}

.floating-particles::after {
    left: 70%;
    animation-delay: -6s;
}

.main-content {
    z-index: 2;
    text-align: center;
    padding: 2rem;
    position: relative;
}

.main-title.breathing {
    font-size: 3.5rem;
    color: #2e7d32;
    text-shadow: 3px 3px 0px #81c784, 0 0 30px rgba(46, 125, 50, 0.3);
    margin-bottom: 2rem;
    animation: breathing 4s ease-in-out infinite;
    font-family: 'Caveat', cursive;
}

.cosmic-onion-main {
    position: relative;
    margin: 2rem 0;
    display: inline-block;
}

.onion-image {
    width: 200px;
    height: 200px;
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.5));
    animation: rotating-galaxy 15s linear infinite;
}

.onion-aura {
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: pulsing 3s ease-in-out infinite;
}

.onion-speech-bubble {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 1.5rem;
    margin: 2rem auto;
    max-width: 600px;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.onion-speech-bubble::before {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 15px solid rgba(255, 255, 255, 0.9);
}

.onion-voice {
    font-family: 'Caveat', cursive;
    font-size: 1.3rem;
    color: #2e7d32;
    font-weight: 600;
    line-height: 1.6;
    overflow: hidden;
    white-space: nowrap;
    animation: typing-effect 4s steps(100, end) forwards;
}

.mode-selection {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.mode-btn {
    padding: 1rem 1.5rem;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 20px;
    font-family: 'Comic Neue', cursive;
    font-weight: bold;
    cursor: pointer;
    animation: pulsing 2s ease-in-out infinite;
    transition: all 0.3s ease;
}

.mode-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

.start-button.main-explore {
    font-size: 2rem;
    padding: 1.5rem 3rem;
    background: linear-gradient(45deg, #4caf50, #8bc34a, #cddc39);
    color: white;
    border: none;
    border-radius: 30px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    font-family: 'Comic Neue', cursive;
    font-weight: bold;
    transition: all 0.3s ease;
    animation: breathing 3s ease-in-out infinite;
}

.start-button.main-explore:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    background: linear-gradient(45deg, #45a049, #7cb342, #c0ca33);
}

.secret-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.secret-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Pantalla del Microscopio Mejorada */
#microscope-screen {
    background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
    flex-direction: column;
    position: relative;
}

.narrator-box {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 1rem 2rem;
    border-radius: 25px;
    max-width: 600px;
    text-align: center;
    z-index: 10;
    font-family: 'Caveat', cursive;
    font-size: 1.2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.narrator-voice {
    animation: typing-effect 3s steps(50, end) forwards;
    overflow: hidden;
    white-space: nowrap;
}

.microscope-interface.enhanced {
    width: 90%;
    max-width: 900px;
    background: linear-gradient(145deg, #2d3748, #4a5568, #2b6cb0);
    border-radius: 25px;
    padding: 2.5rem;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
    position: relative;
}

.microscope-view {
    width: 100%;
    height: 450px;
    border: 10px solid #718096;
    border-radius: 50%;
    background: radial-gradient(circle, #f7fafc, #e2e8f0, #cbd5e0);
    position: relative;
    overflow: hidden;
    margin-bottom: 2rem;
}

.optical-effects {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.chromatic-ring {
    position: absolute;
    top: 10%;
    left: 10%;
    right: 10%;
    bottom: 10%;
    border: 2px solid transparent;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #9400d3, #ff0000);
    opacity: 0.1;
    animation: spin 20s linear infinite;
}

.focus-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border: 2px dashed rgba(66, 153, 225, 0.5);
    border-radius: 50%;
    animation: pulsing 2s ease-in-out infinite;
}

.magnifying-cursor.advanced {
    position: absolute;
    width: 80px;
    height: 80px;
    border: 4px solid #4299e1;
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(circle, rgba(66, 153, 225, 0.1), rgba(66, 153, 225, 0.05), transparent);
    transition: all 0.2s ease;
    box-shadow: 0 0 20px rgba(66, 153, 225, 0.3);
}

.controls-enhanced {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.control-btn {
    padding: 1rem 2rem;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 20px;
    font-family: 'Comic Neue', cursive;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.control-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.control-btn:hover::before {
    left: 100%;
}

.control-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
    background: linear-gradient(45deg, #5a67d8, #6b46c1);
}

.zoom-effect:hover {
    animation: pulsing 0.5s ease-in-out;
}

.interact-pulse {
    animation: pulsing 2s ease-in-out infinite;
}

.notes-glow:hover {
    box-shadow: 0 0 30px rgba(255, 193, 7, 0.5);
}

.lab-sparkle {
    background: linear-gradient(45deg, #e91e63, #9c27b0);
}

.lab-sparkle:hover {
    background: linear-gradient(45deg, #c2185b, #7b1fa2);
}

.level-indicator.enhanced {
    text-align: center;
    color: #e2e8f0;
    font-size: 1.3rem;
    font-weight: bold;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    width: 0%;
    transition: width 0.8s ease;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

/* Niveles del Microscopio Mejorados */
.level-0 {
    background: radial-gradient(circle, #fff3cd, #ffeaa7, #fab1a0);
    font-size: 8rem;
    position: relative;
}

.level-1 {
    background: radial-gradient(circle, #d1ecf1, #bee5eb, #a8dadc);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    padding: 2rem;
}

.cell {
    background: radial-gradient(circle, #ffeb9c, #ffeaa7, #fdcb6e);
    border: 4px solid #e17055;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: cellBreathe 3s ease-in-out infinite;
    position: relative;
}

.cell::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border: 2px solid transparent;
    border-radius: 50%;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4) border-box;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cell:hover::before {
    opacity: 0.3;
}

.cell:hover {
    transform: scale(1.15);
    box-shadow: 0 0 30px rgba(225, 112, 85, 0.8);
}

.cell.talking {
    animation: cellTalk 0.6s ease-in-out infinite;
}

@keyframes cellTalk {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(-3deg); }
    75% { transform: scale(1.1) rotate(3deg); }
}

.level-2 {
    background: radial-gradient(circle, #e8f5e8, #c8e6c8, #a8d8a8);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.dna-helix {
    width: 250px;
    height: 350px;
    position: relative;
    animation: dnaRotate 6s linear infinite;
}

.dna-helix::before {
    content: '🧬';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    z-index: 2;
    animation: pulsing 2s ease-in-out infinite;
}

.level-3 {
    background: radial-gradient(circle, #f8d7da, #f5c6cb, #f1959b);
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 1.5rem;
    align-content: center;
    justify-content: center;
}

.microbe {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: microbeMove 4s ease-in-out infinite;
    position: relative;
}

.microbe::after {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border-radius: 50%;
    background: radial-gradient(circle, transparent 60%, rgba(255, 255, 255, 0.3));
    pointer-events: none;
}

.microbe.good {
    background: linear-gradient(45deg, #56cc9d, #6c5ce7, #74b9ff);
}

.microbe.bad {
    background: linear-gradient(45deg, #ff7675, #fd79a8, #e84393);
    animation: microbeBad 1.5s ease-in-out infinite;
}

.level-4 {
    background: radial-gradient(circle, #667eea, #764ba2, #341f97);
    position: relative;
    overflow: hidden;
}

.tunnel {
    position: absolute;
    width: 300%;
    height: 300%;
    top: -100%;
    left: -100%;
    background: conic-gradient(from 0deg, transparent, #667eea, transparent, #764ba2, transparent, #341f97, transparent);
    border-radius: 50%;
    animation: tunnelSpin 12s linear infinite;
}

.cosmic-onion {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 5rem;
    z-index: 2;
    animation: cosmicFloat 6s ease-in-out infinite;
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.5));
}

/* Cuaderno Mejorado */
.notebook.enhanced {
    background: linear-gradient(145deg, #ffeaa7, #fab1a0, #fdcb6e);
    border-radius: 20px;
    padding: 2.5rem;
    max-width: 700px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    position: relative;
}

.notebook-title {
    color: #2d3436;
    margin-bottom: 2rem;
    text-align: center;
    font-family: 'Caveat', cursive;
    font-size: 2.5rem;
    text-shadow: 2px 2px 0px rgba(255, 255, 255, 0.5);
}

.notes-content-enhanced {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 1rem;
}

.note-entry {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    border-left: 5px solid #4caf50;
    transition: all 0.3s ease;
}

.note-entry:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.note-entry.locked {
    opacity: 0.6;
    background: #ddd;
    border-left-color: #bbb;
}

.unlock-progress {
    width: 100%;
    height: 4px;
    background: #eee;
    border-radius: 2px;
    margin-top: 1rem;
    overflow: hidden;
}

.unlock-bar {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    width: 0%;
    transition: width 1s ease;
}

/* Laboratorio Avanzado */
.laboratory-advanced {
    background: linear-gradient(145deg, #2d3748, #4a5568);
    border-radius: 20px;
    padding: 2rem;
    max-width: 900px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    color: white;
}

.lab-title {
    text-align: center;
    font-family: 'Caveat', cursive;
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: #e2e8f0;
}

.lab-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.lab-section {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.lab-section:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-5px);
}

/* Pantalla Final Mejorada */
.final-animation.enhanced {
    text-align: center;
    color: white;
    position: relative;
}

.universe-transformation {
    position: relative;
    width: 400px;
    height: 400px;
    margin: 0 auto 3rem;
}

.onion-planet {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: rotating-galaxy 20s linear infinite;
}

.planet-image {
    width: 200px;
    height: 200px;
    filter: drop-shadow(0 0 30px rgba(255, 255, 255, 0.8));
}

.planetary-rings {
    position: absolute;
    top: -50px;
    left: -50px;
    right: -50px;
    bottom: -50px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: spin 15s linear infinite reverse;
}

.planetary-rings::before {
    content: '';
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
}

.stars-field {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, white, transparent),
        radial-gradient(2px 2px at 40px 70px, white, transparent),
        radial-gradient(1px 1px at 90px 40px, white, transparent),
        radial-gradient(1px 1px at 130px 80px, white, transparent),
        radial-gradient(2px 2px at 160px 30px, white, transparent),
        radial-gradient(1px 1px at 200px 60px, white, transparent);
    background-repeat: repeat;
    background-size: 250px 150px;
    animation: starsMove 30s linear infinite;
}

.cosmic-dust {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(255, 255, 255, 0.05) 100%);
    animation: pulsing 8s ease-in-out infinite;
}

.final-message.poetic {
    font-size: 2rem;
    margin-bottom: 2rem;
    line-height: 1.8;
    max-width: 600px;
    font-family: 'Caveat', cursive;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.final-reflection {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 1.5rem;
    margin: 2rem auto;
    max-width: 500px;
    backdrop-filter: blur(10px);
}

.comparison-text {
    font-size: 1.2rem;
    line-height: 1.6;
    opacity: 0.9;
}

.cosmic-glow {
    background: linear-gradient(45deg, #667eea, #764ba2, #667eea);
    background-size: 200% 200%;
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 2rem;
    border-radius: 20px;
    width: 80%;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

/* Responsive mejorado */
@media (max-width: 768px) {
    .main-title.breathing {
        font-size: 2.8rem;
    }
    
    .onion-image {
        width: 150px;
        height: 150px;
    }
    
    .start-button.main-explore {
        font-size: 1.6rem;
        padding: 1.2rem 2rem;
    }
    
    .mode-selection {
        flex-direction: column;
        align-items: center;
    }
    
    .microscope-view {
        height: 350px;
    }
    
    .controls-enhanced {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .control-btn {
        padding: 0.8rem 1.2rem;
        font-size: 0.9rem;
    }

    .lab-sections {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .main-title.breathing {
        font-size: 2.2rem;
    }
    
    .onion-speech-bubble {
        padding: 1rem;
        margin: 1rem;
    }
    
    .onion-voice {
        font-size: 1.1rem;
    }
    
    .microscope-interface.enhanced {
        padding: 1.5rem;
    }
    
    .microscope-view {
        height: 280px;
    }
}

/* Animaciones adicionales */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

@keyframes dnaRotate {
    from { transform: rotateY(0deg); }
    to { transform: rotateY(360deg); }
}

@keyframes microbeMove {
    0%, 100% { transform: translateX(0) translateY(0); }
    25% { transform: translateX(15px) translateY(-15px); }
    50% { transform: translateX(-10px) translateY(15px); }
    75% { transform: translateX(10px) translateY(8px); }
}

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

@keyframes tunnelSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes cosmicFloat {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.15); }
}

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

@keyframes starsMove {
    from { transform: translateY(0px); }
    to { transform: translateY(-150px); }
}