<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>BLADE MODS Login</title>
    <script src="https://cdn.jsdelivr.net/particles.js/2.0.0/particles.min.js"></script>
    <style>
        body, html {
            margin: 0;
            padding: 0;
            height: 100%;
            overflow: hidden;
            font-family: Arial, sans-serif;
            transition: background-color 2s linear;
        }

        /* Snow Particle Animation */
        #particles-js {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: -1;
        }

        .linear1, .linear2 {
            display: none;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            text-align: center;
            color: white;
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 0 15px rgba(0, 0, 0, 0.7);
            background-color: rgba(0, 0, 0, 0.8);
        }

        .linear1 {
            display: block;
        }

        button {
            margin-top: 10px;
            padding: 10px;
            cursor: pointer;
            background-color: rgba(0, 0, 0, 0.7);
            color: white;
            border: none;
            border-radius: 5px;
        }

        input {
            padding: 10px;
            margin: 10px;
            width: 200px;
            font-size: 16px;
        }

        .text-view {
            font-size: 24px;
            margin-bottom: 10px;
        }

        /* Popup Modal */
        .popup {
            display: none;
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: rgba(0, 0, 0, 0.9);
            color: white;
            padding: 20px;
            border-radius: 10px;
            text-align: center;
            box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
            z-index: 1000;
        }

        .popup button {
            margin-top: 10px;
            background-color: white;
            color: black;
            border: none;
            padding: 5px 10px;
            cursor: pointer;
            border-radius: 5px;
        }

        .popup-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            z-index: 999;
        }
    </style>
</head>
<body>

    <!-- Snow Particle Background -->
    <div id="particles-js"></div>

    <!-- Login Page (linear1) -->
    <div id="linear1" class="linear1">
        <h2 id="textview1" class="text-view">BLADE MODS</h2>
        <input type="text" id="username" placeholder="Enter Username"><br><br>
        <input type="password" id="password" placeholder="Enter Password"><br><br>
        <button id="button1" onclick="login()">LOGIN</button>
        <p id="loginMessage"></p>
    </div>

    <!-- Second Page (linear2) -->
    <div id="linear2" class="linear2">
        <h2 id="textview5" class="text-view">BLADE MODS</h2>
        <h3>Period: <span id="textview6"></span></h3>
        <h3>Time Left: <span id="textview7"></span></h3>
        <h3>Result: <span id="textview4"></span></h3>
        <button id="button2" onclick="checkResult()">Check Result</button>
        <button id="button3" onclick="redirectTelegram()">Join Telegram</button>
    </div>

    <!-- Popup Modal -->
    <div id="popupOverlay" class="popup-overlay"></div>
    <div id="popupMessage" class="popup">
        <p id="popupText"></p>
        <button onclick="closePopup()">OK</button>
    </div>

    <script>
        let canCheckResult = false;

        // Show popup message
        function showPopup(message) {
            document.getElementById("popupText").innerText = message;
            document.getElementById("popupOverlay").style.display = "block";
            document.getElementById("popupMessage").style.display = "block";
        }

        // Close popup
        function closePopup() {
            document.getElementById("popupOverlay").style.display = "none";
            document.getElementById("popupMessage").style.display = "none";
        }

        // Login functionality
        function login() {
            const username = document.getElementById("username").value;
            const password = document.getElementById("password").value;

            if (username === "BLADE MODS" && password === "BLADE_SRS") {
                showPopup("Login Success");
                document.getElementById("linear1").style.display = "none";
                document.getElementById("linear2").style.display = "block";
                startTimer();
            } else {
                showPopup("Invalid Credentials");
            }
        }

        // Redirect to Telegram channel
        function redirectTelegram() {
            window.location.href = "https://t.me/AFMBLADE";
        }

        // Pick random result (BIG or SMALL)
        function checkResult() {
            if (!canCheckResult) {
                showPopup("Wait For Next Period");
                return;
            }
            const result = Math.random() < 0.5 ? "BIG" : "SMALL";
            document.getElementById("textview4").innerText = result;
            canCheckResult = false;
        }

        // Start timer function
        function startTimer() {
            setInterval(() => {
                const now = new Date();
                const seconds = now.getSeconds();
                const remainingSeconds = 60 - seconds;

                document.getElementById("textview7").innerText = `00:${remainingSeconds < 10 ? "0" : ""}${remainingSeconds}`;

                if (remainingSeconds === 60) {
                    canCheckResult = true;
                }
            }, 1000);
        }

        // Auto background color change
        function changeBackgroundColor() {
            const colors = ["#1a1a2e", "#16213e", "#0f3460", "#e94560", "#ff5722", "#673ab7", "#3f51b5"];
            let index = 0;

            setInterval(() => {
                document.body.style.backgroundColor = colors[index];
                index = (index + 1) % colors.length;
            }, 5000);
        }
        changeBackgroundColor();

        // Snow particle effect
        particlesJS("particles-js", {
            particles: {
                number: { value: 100 },
                size: { value: 3 },
                move: { speed: 1, direction: "bottom" },
                opacity: { value: 0.7 },
                color: { value: "#ffffff" },
                shape: { type: "circle" },
                line_linked: { enable: false }
            }
        });
    </script>

</body>
</html>
