<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Live Crypto Prices</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            font-family: Arial, sans-serif;
            background-color: #000;
            color: #0f0;
            text-align: center;
        }
                .stars {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            z-index: -1;
            pointer-events: none;
        }

        /* CODED BY - DARK LMNx9 */
        .star {
            position: absolute;
            background-color: #00ff00;
            border-radius: 50%;
            opacity: 0;
            animation: twinkle 1.5s infinite alternate;
        }

        /* CODED BY - DARK LMNx9 */
@keyframes twinkle {
            0% {
                opacity: 0.5;
                transform: scale(1);
            }
            50% {
                opacity: 1;
                transform: scale(1.2);
            }
            100% {
                opacity: 0.5;
                transform: scale(1);
            }
        }

                /* CODED BY - DARK LMNx9 */
        .header-box {
            padding: 5px;
            margin: 20px auto;
            background-color: rgba(0, 0, 0, 0.9);
            border: 2px solid #00ff00;
            border-radius: 5px;
            max-width: 250px;
        }
        /* CODED BY - DARK LMNx9 */
        .header-box h1, .header-box p {
            margin: 5px 0;
        }
        /* CODED BY - DARK LMNx9 */
        .header-box .developer {
            font-size: 16px;
            font-weight: bold;
            color: #00ff00;
            text-decoration: none;
        }
        /* CODED BY - DARK LMNx9 */
        .header-box .developer:hover {
            color: #00cc00;
        }
                /* CODED BY - DARK LMNx9 */
        .container {
            padding: 20px;
            max-width: 480px;
            margin: auto;
        }
                /* CODED BY - DARK LMNx9 */
        .circle-container {
            margin: 20px auto 10px;
        }
        /* CODED BY - DARK LMNx9 */
        .circle-image {
            width: 120px;
            height: 120px;
            margin: 20px auto;
            border: 3px solid #00ff00;
            border-radius: 50%;
            overflow: hidden;
        }
        /* CODED BY - DARK LMNx9 */
        .circle-image img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .button-container {
            margin: 1px 0;
        }
        /* CODED BY - DARK LMNx9 */
        .button {
            display: inline-block;
            width: 120px;
            padding: 10px;
            margin: 10px;
            background-color: #00ff3c;
            color: #000;
            text-align: center;
            border: none;
            border-radius: 5px;
            font-size: 16px;
            cursor: pointer;
            text-decoration: none;
            font-weight: bold;
        }
        .button:hover {
            background-color: #00ff37;
        }
        /* CODED BY - DARK LMNx9 */
        .search-bar {
            position: relative;
            margin-bottom: 20px;
            border: 2px solid #0f0;
            border-radius: 5px;
            overflow: hidden;
        }
        /* CODED BY - DARK LMNx9 */
        .search-bar input {
            width: 100%;
            padding: 10px;
            font-size: 16px;
            border: none;
            outline: none;
            color: #0f0;
            background-color: #000;
        }

        .search-bar input::placeholder {
            color: #0f0;
        }
        /* CODED BY - DARK LMNx9 */
        .suggestions {
            position: absolute;
            top: 100%;
            left: 0;
            width: 100%;
            max-height: 150px;
            overflow-y: auto;
            background-color: #000;
            border: 1px solid #0f0;
            z-index: 10;
        }
        /* CODED BY - DARK LMNx9 */
        .suggestions div {
            padding: 10px;
            cursor: pointer;
        }

        .suggestions div:hover {
            background-color: #0f0;
            color: #000;
        }
        /* CODED BY - DARK LMNx9 */
        .crypto-list {
            border: 2px solid #0f0;
            padding: 10px;
            border-radius: 5px;
            margin-top: 20px;
        }
        /* CODED BY - DARK LMNx9 */
        .crypto-item {
            display: flex;
            justify-content: space-between;
            padding: 10px 0;
            border-bottom: 1px solid #0f0;
        }

        .crypto-item:last-child {
            border-bottom: none;
        }
        /* CODED BY - DARK LMNx9 */
        .crypto-item span {
            font-size: 16px;
        }

        .loading {
            text-align: center;
            font-size: 18px;
            margin-top: 10px;
        }
    </style>
</head>
<body>
    <div class="stars" id="stars"></div>
    <div class="circle-container">
            <div class="circle-image">
                <img src="https://raw.githubusercontent.com/LMNx9-CYBER-999/About-LMNx9/refs/heads/main/images%20(3).png" alt="LMNx9 Logo">
            </div>
        </a>
    </div>
    <div class="header-box">
        <h1>Crypto LIVE Price</h1>
        <p>Get Always Updated Live Price</p>
        <a class="developer"> Developed By - DARK LMNx9 </a>
    </div>
    <div class="button-container">
        <button class="button" onclick="location.reload();"><cite>REFRESH</cite></button>
        <button class="button" onclick="location.href='file:///android_asset/LMNx2.html';"><cite>CONVERTER</cite></button>
    </div>

    <div class="container">
        <div class="search-bar">
            <input 
                type="text" 
                id="searchInput" 
                placeholder="Search crypto with name..." 
                oninput="showSuggestions()">
            <div class="suggestions" id="suggestionsBox"></div>
        </div>

        <div class="crypto-list" id="cryptoList"></div>
        <div class="loading" id="loadingSpinner" style="display: none;">Loading...</div>
    </div>

    <script>
            
        function checkNetwork() {
            if (navigator.onLine) {
                console.log(""); 
            } else {
            window.location.href = 'file:///android_asset/LMNx4.html';
                }
            }
            
        const apiUrl = "https://api.coingecko.com/api/v3/coins/markets";
        const vsCurrency = "usd";
        let allCryptoData = [];

        function fetchAllCryptos() {
            const loadingSpinner = document.getElementById("loadingSpinner");
            loadingSpinner.style.display = "block";
        /* CODED BY - DARK LMNx9 */
            fetch(`${apiUrl}?vs_currency=${vsCurrency}&order=market_cap_desc&per_page=250&page=1`)
                .then(response => response.json())
                .then(data => {
                    allCryptoData = data;
                    displayCryptoData(allCryptoData);
                    loadingSpinner.style.display = "none";
                })
                .catch(err => {
                    console.error("Error fetching crypto data:", err);
                    loadingSpinner.style.display = "none";
                });
        }
        /* CODED BY - DARK LMNx9 */
        function displayCryptoData(data) {
            const cryptoList = document.getElementById("cryptoList");
            cryptoList.innerHTML = "";
        /* CODED BY - DARK LMNx9 */
            data.forEach(crypto => {
                const cryptoItem = `
                    <div class="crypto-item">
                        <span>${crypto.name} (${crypto.symbol.toUpperCase()})</span>
                        <span>$${crypto.current_price.toFixed(2)}</span>
                    </div>`;
                cryptoList.innerHTML += cryptoItem;
            });
        }
        /* CODED BY - DARK LMNx9 */
        function showSuggestions() {
            const searchInput = document.getElementById("searchInput").value.toLowerCase();
            const suggestionsBox = document.getElementById("suggestionsBox");
        /* CODED BY - DARK LMNx9 */
            if (!searchInput) {
                suggestionsBox.innerHTML = "";
                displayCryptoData(allCryptoData);
                return;
            }
        /* CODED BY - DARK LMNx9 */
            const filteredData = allCryptoData.filter(crypto => 
                crypto.name.toLowerCase().includes(searchInput) || 
                crypto.symbol.toLowerCase().includes(searchInput)
            );
        /* CODED BY - DARK LMNx9 */
            suggestionsBox.innerHTML = "";
            filteredData.slice(0, 10).forEach(crypto => {
                const suggestionItem = `
                    <div onclick="selectCrypto('${crypto.id}')">
                        ${crypto.name} (${crypto.symbol.toUpperCase()})
                    </div>`;
                suggestionsBox.innerHTML += suggestionItem;
            });
        /* CODED BY - DARK LMNx9 */
            displayCryptoData(filteredData);
        }
        /* CODED BY - DARK LMNx9 */
        function selectCrypto(cryptoId) {
            const selectedCrypto = allCryptoData.find(crypto => crypto.id === cryptoId);
            if (selectedCrypto) {
                displayCryptoData([selectedCrypto]);
            }
        /* CODED BY - DARK LMNx9 */
            document.getElementById("searchInput").value = "";
            document.getElementById("suggestionsBox").innerHTML = "";
        }
        /* CODED BY - DARK LMNx9 */
        fetchAllCryptos();
        function generateStars() {
            const starsContainer = document.getElementById('stars');
            const starCount = 200;
        /* CODED BY - DARK LMNx9 */
            for (let i = 0; i < starCount; i++) {
                const star = document.createElement('div');
                star.classList.add('star');

                const size = Math.random() * 2 + 1;
                const left = Math.random() * 100 + 'vw';
                const top = Math.random() * 100 + 'vh';
                const delay = Math.random() * 1 + 's';

                star.style.width = size + 'px';
                star.style.height = size + 'px';
                star.style.left = left;
                star.style.top = top;
                star.style.animationDuration = (Math.random() * 2 + 1) + 's';
                star.style.animationDelay = delay;
                starsContainer.appendChild(star);
            }
        }
        /* CODED BY - DARK LMNx9 */
        checkNetwork();
        window.onload = generateStars;
    </script>
</body>
</html>
