/* ESCENA 3: GREEN - La Transformación */

/* Fondo y grid de la escena 3 */
#scene3 {
    background: linear-gradient(135deg, #065f46 0%, #064e3b 100%);
}

.green-grid {
    position: absolute;
    inset: -50%;
    width: 200%;
    height: 200%;
    background-image:
        linear-gradient(to right, rgba(16, 185, 129, 0.08) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(16, 185, 129, 0.08) 1px, transparent 1px);
    background-size: 30px 30px;
    transform: perspective(500px) rotateX(60deg) translateY(0) translateZ(-100px);
    z-index: 1;
    pointer-events: none;
}

.scene.active .green-grid {
    animation: gridDrift 20s linear infinite;
}

/* Glitch overlay para efecto de transformación */
.glitch-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(16, 185, 129, 0.1) 50%, transparent 100%);
    opacity: 0;
    z-index: 5;
    pointer-events: none;
}

.scene.active .glitch-overlay {
    animation: glitchSweep 1.5s ease-in-out 1.3s;
}

@keyframes glitchSweep {

    0%,
    100% {
        opacity: 0;
        transform: translateX(-100%);
    }

    50% {
        opacity: 1;
        transform: translateX(100%);
    }
}

/* Contenedor de la transformación mágica */
.magic-cell-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 25;
}

/* Celda de Excel que desaparece */
.excel-cell-magic {
    width: 150px;
    height: 80px;
    background: rgba(30, 30, 30, 0.9);
    border: 2px solid #fb923c;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    color: #fef3c7;
    border-radius: 4px;
    opacity: 1;
    z-index: 25;
}

.scene.active .excel-cell-magic {
    animation: cellExplode 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards 0.8s;
}

@keyframes cellExplode {
    0% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }

    70% {
        opacity: 0.5;
        transform: scale(1.3) rotate(10deg);
        filter: blur(3px);
    }

    100% {
        opacity: 0;
        transform: scale(0.5) rotate(25deg);
        filter: blur(10px);
    }
}

/* Anillos de explosión */
.explosion-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border: 3px solid #10b981;
    border-radius: 50%;
    opacity: 0;
}

.scene.active .explosion-ring:nth-child(1) {
    animation: ringExpand 1.2s ease-out forwards 1.2s;
}

.scene.active .explosion-ring:nth-child(2) {
    animation: ringExpand 1.2s ease-out forwards 1.4s;
}

.scene.active .explosion-ring:nth-child(3) {
    animation: ringExpand 1.2s ease-out forwards 1.6s;
}

@keyframes ringExpand {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }

    30% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(2.5);
    }
}

/* Sparkles / partículas */
.sparkles-container {
    position: absolute;
    inset: 0;
    z-index: 24;
    pointer-events: none;
}

.sparkle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.8);
    opacity: 0;
}

.scene.active .sparkle:nth-child(1) {
    animation: sparkleOut 1.2s ease-out forwards 2.3s;
    top: 50%;
    left: 50%;
    --tx: -80px;
    --ty: -80px;
}

.scene.active .sparkle:nth-child(2) {
    animation: sparkleOut 1.2s ease-out forwards 2.35s;
    top: 50%;
    left: 50%;
    --tx: 80px;
    --ty: -80px;
}

.scene.active .sparkle:nth-child(3) {
    animation: sparkleOut 1.2s ease-out forwards 2.4s;
    top: 50%;
    left: 50%;
    --tx: -80px;
    --ty: 80px;
}

.scene.active .sparkle:nth-child(4) {
    animation: sparkleOut 1.2s ease-out forwards 2.45s;
    top: 50%;
    left: 50%;
    --tx: 80px;
    --ty: 80px;
}

.scene.active .sparkle:nth-child(5) {
    animation: sparkleOut 1.2s ease-out forwards 2.38s;
    top: 50%;
    left: 50%;
    --tx: 0px;
    --ty: -100px;
}

.scene.active .sparkle:nth-child(6) {
    animation: sparkleOut 1.2s ease-out forwards 2.42s;
    top: 50%;
    left: 50%;
    --tx: 0px;
    --ty: 100px;
}

@keyframes sparkleOut {
    0% {
        opacity: 0;
        transform: translate(0, 0) scale(0);
    }

    30% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) scale(0.3);
    }
}

/* Icono de la app que aparece */
.app-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 40px rgba(16, 185, 129, 0.6), 0 20px 60px rgba(0, 0, 0, 0.8);
    opacity: 0;
    z-index: 26;
}

.scene.active .app-icon {
    animation: appIconPop 1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards 2.8s;
}

@keyframes appIconPop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0) rotate(-180deg);
    }

    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
    }
}

.app-icon-symbol {
    font-size: 3rem;
    margin-bottom: 5px;
}

.app-icon-label {
    font-size: 0.6rem;
    font-weight: 700;
    color: white;
    letter-spacing: 1px;
}

/* Título de escena 3 */
.scene3-title {
    font-weight: 900;
    font-size: 2.5rem;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: -1.5px;
    opacity: 0;
    text-shadow: 0 5px 25px rgba(0, 0, 0, 0.8);
}

.scene.active .scene3-title {
    animation: titleShine 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards 1.8s;
}

@keyframes titleShine {
    0% {
        opacity: 0;
        transform: scale(0.7) translateY(30px);
        filter: blur(10px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: blur(0);
    }
}

/* Green glow effect */
.green-glow {
    color: #10b981;
    text-shadow: 0 0 30px rgba(16, 185, 129, 1), 0 0 60px rgba(16, 185, 129, 0.7);
    animation: greenPulse 2s ease-in-out infinite;
}

@keyframes greenPulse {

    0%,
    100% {
        text-shadow: 0 0 30px rgba(16, 185, 129, 1), 0 0 60px rgba(16, 185, 129, 0.7);
    }

    50% {
        text-shadow: 0 0 40px rgba(16, 185, 129, 1), 0 0 80px rgba(16, 185, 129, 0.9);
    }
}