// ✅ Recent Winners Live Ticker — GetAllGameList.php-এর awardRecordList থেকে
(async function loadWinnersTicker() {
    const wrap = document.getElementById('winnersTicker');
    if (!wrap) return;
    try {
        const data = await getGameListData();
        const list = data?.data?.awardRecordList || [];
        if (list.length === 0) {
            wrap.innerHTML = '<span class="text-gray-500 text-[11px]">এখনো কোনো Win Record নেই।</span>';
            return;
        }
        // ✅ Seamless Loop-এর জন্য তালিকাটা দুইবার বসানো হচ্ছে
        const chips = list.map(w => {
            const phone = String(w.userName || '').replace(/(\d{4})\d+(\d{3})/, '$1***$2');
            const img = w.imgUrl || '';
            const game = (w.gameName || 'Game').substring(0, 22);
            const amount = Number(w.bonusAmount || 0).toLocaleString('en-IN');
            const mult = w.multiple ? `${w.multiple}x` : '';
            return `
                <span class="winner-chip">
                    <img src="${img}" alt="" onerror="this.style.display='none'">
                    <span class="wtxt">${phone} জিতলো <span class="wamt">৳${amount}</span> ${mult ? `(${mult})` : ''} — ${game}</span>
                </span>
            `;
        }).join('');
        wrap.innerHTML = chips + chips;
    } catch (e) {
        wrap.innerHTML = '<span class="text-gray-500 text-[11px]">Win Record লোড করা যায়নি।</span>';
    }
})();
