<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Pokemon Leaf Green Embed</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            overflow: hidden; /* Prevent overflow */
        }
        iframe {
            border: none;
            width: 100%; /* Full width */
            height: 100%; /* Full height */
            max-width: 800px; /* Maximum width for larger screens */
            max-height: 600px; /* Maximum height for larger screens */
            transition: opacity 0.5s ease; /* Fade in effect */
            opacity: 0; /* Start as invisible */
            position: absolute; /* Overlay */
        }

        /* Loader container */
        .loader-container {
            display: flex;
            justify-content: center;
            align-items: center;
            position: absolute;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.7); /* Semi-transparent background */
            z-index: 10; /* Above iframe */
            animation: pulseBg 1.5s infinite alternate; /* Pulsing background */
        }

        /* Pulse background animation */
        @keyframes pulseBg {
            0% {
                background: rgba(0, 0, 0, 0.7);
            }
            100% {
                background: rgba(0, 0, 0, 0.85);
            }
        }

        /* Cool Spinner animation */
        .spinner {
            width: 100px;
            height: 100px;
            border: 8px solid rgba(255, 255, 255, 0.1);
            border-top: 8px solid #f1c40f;
            border-right: 8px solid #e74c3c;
            border-radius: 50%;
            animation: spin 1s linear infinite;
            box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
        }

        /* Keyframes for spin */
        @keyframes spin {
            0% {
                transform: rotate(0deg);
            }
            100% {
                transform: rotate(360deg);
            }
        }

        /* Text animation */
        .loader-text {
            font-family: 'Arial', sans-serif;
            font-size: 24px;
            color: #fff;
            margin-top: 20px;
            animation: blinkText 1.5s ease-in-out infinite;
        }

        /* Blinking text animation */
        @keyframes blinkText {
            0% {
                opacity: 1;
            }
            50% {
                opacity: 0.5;
            }
            100% {
                opacity: 1;
            }
        }
    </style>
</head>
<body>

    <!-- Loading animation container -->
    <div class="loader-container" id="loader">
        <div class="spinner"></div>
        <div class="loader-text">Loading the Game...</div>
    </div>

    <iframe 
        id="gameIframe"
        src="about:blank" 
        title="Pokemon Leaf Green Launcher"
        allow="fullscreen; autoplay; encrypted-media"
        loading="lazy">
    </iframe>

    <script>
        // Load the game after the main content
        document.addEventListener("DOMContentLoaded", function() {
            const iframe = document.getElementById("gameIframe");
            const loader = document.getElementById("loader");

            // Add a delay before loading the iframe
            setTimeout(function() {
                iframe.src = "https://dps2004.github.io/gba/launcher.html#pokemonleafgreen"; // Set the source
                iframe.onload = function() {
                    iframe.style.opacity = 1; // Fade in effect
                    loader.style.opacity = 0; // Hide the loader
                    setTimeout(() => loader.remove(), 300); // Remove loader after fade out
                };
            }, 1500); // 1.5-second delay before loading
        });
    </script>

</body>
</html>
