function showSkeleton() {
    const grid = document.getElementById('gamesGrid');
    grid.innerHTML = Array(15).fill(0).map(() => `
        <div class="game-card"><div class="game-img-wrap skeleton"></div>
        <div style="height:32px; padding:9px 12px;"><div class="skeleton" style="height:10px; border-radius:5px;"></div></div></div>
    `).join('');
}

async function loadGames(reset) {
    if (reset) { currentPage = 1; allGames = []; showSkeleton(); }
    try {
        // ✅ ঠিক করা হলো — "ALL"-এ এখন সব Vendor-JSON-File
        // Combine করা নতুন API ব্যবহার করা হচ্ছে (আগের সীমিত
        // Data-Source-এর বদলে)
        const url = currentVendor
            ? '/get_vendor_games.php?vendor=' + currentVendor + '&page=' + currentPage + '&limit=21'
            : '/get_all_slots_combined.php?page=' + currentPage + '&limit=21';
        const res = await fetch(url);
        const data = await res.json();
        allGames = allGames.concat(data.games || []);
        currentPage++;
        document.getElementById('loadMoreBtn').style.display = data.has_more ? 'block' : 'none';
        renderGrid();
    } catch (e) {}
}
function loadMore() { loadGames(false); }
