closeKycSuccessOverlay(); const pending=document.getElementById('kycPendingOverlay'); if(pending) pending.style.display='none'; const modal=document.getElementById('kycModal'); if(modal) modal.style.display='none'; const note=document.getElementById('kycPendNote'); if(note) note.style.display='none'; const actions=document.getElementById('kycActionBtns'); if(actions) actions.style.display='flex'; const bell=document.querySelector('.badge-dot'); if(bell) bell.classList.add('show'); await restoreKycReturnContext(); updateKycStatus(currentUser); showToast(curLang==='mm' ? '✅ KYC Verify ဖြစ်ပြီးပါပြီ။ Trade / Deposit / Withdraw ကို ဆက်လုပ်နိုင်ပါပြီ။' : '✅ KYC verified. Trade / Deposit / Withdraw are now unlocked.'); } function showToast(msg){const t=document.createElement('div');t.style.cssText='position:fixed;bottom:90px;left:50%;transform:translateX(-50%);background:rgba(6,6,5,.95);color:#fafaf5;padding:10px 22px;border-radius:12px;font-size:13px;z-index:99999;border:1px solid rgba(201,168,76,.4);backdrop-filter:blur(10px);max-width:90vw;text-align:center;font-family:"DM Sans",sans-serif';t.textContent=msg;document.body.appendChild(t);setTimeout(()=>t.remove(),3200);} function showAbout(){showToast("COMEX GOLD TRADING — Myanmar's Premier Digital Gold Platform");} function showGoldShop(idx, btn){ showShopCard(idx, btn); } function openAboutApp(){ const profileNav=document.querySelector('.nav-item[data-tab="profile"]'); if(profileNav && !profileNav.classList.contains('active')) switchTab(profileNav); const box=document.getElementById('aboutBox'); if(!box) return; box.classList.toggle('open'); if(box.classList.contains('open')){ setTimeout(()=>box.scrollIntoView({behavior:'smooth',block:'nearest'}),120); } } // ================================================================ // INIT // ================================================================ window.addEventListener('DOMContentLoaded',()=>{ // Build landing content immediately buildTicker();buildMarkets();buildSparkline(); // NOTE: splash hides ONLY when onAuthStateChanged fires (not on fixed timer) // This prevents the flash where landing shows then immediately hides applyAutoTheme(); renderHomeContent(); renderAboutContent(); applyLanguage(curLang||DEFAULT_LANG); bindGatekeeperControls(); syncSecurityModalStates(); updateGateLockedUI(); syncSupportAvatars(); const greeting=document.querySelector('#chatMsgs .msg-bub p'); if(greeting){ greeting.dataset.staticGreeting='1'; greeting.textContent=t('supportGreeting'); } const chatInp=document.getElementById('chatInp'); if(chatInp){ chatInp.textContent=t('messagePlaceholder'); chatInp.addEventListener('focus',()=>{ if(chatInp.textContent.trim()===t('messagePlaceholder')) chatInp.textContent=''; chatInp.style.color='var(--text)'; }); chatInp.addEventListener('blur',()=>{ if(!chatInp.textContent.trim()){ chatInp.textContent=t('messagePlaceholder'); chatInp.style.color='var(--subtext)'; } }); } // Fallback: if Firebase takes too long, hide splash and show landing after 5s setTimeout(()=>{ const splash=document.getElementById('appSplash'); if(splash){splash.style.opacity='0';setTimeout(()=>{if(splash.parentNode)splash.remove();},400);} const ls=document.getElementById('landingScreen'); if(ls && ls.style.display==='none') ls.style.display='block'; }, 5000); });