<html lang="en"><head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>𝐖𝐈𝐍𝐆𝐎 𝟏 𝐌𝐈𝐍 𝐏𝐑𝐄𝐃𝐈𝐂𝐓𝐈𝐎𝐍</title>

    <script src="js/chart.js"></script>
    


<style>

    /* General Styles */
    body {
        font-family: 'Courier New', Courier, monospace; /* Monospaced font for hacker feel */
        background-color: #121212; /* Dark background for a hacker look */
        color: #00FF41; /* Neon green text color for that classic hacker look */
        margin: 0;
        padding: 0;
        text-align: center;
        overflow-x: hidden; /* Prevent horizontal scroll */
        overflow-y: auto;  /* Allow vertical scrolling */
        height: 100vh; /* Ensure the body takes full viewport height */
    }

    /* Container styles to prevent overflow */
    .container {
        max-width: 100%;  /* Prevent any horizontal overflow */
        overflow-x: hidden; /* Prevent horizontal scroll */
        height: 100%;  /* Take full screen height */
    }

    /* Login Box */
    .login-container {
        background: rgba(0, 0, 0, 0.8); /* Dark, semi-transparent background */
        padding: 40px;
        border-radius: 10px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.8);
        text-align: center;
        width: 350px;
        margin: auto;
        border: 2px solid #00FF41; /* Neon green border */
        transition: all 0.3s ease-in-out;
        max-width: 100%; /* Prevent overflow on smaller screens */
        box-sizing: border-box;
    }

    .login-container:hover {
        box-shadow: 0 8px 16px rgba(0, 255, 65, 0.4);
    }

    h2 {
        color: #00FF41; /* Neon green color */
        font-size: 28px;
        margin-bottom: 20px;
    }

    /* Input Fields */
    .input-box {
        width: 100%;
        padding: 12px;
        margin: 10px 0;
        border: 1px solid #333;
        border-radius: 5px;
        background: #1d1d1d;
        color: #00FF41;
        font-size: 16px;
        outline: none;
        transition: all 0.3s ease;
        box-sizing: border-box;
    }

    .input-box:focus {
        border: 1px solid #00FF41;
        background: #333333;
        color: #00FF41;
    }

    /* Glowing Button */
    .login-btn, .telegram-btn {
        width: 100%;
        padding: 14px;
        border: none;
        border-radius: 5px;
        font-size: 16px;
        color: white;
        cursor: pointer;
        background: #00FF41; /* Neon green */
        box-shadow: 0 4px 12px rgba(0, 255, 65, 0.3);
        transition: all 0.3s ease-in-out;
        max-width: 100%; /* Prevent overflow */
        box-sizing: border-box;
    }

    .login-btn:hover, .telegram-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(0, 255, 65, 0.5);
    }

    .login-btn:active, .telegram-btn:active {
        transform: translateY(0);
    }

    /* Message Display */
    #message {
        margin-top: 15px;
        font-size: 14px;
        color: #FF6347; /* Bright red message color for alerts */
    }

    /* Table Styling */
    table {
        width: 100%;
        border-collapse: collapse;
        background: #1d1d1d;
        border-radius: 8px;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
        table-layout: fixed; /* Prevent table from expanding beyond width */
        word-wrap: break-word; /* Ensure content doesn't overflow */
    }

    th, td {
        padding: 12px;
        text-align: center;
        border-bottom: 1px solid #333;
        font-size: 14px;
        color: #00FF41;
    }

    th {
        background: #333;
        color: #00FF41;
        font-weight: bold;
    }

    tr:hover {
        background: rgba(0, 255, 65, 0.1);
    }

    /* Dashboard (Initially Hidden) */
        .dashboard {
            display: none;
            text-align: center;
            padding: 0px;
            }

    /* Card Design */
    .card {
        max-width: 90%;
        margin: 20px auto;
        padding: 20px;
        border-radius: 8px;
        background: rgba(0, 255, 65, 0.1);
        border: 2px solid #00FF41;
        box-shadow: 0px 0px 20px #00FF41;
        overflow: hidden; /* Ensure no content overflows the card */
    }

    /* Glowing Buttons */
    .glow-button {
        display: inline-block;
        padding: 10px 20px;
        border-radius: 5px;
        text-decoration: none;
        color: white;
        font-weight: bold;
        transition: 0.3s;
        background: linear-gradient(90deg, #00FF41, #00CC36);
        box-shadow: 0px 0px 20px #00FF41;
    }

    .glow-button:hover {
        transform: scale(1.1);
        box-shadow: 0px 0px 30px #00FF41;
    }

    /* Prediction Chart */
    #predictionChart {
        width: 100%;
        height: 250px;
        border: 2px solid #00FF41;
        border-radius: 8px;
        background-color: #1d1d1d;
        box-sizing: border-box; /* Ensure content stays within bounds */
    }

    .pagination {
        display: flex;
        justify-content: center;
        margin-top: 20px;
    }

    .pagination button {
        padding: 10px 20px;
        margin: 0 5px;
        border: none;
        border-radius: 5px;
        background-color: #333;
        color: #00FF41;
        cursor: pointer;
        transition: background-color 0.3s ease, transform 0.2s ease;
        max-width: 100%;
        box-sizing: border-box;
    }

    .pagination button:hover {
        background-color: #00FF41;
        color: #121212;
        transform: scale(1.05);
    }

    .pagination button:disabled {
        background-color: #333;
        cursor: not-allowed;
    }

    #timeRemaining {
        font-size: 24px;
        font-weight: bold;
        text-align: center;
        color: #00FF41;
    }

    #predictedNumber, #predictedPremium {
        font-size: 18px;
        text-align: center;
        margin: 10px 0;
        color: #00FF41;
    }

    /* Button Group */
    .button-group {
        display: flex;
        justify-content: center;
        margin: 20px 0;
    }

    .button-group a {
        padding: 10px 20px;
        margin: 0 10px;
        border-radius: 5px;
        cursor: pointer;
        text-decoration: none;
        color: #121212; /* Dark color for text */
        background-color: #00FF41; /* Neon green */
        transition: background-color 0.3s ease, transform 0.2s ease;
        max-width: 100%;
        box-sizing: border-box;
    }

    .button-group a:hover {
        background-color: #00CC36;
        transform: scale(1.05);
    }

</style>





</head>

<body>

<div class="mainContent">
        <!-- Login Form -->
        <div class="login-container" id="loginBox">
            <h2>Login</h2>
            <form id="loginForm">
                <input type="email" id="email" class="input-box" placeholder="Enter Email" required>
                <input type="password" id="password" class="input-box" placeholder="Enter Password" required>
                <button type="submit" class="login-btn">Login</button>
            </form>
            <p id="message"></p>
            <a href="https://t.me/ColorTraderPro" target="_blank">
                <button class="telegram-btn">Join Us on Telegram</button>
            </a>
        </div>

    <!-- Main Content -->
    <div class="dashboard" id="dashboard">


    <h1>𝐖𝐈𝐍𝐆𝐎 𝟏 𝐌𝐈𝐍 𝐏𝐑𝐄𝐃𝐈𝐂𝐓𝐈𝐎𝐍</h1>
    
                <p id="message"></p>
            <a href="https://www.55wingoe.com/#/register?invitationCode=885723619234">
                <button class="telegram-btn">REGISTER NOW!!</button>
            </a>

    <div class="card">

        <h2>©ColorTraderPro™</h2>

        <p id="predictedNumber">Prediction :--</p>

        <p id="predictedPremium">Enjoy: --</p>

    </div>

    <div class="card">

        <h2>Timer</h2>

        <p id="timeRemaining">--:--</p>

        

    <div class="button-group">

    </div>

    </div>

    <div class="card">

        <h2>Collected Data</h2>

        <table id="dataTable">

            <thead>

                <tr>

                    <th>Issue Number</th>

                    <th>Number</th>

                    <th>Colour</th>

                    <th>Premium</th>

                </tr>

            </thead>

            <tbody>

                <!-- Data rows will be inserted here -->

            </tbody>

        </table>

    </div>

    <div class="card">

        <h2>Prediction History</h2>

        <table id="predictionHistoryTable">

            <thead>

                <tr>

                    <th>Issue Number</th>

                    <th>Prediction</th>

                    <th>Actual Number</th>

                    <th>Result</th>

                </tr>

            </thead>

            <tbody></tbody>

        </table>

        <div class="pagination">

            <button id="prevPage" disabled="">Previous</button>

            <button id="nextPage" disabled="">Next</button>

        </div>

    </div>

    <div class="card">

        <h2>Devloper  @ColorTraderPro™</h2>

        <div class="button-group">

            <p id="message"></p>
            <a href="https://t.me/ColorTraderPro" target="_blank">
                <button class="telegram-btn">Join Us on Telegram</button>
            </a>

    </div>

<script>
document.addEventListener('DOMContentLoaded', function() {
    const tableBody = document.querySelector('#dataTable tbody');
    const predictedNumberElement = document.getElementById('predictedNumber');
    const predictedPremiumElement = document.getElementById('predictedPremium');
    const timerElement = document.getElementById('timeRemaining');
    const historyTableBody = document.querySelector('#predictionHistoryTable tbody');
    const prevPageButton = document.getElementById('prevPage');
    const nextPageButton = document.getElementById('nextPage');

    let predictionHistory = JSON.parse(localStorage.getItem('predictionHistory')) || [];
    let lastPrediction = JSON.parse(localStorage.getItem('lastPrediction'));
    let currentPrediction = JSON.parse(localStorage.getItem('currentPrediction')) || {};
    let currentPage = 0;
    const itemsPerPage = 10;
    let timerInterval;

    const fetchNoAverageEmerdList = () => {
        return fetch('https://api.bdg88zf.com/api/webapi/GetNoaverageEmerdList', {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json;charset=UTF-8',
                'Accept': 'application/json, text/plain, */*'
            },
            body: JSON.stringify({
                pageSize: 10,
                pageNo: 1,
                typeId: 1,
                language: 0,
                random: "ded40537a2ce416e96c00e5218f6859a",
                signature: "69306982EEEB19FA940D72EC93C62552",
                timestamp: Math.floor(Date.now() / 1000)
            })
        })
        .then(response => response.json())
        .catch(error => console.error('Error fetching data:', error));
    };

    const fetchGameIssue = () => {
        return fetch('https://api.bdg88zf.com/api/webapi/GetGameIssue', {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json;charset=UTF-8',
                'Accept': 'application/json, text/plain, */*'
            },
            body: JSON.stringify({
                typeId: 1,
                language: 0,
                random: "f8dcb5c527814db68800e3946a2b60e8",
                signature: "08CF7FF3339ED58D4743F4B650FCBEA9",
                timestamp: Math.floor(Date.now() / 1000)
            })
        })
        .then(response => response.json())
        .catch(error => console.error('Error fetching game issue:', error));
    };

    // Function to categorize number as "BIG" or "SMALL"
    const categorizeBigSmall = (number) => {
        return number >= 0 && number <= 4 ? 'SMALL' : 'BIG';
    };

    // Function to categorize number as "Red" or "Green" based on pattern
    const categorizeRedGreen = (number) => {
        return [0, 2, 4, 6, 8].includes(number) ? 'Red' : 'Green';
    };

    // Function to track frequencies of Big/Small and Red/Green in history
    const getLastCategoryFrequencies = (numbers) => {
        let redCount = 0;
        let greenCount = 0;
        let bigCount = 0;
        let smallCount = 0;
        
        numbers.forEach(number => {
            if (categorizeBigSmall(number) === 'BIG') {
                bigCount++;
            } else {
                smallCount++;
            }
            if (categorizeRedGreen(number) === 'Red') {
                redCount++;
            } else {
                greenCount++;
            }
        });

        return { redCount, greenCount, bigCount, smallCount };
    };

    // Generate prediction based on the frequencies of Big/Small and Red/Green
    const generatePrediction = (lastNumbers) => {
        const { redCount, greenCount, bigCount, smallCount } = getLastCategoryFrequencies(lastNumbers);

        let predictedOption = {};
        let chancePercentage = 0;

        // First, decide if we should predict Big/Small or Red/Green
        if (bigCount + smallCount > redCount + greenCount) {
            // Focus on Big/Small prediction
            if (bigCount / (bigCount + smallCount) > 0.8) {
                predictedOption = { size: 'BIG' };
                chancePercentage = 90; // 90% chance for BIG
            } else if (smallCount / (bigCount + smallCount) > 0.8) {
                predictedOption = { size: 'SMALL' };
                chancePercentage = 90; // 90% chance for SMALL
            } else {
                // If unsure, mix up with Red/Green
                predictedOption = Math.random() > 0.5 ? { size: 'BIG' } : { size: 'SMALL' };
                chancePercentage = 60;
            }
        } else {
            // Focus on Red/Green prediction
            if (redCount / (redCount + greenCount) > 0.8) {
                predictedOption = { color: 'Red' };
                chancePercentage = 90; // 90% chance for Red
            } else if (greenCount / (redCount + greenCount) > 0.8) {
                predictedOption = { color: 'Green' };
                chancePercentage = 90; // 90% chance for Green
            } else {
                // If unsure, mix up with Big/Small
                predictedOption = Math.random() > 0.5 ? { color: 'Red' } : { color: 'Green' };
                chancePercentage = 60;
            }
        }

        return { predictedOption, chancePercentage };
    };

    // Save result and prediction to history
    const savePredictionToHistory = (prediction, result, issueNumber, actualNumber) => {
        predictionHistory.unshift({
            issueNumber: issueNumber,
            predictedOption: prediction,
            result: result,
            actualNumber: actualNumber
        });

        if (predictionHistory.length > 10) {
            predictionHistory.pop();
        }

        localStorage.setItem('predictionHistory', JSON.stringify(predictionHistory));
    };

    // Evaluate prediction based on actual number
    const evaluatePrediction = (predictedOption, actualNumber) => {
        let result = 'Loss';

        if (predictedOption.size) {
            // Check size prediction (BIG or SMALL)
            if (predictedOption.size === 'BIG' && actualNumber >= 5 && actualNumber <= 9) {
                result = 'Win';
            }
            if (predictedOption.size === 'SMALL' && actualNumber >= 0 && actualNumber <= 4) {
                result = 'Win';
            }
        } else if (predictedOption.color) {
            // Check color prediction (Red or Green)
            if (predictedOption.color === 'Red' && [0, 2, 4, 6, 8].includes(actualNumber)) {
                result = 'Win';
            }
            if (predictedOption.color === 'Green' && [1, 3, 5, 7, 9].includes(actualNumber)) {
                result = 'Win';
            }
        }

        return result;
    };

    const updateDataAndPrediction = () => {
        fetchNoAverageEmerdList()
            .then(data => {
                const list = data.data.list;
                tableBody.innerHTML = '';

                list.forEach(item => {
                    const row = document.createElement('tr');
                    row.innerHTML = `
                        <td>${item.issueNumber}</td>
                        <td>${item.number}</td> <!-- Show actual number here -->
                        <td>${item.colour}</td>
                        <td>${item.premium}</td>
                    `;
                    tableBody.appendChild(row);
                });

                const latestIssue = list[0].issueNumber;
                const latestActual = Number(list[0].number);

                const last10Numbers = list.slice(0, 10).map(item => Number(item.number));

                // If new period, update prediction and save history
                if (!lastPrediction || lastPrediction.issueNumber !== latestIssue) {
                    const { predictedOption, chancePercentage } = generatePrediction(last10Numbers);

                    let result = evaluatePrediction(predictedOption, latestActual);

                    savePredictionToHistory(predictedOption, result, latestIssue, latestActual);

                    currentPrediction = {
                        issueNumber: latestIssue,
                        predictedOption: predictedOption,
                        chancePercentage: chancePercentage
                    };

                    localStorage.setItem('currentPrediction', JSON.stringify(currentPrediction));
                }

                if (currentPrediction.predictedOption) {
                    predictedNumberElement.textContent = `Prediction: ${currentPrediction.predictedOption.size || currentPrediction.predictedOption.color}`;
                    predictedPremiumElement.textContent = `Chance: ${currentPrediction.chancePercentage}%`;

                } else {
                    predictedNumberElement.textContent = "Prediction: Pending";
                    predictedPremiumElement.textContent = "";
                }

                lastPrediction = { ...currentPrediction };
                localStorage.setItem('lastPrediction', JSON.stringify(lastPrediction));

                updatePredictionHistoryTable();
            })
            .catch(error => console.error('Error updating prediction:', error));
    };

    const updatePredictionHistoryTable = () => {
        historyTableBody.innerHTML = '';
        const start = currentPage * itemsPerPage;
        const end = start + itemsPerPage;
        const paginatedHistory = predictionHistory.slice(start, end);

        paginatedHistory.forEach(entry => {
            const row = document.createElement('tr');
            row.innerHTML = `
                <td>${entry.issueNumber}</td>
                <td>${entry.predictedOption.size || entry.predictedOption.color}</td>
                <td>${entry.actualNumber}</td>
                <td>${entry.result}</td>
            `;
            historyTableBody.appendChild(row);
        });

        prevPageButton.disabled = currentPage === 0;
        nextPageButton.disabled = end >= predictionHistory.length;
    };

    const updateTimer = () => {
        fetchGameIssue()
            .then(data => {
                const { endTime } = data.data;
                const endDate = new Date(endTime);
                const now = new Date();
                const remainingTimeMs = endDate - now;

                if (remainingTimeMs <= 0) {
                    timerElement.textContent = "Time Remaining: 00:00:00";
                    clearInterval(timerInterval);
                    updateDataAndPrediction();
                    updateTimer();
                } else {
                    const minutes = String(Math.floor((remainingTimeMs % (1000 * 60 * 60)) / (1000 * 60))).padStart(2, '0');
                    const seconds = String(Math.floor((remainingTimeMs % (1000 * 60)) / 1000)).padStart(2, '0');
                    timerElement.textContent = `Time Remaining: 00:${minutes}:${seconds}`;
                }
            })
            .catch(error => console.error('Error fetching game issue for timer:', error));
    };

    updateDataAndPrediction();
    updateTimer();
    timerInterval = setInterval(() => {
        updateTimer();
        updateDataAndPrediction();
    }, 1000);

    updatePredictionHistoryTable();
});
</script>





    <!-- Firebase Integration and Login Handling -->

<script type="module">
    // Firebase v9+ import
    import { initializeApp } from "https://www.gstatic.com/firebasejs/9.0.0/firebase-app.js";
    import { getAuth, signInWithEmailAndPassword, signOut } from "https://www.gstatic.com/firebasejs/9.0.0/firebase-auth.js";

    // Firebase Configuration
    const firebaseConfig = {
            apiKey: "AIzaSyBL1KlVtPLoGgkhsH1QnkrEkV_s9x7-Mws",

            authDomain: "colortraderpro-panel.firebaseapp.com",

            databaseURL: "https://colortraderpro-panel-default-rtdb.firebaseio.com",

            projectId: "colortraderpro-panel",

            storageBucket: "colortraderpro-panel.firebasestorage.app",

            messagingSenderId: "612198052901",

            appId: "1:612198052901:android:26b24e8056ca9f26953bcc"
    };

    // Initialize Firebase
    const app = initializeApp(firebaseConfig);
    const auth = getAuth(app);

    // Login Function
    document.getElementById('loginForm').addEventListener('submit', function(event) {
        event.preventDefault();
        
        const email = document.getElementById('email').value;
        const password = document.getElementById('password').value;

        signInWithEmailAndPassword(auth, email, password)
            .then((userCredential) => {
                document.getElementById('message').innerText = "Login Successful!";
                document.getElementById('message').style.color = "#00ff00";

                // Dashboard Show
                setTimeout(() => {
                    document.getElementById('loginBox').style.display = "none";
                    document.getElementById('dashboard').style.display = "block";
                }, 1000);
            })
            .catch((error) => {
                document.getElementById('message').innerText = "Invalid Email or Password!";
                document.getElementById('message').style.color = "#ff4b2b";
            });
    });

    // Logout Function
    function logout() {
        signOut(auth).then(() => {
            document.getElementById('loginBox').style.display = "block";
            document.getElementById('dashboard').style.display = "none";
        }).catch((error) => {
            console.error("Logout Error:", error);
        });
    }
</script>

</div></body></html>