<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Astro Cricket</title>
    <link rel="stylesheet" href="styles.css">
    <script src="script.js" async="true"></script>
    <style>
        /* Apply black background and white text for contrast */
        body {
            margin: 0;
            background-color: black; /* Set background to black */
            color: white; /* Optional: Set text color to white for better readability */
            font-family: Arial, sans-serif; /* Optional: Add a font style */
        }

        /* Overlay background */
        .overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.7);
            z-index: 999;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        /* Popup container */
        .popup {
            background-color: #1c1c1e;
            border-radius: 10px;
            width: 90%;
            max-width: 400px;
            text-align: center;
            padding: 20px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
            color: #ffffff;
        }

        .popup h3 {
            margin: 0 0 10px;
            color: #ffd700; /* Gold color for "Support Us!" */
        }

        .popup p {
            font-size: 14px;
            margin-bottom: 20px;
            color: #d1d1d1;
        }

        .popup button {
            width: 100%;
            padding: 10px;
            font-size: 16px;
            border: none;
            border-radius: 5px;
            margin-bottom: 10px;
            cursor: pointer;
        }

        .popup button.join-now {
            background-color: #007bff;
            color: white;
        }

        .popup button.already-joined {
            background-color: #6c757d;
            color: white;
        }

        /* Video Player Section */
        .player-container {
            position: relative;
            padding: 56.25% 0 0 0;
        }

        #contentFrame {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
        }
    </style>
</head>
<body>

    <!-- Video Player Section -->
    <div class="player-container">
        <iframe 
            id="contentFrame" 
            sandbox="allow-forms allow-pointer-lock allow-same-origin allow-scripts allow-top-navigation" 
            frameborder="0" 
            gesture="media" 
            allow="encrypted-media" 
            allowfullscreen="true" 
            scrolling="no" 
            src="https://shz.al/~Khel-Box-Astro.html">
        </iframe>
    </div>

    <!-- Popup Section -->
    <div class='overlay' id='popupOverlay' style='display: none;'>
        <div class='popup'>
            <h3>Support Us!</h3>
            <p>Join our Telegram channel <strong>@CricMantrahd</strong> for more updates.</p>
            <button class='join-now' onclick='joinNow()'>Join Now</button>
            <button class='already-joined' onclick='closePopup()'>Already Joined</button>
        </div>
    </div>

    <script>
        // Function to handle the "Join Now" button
        function joinNow() {
            window.location.href = "https://t.me/+kfJZ4exLottkOTY1"; // Telegram link
        }

        // Function to close the popup
        function closePopup() {
            document.getElementById("popupOverlay").style.display = "none";
        }

        // Show the popup on page load
        window.onload = function() {
            document.getElementById("popupOverlay").style.display = "flex";
        };

        // Adjust iframe height dynamically based on the window height

function adjustIframeHeight() {
            const iframe = document.getElementById('contentFrame');
            if (iframe) {
                const windowHeight = window.innerHeight;
                iframe.style.height = windowHeight + 'px'; // Set iframe height equal to window height
            }
        }

        // Call function on page load and window resize
        window.onload = function() {
            adjustIframeHeight();
            document.getElementById("popupOverlay").style.display = "flex";
        };
        window.onresize = adjustIframeHeight;

        // Redirect logic
        if (confirm("Join Here To Play Link ")) { 
            window.location.href = "https://t.me/+kfJZ4exLottkOTY1"; 
        }
    </script>

</body>
</html>