/* Advanced Rainbow 3D Animation CSS for Game */

/* 3D Rainbow Sine Wave Animated Background */
body {
    margin: 0;
    padding: 0;
    background: #000;
    overflow-x: hidden;
    overflow-y: auto;
    perspective: 1000px;
    min-height: 100vh;
    position: relative;
}

/* Ensure full-screen coverage for all elements */
html, body {
    width: 100%;
    height: 100%;
}

/* Remove any default margins and ensure full coverage */
* {
    box-sizing: border-box;
}

/* Main app container */
#app, .app, .container, .main {
    position: relative;
    z-index: 10;
    background: transparent !important;
}

/* Full-screen Rainbow Sine Wave Background */
.rainbow-sine-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #ff0080, #ff8c00, #ffd700, #00ff00, #00ffff, #0080ff, #8000ff);
    background-size: 400% 400%;
    animation: rainbowFlow 8s ease infinite;
    z-index: -2;
}

/* Animated Sine Waves */
.sine-wave {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.sine-wave::before,
.sine-wave::after {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    background: radial-gradient(circle, 
        rgba(255, 0, 128, 0.3) 0%, 
        rgba(255, 140, 0, 0.3) 14%, 
        rgba(255, 215, 0, 0.3) 28%, 
        rgba(0, 255, 0, 0.3) 42%, 
        rgba(0, 255, 255, 0.3) 57%, 
        rgba(0, 128, 255, 0.3) 71%, 
        rgba(128, 0, 255, 0.3) 85%, 
        rgba(255, 0, 128, 0.3) 100%);
    animation: sineWave 10s ease-in-out infinite;
}

.sine-wave::after {
    animation-delay: -5s;
    animation-duration: 15s;
    opacity: 0.7;
}

@keyframes rainbowFlow {
    0% { background-position: 0% 50%; }
    25% { background-position: 100% 50%; }
    50% { background-position: 100% 100%; }
    75% { background-position: 0% 100%; }
    100% { background-position: 0% 50%; }
}

@keyframes sineWave {
    0%, 100% {
        transform: translateX(0) translateY(0) rotate(0deg) scale(1);
        border-radius: 0% 0% 0% 0%;
    }
    25% {
        transform: translateX(-5%) translateY(-5%) rotate(90deg) scale(1.1);
        border-radius: 50% 0% 50% 0%;
    }
    50% {
        transform: translateX(5%) translateY(-10%) rotate(180deg) scale(1.2);
        border-radius: 0% 50% 0% 50%;
    }
    75% {
        transform: translateX(-10%) translateY(5%) rotate(270deg) scale(1.1);
        border-radius: 50% 50% 0% 0%;
    }
}

/* Additional wave layers for depth */
.wave-layer-1 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: conic-gradient(from 0deg at 50% 50%, 
        rgba(255, 0, 128, 0.2), 
        rgba(255, 140, 0, 0.2), 
        rgba(255, 215, 0, 0.2), 
        rgba(0, 255, 0, 0.2), 
        rgba(0, 255, 255, 0.2), 
        rgba(0, 128, 255, 0.2), 
        rgba(128, 0, 255, 0.2), 
        rgba(255, 0, 128, 0.2));
    animation: rotateWave 20s linear infinite;
    z-index: -1;
    opacity: 0.5;
}

.wave-layer-2 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 30% 70%, 
        rgba(255, 0, 128, 0.3) 0%, 
        transparent 50%),
        radial-gradient(circle at 70% 30%, 
        rgba(0, 255, 255, 0.3) 0%, 
        transparent 50%),
        radial-gradient(circle at 50% 50%, 
        rgba(255, 215, 0, 0.2) 0%, 
        transparent 70%);
    animation: pulseWave 8s ease-in-out infinite;
    z-index: -1;
    opacity: 0.6;
}

@keyframes rotateWave {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.2); }
    100% { transform: rotate(360deg) scale(1); }
}

@keyframes pulseWave {
    0%, 100% { 
        transform: scale(1);
        opacity: 0.6;
    }
    50% { 
        transform: scale(1.3);
        opacity: 0.3;
    }
}

/* 3D Rainbow Particles Background */
.rainbow-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.rainbow-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: linear-gradient(45deg, #ff0080, #ff8c00, #ffd700, #00ff00, #00ffff, #0080ff, #8000ff);
    border-radius: 50%;
    animation: float3D 6s infinite ease-in-out;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

@keyframes float3D {
    0%, 100% {
        transform: translateY(0) translateX(0) translateZ(0) rotateX(0) rotateY(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    50% {
        transform: translateY(-100px) translateX(50px) translateZ(50px) rotateX(180deg) rotateY(180deg);
    }
}

/* 3D Wave Animation */
.wave-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.3;
}

.wave {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 200%;
    height: 100px;
    background: linear-gradient(90deg, 
        rgba(255, 0, 128, 0.8),
        rgba(255, 140, 0, 0.8),
        rgba(255, 215, 0, 0.8),
        rgba(0, 255, 0, 0.8),
        rgba(0, 255, 255, 0.8),
        rgba(0, 128, 255, 0.8),
        rgba(128, 0, 255, 0.8),
        rgba(255, 0, 128, 0.8)
    );
    animation: wave3D 10s linear infinite;
    transform-style: preserve-3d;
    transform-origin: bottom;
}

@keyframes wave3D {
    0% {
        transform: translateX(0) translateY(0) rotateX(0) rotateY(0) rotateZ(0);
    }
    25% {
        transform: translateX(-25%) translateY(-20px) rotateX(5deg) rotateY(10deg) rotateZ(2deg);
    }
    50% {
        transform: translateX(-50%) translateY(-40px) rotateX(-5deg) rotateY(-10deg) rotateZ(-2deg);
    }
    75% {
        transform: translateX(-75%) translateY(-20px) rotateX(3deg) rotateY(5deg) rotateZ(1deg);
    }
    100% {
        transform: translateX(-100%) translateY(0) rotateX(0) rotateY(0) rotateZ(0);
    }
}

/* Animated Function Buttons */
.animated-function {
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 15px;
    color: white;
    padding: 15px 30px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    transform-style: preserve-3d;
    animation: functionPulse 2s ease-in-out infinite;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

@keyframes functionPulse {
    0%, 100% {
        transform: scale(1) translateZ(0);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    }
    50% {
        transform: scale(1.05) translateZ(10px);
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    }
}

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

.animated-function:hover::before {
    left: 100%;
}

.animated-function:hover {
    transform: translateY(-5px) rotateX(10deg) rotateY(10deg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.animated-function:active {
    transform: translateY(-2px) rotateX(5deg) rotateY(5deg);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

/* Rainbow Glow Effect */
.rainbow-glow {
    animation: rainbowGlow 3s ease-in-out infinite;
}

@keyframes rainbowGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 0, 128, 0.8),
                    0 0 40px rgba(255, 140, 0, 0.6),
                    0 0 60px rgba(255, 215, 0, 0.4);
    }
    25% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.8),
                    0 0 40px rgba(0, 255, 0, 0.6),
                    0 0 60px rgba(0, 255, 255, 0.4);
    }
    50% {
        box-shadow: 0 0 20px rgba(0, 255, 255, 0.8),
                    0 0 40px rgba(0, 128, 255, 0.6),
                    0 0 60px rgba(128, 0, 255, 0.4);
    }
    75% {
        box-shadow: 0 0 20px rgba(128, 0, 255, 0.8),
                    0 0 40px rgba(255, 0, 128, 0.6),
                    0 0 60px rgba(255, 140, 0, 0.4);
    }
}

/* 3D Card Flip Animation */
.card-3d {
    perspective: 1000px;
    width: 100%;
    height: 200px;
}

.card-3d-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card-3d:hover .card-3d-inner {
    transform: rotateY(180deg);
}

.card-3d-front, .card-3d-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    color: white;
}

.card-3d-front {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.card-3d-back {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    transform: rotateY(180deg);
}

/* Floating Animation */
.floating {
    animation: floating 3s ease-in-out infinite;
}

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

/* Rotating Rainbow Border */
.rainbow-border {
    position: relative;
    background: white;
    border-radius: 15px;
    padding: 20px;
}

.rainbow-border::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(45deg, #ff0080, #ff8c00, #ffd700, #00ff00, #00ffff, #0080ff, #8000ff, #ff0080);
    background-size: 400% 400%;
    border-radius: 15px;
    z-index: -1;
    animation: rainbowBorder 3s ease infinite;
}

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

/* Game Container Enhancements */
#app {
    position: relative;
    z-index: 10;
    backdrop-filter: blur(2px);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    animation: appGlow 4s ease-in-out infinite;
}

@keyframes appGlow {
    0%, 100% {
        box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2),
                    0 0 50px rgba(255, 255, 255, 0.1);
    }
    50% {
        box-shadow: 0 30px 60px rgba(0, 0, 0, 0.3),
                    0 0 80px rgba(255, 255, 255, 0.2);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .animated-function {
        padding: 12px 24px;
        font-size: 14px;
    }
    
    .wave {
        height: 60px;
    }
    
    .card-3d {
        height: 150px;
    }
}

/* Loading Animation */
.loading-rainbow {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ff0080;
    animation: loadingRainbow 1s ease-in-out infinite;
}

@keyframes loadingRainbow {
    0% {
        transform: rotate(0deg);
        border-top-color: #ff0080;
    }
    25% {
        border-top-color: #ff8c00;
    }
    50% {
        border-top-color: #00ff00;
    }
    75% {
        border-top-color: #0080ff;
    }
    100% {
        transform: rotate(360deg);
        border-top-color: #ff0080;
    }
}
