<!DOCTYPE html>
<html lang="th">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>SMS SPAMMER</title>
    <style>
        body {
            font-family: 'Poppins', sans-serif;
            margin: 0;
            padding: 0;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            height: 100vh;
            color: #fff;
            background-image: url('https://media1.tenor.com/m/X2OlfXMC0rgAAAAd/blue-archive.gif');
            background-size: cover;
            background-position: center;
            background-attachment: fixed;
            animation: gradientAnimation 10s ease infinite;
            overflow: hidden;
        }

        h1 {
            color: #ffffff;
            font-size: 56px;
            font-weight: bold;
            text-shadow: 0px 4px 10px rgba(0, 0, 0, 0.8), 0 0 25px #ff00ff, 0 0 10px #ff00ff;
            animation: textAnimation 1.5s ease-in-out infinite alternate;
        }

        @keyframes textAnimation {
            0% {
                color: #ff00ff;
                text-shadow: 0px 0px 10px #ff80ff, 0px 0px 20px #ff00ff;
            }
            100% {
                color: #ff80ff;
                text-shadow: 0px 0px 10px #ff00ff, 0px 0px 30px #ff80ff;
            }
        }

        .form-group label {
            font-size: 20px;
            color: #ff66cc;
            text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
            margin-bottom: 10px;
        }

        .form-group input {
            padding: 12px;
            font-size: 18px;
            border-radius: 10px;
            border: 2px solid #ff66cc;
            margin: 10px 0;
            width: 100%;
            box-sizing: border-box;
            background: rgba(255, 255, 255, 0.15);
            color: #fff;
            transition: all 0.3s ease;
        }

        .form-group input:focus {
            outline: none;
            border-color: #ff00ff;
            box-shadow: 0 0 8px rgba(255, 0, 255, 0.7);
        }

        button {
            background: #ff00ff;
            color: #fff;
            padding: 18px;
            font-size: 20px;
            border-radius: 12px;
            border: none;
            cursor: pointer;
            transition: all 0.3s ease;
            width: 100%;
            margin-top: 20px;
        }

        button:hover {
            background: #ff66cc;
            transform: scale(1.05);
            box-shadow: 0 0 20px rgba(255, 0, 255, 0.7);
        }

        .loader {
            margin-top: 20px;
            display: none;
            font-family: 'Courier New', Courier, monospace;
            font-size: 22px;
            color: #ff00ff;
            animation: loaderAnimation 1.5s infinite;
        }

        @keyframes loaderAnimation {
            0% { text-shadow: 0 0 5px #ff00ff, 0 0 10px #ff00ff; }
            50% { text-shadow: 0 0 15px #ff00ff, 0 0 30px #ff00ff; }
            100% { text-shadow: 0 0 5px #ff00ff, 0 0 10px #ff00ff; }
        }

        .response {
            margin-top: 20px;
            font-size: 18px;
            font-weight: bold;
            text-shadow: 1px 1px 5px rgba(0, 0, 0, 0.7);
        }

        .snowflake {
            position: fixed;
            top: 0;
            left: 0;
            width: 15px;
            height: 15px;
            background-color: #ffffff;
            border-radius: 50%;
            animation: snowflakeAnimation 10s linear infinite;
        }

        @keyframes snowflakeAnimation {
            0% { transform: translateY(0) translateX(0); }
            100% { transform: translateY(100vh) translateX(100vw); }
        }

        @media (max-width: 600px) {
            h1 {
                font-size: 40px;
            }

            .form-group input,
            button {
                font-size: 16px;
            }
        }
    </style>
</head>
<body>

    <div class="container">
        <center><h1>สแปมข้อความและโทร</h1></center>

        <div class="form-group">
            <label for="keycs">🔐 คีย์</label>
            <input type="text" id="keycs" placeholder="ใส่คีย์ (1-10 ตัวอักษร)">
        </div>
        <div class="form-group">
            <label for="phone">📱 เบอร์เป้าหมาย (เบอร์ไทย)</label>
            <input type="text" id="phone" placeholder="ใส่เบอร์โทร 10 หลัก เช่น 0912345678" maxlength="10">
        </div>
        <div class="form-group">
            <label for="count">⏲️ จำนวนข้อความที่จะส่ง</label>
            <input type="number" id="count" placeholder="1-5" min="1" max="5">
        </div>
        <button id="submit-btn">🚀 คลิ๊กตรงนี้เพื่อเริ่มทำการแสปม 🚀</button>

        <div class="loader" id="loader">กำลังดำเนินการ...</div>
        <div id="response" class="response"></div>
    </div>

    <audio id="background-music" src="bfhmsc.mp3" autoplay loop></audio>

    <script>
        document.getElementById('submit-btn').addEventListener('click', async () => {
            const keycs = document.getElementById('keycs').value;
            const phone = document.getElementById('phone').value;
            const count = parseInt(document.getElementById('count').value);
            const responseDiv = document.getElementById('response');
            const loader = document.getElementById('loader');

            if (!keycs || keycs.length > 10) {
                responseDiv.textContent = 'กรุณาใส่คีย์ให้ถูกต้อง (1-10 ตัวอักษร)!';
                responseDiv.style.color = 'red';
                return;
            }

            if (!phone || phone.length !== 10 || !/^\d+$/.test(phone)) {
                responseDiv.textContent = 'กรุณาใส่เบอร์โทร 10 หลักให้ถูกต้อง';
                responseDiv.style.color = 'red';
                return;
            }

            if (isNaN(count) || count < 1 || count > 5) {
                responseDiv.textContent = 'กรุณาใส่จำนวน 1 - 5';
                responseDiv.style.color = 'red';
                return;
            }

            try {
                loader.style.display = 'block';
                const apiUrl = `https://api.cyber-safe.cloud/api/spamsms/${keycs}/${phone}/${count}`;
                const response = await fetch(apiUrl);
                if (response.ok) {
                    const data = await response.json();
                    loader.style.display = 'none';
                    if (data.success) {
                        responseDiv.textContent = `กำลังส่งข้อความไปที่เบอร์ ${phone} จำนวน ${count} ครั้ง`;
                        responseDiv.style.color = 'purple';
                    } else {
                        responseDiv.textContent = 'เกิดข้อผิดพลาด: ' + data.error;
                        responseDiv.style.color = 'red';
                    }
                } else {
                    loader.style.display = 'none';
                    responseDiv.textContent = 'เกิดข้อผิดพลาด: ไม่สามารถเชื่อมต่อกับ API ได้';
                    responseDiv.style.color = 'red';
                }
            } catch (error) {
                loader.style.display = 'none';
                responseDiv.textContent = 'เกิดข้อผิดพลาด: ' + error.message;
                responseDiv.style.color = 'red';
            }
        });

        function createSnowflakes() {
            for (let i = 0; i < 50; i++) {
                const snowflake = document.createElement('div');
                snowflake.classList.add('snowflake');
                snowflake.style.left = `${Math.random() * 100}vw`;
                snowflake.style.animationDuration = `${Math.random() * 10 + 5}s`;
                snowflake.style.animationDelay = `${Math.random() * 10}s`;
                document.body.appendChild(snowflake);
            }
        }
        createSnowflakes();
    </script>
</body>
</html>
