<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>TANMAY Prediction with AutoPeriod</title>
    <style>
        body {
            margin: 0;
            font-family: 'Arial', sans-serif;
            background-color: #1e1e2d;
            color: white;
            display: flex;
            flex-direction: column;
            height: 100vh;
        }

        /* Prediction Bar Container */
        .prediction-container {
            background-color: #292a3d;
            width: 100%;
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 10px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
            border-radius: 30px; /* Fully curved edges */
        }

        /* Header Section */
        .header {
            text-align: center;
            font-size: 18px;
            font-weight: bold;
            margin-bottom: 10px;
        }

        /* Period Box */
        .period-box {
            margin-bottom: 10px;
            font-size: 14px;
            font-weight: bold;
            text-align: center;
            color: #f2f2f2;
        }

        /* Prediction Bar */
        .prediction-bar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            width: 90%;
        }

        /* Sliders */
        .sliders {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .slider-label {
            display: flex;
            align-items: center;
            font-size: 14px;
            gap: 10px;
        }

        .slider-label input {
            width: 40px;
            height: 20px;
            -webkit-appearance: none;
            appearance: none;
            background-color: #444;
            border-radius: 50px; /* Fully curved slider */
            position: relative;
            cursor: pointer;
            outline: none;
        }

        .slider-label input:checked {
            background-color: #007bff;
        }

        .slider-label input::before {
            content: '';
            position: absolute;
            width: 16px;
            height: 16px;
            background-color: white;
            border-radius: 50%;
            top: 2px;
            left: 2px;
            transition: all 0.3s ease;
        }

        .slider-label input:checked::before {
            left: 22px;
        }

        /* Prediction Section */
        .prediction-box {
            background-color: #33334c;
            padding: 10px 15px;
            border-radius: 30px;
            font-size: 14px;
            font-weight: bold;
            text-align: center;
            color: #ffeb3b;
            flex: 1;
            margin: 0 10px;
        }

        /* Timer Box */
        .timer-box {
            background-color: #444;
            width: 50px;
            height: 50px;
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 14px;
            font-weight: bold;
            color: white;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
        }

        /* Telegram Button */
        .telegram-button {
            background-color: #007bff;
            color: white;
            text-align: center;
            font-size: 14px;
            font-weight: bold;
            padding: 10px 20px;
            border-radius: 30px;
            cursor: pointer;
            margin-top: 15px;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
            transition: 0.3s ease;
            text-decoration: none;
        }

        .telegram-button:hover {
            background-color: #0056b3;
        }

        /* WebView */
        .webview-container {
            flex: 3;
            width: 100%;
            background-color: #fff;
            overflow: hidden;
            border-top-left-radius: 30px;
            border-top-right-radius: 30px;
        }

        .webview {
            width: 100%;
            height: 100%;
            border: none;
        }

        /* Wait Message */
        .wait-message {
            font-size: 14px;
            font-weight: bold;
            color: #ff5733;
            margin-top: 10px;
            display: none; /* Hidden by default */
        }
    </style>
</head>
<body>
    <!-- Prediction Bar Container -->
    <div class="prediction-container">
        <!-- Header Section -->
        <div class="header">𝙏𝘼𝙉𝙈𝘼𝙔 𝙂𝙊𝘿 𝙋𝙍𝙀𝘿𝙄𝘾𝙏𝙄𝙊𝙉</div>

        <!-- Period Box -->
        <div class="period-box" id="period1m">Period: -</div>

        <!-- Prediction Bar -->
        <div class="prediction-bar">
            <!-- Sliders -->
            <div class="sliders">
                <label class="slider-label">
                    Big/Small
                    <input type="radio" name="prediction" id="ᏰᎥᎶᎶᏕᎷᏗᏝᏝᏝ" onclick="setPredictionType('ᏰᎥᎶᎶ/ᏕᎷᏗᏝᏝᏝ')">
                </label>
                <label class="slider-label">
                    Red/Green
                    <input type="radio" name="prediction" id="RÈÐ♥️Gᵣₑₑₙ 💚" onclick="setPredictionType('RÈÐ♥️/Gᵣₑₑₙ 💚')">
                </label>
                <label class="slider-label">
                    Number
                    <input type="radio" name="prediction" id="number" onclick="setPredictionType('NUMBER')">
                </label>
            </div>

            <!-- Prediction Result -->
            <div class="prediction-box" id="predictionBox">
                Next result is: -
            </div>

            <!-- Timer -->
            <div class="timer-box" id="timerBox">60</div>
        </div>

        <!-- Wait for New Period Message -->
        <div class="wait-message" id="waitMessage">Wait for the New Period...</div>

        <!-- Telegram Button -->
        <a href="https://t.me/+D5G6xvumHfVhYmY1" class="telegram-button" target="_blank">Join Telegram</a>
    </div>

    <!-- WebView Container -->
    <div class="webview-container">
        <iframe class="webview" id="webview" src="https://91123.in"></iframe>
    </div>

    <script>
        let predictionType = null; 
        let periodEnded = true;
        let waitingForNewPeriod = false; 
        const predictionBox = document.getElementById('predictionBox');
        const timerBox = document.getElementById('timerBox');
        const periodBox = document.getElementById('period1m'); 
        const waitMessage = document.getElementById('waitMessage'); 

        // Set Prediction Type
        function setPredictionType(type) {
            predictionType = type;
            generateResult();
        }

        // Generate Prediction Result
        function generateResult() {
            if (periodEnded) {
                let result = '';
                if (predictionType === 'ᏰᎥᎶᎶ/ᏕᎷᏗᏝᏝᏝ') {
                    result = Math.random() < 0.5 ? 'ᏰᎥᎶᎶ' : 'ᏕᎷᏗᏝᏝᏝ';
                } else if (predictionType === 'RÈÐ♥️/Gᵣₑₑₙ 💚') {
                    result = Math.random() < 0.5 ? 'RÈÐ♥️' : 'Gᵣₑₑₙ 💚';
                } else if (predictionType === 'NUMBER') {
                    result = Math.floor(Math.random() * 10);
                } else {
                    result = 'Select Prediction Type';
                }
                predictionBox.textContent = `Next result is: ${result}`;
                periodEnded = false;
                waitMessage.style.display = 'none';
            }
        }

        // Timer and AutoPeriod Functionality
        function startAutoPeriod() {
            setInterval(() => {
                const calendar = new Date();
                const seconds = calendar.getUTCSeconds();
                const remainingSeconds = 60 - seconds;
                const minutes = calendar.getUTCMinutes();
                const hours = calendar.getUTCHours();
                const totalMinutes = hours * 60 + minutes;
                const periodNumber = `${calendar.getUTCFullYear()}${(calendar.getUTCMonth() + 1).toString().padStart(2, '0')}${calendar.getUTCDate().toString().padStart(2, '0')}1000${(10001 + totalMinutes)}`;
                periodBox.textContent = `Period: ${periodNumber}`;
                timerBox.textContent = remainingSeconds.toString().padStart(2, '0');

                if (remainingSeconds === 60 && predictionType) {
                    periodEnded = true;
                    waitMessage.style.display = 'block';
                    generateResult();
                }
            }, 1000);
        }

        window.onload = startAutoPeriod;
    </script>
</body>
</html>
    

