<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Fleaks Game req</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
    <style>
        body {
            background-color: black;
            color: white;
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            flex-direction: column;
            overflow: hidden;
            position: relative;
        }

        form {
            width: 100%;
            max-width: 400px;
            text-align: center;
            z-index: 10;
        }

        img {
            margin-top: 20px;
            cursor: pointer;
            transition: transform 0.3s ease; /* Transition for the scaling effect */
        }

        img:hover {
            transform: scale(1.1); /* Scale the image to 110% on hover */
        }

        .input-effect {
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }

        .input-effect:focus {
            transform: scale(1.05);
            box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
            outline: none;
        }

        .snowflake {
            position: absolute;
            top: -10px;
            color: white;
            font-size: 1em;
            opacity: 0.8;
            pointer-events: none;
            animation: fall linear infinite;
        }

        @keyframes fall {
            to {
                transform: translateY(100vh);
            }
        }

        .made-by {
            position: absolute;
            top: 10px;
            right: 10px;
            color: white;
            text-decoration: none;
            font-size: 14px;
        }

        .made-by:hover {
            text-decoration: underline;
        }

        .notification {
            position: fixed;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            background-color: rgba(0, 123, 255, 0.8);
            color: white;
            padding: 10px 20px;
            border-radius: 5px;
            opacity: 0;
            transition: opacity 0.5s ease;
            z-index: 100;
        }

        .notification.show {
            opacity: 1;
        }

        .shake {
            animation: shake 0.5s;
        }

        @keyframes shake {
            0% { transform: translateX(0); }
            25% { transform: translateX(-5px); }
            50% { transform: translateX(5px); }
            75% { transform: translateX(-5px); }
            100% { transform: translateX(0); }
        }

        .notification.error {
            background-color: rgba(255, 0, 0, 0.8);
        }

        .gold-button {
            position: absolute;
            top: 10px;
            left: 10px;
            background: linear-gradient(45deg, #ffd700, #ffa500, #ffb300);
            color: black;
            padding: 12px 24px;
            border: none;
            border-radius: 20px;
            cursor: pointer;
            font-size: 16px;
            font-weight: bold;
            text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
            box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
            animation: glow 2s ease-in-out infinite;
        }

        @keyframes glow {
            0% {
                box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
            }
            50% {
                box-shadow: 0 0 30px rgba(255, 215, 0, 0.8);
            }
            100% {
                box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
            }
        }
    </style>
</head>
<body>
    <a href="https://discord.com/users/1131745793628442624" class="made-by" target="_blank">made by flanch</a>
    <h1>fleaks</h1>
    <form onsubmit="sendMessage(event)">
        <div class="mb-3">
            <label for="messageInput" class="form-label">Enter your Game</label>
            <input type="text" class="form-control input-effect" id="messageInput" required>
        </div>
        <button type="submit" class="btn btn-primary" id="submitButton">Submit</button>
    </form>

    <a href="https://discord.gg/cTk5GbJT" target="_blank">
        <img src="https://static.vecteezy.com/system/resources/previews/006/892/622/non_2x/discord-logo-icons-editorial-collection-free-vector.jpg" alt="Discord Logo" width="100">
    </a>

    <button class="gold-button" onclick="window.location.href='http://fleaksvip.ct.ws/'">VIP</button>

    <div class="notification" id="notification"></div>

    <script>
        function createSnowflake() {
            const snowflake = document.createElement('div');
            snowflake.className = 'snowflake';
            snowflake.innerHTML = '❄';
            snowflake.style.left = Math.random() * 100 + 'vw';
            snowflake.style.fontSize = Math.random() * 1.5 + 0.5 + 'em';
            snowflake.style.animationDuration = Math.random() * 3 + 2 + 's';
            snowflake.style.opacity = Math.random();

            document.body.appendChild(snowflake);

            snowflake.addEventListener('animationend', () => {
                snowflake.remove();
            });
        }

        setInterval(() => {
            const numberOfSnowflakes = Math.floor(Math.random() * 1) + 1;
            for (let i = 0; i < numberOfSnowflakes; i++) {
                createSnowflake();
            }
        }, 500);

        let submittedMessages = JSON.parse(localStorage.getItem('submittedMessages')) || [];
        let cooldownEndTime = localStorage.getItem('cooldownEndTime') ? parseInt(localStorage.getItem('cooldownEndTime')) : 0;

        function updateCooldownDisplay() {
            const submitButton = document.getElementById('submitButton');
            const currentTime = Date.now();
            if (currentTime < cooldownEndTime) {
                const remainingCooldown = Math.ceil((cooldownEndTime - currentTime) / 1000);

                submitButton.innerText = `Cooldown... (${remainingCooldown}s)`;
                submitButton.disabled = true;
            } else {
                submitButton.innerText = 'Submit';
                submitButton.disabled = false;
            }
        }

        updateCooldownDisplay();

        async function sendMessage(ev) {
            ev.preventDefault();

            const messageContent = document.getElementById('messageInput').value;
            const notification = document.getElementById('notification');

            if (submittedMessages.includes(messageContent)) {
                notification.innerText = 'Game already requested!';
                notification.classList.add('show', 'shake', 'error');
                setTimeout(() => {
                    notification.classList.remove('show', 'shake', 'error');
                }, 3000);
                return;
            }

            const currentTime = Date.now();
            if (currentTime < cooldownEndTime) {
                updateCooldownDisplay();
                return;
            }

            let cooldownTime = 10;

            cooldownEndTime = currentTime + cooldownTime * 1000;
            localStorage.setItem('cooldownEndTime', cooldownEndTime);

            const interval = setInterval(() => {
                updateCooldownDisplay();
                if (Date.now() >= cooldownEndTime) {
                    clearInterval(interval);
                }
            }, 1000);

            const webhookBody = {
                content: messageContent,
            };

            const webhookUrl = 'https://discord.com/api/webhooks/1308116214370795521/17BCGV9xbjUGk94k4XbHT22SQ27uekskNkIfB98Fp1mvQBjod3R73ymZJidC0nkoPN5K';

            const response = await fetch(webhookUrl, {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json'
                },
                body: JSON.stringify(webhookBody)
            });

            if (response.ok) {
                notification.innerText = 'Game Requested successfully!';
                notification.classList.add('show');
                setTimeout(() => {
                    notification.classList.remove('show');
                }, 3000);
                submittedMessages.push(messageContent);
                localStorage.setItem('submittedMessages', JSON.stringify(submittedMessages));
            } else {
                notification.innerText = 'Error. Please try again later.';
                notification.classList.add('show', 'shake');
                setTimeout(() => {
                    notification.classList.remove('show', 'shake');
                }, 3000);
            }
        }
    </script>
</body>
</html>