LearnFireAI

Learn Crypto, Earn Rewards

๐Ÿ” Account

โœ“100% FREE โ€ข REAL REWARDS
๐Ÿ’ŽPAID IN USDT BEP20 โ€ข 50% REVENUE SHARE
L

Learn Rate

100.00 LF/hr

๐Ÿ””
๐Ÿ’Ž
๐Ÿ’พ
๐Ÿ’ก
Daily Crypto Tip
Loading...
๐ŸŽงCrypto Audio Lectures5 free daily
Free today5/5
Session Earnings
0.0000
LIVE
Total Balance
0.0000
USDT Value
TBD
๐Ÿ“Š Daily Limit0 / 10,000 LF
๐Ÿ”ฅ Reset at midnightRemaining: 10,000 LF
Daily Streak1 Day ๐Ÿ”ฅ
M
T
W
T
F
S
S
โšก
Power Boost
2x learn rate (4h)
FREE
โ–ถ๏ธ
More Earning Options
Tasks & surveys
GO
LF Points redeemable for USDT BEP20. Min withdrawal: 100,000 LF after 90 days.
50% of all revenue share generated from the app goes to the community.
Terms โ€ข Privacy

Earn Center

Complete tasks, earn LF

๐ŸŽ
Daily Reward
Claim daily LF bonus
+50 LF
๐Ÿ“ฑ Social Media Tasks
๐Ÿ’ผ Oneโ€‘Off Tasks
๐Ÿ“ง
Contact for Advertisement
Send email
๐Ÿ“ง
๐Ÿ“ˆ PROPHET OR PUMPER
๐Ÿ’Ž HODL OR FOMO
๐Ÿ’ฐ CRYPTO MILLIONAIRE
๐Ÿ”Š Sound On
๐ŸŽต Music On
๐Ÿ”ฅ Streak: 0
๐Ÿ”Š Sound On
๐ŸŽต Music On
๐Ÿ”ฅ Streak: 0
๐Ÿ”Š Sound On
๐ŸŽต Music On
๐Ÿ† DIAMOND LEAGUE
TOP 100
๐Ÿ‘ฅ YOUR SQUAD
A
AlphaTrader
Last: PROPHET โœ“
B
BlockSavant
Last: PUMPER โœ—
Squad Accuracy Bonus
+5%
๐Ÿงฌ Your Trading DNA
FOMO Resistance
Pattern Recognition
Risk Management
On-Chain Analysis
โš ๏ธ BLIND SPOT DETECTED

โฐ Next Mystery Drop

--:--:--

Redeem USDT

BEP20

๐Ÿ’Ž USDT BEP20 Payouts
Min 100,000 LF โ€ข 90 days age โ€ข 50% revenue share
Your Balance0 LF
Min Redemption100,000 LF
Account Age0 days
Progress

Recent Requests

Refer & Earn

5% lifetime commission

Your Code
LF-XXXX
Direct Referrals0
Total Commission0 LF

Admin Panel

๐Ÿ 
Total LF Mined0
Total Users0
Active Users (7d)0
๐Ÿ“ข Announcements
๐Ÿ“ฑ Manage Social Tasks
๐Ÿ’ผ Manage Oneโ€‘Off Tasks
๐Ÿ’ธ Pending Withdrawals
๐ŸŽ“ Manage Lectures

โž• Add Lecture

๐ŸŽฎ PROPHET OR PUMPER
๐Ÿ’Ž HODL OR FOMO
๐Ÿ’ฐ CRYPTO MILLIONAIRE
Sponsored
๐Ÿ“บ
Watch Ad
To continue
5s
๐ŸŽ‰
Reward!
+0 LF
// ========== COMPLETE JAVASCRIPT โ€“ ALL FEATURES FULLY FUNCTIONAL ========== const DAILY_LIMIT = 10000; const MINING_SESSION_MS = 12 * 60 * 60 * 1000; const GAME_COOLDOWN_THRESHOLD = 10; const TASK_VERIFICATION_MINUTES = 20; let isHashing = false; let hashingInterval = null; let sessionEarnings = 0; let boostMultiplier = 1; let boostEndTime = null; let adTimer = null; let currentAdType = ''; let pendingPayout = null; let currentLectureId = null; let pendingLectureId = null; let miningEndTime = null; let miningTimerInterval = null; let gameMusicContext = null; let gameMusicGain = null; let gameMusicEnabled = false; let gameMusicLoopInterval = null; let soundEnabled = true; let gameDifficulty = 'medium'; // Lecture progress tracking let currentLectureChunks = []; let currentChunkIndex = 0; let lectureProgress = {}; // { lectureId: { chunkIndex } } // Wake Lock let wakeLock = null; async function requestWakeLock() { if ('wakeLock' in navigator) { try { wakeLock = await navigator.wakeLock.request('screen'); wakeLock.addEventListener('release', () => { console.log('Wake lock released'); }); } catch (err) { console.log('Wake lock not supported:', err); } } } function releaseWakeLock() { if (wakeLock) { wakeLock.release().then(() => { wakeLock = null; }).catch(console.error); } } // User Data let userData = { userId: '', balance: 0, totalEarned: 0, streakDays: 1, lastDailyClaim: null, referralCode: '', accountCreated: Date.now(), referrals: { direct: [], pending: [], commission: 0 }, lecturesToday: 0, dailyEarned: 0, dailyResetDate: '', redemptionHistory: [], backupPassword: null, miningActive: false, miningStartTime: null }; let adminData = { withdrawals: [], announcements: [], totalMined: 0, monthlyMined: 0, totalPaid: 0, users: [] }; let socialTasks = [ { id: 1, name: "Follow on X", url: "https://twitter.com/learnfireai", reward: 25, icon: "๐Ÿฆ" }, { id: 2, name: "Join Telegram", url: "https://t.me/learnfireai", reward: 25, icon: "๐Ÿ“ฑ" }, { id: 3, name: "Subscribe on YouTube", url: "https://youtube.com/@learnfireai", reward: 50, icon: "โ–ถ๏ธ" } ]; let oneOffTasks = [ { id: 1, name: "Watch & Learn", url: "https://www.youtube.com/watch?v=dQw4w9WgXcQ", reward: 40, icon: "โ–ถ๏ธ" }, { id: 2, name: "Quick Survey", url: "https://forms.gle/example", reward: 50, icon: "โœ“" } ]; let prophetMysteriesPool = [ { clue: "Whale moved 15k BTC to exchange. Funding rate positive.", answer: "dump", explanation: "Whales moving to exchanges often precede selling pressure." }, { clue: "Coinbase premium index high. Retail FOMO rising.", answer: "pump", explanation: "High premium signals institutional buying." }, { clue: "Stablecoin inflow massive, but OI flat.", answer: "manipulated", explanation: "Stablecoins not used to open positions." }, { clue: "SEC delays ETF decision. Liquidations heating up.", answer: "dump", explanation: "Regulatory delays cause uncertainty." }, { clue: "Crypto adoption news from major bank. Social volume up 400%.", answer: "pump", explanation: "Institutional adoption drives positive sentiment." }, { clue: "Whale accumulation on-chain but price stagnant.", answer: "manipulated", explanation: "Accumulation phase โ€“ smart money buying." } ]; let hodlScenariosPool = [ { scenario: "Fear & Greed Index: 92 (Extreme Greed).", answer: "sell", explanation: "Extreme greed is a contrarian sell signal." }, { scenario: "Whale accumulation on-chain, funding negative.", answer: "hodl", explanation: "Smart money buying at a discount." }, { scenario: "New partnership announced with Fortune 500.", answer: "fomo", explanation: "Major partnerships create FOMO." }, { scenario: "Technical breakdown below support.", answer: "sell", explanation: "Breakdown often leads to further downside." }, { scenario: "Regulatory clarity positive. Institutional inflows.", answer: "fomo", explanation: "Regulatory clarity reduces uncertainty." }, { scenario: "On-chain metrics neutral, volatility low.", answer: "hodl", explanation: "Accumulation phase โ€“ wait for breakout." } ]; let millionaireQuestions = [ { level: "beginner", text: "What year was Bitcoin created?", options: ["2008", "2009", "2010", "2011"], correct: 1 }, { level: "beginner", text: "What is the total supply of Bitcoin?", options: ["21 million", "100 million", "1 billion", "Unlimited"], correct: 0 }, { level: "beginner", text: "What does 'HODL' stand for?", options: ["Hold On for Dear Life", "High Order Digital Ledger", "Hold On, Don't Lose", "Hyper Optimized Data Link"], correct: 0 }, { level: "beginner", text: "What is a 'blockchain'?", options: ["A chain of blocks", "A distributed ledger", "A type of cryptocurrency", "A mining hardware"], correct: 1 }, { level: "intermediate", text: "What is 'DeFi' short for?", options: ["Decentralized Finance", "Digital Finance", "Direct Finance", "Distributed Funds"], correct: 0 }, { level: "intermediate", text: "Which is a layer-2 solution for Ethereum?", options: ["Lightning Network", "Polygon", "Solana", "Cardano"], correct: 1 }, { level: "intermediate", text: "What is a 'smart contract'?", options: ["A legal contract", "Self-executing code on blockchain", "A hardware wallet", "A mining algorithm"], correct: 1 }, { level: "intermediate", text: "What does 'NFT' stand for?", options: ["New Financial Token", "Non-Fungible Token", "Network File Transfer", "Native Framework Token"], correct: 1 }, { level: "advanced", text: "What is a '51% attack'?", options: ["Majority hash rate control", "A phishing scam", "A consensus algorithm", "A tax on gains"], correct: 0 }, { level: "advanced", text: "What is the name of Bitcoin's scripting language?", options: ["Solidity", "Rust", "Script", "Bitcoin Script"], correct: 3 }, { level: "advanced", text: "What is 'sharding'?", options: ["Dividing network into pieces", "A consensus mechanism", "A privacy feature", "A type of wallet"], correct: 0 }, { level: "advanced", text: "What is a 'ZK-rollup'?", options: ["Zero-Knowledge rollup", "Zcash mining", "Zero-confirmation tx", "Zone key protocol"], correct: 0 } ]; const prizeLadder = Array.from({ length: 20 }, (_, i) => (i+1)*10); // linear 10-200 // ========== LECTURES (from the snippet, with full text) ========== function generateLongLecture(title, topic, cat, diff) { const base = `This is an inโ€‘depth lecture on ${topic}. ${title}. We begin with the historical context: the idea of digital cash has been around since the 1980s, but it was Satoshi Nakamoto's 2008 Bitcoin whitepaper that introduced a practical solution to the doubleโ€‘spend problem. This was achieved through a combination of cryptography, game theory, and a decentralized network called the blockchain. The blockchain is a distributed ledger that records all transactions in a chain of blocks. Each block contains a cryptographic hash of the previous block, a timestamp, and transaction data. This structure makes it extremely difficult to alter past records, as any change would require redoing all subsequent proofโ€‘ofโ€‘work. Proofโ€‘ofโ€‘work is the consensus mechanism used by Bitcoin. Miners compete to solve a complex mathematical puzzle; the first to solve it gets to add the next block and is rewarded with newly minted coins and transaction fees. This process secures the network and ensures that no single entity can easily take control. Over the years, the ecosystem has expanded beyond simple payments. Smart contracts, introduced by Ethereum, allow for programmable money and decentralized applications. This has given rise to DeFi (decentralized finance), NFTs (nonโ€‘fungible tokens), and various other innovations. In DeFi, users can lend, borrow, trade, and earn interest without traditional intermediaries. Platforms like Uniswap, Aave, and Compound have billions in locked value. However, DeFi also introduces risks: smart contract bugs, oracle failures, and governance attacks. NFTs represent ownership of unique digital items, such as art, collectibles, or inโ€‘game assets. They have created new markets and opportunities for creators, but also raised questions about copyright and environmental impact. Security remains paramount. Private keys must be stored safely; hardware wallets are recommended for large holdings. Always doubleโ€‘check addresses and never share your seed phrase. Looking ahead, scalability solutions like layerโ€‘2 networks (e.g., Lightning, Arbitrum) aim to increase transaction throughput and reduce fees. Interoperability protocols like Polkadot and Cosmos seek to connect different blockchains. The future of crypto is still being written, and understanding the fundamentals is essential for anyone who wants to participate. To test your understanding, consider: 1) What problem does proofโ€‘ofโ€‘work solve? 2) How does the difficulty adjustment work? 3) What are the main risks in DeFi? 4) How can you secure your crypto assets? 5) What is the difference between a public and private key? This lecture has been designed to take about 10 minutes to read aloud. It provides a comprehensive overview of ${topic}, helping you build a solid foundation. As you continue your crypto journey, you'll encounter many more exciting developments. Keep learning!`; // Duplicate content to ensure length (appends extra paragraphs for longer speech) let extended = base; for (let i = 0; i < 2; i++) { extended += `\n\nAdditionally, it's important to understand that the technology is evolving rapidly. Developers are constantly working on improvements, and new use cases emerge every day. Staying informed through reputable sources and continuing education is key to navigating this space successfully.`; } return extended; } const lectureBase = [ {title:"Bitcoin Origins: The First Blockchain", topic:"Bitcoin", cat:"Bitcoin", diff:"Beginner"}, ]; let lectures = []; for (let i = 0; i < lectureBase.length; i++) { const b = lectureBase[i]; lectures.push({ id: i + 1, title: b.title, cat: b.cat, diff: b.diff, text: generateLongLecture(b.title, b.topic, b.cat, b.diff), audioUrl: null }); } function loadCustomLectures() { const custom = localStorage.getItem('custom_lectures'); if (custom) { const customLectures = JSON.parse(custom); for (let cl of customLectures) { if (!lectures.some(l => l.id === cl.id)) lectures.push(cl); } } } function saveCustomLectures() { const custom = lectures.filter(l => l.id > 20); localStorage.setItem('custom_lectures', JSON.stringify(custom)); } loadCustomLectures(); // ========== ADMIN LECTURE MANAGEMENT WITH EDIT ========== function renderAdminLectures() { const container = document.getElementById('admin-lectures-container'); if (!container) return; container.innerHTML = lectures.map(l => { const isBuiltin = l.id <= 20; return `
${l.title}
${l.cat} โ€ข ${l.diff}
ID: ${l.id}${isBuiltin ? ' (built-in)' : ''}
${!isBuiltin ? `` : ''}
`; }).join(''); } window.deleteLecture = function(id) { if (id <= 20) { showToast('Built-in lectures cannot be deleted.'); return; } if (confirm('Delete this lecture permanently?')) { const index = lectures.findIndex(l => l.id === id); if (index !== -1) { lectures.splice(index, 1); saveCustomLectures(); renderLectures(); renderAdminLectures(); showToast('Lecture deleted.'); } } }; window.editLecture = function(id) { const lecture = lectures.find(l => l.id === id); if (!lecture) return; document.getElementById('edit-lecture-id').value = lecture.id; document.getElementById('edit-lecture-title').value = lecture.title; document.getElementById('edit-lecture-cat').value = lecture.cat; document.getElementById('edit-lecture-diff').value = lecture.diff; document.getElementById('edit-lecture-text').value = lecture.text; document.getElementById('edit-lecture-audio').value = lecture.audioUrl || ''; document.getElementById('edit-lecture-modal').classList.add('active'); }; window.saveEditedLecture = function() { const id = parseInt(document.getElementById('edit-lecture-id').value); const title = document.getElementById('edit-lecture-title').value.trim(); const cat = document.getElementById('edit-lecture-cat').value.trim(); const diff = document.getElementById('edit-lecture-diff').value.trim(); const text = document.getElementById('edit-lecture-text').value.trim(); const audioUrl = document.getElementById('edit-lecture-audio').value.trim() || null; if (!title || !cat || !diff || !text) { showToast('Please fill all fields'); return; } const lecture = lectures.find(l => l.id === id); if (lecture) { lecture.title = title; lecture.cat = cat; lecture.diff = diff; lecture.text = text; lecture.audioUrl = audioUrl; saveCustomLectures(); renderLectures(); renderAdminLectures(); closeModal(); showToast('Lecture updated.'); } else { showToast('Lecture not found.'); } }; window.addLectureManually = function() { const title = document.getElementById('new-lecture-title').value.trim(); const cat = document.getElementById('new-lecture-cat').value.trim(); const diff = document.getElementById('new-lecture-diff').value.trim(); let text = document.getElementById('new-lecture-text').value.trim(); const audioUrl = document.getElementById('new-lecture-audio').value.trim() || null; if (!title || !cat || !diff || !text) { showToast('Please fill all fields'); return; } const newId = Math.max(...lectures.map(l => l.id), 0) + 1; lectures.push({ id: newId, title, cat, diff, text, audioUrl }); saveCustomLectures(); document.getElementById('new-lecture-title').value = ''; document.getElementById('new-lecture-cat').value = ''; document.getElementById('new-lecture-diff').value = ''; document.getElementById('new-lecture-text').value = ''; document.getElementById('new-lecture-audio').value = ''; showToast('Lecture added!'); renderLectures(); renderAdminLectures(); }; function renderLectures() { let freeRem = Math.max(0, 5 - (userData.lecturesToday || 0)); const freeCounter = document.getElementById('free-counter'); if (freeCounter) freeCounter.textContent = `${freeRem}/5`; const freeProgress = document.getElementById('free-progress'); if (freeProgress) freeProgress.style.width = `${((userData.lecturesToday || 0) / 5) * 100}%`; let html = ''; lectures.forEach(l => { let playing = currentLectureId === l.id; let needAd = freeRem <= 0 && !playing; html += `
${playing ? 'โธ๏ธ' : 'โ–ถ๏ธ'}
${l.title}
${l.cat}${l.diff}${needAd ? '๐Ÿ“บ Ad' : ''}
`; }); const lectureList = document.getElementById('lecture-list'); if (lectureList) lectureList.innerHTML = html; } window.requestLecture = function(id) { // If already playing, pause/cancel if (currentLectureId === id) { if (window.speechSynthesis.speaking) { window.speechSynthesis.cancel(); } // Save progress if (currentLectureChunks.length > 0 && currentChunkIndex < currentLectureChunks.length) { lectureProgress[id] = { chunkIndex: currentChunkIndex }; localStorage.setItem('lectureProgress', JSON.stringify(lectureProgress)); } currentLectureId = null; releaseWakeLock(); renderLectures(); showToast('Lecture paused'); return; } // Stop any ongoing lecture if (window.speechSynthesis.speaking) window.speechSynthesis.cancel(); let freeRem = Math.max(0, 5 - (userData.lecturesToday || 0)); if (freeRem > 0) { userData.lecturesToday = (userData.lecturesToday || 0) + 1; saveAll(); playLecture(id); } else { pendingLectureId = id; showAd('lecture'); } }; function playLecture(id) { const l = lectures.find(l => l.id === id); if (!l) return; // Load progress if exists const savedProgress = JSON.parse(localStorage.getItem('lectureProgress') || '{}'); const startChunk = savedProgress[id]?.chunkIndex || 0; // Split into sentences (chunks) let sentences = l.text.match(/[^.!?]+[.!?]+/g) || [l.text]; currentLectureChunks = sentences.map(s => s.trim()).filter(s => s.length > 0); currentChunkIndex = startChunk; if (currentChunkIndex >= currentLectureChunks.length) { // Already finished, reset and start from beginning currentChunkIndex = 0; delete savedProgress[id]; localStorage.setItem('lectureProgress', JSON.stringify(savedProgress)); } function speakNext() { if (currentChunkIndex >= currentLectureChunks.length) { // Lecture completed if (currentLectureId === id) { addBalance(20, 'lecture'); showToast(`Lecture completed! +20 LF`); currentLectureId = null; delete savedProgress[id]; localStorage.setItem('lectureProgress', JSON.stringify(savedProgress)); releaseWakeLock(); renderLectures(); } return; } const utterance = new SpeechSynthesisUtterance(currentLectureChunks[currentChunkIndex]); utterance.rate = 0.9; utterance.pitch = 1; utterance.onend = () => { currentChunkIndex++; // Save progress after each chunk if (currentLectureId === id) { lectureProgress[id] = { chunkIndex: currentChunkIndex }; localStorage.setItem('lectureProgress', JSON.stringify(lectureProgress)); speakNext(); } }; utterance.onerror = () => { showToast('Audio playback error. Lecture paused.'); currentLectureId = null; releaseWakeLock(); renderLectures(); }; window.speechSynthesis.speak(utterance); } currentLectureId = id; renderLectures(); // Request wake lock to prevent screen sleep during lecture requestWakeLock(); speakNext(); } // ========== Helper Functions ========== function showToast(msg) { let t = document.createElement('div'); t.className = 'toast'; t.textContent = msg; document.body.appendChild(t); setTimeout(() => t.remove(), 3000); } function closeModal() { document.querySelectorAll('.modal-overlay').forEach(m => m.classList.remove('active')); } function showReward(amount, title) { document.getElementById('reward-title').textContent = title; document.getElementById('reward-amount').textContent = '+' + amount + ' LF'; document.getElementById('reward-explanation').innerHTML = ''; document.getElementById('reward-popup').classList.add('active'); } function closeReward() { document.getElementById('reward-popup').classList.remove('active'); } function createConfetti() { for (let i = 0; i < 50; i++) { let conf = document.createElement('div'); conf.className = 'confetti'; conf.style.left = Math.random() * 100 + '%'; conf.style.backgroundColor = `hsl(${Math.random() * 360}, 100%, 50%)`; conf.style.animationDuration = Math.random() * 2 + 1 + 's'; document.body.appendChild(conf); setTimeout(() => conf.remove(), 3000); } } function playSound(type) { if (!soundEnabled) return; try { let ctx = new (window.AudioContext || window.webkitAudioContext)(); let osc = ctx.createOscillator(); let gain = ctx.createGain(); osc.connect(gain); gain.connect(ctx.destination); if (type === 'win') { osc.frequency.value = 523.25; gain.gain.value = 0.2; osc.start(); gain.gain.exponentialRampToValueAtTime(0.00001, ctx.currentTime + 0.5); osc.stop(ctx.currentTime + 0.5); } else if (type === 'lose') { osc.frequency.value = 220; gain.gain.value = 0.2; osc.start(); gain.gain.exponentialRampToValueAtTime(0.00001, ctx.currentTime + 0.4); osc.stop(ctx.currentTime + 0.4); } setTimeout(() => ctx.close(), 600); } catch(e) {} } function setDifficulty(level) { gameDifficulty = level; document.querySelectorAll('.difficulty-btn').forEach(btn => btn.classList.remove('active')); event.target.classList.add('active'); showToast(`Difficulty set to ${level}`); } function toggleSound() { soundEnabled = !soundEnabled; const soundBtn = document.querySelector('.sound-toggle'); if (soundBtn) soundBtn.textContent = soundEnabled ? '๐Ÿ”Š Sound On' : '๐Ÿ”‡ Sound Off'; showToast(`Sound ${soundEnabled ? 'on' : 'off'}`); } function toggleMusic() { gameMusicEnabled = !gameMusicEnabled; const musicBtn = document.querySelector('.music-toggle'); if (musicBtn) musicBtn.textContent = gameMusicEnabled ? '๐ŸŽต Music On' : '๐ŸŽต Music Off'; showToast(`Music ${gameMusicEnabled ? 'on' : 'off'}`); if (gameMusicEnabled && document.getElementById('game-screen').classList.contains('active')) startGameMusic(); else stopGameMusic(); } function startGameMusic() { if (!gameMusicEnabled) return; if (!gameMusicContext) { try { gameMusicContext = new (window.AudioContext || window.webkitAudioContext)(); gameMusicGain = gameMusicContext.createGain(); gameMusicGain.gain.value = 0.3; gameMusicGain.connect(gameMusicContext.destination); } catch(e) {} } if (!gameMusicContext) return; if (gameMusicContext.state === 'suspended') gameMusicContext.resume(); if (gameMusicLoopInterval) clearInterval(gameMusicLoopInterval); const notes = [261.63, 329.63, 392.00]; let noteIndex = 0; gameMusicLoopInterval = setInterval(() => { if (!gameMusicEnabled || !gameMusicContext || gameMusicContext.state !== 'running') return; const now = gameMusicContext.currentTime; const osc = gameMusicContext.createOscillator(); const gain = gameMusicContext.createGain(); osc.type = 'sine'; osc.frequency.value = notes[noteIndex % notes.length]; gain.gain.setValueAtTime(0.1, now); gain.gain.exponentialRampToValueAtTime(0.0001, now + 0.8); osc.connect(gain); gain.connect(gameMusicGain); osc.start(now); osc.stop(now + 0.8); noteIndex++; }, 1500); } function stopGameMusic() { if (gameMusicLoopInterval) clearInterval(gameMusicLoopInterval); gameMusicLoopInterval = null; if (gameMusicContext && gameMusicContext.state === 'running') gameMusicContext.suspend(); } // ========== MINING ========== function startMiningSession() { if (isHashing) return; if (userData.dailyEarned >= DAILY_LIMIT) { showToast(`Daily limit reached`); return; } miningEndTime = Date.now() + MINING_SESSION_MS; userData.miningActive = true; userData.miningStartTime = Date.now(); saveAll(); isHashing = true; document.getElementById('hashing-btn').classList.add('active'); document.getElementById('hashing-text').textContent = 'STOP'; document.getElementById('hashing-status').textContent = 'Learning active...'; document.getElementById('live-indicator').classList.add('active'); if (hashingInterval) clearInterval(hashingInterval); hashingInterval = setInterval(() => { if (!isHashing) return; if (userData.dailyEarned >= DAILY_LIMIT) { stopHashing(); showToast(`Daily limit reached.`); return; } if (Date.now() >= miningEndTime) { stopHashing(); showToast(`12โ€‘hour session completed.`); return; } let ratePerSec = boostMultiplier > 1 ? 200 / 3600 : 100 / 3600; let earned = ratePerSec; if (userData.dailyEarned + earned > DAILY_LIMIT) earned = DAILY_LIMIT - userData.dailyEarned; if (earned <= 0) { stopHashing(); showToast(`Daily limit reached.`); return; } sessionEarnings += earned; userData.balance += earned; userData.totalEarned += earned; userData.dailyEarned += earned; updateAllDisplays(); const hashingSection = document.getElementById('hashing-section'); if (hashingSection && Math.random() > 0.7) { let h = document.createElement('div'); h.className = 'floating-hash'; h.textContent = '+' + earned.toFixed(4) + ' LF'; h.style.left = (Math.random() * 200 + 40) + 'px'; h.style.top = (Math.random() * 200 + 40) + 'px'; hashingSection.appendChild(h); setTimeout(() => h.remove(), 1000); } }, 1000); if (miningTimerInterval) clearInterval(miningTimerInterval); miningTimerInterval = setInterval(() => { const timerElem = document.getElementById('mining-timer'); if (timerElem && isHashing && miningEndTime) { const remaining = miningEndTime - Date.now(); if (remaining <= 0) timerElem.textContent = ''; else { const hours = Math.floor(remaining / 3600000); const minutes = Math.floor((remaining % 3600000) / 60000); const seconds = Math.floor((remaining % 60000) / 1000); timerElem.textContent = `${hours}h ${minutes}m ${seconds}s remaining`; } } }, 1000); } function stopHashing() { if (hashingInterval) clearInterval(hashingInterval); if (miningTimerInterval) clearInterval(miningTimerInterval); isHashing = false; userData.miningActive = false; userData.miningStartTime = null; miningEndTime = null; saveAll(); document.getElementById('hashing-btn').classList.remove('active'); document.getElementById('hashing-text').textContent = 'LEARN'; document.getElementById('hashing-status').textContent = 'Tap to start'; document.getElementById('live-indicator').classList.remove('active'); } function toggleHashing() { if (isHashing) { stopHashing(); return; } if (userData.dailyEarned >= DAILY_LIMIT) { showToast(`Daily limit reached`); return; } showAd('start'); } function startHashingAfterAd() { if (!isHashing && userData.dailyEarned < DAILY_LIMIT) startMiningSession(); } // ========== AD SYSTEM ========== function showAd(type) { currentAdType = type; let adDiv = document.getElementById('ad-overlay'); adDiv.classList.add('active'); let timeLeft = 5; let timer = document.getElementById('ad-timer'); let btn = document.getElementById('watch-btn'); btn.disabled = true; btn.textContent = `Wait ${timeLeft}s...`; if (adTimer) clearInterval(adTimer); adTimer = setInterval(() => { timeLeft--; timer.textContent = timeLeft + 's'; btn.textContent = `Wait ${timeLeft}s...`; if (timeLeft <= 0) { clearInterval(adTimer); btn.disabled = false; btn.textContent = 'CONTINUE'; } }, 1000); } function completeAd() { if (currentAdType === 'start') startHashingAfterAd(); else if (currentAdType === 'lecture' && pendingLectureId) playLecture(pendingLectureId); else if (currentAdType === 'boost') activateBoost(); else addBalance(5, 'ad'); closeAd(); } function closeAd() { clearInterval(adTimer); document.getElementById('ad-overlay').classList.remove('active'); } function activateBoost() { boostMultiplier = 2; boostEndTime = Date.now() + 4 * 3600000; userData.boostActive = true; userData.boostEndTime = boostEndTime; saveAll(); updateAllDisplays(); showToast('โšก 2x Boost activated!'); } function checkBoostStatus() { if (userData.boostActive && userData.boostEndTime && Date.now() < userData.boostEndTime) boostMultiplier = 2; else { boostMultiplier = 1; userData.boostActive = false; userData.boostEndTime = null; saveAll(); } } setInterval(checkBoostStatus, 60000); // ========== TASKS (with 20โ€‘minute verification) ========== function loadTasks() { const storedSocial = localStorage.getItem('socialTasks'); if (storedSocial) socialTasks = JSON.parse(storedSocial); const storedOneOff = localStorage.getItem('oneOffTasks'); if (storedOneOff) oneOffTasks = JSON.parse(storedOneOff); saveTasks(); } function saveTasks() { localStorage.setItem('socialTasks', JSON.stringify(socialTasks)); localStorage.setItem('oneOffTasks', JSON.stringify(oneOffTasks)); } function renderUserTasks() { const socialContainer = document.getElementById('social-tasks-container'); if (socialContainer) { const userCompleted = JSON.parse(localStorage.getItem('userCompletedSocial')) || {}; socialContainer.innerHTML = socialTasks.map(task => { const pending = localStorage.getItem(`socialTask_${task.id}_end`); let status = ''; if (pending && Date.now() < parseInt(pending)) { const remaining = Math.ceil((parseInt(pending) - Date.now()) / 60000); status = `
โณ ${remaining} min left
`; } return `
${task.icon}
${task.name}
${task.url}
${status}
${userCompleted[task.id] ? 'โœ“ CLAIMED' : `+${task.reward} LF`}
`; }).join(''); } const oneOffContainer = document.getElementById('oneoff-tasks-container'); if (oneOffContainer) { const userCompletedOneOff = JSON.parse(localStorage.getItem('userCompletedOneOff')) || {}; oneOffContainer.innerHTML = oneOffTasks.map(task => { const pending = localStorage.getItem(`oneoffTask_${task.id}_end`); let status = ''; if (pending && Date.now() < parseInt(pending)) { const remaining = Math.ceil((parseInt(pending) - Date.now()) / 60000); status = `
โณ ${remaining} min left
`; } return `
${task.icon}
${task.name}
${task.url}
${status}
${userCompletedOneOff[task.id] ? 'โœ“ CLAIMED' : `+${task.reward} LF`}
`; }).join(''); } } function renderAdminTasks() { const socialContainer = document.getElementById('social-tasks-admin'); if (socialContainer) { socialContainer.innerHTML = socialTasks.map(t => `
${t.icon} ${t.name}
${t.url}
Reward: ${t.reward} LF
`).join(''); } const oneOffContainer = document.getElementById('oneoff-tasks-admin'); if (oneOffContainer) { oneOffContainer.innerHTML = oneOffTasks.map(t => `
${t.icon} ${t.name}
${t.url}
Reward: ${t.reward} LF
`).join(''); } } function editTask(type, id) { const task = (type === 'social' ? socialTasks : oneOffTasks).find(t => t.id === id); if (!task) return; document.getElementById('edit-task-name').value = task.name; document.getElementById('edit-task-url').value = task.url; document.getElementById('edit-task-reward').value = task.reward; document.getElementById('edit-task-icon').value = task.icon; window.currentEdit = { type, id }; document.getElementById('edit-task-modal').classList.add('active'); } function saveEditedTask() { const { type, id } = window.currentEdit; const name = document.getElementById('edit-task-name').value.trim(); const url = document.getElementById('edit-task-url').value.trim(); const reward = parseInt(document.getElementById('edit-task-reward').value); const icon = document.getElementById('edit-task-icon').value.trim() || '๐Ÿ“Œ'; if (!name || !url || isNaN(reward)) { showToast('Please fill all fields'); return; } const taskList = type === 'social' ? socialTasks : oneOffTasks; if (id === null) { const newId = Date.now(); taskList.push({ id: newId, name, url, reward, icon }); } else { const index = taskList.findIndex(t => t.id === id); if (index !== -1) taskList[index] = { ...taskList[index], name, url, reward, icon }; } saveTasks(); renderAdminTasks(); renderUserTasks(); closeModal(); showToast(id === null ? 'Task added' : 'Task updated'); } function deleteTask(type, id) { if (!confirm('Delete this task?')) return; const taskList = type === 'social' ? socialTasks : oneOffTasks; const index = taskList.findIndex(t => t.id === id); if (index !== -1) taskList.splice(index, 1); saveTasks(); renderAdminTasks(); renderUserTasks(); showToast('Task deleted'); } function showAddSocialTaskModal() { document.getElementById('edit-task-name').value = ''; document.getElementById('edit-task-url').value = ''; document.getElementById('edit-task-reward').value = ''; document.getElementById('edit-task-icon').value = ''; window.currentEdit = { type: 'social', id: null }; document.getElementById('edit-task-modal').classList.add('active'); } function showAddOneOffTaskModal() { document.getElementById('edit-task-name').value = ''; document.getElementById('edit-task-url').value = ''; document.getElementById('edit-task-reward').value = ''; document.getElementById('edit-task-icon').value = ''; window.currentEdit = { type: 'oneoff', id: null }; document.getElementById('edit-task-modal').classList.add('active'); } function startSocialTask(taskId) { const task = socialTasks.find(t => t.id === taskId); if (!task) return; const userCompleted = JSON.parse(localStorage.getItem('userCompletedSocial')) || {}; if (userCompleted[taskId]) { showToast('Already completed!'); return; } const pendingEnd = localStorage.getItem(`socialTask_${taskId}_end`); if (pendingEnd && Date.now() < parseInt(pendingEnd)) { const remaining = Math.ceil((parseInt(pendingEnd) - Date.now()) / 60000); showToast(`Please wait ${remaining} minutes before claiming.`); return; } showAdWithCallback(() => { window.open(task.url, '_blank'); showToast(`Complete the task. Return in ${TASK_VERIFICATION_MINUTES} minutes to claim.`); const endTime = Date.now() + TASK_VERIFICATION_MINUTES * 60 * 1000; localStorage.setItem(`socialTask_${taskId}_end`, endTime); renderUserTasks(); const interval = setInterval(() => { if (Date.now() >= endTime) { clearInterval(interval); userCompleted[taskId] = true; localStorage.setItem('userCompletedSocial', JSON.stringify(userCompleted)); localStorage.removeItem(`socialTask_${taskId}_end`); addBalance(task.reward, 'social'); showToast(`๐ŸŽ‰ +${task.reward} LF for ${task.name}!`); renderUserTasks(); } }, 1000); }); } function startOneOffTask(taskId) { const task = oneOffTasks.find(t => t.id === taskId); if (!task) return; const userCompletedOneOff = JSON.parse(localStorage.getItem('userCompletedOneOff')) || {}; if (userCompletedOneOff[taskId]) { showToast('Already completed!'); return; } const pendingEnd = localStorage.getItem(`oneoffTask_${taskId}_end`); if (pendingEnd && Date.now() < parseInt(pendingEnd)) { const remaining = Math.ceil((parseInt(pendingEnd) - Date.now()) / 60000); showToast(`Please wait ${remaining} minutes before claiming.`); return; } showAdWithCallback(() => { window.open(task.url, '_blank'); showToast(`Complete the task. Return in ${TASK_VERIFICATION_MINUTES} minutes to claim.`); const endTime = Date.now() + TASK_VERIFICATION_MINUTES * 60 * 1000; localStorage.setItem(`oneoffTask_${taskId}_end`, endTime); renderUserTasks(); const interval = setInterval(() => { if (Date.now() >= endTime) { clearInterval(interval); userCompletedOneOff[taskId] = true; localStorage.setItem('userCompletedOneOff', JSON.stringify(userCompletedOneOff)); localStorage.removeItem(`oneoffTask_${taskId}_end`); addBalance(task.reward, 'oneoff'); showToast(`๐ŸŽ‰ +${task.reward} LF for ${task.name}!`); renderUserTasks(); } }, 1000); }); } // ========== ANNOUNCEMENTS ========== let announcements = [], lastReadAnnouncementId = 0; function loadAnnouncements() { const stored = localStorage.getItem('app_announcements'); if (stored) announcements = JSON.parse(stored); const lastRead = localStorage.getItem('lastReadAnnouncementId'); if (lastRead) lastReadAnnouncementId = parseInt(lastRead); updateNotificationBadge(); showLatestAnnouncementBanner(); } function saveAnnouncements() { localStorage.setItem('app_announcements', JSON.stringify(announcements)); localStorage.setItem('lastReadAnnouncementId', lastReadAnnouncementId); updateNotificationBadge(); } function updateNotificationBadge() { const unread = announcements.filter(a => a.id > lastReadAnnouncementId).length; const badge = document.getElementById('notification-badge'); if (unread > 0) { badge.textContent = unread > 99 ? '99+' : unread; badge.style.display = 'flex'; } else badge.style.display = 'none'; } function showLatestAnnouncementBanner() { const banner = document.getElementById('announcement-banner'); if (!announcements.length) { banner.style.display = 'none'; return; } document.getElementById('announcement-message').textContent = announcements[announcements.length - 1].text; banner.style.display = 'flex'; } function openAnnouncementModal() { const modal = document.getElementById('announcements-modal'); const container = document.getElementById('announcements-list'); if (!container) return; container.innerHTML = ''; if (announcements.length === 0) container.innerHTML = '

No announcements yet.

'; else announcements.slice().reverse().forEach(a => { const date = new Date(a.timestamp).toLocaleString(); container.innerHTML += `
${date}
${a.text}
`; }); if (announcements.length) { const maxId = Math.max(...announcements.map(a => a.id)); if (maxId > lastReadAnnouncementId) { lastReadAnnouncementId = maxId; saveAnnouncements(); } } modal.classList.add('active'); } function postAnnouncement() { const text = document.getElementById('announcement-text').value.trim(); if (!text) { showToast("Please enter announcement text."); return; } const newId = Date.now(); announcements.push({ id: newId, text: text, timestamp: Date.now() }); saveAnnouncements(); document.getElementById('announcement-text').value = ''; showToast("Announcement posted!"); showLatestAnnouncementBanner(); if (newId > lastReadAnnouncementId) updateNotificationBadge(); } function dismissAnnouncement() { document.getElementById('announcement-banner').style.display = 'none'; } // ========== GAME COOLDOWN & AD ========== let totalGamesPlayed = parseInt(localStorage.getItem('totalGamesPlayed')) || 0; let gameCooldownEnd = parseInt(localStorage.getItem('gameCooldownEnd')) || 0; function updateGameCooldownDisplay() { const now = Date.now(); let remaining = gameCooldownEnd - now; let displayText = '', disabled = false; if (remaining > 0) { let hours = Math.floor(remaining / 3600000); let minutes = Math.floor((remaining % 3600000) / 60000); let seconds = Math.floor((remaining % 60000) / 1000); displayText = `โณ Cooldown: ${hours}h ${minutes}m ${seconds}s (after ${totalGamesPlayed}/${GAME_COOLDOWN_THRESHOLD} plays)`; disabled = true; } else if (totalGamesPlayed >= GAME_COOLDOWN_THRESHOLD) { totalGamesPlayed = 0; localStorage.setItem('totalGamesPlayed', 0); gameCooldownEnd = 0; localStorage.setItem('gameCooldownEnd', 0); displayText = ''; disabled = false; } else { displayText = `${totalGamesPlayed}/${GAME_COOLDOWN_THRESHOLD} games played this cycle`; disabled = false; } const prophetStart = document.getElementById('prophetStartBtn'); const hodlStart = document.getElementById('hodlStartBtn'); const millionaireStart = document.getElementById('millionaireStartBtn'); if (prophetStart) { prophetStart.disabled = disabled; prophetStart.style.opacity = disabled ? '0.5' : '1'; } if (hodlStart) { hodlStart.disabled = disabled; hodlStart.style.opacity = disabled ? '0.5' : '1'; } if (millionaireStart) { millionaireStart.disabled = disabled; millionaireStart.style.opacity = disabled ? '0.5' : '1'; } const prophetCD = document.getElementById('prophetCooldownDisplay'); if (prophetCD) prophetCD.textContent = displayText; const hodlCD = document.getElementById('hodlCooldownDisplay'); if (hodlCD) hodlCD.textContent = displayText; const millionaireCD = document.getElementById('millionaireCooldownDisplay'); if (millionaireCD) millionaireCD.textContent = displayText; } function recordGamePlay() { totalGamesPlayed++; localStorage.setItem('totalGamesPlayed', totalGamesPlayed); if (totalGamesPlayed >= GAME_COOLDOWN_THRESHOLD) { gameCooldownEnd = Date.now() + 4 * 60 * 60 * 1000; localStorage.setItem('gameCooldownEnd', gameCooldownEnd); showToast(`๐Ÿ”ฅ ${GAME_COOLDOWN_THRESHOLD} games played. Next games available in 4 hours.`); } updateGameCooldownDisplay(); } function isGameAvailable() { return !(gameCooldownEnd > Date.now() || totalGamesPlayed >= GAME_COOLDOWN_THRESHOLD); } function showAdWithCallback(callback) { const adModal = document.createElement('div'); adModal.className = 'ad-overlay active'; adModal.innerHTML = `
Sponsored
๐Ÿ“บ
Watch This Ad
To continue, please watch this short ad.
5s
`; document.body.appendChild(adModal); let timeLeft = 5; const timerEl = adModal.querySelector('#adTimer'); const btn = adModal.querySelector('#adWatchBtn'); const interval = setInterval(() => { timeLeft--; timerEl.textContent = timeLeft + 's'; btn.textContent = `Wait ${timeLeft}s...`; if (timeLeft <= 0) { clearInterval(interval); btn.disabled = false; btn.textContent = 'CONTINUE'; btn.onclick = () => { adModal.remove(); callback(); }; } }, 1000); } function startGameWithAd(gameType, startFunction) { if (!isGameAvailable()) { showToast('โณ Game cooldown active.'); updateGameCooldownDisplay(); return; } if (userData.dailyEarned >= DAILY_LIMIT) { showToast(`Daily earning limit reached.`); return; } showAdWithCallback(() => { startFunction(); recordGamePlay(); }); } // ========== PROPHET GAME ========== let prophetStreak = 0, prophetGameActive = false, prophetTimerInterval = null, currentProphetMystery = null, usedProphetIndices = []; function getNextProphetMystery() { if (prophetMysteriesPool.length === 0) return { clue: "Default clue", answer: "pump", explanation: "Default" }; if (usedProphetIndices.length >= prophetMysteriesPool.length) usedProphetIndices = []; let available = prophetMysteriesPool.map((_, idx) => idx).filter(i => !usedProphetIndices.includes(i)); let randomIndex = available[Math.floor(Math.random() * available.length)]; usedProphetIndices.push(randomIndex); return prophetMysteriesPool[randomIndex]; } function loadProphetMystery() { currentProphetMystery = getNextProphetMystery(); document.getElementById('prophetMystery').innerHTML = `
๐Ÿ” ON-CHAIN SIGNAL
${currentProphetMystery.clue}
`; } function startProphetTimer() { let timeLeft = 45; const timerElem = document.getElementById('prophetTimer'); if (prophetTimerInterval) clearInterval(prophetTimerInterval); prophetTimerInterval = setInterval(() => { timeLeft--; timerElem.textContent = timeLeft; if (timeLeft <= 0) { clearInterval(prophetTimerInterval); if (prophetGameActive) makeProphetDecision('timeout'); } }, 1000); } function stopProphetGame() { prophetGameActive = false; if (prophetTimerInterval) clearInterval(prophetTimerInterval); document.getElementById('prophetGameContent').style.display = 'none'; document.getElementById('prophetStartBtn').style.display = 'block'; } function makeProphetDecision(choice) { if (!prophetGameActive) return; prophetGameActive = false; if (prophetTimerInterval) clearInterval(prophetTimerInterval); let difficultyMult = gameDifficulty === 'medium' ? 1.5 : (gameDifficulty === 'hard' ? 2 : 1); let isCorrect = (choice === currentProphetMystery.answer); if (isCorrect) { let reward = Math.floor(20 * difficultyMult); addBalance(reward, 'prophet'); prophetStreak++; document.getElementById('prophetStreakDisplay').innerHTML = `๐Ÿ”ฅ Streak: ${prophetStreak}`; showGameFeedback(true, reward, `โœ… Correct! +${reward} LF`, currentProphetMystery.explanation); if (soundEnabled) playSound('win'); createConfetti(); } else { let penalty = 10; userData.balance = Math.max(0, userData.balance - penalty); saveAll(); prophetStreak = 0; document.getElementById('prophetStreakDisplay').innerHTML = `๐Ÿ”ฅ Streak: 0`; showGameFeedback(false, penalty, `โŒ Wrong! -${penalty} LF. Correct answer: ${currentProphetMystery.answer.toUpperCase()}`, currentProphetMystery.explanation); if (soundEnabled) playSound('lose'); } updateAllDisplays(); stopProphetGame(); } function startProphetGame() { if (prophetGameActive) return; prophetGameActive = true; loadProphetMystery(); document.getElementById('prophetGameContent').style.display = 'block'; document.getElementById('prophetStartBtn').style.display = 'none'; startProphetTimer(); if (soundEnabled) playSound('start'); } function startProphetGameWithAd() { startGameWithAd('prophet', startProphetGame); } // ========== HODL GAME ========== let hodlStreak = 0, hodlGameActive = false, hodlTimerInterval = null, currentHodlScenario = null, usedHodlIndices = []; function getNextHodlScenario() { if (hodlScenariosPool.length === 0) return { scenario: "Default scenario", answer: "hodl", explanation: "Default" }; if (usedHodlIndices.length >= hodlScenariosPool.length) usedHodlIndices = []; let available = hodlScenariosPool.map((_, idx) => idx).filter(i => !usedHodlIndices.includes(i)); let randomIndex = available[Math.floor(Math.random() * available.length)]; usedHodlIndices.push(randomIndex); return hodlScenariosPool[randomIndex]; } function startHodlTimer() { let timeLeft = 20; const timerElem = document.getElementById('hodlTimer'); if (hodlTimerInterval) clearInterval(hodlTimerInterval); hodlTimerInterval = setInterval(() => { timeLeft--; timerElem.textContent = timeLeft; if (timeLeft <= 0) { clearInterval(hodlTimerInterval); if (hodlGameActive) makeHodlDecision('timeout'); } }, 1000); } function stopHodlGame() { hodlGameActive = false; if (hodlTimerInterval) clearInterval(hodlTimerInterval); document.getElementById('hodlGameContent').style.display = 'none'; document.getElementById('hodlStartBtn').style.display = 'block'; } function makeHodlDecision(choice) { if (!hodlGameActive) return; hodlGameActive = false; if (hodlTimerInterval) clearInterval(hodlTimerInterval); let difficultyMult = gameDifficulty === 'medium' ? 1.5 : (gameDifficulty === 'hard' ? 2 : 1); let isCorrect = (choice === currentHodlScenario.answer); if (isCorrect) { let reward = Math.floor(20 * difficultyMult); addBalance(reward, 'hodl'); hodlStreak++; document.getElementById('hodlStreakDisplay').innerHTML = `๐Ÿ”ฅ Streak: ${hodlStreak}`; showGameFeedback(true, reward, `โœ… Correct! +${reward} LF`, currentHodlScenario.explanation); if (soundEnabled) playSound('win'); createConfetti(); } else { let penalty = 10; userData.balance = Math.max(0, userData.balance - penalty); saveAll(); hodlStreak = 0; document.getElementById('hodlStreakDisplay').innerHTML = `๐Ÿ”ฅ Streak: 0`; showGameFeedback(false, penalty, `โŒ Wrong! -${penalty} LF. Best move: ${currentHodlScenario.answer.toUpperCase()}`, currentHodlScenario.explanation); if (soundEnabled) playSound('lose'); } updateAllDisplays(); stopHodlGame(); } function startHodlGame() { if (hodlGameActive) return; hodlGameActive = true; currentHodlScenario = getNextHodlScenario(); document.getElementById('hodlScenario').innerHTML = `
๐Ÿ“Š MARKET SCENARIO
${currentHodlScenario.scenario}
`; document.getElementById('hodlGameContent').style.display = 'block'; document.getElementById('hodlStartBtn').style.display = 'none'; startHodlTimer(); if (soundEnabled) playSound('start'); } function startHodlGameWithAd() { startGameWithAd('hodl', startHodlGame); } // ========== MILLIONAIRE GAME ========== let millionaireActive = false, millionaireCurrentIndex = 0, millionaireCurrentQuestion = null, millionaireUsedFifty = false, millionaireUsedCall = false, millionaireCurrentAnswers = [], millionaireTimerInterval = null; function getQuestionForLevel(level) { const pool = millionaireQuestions.filter(q => q.level === level); return pool.length ? pool[Math.floor(Math.random() * pool.length)] : millionaireQuestions[0]; } function shuffleArray(arr) { for (let i = arr.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)); [arr[i], arr[j]] = [arr[j], arr[i]]; } return arr; } function loadMillionaireQuestion() { let level = "beginner"; if (millionaireCurrentIndex >= 7) level = "intermediate"; if (millionaireCurrentIndex >= 14) level = "advanced"; millionaireCurrentQuestion = getQuestionForLevel(level); let options = [...millionaireCurrentQuestion.options]; millionaireCurrentAnswers = shuffleArray(options); document.getElementById('millionaireQuestionText').innerText = millionaireCurrentQuestion.text; const container = document.getElementById('millionaireAnswers'); container.innerHTML = millionaireCurrentAnswers.map((opt, idx) => ``).join(''); document.getElementById('millionaireStatus').innerHTML = ''; document.getElementById('fiftyFiftyBtn').classList.toggle('disabled', millionaireUsedFifty); document.getElementById('callFriendBtn').classList.toggle('disabled', millionaireUsedCall); if (millionaireTimerInterval) clearInterval(millionaireTimerInterval); let timeLeft = 30; const timerEl = document.getElementById('millionaireTimer'); timerEl.textContent = timeLeft; millionaireTimerInterval = setInterval(() => { timeLeft--; timerEl.textContent = timeLeft; if (timeLeft <= 0) { clearInterval(millionaireTimerInterval); if (millionaireActive) { showToast("Time's up! Wrong answer."); let prize = millionaireCurrentIndex >= 5 ? prizeLadder[4] : 0; addBalance(prize, 'millionaire'); showToast(`You win ${prize} LF.`); endMillionaireGame(); } } }, 1000); } function renderPrizeLadder() { const ladderDiv = document.getElementById('prizeLadder'); if (!ladderDiv) return; ladderDiv.innerHTML = prizeLadder.map((prize, idx) => `
${idx === 0 ? 'Start' : ''} ${prize} LF
`).join(''); } function checkMillionaireAnswer(selectedIdx) { if (!millionaireActive) return; if (millionaireTimerInterval) clearInterval(millionaireTimerInterval); const selectedAnswer = millionaireCurrentAnswers[selectedIdx]; const isCorrect = (selectedAnswer === millionaireCurrentQuestion.options[millionaireCurrentQuestion.correct]); if (isCorrect) { millionaireCurrentIndex++; if (millionaireCurrentIndex >= prizeLadder.length) { const finalPrize = prizeLadder[prizeLadder.length - 1]; addBalance(finalPrize, 'millionaire'); showReward(finalPrize, '๐Ÿ† CRYPTO MILLIONAIRE!'); endMillionaireGame(); createConfetti(); return; } loadMillionaireQuestion(); renderPrizeLadder(); } else { let prize = 0; if (millionaireCurrentIndex >= 5) prize = prizeLadder[4]; addBalance(prize, 'millionaire'); showToast(`Wrong answer! You win ${prize} LF.`); endMillionaireGame(); } } function useFiftyFifty() { if (!millionaireActive || millionaireUsedFifty) return; millionaireUsedFifty = true; const correctOption = millionaireCurrentQuestion.options[millionaireCurrentQuestion.correct]; let wrongIndices = []; millionaireCurrentAnswers.forEach((opt, idx) => { if (opt !== correctOption) wrongIndices.push(idx); }); const toRemove = wrongIndices.slice(0, 2); const newAnswers = millionaireCurrentAnswers.filter((_, idx) => !toRemove.includes(idx)); const container = document.getElementById('millionaireAnswers'); container.innerHTML = newAnswers.map((opt, idx) => ``).join(''); document.getElementById('fiftyFiftyBtn').classList.add('disabled'); showToast('50/50 used! Two wrong answers removed.'); } function useCallFriend() { if (!millionaireActive || millionaireUsedCall) return; millionaireUsedCall = true; const correctIndex = millionaireCurrentQuestion.correct; const friendHint = Math.random() < 0.8 ? millionaireCurrentQuestion.options[correctIndex] : millionaireCurrentQuestion.options[(correctIndex + 1) % millionaireCurrentQuestion.options.length]; showToast(`๐Ÿ“ž Your friend says: "I think it's ${friendHint}"`); document.getElementById('callFriendBtn').classList.add('disabled'); } function walkAway() { if (!millionaireActive) return; if (millionaireTimerInterval) clearInterval(millionaireTimerInterval); const prize = millionaireCurrentIndex === 0 ? 0 : prizeLadder[millionaireCurrentIndex - 1]; addBalance(prize, 'millionaire'); showToast(`You walk away with ${prize} LF!`); endMillionaireGame(); } function endMillionaireGame() { millionaireActive = false; if (millionaireTimerInterval) clearInterval(millionaireTimerInterval); document.getElementById('millionaireGameContent').style.display = 'none'; document.getElementById('millionaireStartBtn').style.display = 'block'; millionaireUsedFifty = false; millionaireUsedCall = false; millionaireCurrentIndex = 0; } function startMillionaireGame() { if (millionaireActive) return; millionaireActive = true; millionaireCurrentIndex = 0; millionaireUsedFifty = false; millionaireUsedCall = false; document.getElementById('millionaireGameContent').style.display = 'block'; document.getElementById('millionaireStartBtn').style.display = 'none'; loadMillionaireQuestion(); renderPrizeLadder(); if (soundEnabled) playSound('start'); } function startMillionaireGameWithAd() { startGameWithAd('millionaire', startMillionaireGame); } // ========== GAME ADMIN CRUD ========== function saveGameData() { localStorage.setItem('prophetMysteries', JSON.stringify(prophetMysteriesPool)); localStorage.setItem('hodlScenarios', JSON.stringify(hodlScenariosPool)); localStorage.setItem('millionaireQuestions', JSON.stringify(millionaireQuestions)); } function renderProphetAdminList() { const container = document.getElementById('prophet-admin-list'); if (!container) return; container.innerHTML = prophetMysteriesPool.map((item, idx) => `
Clue: ${item.clue}
Answer: ${item.answer.toUpperCase()} | Exp: ${item.explanation.substring(0,50)}...
`).join(''); } function openProphetModal(idx) { const item = idx !== null ? prophetMysteriesPool[idx] : null; document.getElementById('edit-prophet-clue').value = item ? item.clue : ''; document.getElementById('edit-prophet-answer').value = item ? item.answer : 'pump'; document.getElementById('edit-prophet-explanation').value = item ? item.explanation : ''; document.getElementById('edit-prophet-id').value = idx !== null ? idx : -1; document.getElementById('edit-prophet-modal').classList.add('active'); } function saveProphetEdit() { const idx = parseInt(document.getElementById('edit-prophet-id').value); const clue = document.getElementById('edit-prophet-clue').value.trim(); const answer = document.getElementById('edit-prophet-answer').value; const explanation = document.getElementById('edit-prophet-explanation').value.trim(); if (!clue || !explanation) { showToast('Fill all fields'); return; } if (idx === -1) prophetMysteriesPool.push({ clue, answer, explanation }); else prophetMysteriesPool[idx] = { clue, answer, explanation }; saveGameData(); renderProphetAdminList(); closeModal(); showToast('Prophet mystery saved'); } function deleteProphetItem(idx) { if (confirm('Delete this mystery?')) { prophetMysteriesPool.splice(idx, 1); saveGameData(); renderProphetAdminList(); showToast('Deleted'); } } function showAddProphetModal() { openProphetModal(null); } function renderHodlAdminList() { const container = document.getElementById('hodl-admin-list'); if (!container) return; container.innerHTML = hodlScenariosPool.map((item, idx) => `
Scenario: ${item.scenario}
Answer: ${item.answer.toUpperCase()} | Exp: ${item.explanation.substring(0,50)}...
`).join(''); } function openHodlModal(idx) { const item = idx !== null ? hodlScenariosPool[idx] : null; document.getElementById('edit-hodl-scenario').value = item ? item.scenario : ''; document.getElementById('edit-hodl-answer').value = item ? item.answer : 'hodl'; document.getElementById('edit-hodl-explanation').value = item ? item.explanation : ''; document.getElementById('edit-hodl-id').value = idx !== null ? idx : -1; document.getElementById('edit-hodl-modal').classList.add('active'); } function saveHodlEdit() { const idx = parseInt(document.getElementById('edit-hodl-id').value); const scenario = document.getElementById('edit-hodl-scenario').value.trim(); const answer = document.getElementById('edit-hodl-answer').value; const explanation = document.getElementById('edit-hodl-explanation').value.trim(); if (!scenario || !explanation) { showToast('Fill all fields'); return; } if (idx === -1) hodlScenariosPool.push({ scenario, answer, explanation }); else hodlScenariosPool[idx] = { scenario, answer, explanation }; saveGameData(); renderHodlAdminList(); closeModal(); showToast('HODL scenario saved'); } function deleteHodlItem(idx) { if (confirm('Delete this scenario?')) { hodlScenariosPool.splice(idx, 1); saveGameData(); renderHodlAdminList(); showToast('Deleted'); } } function showAddHodlModal() { openHodlModal(null); } function renderMillionaireAdminList() { const container = document.getElementById('millionaire-admin-list'); if (!container) return; container.innerHTML = millionaireQuestions.map((item, idx) => `
Q: ${item.text}
Level: ${item.level} | Options: ${item.options.join(', ')}
Correct: ${item.options[item.correct]}
`).join(''); } function openMillionaireModal(idx) { const item = idx !== null ? millionaireQuestions[idx] : null; document.getElementById('edit-millionaire-text').value = item ? item.text : ''; document.getElementById('edit-millionaire-level').value = item ? item.level : 'beginner'; for (let i = 0; i < 4; i++) { document.getElementById(`edit-millionaire-opt${i}`).value = item ? item.options[i] : ''; } document.getElementById('edit-millionaire-correct').value = item ? item.correct : 0; document.getElementById('edit-millionaire-id').value = idx !== null ? idx : -1; document.getElementById('edit-millionaire-modal').classList.add('active'); } function saveMillionaireEdit() { const idx = parseInt(document.getElementById('edit-millionaire-id').value); const text = document.getElementById('edit-millionaire-text').value.trim(); const level = document.getElementById('edit-millionaire-level').value; const options = []; for (let i = 0; i < 4; i++) options.push(document.getElementById(`edit-millionaire-opt${i}`).value.trim()); const correct = parseInt(document.getElementById('edit-millionaire-correct').value); if (!text || options.some(o => !o)) { showToast('Fill all fields'); return; } const newQ = { level, text, options, correct }; if (idx === -1) millionaireQuestions.push(newQ); else millionaireQuestions[idx] = newQ; saveGameData(); renderMillionaireAdminList(); closeModal(); showToast('Question saved'); } function deleteMillionaireItem(idx) { if (confirm('Delete this question?')) { millionaireQuestions.splice(idx, 1); saveGameData(); renderMillionaireAdminList(); showToast('Deleted'); } } function showAddMillionaireModal() { openMillionaireModal(null); } // ========== USER DATA MANAGEMENT ========== function loadUserData() { try { const s = localStorage.getItem('learnfire_v6'); if (s) userData = JSON.parse(s); } catch (e) {} if (!userData.userId) { userData.userId = 'LF-' + Math.random().toString(36).substr(2, 9).toUpperCase(); userData.referralCode = userData.userId; userData.accountCreated = Date.now(); userData.dailyEarned = 0; userData.dailyResetDate = ''; userData.redemptionHistory = []; userData.backupPassword = null; userData.miningActive = false; userData.miningStartTime = null; } resetDailyIfNeeded(); if (userData.miningActive && userData.miningStartTime) { const elapsed = Date.now() - userData.miningStartTime; if (elapsed < MINING_SESSION_MS) { miningEndTime = userData.miningStartTime + MINING_SESSION_MS; startMiningSession(); } else { userData.miningActive = false; userData.miningStartTime = null; saveAll(); } } saveAll(); } function saveAll() { localStorage.setItem('learnfire_v6', JSON.stringify(userData)); } function resetDailyIfNeeded() { let today = new Date().toDateString(); if (userData.dailyResetDate !== today) { userData.dailyEarned = 0; userData.dailyResetDate = today; saveAll(); if (document.getElementById('home-screen').classList.contains('active')) updateAllDisplays(); } } function canAddBalance(amount) { resetDailyIfNeeded(); return userData.dailyEarned + amount <= DAILY_LIMIT; } function addBalance(amount, source) { if (amount <= 0) return; if (!canAddBalance(amount)) { showToast(`โš ๏ธ Daily limit reached!`); return; } userData.balance += amount; userData.totalEarned += amount; userData.dailyEarned += amount; saveAll(); updateAllDisplays(); } function updateAllDisplays() { const el = id => document.getElementById(id); if (el('total-balance')) el('total-balance').textContent = userData.balance.toFixed(4); if (el('usdt-balance')) el('usdt-balance').textContent = 'TBD'; let bal = Math.floor(userData.balance); if (el('redeem-balance')) el('redeem-balance').textContent = bal + ' LF'; let prog = Math.min((bal / 100000) * 100, 100); if (el('redeem-progress')) el('redeem-progress').style.width = prog + '%'; let age = Math.floor((Date.now() - userData.accountCreated) / 86400000); if (el('account-age')) el('account-age').textContent = age + ' days'; if (el('unlock-btn')) el('unlock-btn').disabled = !(bal >= 100000 && age >= 90); if (el('ref-code')) el('ref-code').textContent = userData.referralCode; let todayStr = new Date().toDateString(); if (userData.lastDailyClaim === todayStr) { if (el('daily-reward-btn')) el('daily-reward-btn').textContent = 'โœ“ CLAIMED'; if (el('daily-reward-status')) el('daily-reward-status').textContent = 'Come back tomorrow!'; } else { if (el('daily-reward-btn')) el('daily-reward-btn').textContent = '+50 LF'; if (el('daily-reward-status')) el('daily-reward-status').textContent = 'Claim daily bonus'; } if (el('streak-count')) el('streak-count').textContent = userData.streakDays + ' Day ๐Ÿ”ฅ'; let today = new Date().getDay(); for (let i = 0; i < 7; i++) { let d = document.getElementById(`day-${i}`); if (d) i === today ? d.classList.add('active') : d.classList.remove('active'); } let ratePerHour = boostMultiplier > 1 ? 200 : 100; if (el('current-rate')) el('current-rate').innerHTML = ratePerHour.toFixed(2) + ' LF/hr'; if (el('user-avatar')) el('user-avatar').textContent = userData.userId.charAt(3) || 'L'; if (el('session-earnings')) el('session-earnings').textContent = sessionEarnings.toFixed(4); let remaining = Math.max(0, DAILY_LIMIT - userData.dailyEarned); if (el('daily-earned-display')) el('daily-earned-display').textContent = `${Math.floor(userData.dailyEarned)} / ${DAILY_LIMIT} LF`; let percent = (userData.dailyEarned / DAILY_LIMIT) * 100; if (el('daily-limit-fill')) el('daily-limit-fill').style.width = Math.min(100, percent) + '%'; if (el('daily-limit-warning')) { if (userData.dailyEarned >= DAILY_LIMIT) { el('daily-limit-warning').style.color = '#ff4444'; el('daily-limit-warning').innerHTML = 'โš ๏ธ Limit reached! Come back tomorrow.'; } else { el('daily-limit-warning').style.color = '#ffaa66'; el('daily-limit-warning').textContent = `Remaining: ${remaining.toFixed(2)} LF`; } } renderRedemptionHistory(); } function claimDailyReward() { let today = new Date().toDateString(); if (userData.lastDailyClaim === today) { showToast('Already claimed'); return; } userData.lastDailyClaim = today; addBalance(50, 'daily'); showReward(50, 'DAILY BONUS!'); updateAllDisplays(); } function showGameFeedback(isCorrect, amount, message, explanation) { document.getElementById('reward-title').textContent = isCorrect ? 'โœ“ CORRECT!' : 'โœ— INCORRECT'; document.getElementById('reward-amount').textContent = isCorrect ? `+${amount} LF` : `-${amount} LF`; document.getElementById('reward-amount').style.color = isCorrect ? 'var(--success)' : 'var(--danger)'; document.getElementById('reward-explanation').innerHTML = `๐Ÿ“– Why?
${explanation}

${message}`; document.getElementById('reward-popup').classList.add('active'); } function setRandomTip() { let tips = ["Bitcoin created in 2009 by Satoshi Nakamoto.", "Ethereum introduced smart contracts.", "Blockchain is a distributed ledger.", "Stablecoins are pegged to USD.", "DeFi removes banks.", "NFTs represent digital ownership.", "Proof of Work vs Proof of Stake.", "Never share private keys.", "Gas fees pay for computation.", "Altcoins are other cryptos."]; const tipText = document.getElementById('tip-text'); if (tipText) tipText.textContent = tips[Math.floor(Math.random() * tips.length)]; } function updateLeaderboard() { const list = document.getElementById('leaderboardList'); if (!list) return; const data = [ { name: "CryptoKing", score: 12450, rank: 1 }, { name: "MoonLord", score: 9820, rank: 2 }, { name: "HODLer", score: 7650, rank: 3 }, { name: "You", score: userData.totalEarned || 0, rank: 42 } ]; list.innerHTML = data.map(p => `
${p.rank}
${p.name}
${p.score} LF
`).join(''); } function updateNextDrop() { const timer = document.getElementById('nextDropTimer'); if (!timer) return; const now = new Date(); const next = new Date(); next.setHours(20, 0, 0, 0); if (now > next) next.setDate(next.getDate() + 1); const diff = next - now; const hours = Math.floor(diff / 3600000); const minutes = Math.floor((diff % 3600000) / 60000); const seconds = Math.floor((diff % 60000) / 1000); timer.textContent = `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`; setTimeout(updateNextDrop, 1000); } function initGameScreen() { updateGameCooldownDisplay(); updateLeaderboard(); updateNextDrop(); } function openProphetTutorial() { document.getElementById('prophetTutorial').classList.add('active'); } function closeProphetTutorial() { document.getElementById('prophetTutorial').classList.remove('active'); } function openHodlTutorial() { document.getElementById('hodlTutorial').classList.add('active'); } function closeHodlTutorial() { document.getElementById('hodlTutorial').classList.remove('active'); } function openMillionaireTutorial() { document.getElementById('millionaireTutorial').classList.add('active'); } function closeMillionaireTutorial() { document.getElementById('millionaireTutorial').classList.remove('active'); } function switchGame(game) { document.querySelectorAll('.game-panel').forEach(p => p.classList.remove('active')); document.getElementById(game + 'Game').classList.add('active'); document.querySelectorAll('.game-tab').forEach(t => t.classList.remove('active')); event.target.classList.add('active'); } // ========== ADMIN & OTHER ========== function initAdminData() { const stored = localStorage.getItem('adminData'); if (stored) adminData = JSON.parse(stored); else adminData = { withdrawals: [], announcements: [], totalMined: 0, monthlyMined: 0, totalPaid: 0, users: [] }; if (!adminData.users) adminData.users = []; localStorage.setItem('adminData', JSON.stringify(adminData)); } initAdminData(); function trackUser() { const users = adminData.users || []; const existing = users.find(u => u.id === userData.userId); if (existing) existing.lastActive = Date.now(); else users.push({ id: userData.userId, firstSeen: Date.now(), lastActive: Date.now() }); adminData.users = users; localStorage.setItem('adminData', JSON.stringify(adminData)); } function updateUserStats() { const users = adminData.users || []; document.getElementById('admin-total-users').textContent = users.length; const sevenDaysAgo = Date.now() - 7 * 24 * 60 * 60 * 1000; const active = users.filter(u => u.lastActive > sevenDaysAgo).length; document.getElementById('admin-active-users').textContent = active; } function updateAdminWithdrawals() { const container = document.getElementById('pending-withdrawals-container'); if (!container) return; const pending = adminData.withdrawals?.filter(w => w.status === 'pending') || []; if (pending.length === 0) container.innerHTML = '

No pending withdrawals.

'; else container.innerHTML = pending.map(w => `
${w.userId} - ${w.amount} LF to ${w.wallet.substring(0,6)}...
`).join(''); } function approveWithdrawal(id) { const w = adminData.withdrawals.find(w => w.id === id); if (w) { w.status = 'approved'; localStorage.setItem('adminData', JSON.stringify(adminData)); showToast('Approved'); updateAdminWithdrawals(); } } function rejectWithdrawal(id) { const w = adminData.withdrawals.find(w => w.id === id); if (w) { w.status = 'rejected'; localStorage.setItem('adminData', JSON.stringify(adminData)); showToast('Rejected'); updateAdminWithdrawals(); } } function requestPayout() { if (userData.balance < 100000) { showToast('Need 100,000 LF'); return; } let age = Math.floor((Date.now() - userData.accountCreated) / 86400000); if (age < 90) { showToast('Account must be 90 days old'); return; } let wallet = document.getElementById('wallet-address').value.trim(); if (!wallet.startsWith('0x') || wallet.length !== 42) { showToast('Enter valid BEP20 address'); return; } let amount = parseInt(document.getElementById('redeem-amount').value); if (amount > userData.balance) amount = Math.floor(userData.balance); if (amount < 100000) amount = 100000; if (amount > 300000) amount = 300000; const request = { id: Date.now(), userId: userData.userId, amount: amount, wallet: wallet, timestamp: Date.now(), status: 'pending' }; if (!userData.redemptionHistory) userData.redemptionHistory = []; userData.redemptionHistory.push(request); saveAll(); let adminData = JSON.parse(localStorage.getItem('adminData')) || { withdrawals: [] }; adminData.withdrawals.push(request); localStorage.setItem('adminData', JSON.stringify(adminData)); showToast('Withdrawal request submitted!'); updateAllDisplays(); } function confirmPayout() { if (pendingPayout) { userData.balance -= pendingPayout.amount; userData.totalWithdrawn += pendingPayout.amount; if (!userData.redemptionHistory) userData.redemptionHistory = []; userData.redemptionHistory.push({ amount: pendingPayout.amount, wallet: pendingPayout.wallet, timestamp: Date.now(), status: 'pending' }); saveAll(); showToast('Withdrawal request submitted!'); updateAllDisplays(); closeModal(); pendingPayout = null; } } function renderRedemptionHistory() { const container = document.getElementById('history-list'); if (!container) return; const history = userData.redemptionHistory || []; if (history.length === 0) { container.innerHTML = '

No requests yet

'; return; } container.innerHTML = history.slice(-5).reverse().map(req => `
${new Date(req.timestamp).toLocaleDateString()}
${req.amount} LF โ†’ ${req.wallet.substring(0, 6)}...${req.wallet.substring(38)}
${req.status}
`).join(''); } function verifyAdmin() { let pwd = document.getElementById('admin-password').value; if (pwd === 'NEWhashFIRE2026$%') { closeModal(); navigateTo('admin'); updateAdminWithdrawals(); renderAdminTasks(); renderAdminLectures(); updateUserStats(); renderProphetAdminList(); renderHodlAdminList(); renderMillionaireAdminList(); } else showToast('Wrong password'); } function promptAdminPassword() { document.getElementById('admin-password-modal').classList.add('active'); } function navigateTo(screen) { // DO NOT cancel speech synthesis when leaving home screen // Lectures continue playing in the background. document.querySelectorAll('.screen').forEach(s => s.classList.remove('active')); document.getElementById(screen + '-screen').classList.add('active'); document.querySelectorAll('.nav-item').forEach(n => n.classList.remove('active')); let target = document.querySelector(`.nav-item[data-screen="${screen}"]`); if (target) target.classList.add('active'); if (screen === 'home' || screen === 'earn' || screen === 'redeem' || screen === 'referral') updateAllDisplays(); if (screen === 'earn') renderUserTasks(); if (screen === 'game') { initGameScreen(); if (gameMusicEnabled) startGameMusic(); else stopGameMusic(); } if (screen === 'admin') { updateAdminWithdrawals(); renderAdminTasks(); renderAdminLectures(); updateUserStats(); renderProphetAdminList(); renderHodlAdminList(); renderMillionaireAdminList(); } } function startApp() { document.getElementById('splash-screen').classList.remove('active'); document.getElementById('home-screen').classList.add('active'); init(); } function init() { loadUserData(); loadAnnouncements(); loadTasks(); renderUserTasks(); let urlParams = new URLSearchParams(window.location.search); let ref = urlParams.get('ref'); if (ref && !userData.referredBy && ref !== userData.referralCode) { userData.referredBy = ref; addBalance(10000, 'referral_bonus'); showToast('๐ŸŽ‰ +10,000 LF bonus!'); } updateAllDisplays(); renderLectures(); setRandomTip(); renderAdminTasks(); renderAdminLectures(); trackUser(); updateGameCooldownDisplay(); updateLeaderboard(); updateNextDrop(); renderProphetAdminList(); renderHodlAdminList(); renderMillionaireAdminList(); } function copyReferralLink() { let link = window.location.origin + window.location.pathname + '?ref=' + userData.referralCode; navigator.clipboard?.writeText(link); showToast('Link copied!'); } function showRestoreModal() { document.getElementById('restore-modal').classList.add('active'); } function showBackupModal() { const modal = document.getElementById('backup-modal'); const promptDiv = document.getElementById('backup-prompt'); const codeDiv = document.getElementById('backup-code-display'); const actionsDiv = document.getElementById('backup-actions'); promptDiv.style.display = 'block'; codeDiv.style.display = 'none'; actionsDiv.style.display = 'none'; document.getElementById('backup-password-input').value = ''; modal.classList.add('active'); } function verifyBackupPassword() { const entered = document.getElementById('backup-password-input').value; if (userData.backupPassword === null) { if (entered.length < 4) { showToast("Password must be at least 4 characters."); return; } userData.backupPassword = entered; saveAll(); showToast("Backup password set! Now enter it again to view your code."); document.getElementById('backup-password-input').value = ''; return; } if (entered !== userData.backupPassword) { showToast("Incorrect password."); return; } const backupCode = btoa(JSON.stringify(userData)); document.getElementById('backup-code-display').textContent = backupCode; document.getElementById('backup-prompt').style.display = 'none'; document.getElementById('backup-code-display').style.display = 'block'; document.getElementById('backup-actions').style.display = 'flex'; document.getElementById('backup-actions').style.gap = '10px'; } function copyBackupCode() { const code = document.getElementById('backup-code-display').textContent; if (code) { navigator.clipboard.writeText(code); showToast('Backup code copied!'); } else showToast('No backup code to copy.'); } function restoreAccount() { let code = document.getElementById('restore-code-input').value; try { let restored = JSON.parse(atob(code)); if (restored.userId) { userData = restored; saveAll(); showToast('Account restored!'); location.reload(); } else throw new Error(); } catch (e) { showToast('Invalid backup code'); } } function showWalletInfo() { document.getElementById('wallet-modal').classList.add('active'); } function openEmailCompose() { window.location.href = 'mailto:ads@LearnFireAI.com'; } function showTerms() { alert('Terms: Learn crypto, earn rewards. Min withdrawal: 100,000 LF after 90 days.'); } function showPrivacy() { alert('Privacy: Your data stays on your device.'); } // Expose all functions globally window.startApp = startApp; window.navigateTo = navigateTo; window.toggleHashing = toggleHashing; window.showAd = showAd; window.completeAd = completeAd; window.closeAd = closeAd; window.claimDailyReward = claimDailyReward; window.requestPayout = requestPayout; window.copyReferralLink = copyReferralLink; window.promptAdminPassword = promptAdminPassword; window.verifyAdmin = verifyAdmin; window.showRestoreModal = showRestoreModal; window.showBackupModal = showBackupModal; window.restoreAccount = restoreAccount; window.verifyBackupPassword = verifyBackupPassword; window.copyBackupCode = copyBackupCode; window.showWalletInfo = showWalletInfo; window.closeModal = closeModal; window.closeReward = closeReward; window.openAnnouncementModal = openAnnouncementModal; window.dismissAnnouncement = dismissAnnouncement; window.postAnnouncement = postAnnouncement; window.editTask = editTask; window.saveEditedTask = saveEditedTask; window.deleteTask = deleteTask; window.showAddSocialTaskModal = showAddSocialTaskModal; window.showAddOneOffTaskModal = showAddOneOffTaskModal; window.startSocialTask = startSocialTask; window.startOneOffTask = startOneOffTask; window.openEmailCompose = openEmailCompose; window.showTerms = showTerms; window.showPrivacy = showPrivacy; window.activateBoost = activateBoost; window.requestLecture = requestLecture; window.addLectureManually = addLectureManually; window.editLecture = editLecture; window.saveEditedLecture = saveEditedLecture; window.deleteLecture = deleteLecture; window.startProphetGameWithAd = startProphetGameWithAd; window.startHodlGameWithAd = startHodlGameWithAd; window.startMillionaireGameWithAd = startMillionaireGameWithAd; window.makeProphetDecision = makeProphetDecision; window.makeHodlDecision = makeHodlDecision; window.useFiftyFifty = useFiftyFifty; window.useCallFriend = useCallFriend; window.walkAway = walkAway; window.checkMillionaireAnswer = checkMillionaireAnswer; window.setDifficulty = setDifficulty; window.toggleSound = toggleSound; window.toggleMusic = toggleMusic; window.switchGame = switchGame; window.openProphetTutorial = openProphetTutorial; window.closeProphetTutorial = closeProphetTutorial; window.openHodlTutorial = openHodlTutorial; window.closeHodlTutorial = closeHodlTutorial; window.openMillionaireTutorial = openMillionaireTutorial; window.closeMillionaireTutorial = closeMillionaireTutorial; window.approveWithdrawal = approveWithdrawal; window.rejectWithdrawal = rejectWithdrawal; window.openProphetModal = openProphetModal; window.saveProphetEdit = saveProphetEdit; window.deleteProphetItem = deleteProphetItem; window.showAddProphetModal = showAddProphetModal; window.openHodlModal = openHodlModal; window.saveHodlEdit = saveHodlEdit; window.deleteHodlItem = deleteHodlItem; window.showAddHodlModal = showAddHodlModal; window.openMillionaireModal = openMillionaireModal; window.saveMillionaireEdit = saveMillionaireEdit; window.deleteMillionaireItem = deleteMillionaireItem; window.showAddMillionaireModal = showAddMillionaireModal; // Preload voices if (window.speechSynthesis) window.speechSynthesis.getVoices();