<?php 
session_start(); 
// ============================================================================== 
// STICKY TIME-BASED ALGORITHM 
// Numbers are locked to the current minute. F5 spamming won't change them. 
// Scaled UP to look like a highly active and popular platform. 
// ============================================================================== 

$now = time(); 
// Quantize time to the current minute (60 seconds). Prevents twitchy updates on rapid refresh. 
$stickyNow = floor($now / 60) * 60; 

$epoch = 1700000000; // Fixed recent past timestamp 
$elapsedDays = floor(($stickyNow - $epoch) / 86400); 
$secondsToday = $stickyNow % 86400; // Seconds passed since midnight 

// 1. Online Users: Boosted to thousands. Breathes between ~2,300 and ~4,700 users. 
$onlineNum = 3500 + floor(1200 * sin($stickyNow / 300)); 
$online = number_format($onlineNum); 

// 2. Winners: Large historical base + rapid new winners today. 
$winnersNum = 142580 + ($elapsedDays * 1400) + floor($secondsToday / 45); 
$winners = number_format($winnersNum); 

// 3. Today's Win: Scaled up to 'M' (Millions). Starts at 24.50M, grows to 42.70M by midnight. 
$todayWin = 24.5 + ($secondsToday / 86400) * 18.2; 
$todayWinFormatted = number_format($todayWin, 2) . "M"; 

// 4. Win Rate: Realistic small wobble (between 97.40% and 98.80%) 
$winRate = 98.10 + (0.7 * sin($stickyNow / 1200)); 
$winRateFormatted = number_format($winRate, 2) . "%"; 

// 5. Jackpot Amount: Believable mid-sized pot (Reduced from 15M to ~845K) 
$jackpotBase = 845200.50; 
$jackpotDailyGrowth = ($secondsToday / 86400) * 18500; // Grows max Rs 18,500 per day 
$jackpotAmount = $jackpotBase + $jackpotDailyGrowth; 
$jackpotFormatted = "Rs" . number_format($jackpotAmount, 2); 

// 6. Recent Minute Payout: Predictable, believable amounts (Rs 1,200 to Rs 6,600) 
$minuteSeed = floor($stickyNow / 60); 
$recentPayout = number_format(1200 + (($minuteSeed % 55) * 100)); 
?> 
<!DOCTYPE html> 
<html lang="en" dir="ltr"> 
<head> 
    <meta charset="UTF-8"> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> 
    <title>PAKclub</title> 
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> 
    <style> 
        * { 
            box-sizing: border-box; 
            font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; 
        } 
        body { 
            background: linear-gradient(to right, #43210d, #140904); 
            background-attachment: fixed; 
            color: #ffffff; 
            margin: 0; 
            padding: 0; 
            padding-bottom: 120px; 
            min-height: 100vh; 
        } 

        /* Top Golden Separator */ 
        .top-divider { 
            height: 1px; 
            width: 85%; 
            margin: 5px auto 10px auto; 
            background: linear-gradient(to right, transparent, rgba(255, 207, 75, 0.5), transparent); 
        } 

        /* Top Nav */ 
        .top-nav { 
            display: flex; 
            justify-content: space-around; 
            padding: 5px 10px 10px 10px; 
            font-size: 11px; 
            text-align: center; 
        } 
        .top-nav-item { 
            display: flex; 
            flex-direction: column; 
            align-items: center; 
            color: #e8dccc; 
            gap: 6px; 
            flex: 1; 
            cursor: pointer; 
            padding-bottom: 6px;
            border-bottom: 2px solid transparent;
            transition: all 0.3s ease;
        } 
        /* Active Filter Styling */
        .top-nav-item.active {
            color: #ffc107;
            border-bottom: 2px solid #ffc107;
            background: linear-gradient(to top, rgba(255, 193, 7, 0.1), transparent);
            border-radius: 6px 6px 0 0;
        }
        .top-nav-icon { 
            font-size: 22px; 
            color: #ffc107; 
            transition: transform 0.2s ease;
        } 
        .top-nav-item.active .top-nav-icon {
            transform: scale(1.1);
            text-shadow: 0 0 8px rgba(255, 193, 7, 0.5);
        }
        
        .eight-ball { 
            width: 22px; 
            height: 22px; 
            background-color: #ffc107; 
            border-radius: 50%; 
            display: flex; 
            align-items: center; 
            justify-content: center; 
            color: #000000; 
            font-weight: bold; 
            font-size: 14px; 
            transition: transform 0.2s ease, box-shadow 0.2s ease;
        } 
        .top-nav-item.active .eight-ball {
            transform: scale(1.1);
            box-shadow: 0 0 8px rgba(255, 193, 7, 0.5);
        }

        /* Banner Slider */ 
        .banner { 
            margin: 0 15px; 
            height: 145px; 
            border-radius: 10px; 
            background-color: #1a0f0a; 
            position: relative; 
            overflow: hidden; 
            border: 1px solid #5e331c; 
            box-shadow: 0 4px 12px rgba(0,0,0,0.4); 
            cursor: pointer; 
        } 
        
        .slides-wrapper { 
            display: flex; 
            width: 100%; 
            height: 100%; 
            transition: transform 0.5s ease-in-out; 
        } 

        .slide-img { 
            flex: 0 0 100%; 
            width: 100%; 
            height: 100%; 
            object-fit: fill; 
        } 

        .banner::before { 
            content: ''; 
            position: absolute; 
            bottom: 0; 
            left: 0; 
            width: 100%; 
            height: 35px; 
            background: linear-gradient(to top, rgba(0,0,0,0.75), transparent); 
            z-index: 1; 
            pointer-events: none; 
        } 

        .banner-dots { 
            position: absolute; 
            bottom: 8px; 
            left: 0; 
            width: 100%; 
            display: flex; 
            justify-content: center; 
            gap: 5px; 
            z-index: 2; 
        } 
        
        .dot { 
            width: 6px; 
            height: 6px; 
            background-color: rgba(255,255,255,0.4); 
            border-radius: 50%; 
            transition: all 0.3s ease; 
        } 
        .dot.active { 
            width: 14px; 
            border-radius: 4px; 
            background-color: #00e5ff; 
            box-shadow: 0 0 8px #00e5ff; 
        } 

        /* Notice Bar */ 
        .notice-bar { 
            margin: 10px 15px; 
            height: 35px; 
            background-color: #2a1b15; 
            border: 1px solid #4d3021; 
            border-radius: 6px; 
            display: flex; 
            align-items: center; 
            padding: 0 12px; 
            gap: 10px; 
            overflow: hidden; 
            cursor: pointer; 
        } 
        .notice-icon { 
            color: #ffc107; 
            font-size: 14px; 
        } 
        .ticker-text { 
            color: #e8dccc; 
            font-size: 14px; 
            white-space: nowrap; 
            width: 100%; 
        } 

        /* Action Grid */ 
        .action-grid { 
            display: flex; 
            justify-content: space-between; 
            margin: 15px; 
            gap: 8px; 
        } 
        .action-card { 
            flex: 1; 
            border-radius: 12px; 
            padding: 16px 2px 14px 2px; 
            text-align: center; 
            font-size: 12px; 
            color: #ffffff; 
            display: flex; 
            flex-direction: column; 
            align-items: center; 
            gap: 10px; 
            border: 1px solid transparent; 
            transition: all 0.3s ease; 
            cursor: pointer; 
        } 
        .action-card:active { 
            transform: scale(0.95); 
        } 
        
        .card-spin { background-color: #352014; border-color: #4a301e; } 
        .card-vip { background-color: #2a1635; border-color: #462558; } 
        .card-deposit { background-color: #2f2a12; border-color: #4b431d; } 
        .card-withdraw { background-color: #1f2916; border-color: #324424; } 

        .card-icon { 
            font-size: 24px; 
            color: #df973b; 
        } 

        /* Super Jackpot Section */ 
        .jackpot-container { 
            margin: 15px; 
            background: url('./img/event.png') center/cover no-repeat; 
            background-color: #170702; 
            border: 1px solid #8a2a16; 
            border-radius: 10px; 
            padding: 25px 15px; 
            text-align: center; 
            position: relative; 
            box-shadow: 0 4px 20px rgba(255, 0, 0, 0.15), inset 0 0 15px rgba(0,0,0,0.5); 
        } 
        .jackpot-title { 
            color: #ffea00; 
            font-size: 14px; 
            margin-bottom: 5px; 
            text-shadow: 1px 1px 2px #000, 0 0 10px rgba(255, 234, 0, 0.5); 
        } 
        .jackpot-amount { 
            color: #ffea00; 
            font-size: 34px; 
            font-weight: bold; 
            text-shadow: 0 0 18px rgba(255, 234, 0, 0.8), 2px 2px 4px rgba(0,0,0,0.8); 
            margin: 0; 
            font-family: 'Arial Black', sans-serif; 
        } 
        .jackpot-sub { 
            color: #ffffff; 
            font-size: 11px; 
            margin-top: 5px; 
            margin-bottom: 20px; 
        } 
        
        /* Accurately Styled 3D Play Now Button */ 
        .btn-play { 
            background: linear-gradient(to bottom, #a70000, #5c0000); 
            color: #ffffff; 
            padding: 10px 45px; 
            border: 2px solid #ffea00; 
            border-radius: 30px; 
            font-size: 18px; 
            font-weight: 500; 
            cursor: pointer; 
            text-shadow: 1px 1px 2px #000; 
            margin: 0 auto; 
            display: block; 
            text-align: center; 
            box-shadow: 0 5px 0 #7a3a14, 0 8px 10px rgba(0,0,0,0.6); 
            transition: transform 0.1s, box-shadow 0.1s; 
            outline: none; 
        } 
        .btn-play:active { 
            transform: translateY(5px); 
            box-shadow: 0 0 0 #7a3a14, 0 2px 4px rgba(0,0,0,0.6); 
        } 

        /* Stats */ 
        .stats-section { 
            margin: 25px 15px 15px 15px; 
            background-color: #241c19; 
            border-radius: 10px; 
            padding: 15px 10px; 
            display: flex; 
            justify-content: space-around; 
            text-align: center; 
            font-size: 11px; 
            position: relative; 
            border: 1px solid #4a3429; 
        } 
        .stats-item { 
            display: flex; 
            flex-direction: column; 
            align-items: center; 
            gap: 4px; 
        } 
        .stats-item span { color: #bcaaa0; } 
        .stats-val { font-weight: bold; font-size: 13px; color: #fff; display: flex; align-items: center; gap: 4px;} 
        
        .stat-icon-blue { color: #00e5ff; text-shadow: 0 0 5px rgba(0, 229, 255, 0.5); } 
        .stat-icon-orange { color: #ff6d00; text-shadow: 0 0 5px rgba(255, 109, 0, 0.5); } 
        .stat-icon-green { color: #00e676; text-shadow: 0 0 5px rgba(0, 230, 118, 0.5); } 
        .stat-icon-yellow { color: #ffea00; text-shadow: 0 0 5px rgba(255, 234, 0, 0.5); } 

        /* Daily Rewards */ 
        .daily-rewards { 
            margin: 0 15px 15px 15px; 
            background: linear-gradient(135deg, #5a331c 0%, #3b2014 50%, #1e1009 100%); 
            border-radius: 12px; 
            padding: 14px 18px; 
            display: flex; 
            align-items: center; 
            justify-content: space-between; 
            border: 1px solid rgba(255, 255, 255, 0.15); 
            box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4); 
            position: relative; 
            overflow: hidden; 
            cursor: pointer; 
        } 

        .daily-rewards::before { 
            content: ''; 
            position: absolute; 
            top: 0; 
            left: -100%; 
            width: 50%; 
            height: 100%; 
            background: linear-gradient(to right, transparent, rgba(255,255,255,0.1), transparent); 
            transform: skewX(-25deg); 
            animation: glassShine 4s infinite; 
        } 

        @keyframes glassShine { 
            0% { left: -100%; } 
            20% { left: 150%; } 
            100% { left: 150%; } 
        } 

        .reward-left { 
            display: flex; 
            align-items: center; 
            justify-content: center; 
            z-index: 2; 
        } 
        .reward-coin { 
            width: 50px; 
            height: auto; 
            filter: drop-shadow(0 0 10px rgba(255, 193, 7, 0.7)); 
            animation: floatCoin 3s ease-in-out infinite; 
        } 
        @keyframes floatCoin { 
            0%, 100% { transform: translateY(0); } 
            50% { transform: translateY(-4px); } 
        } 
        .reward-text { 
            flex: 1; 
            padding: 0 15px; 
            text-align: center; 
            display: flex; 
            flex-direction: column; 
            justify-content: center; 
            z-index: 2; 
        } 
        .reward-title { 
            color: #ffffff; 
            font-size: 15px; 
            font-weight: 900; 
            margin-bottom: 2px; 
            text-shadow: 1px 1px 3px rgba(0,0,0,0.5); 
        } 
        .reward-sub { 
            color: #ffca28; 
            font-size: 11px; 
            font-weight: bold; 
            opacity: 0.9; 
        } 
        .reward-btn { 
            background: linear-gradient(to bottom, #ff9800, #f57c00); 
            color: #fff; 
            border: 1px solid rgba(255,255,255,0.3); 
            border-radius: 20px; 
            padding: 8px 22px; 
            font-size: 15px; 
            cursor: pointer; 
            box-shadow: 0 4px 15px rgba(255, 152, 0, 0.4); 
            transition: all 0.2s ease; 
            z-index: 2; 
        } 
        .reward-btn:active { 
            transform: scale(0.95); 
            box-shadow: 0 2px 8px rgba(255, 152, 0, 0.4); 
        } 

        /* Clean Minimalist Signals List */ 
        .signals-wrapper {
            margin: 0 15px 20px 15px;
            background: linear-gradient(145deg, #1f1209 0%, #110804 100%);
            border: 1px solid rgba(255, 193, 7, 0.15);
            border-radius: 12px;
            padding: 8px 0;
            box-shadow: 0 4px 15px rgba(0,0,0,0.4);
        }
        .signals-header {
            color: #ffc107;
            font-size: 12px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            padding: 8px 15px 12px 15px;
            border-bottom: 1px solid rgba(255, 193, 7, 0.1);
            display: flex;
            align-items: center;
            gap: 6px;
        }
        .signal-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 14px 15px;
            text-decoration: none;
            border-bottom: 1px solid rgba(255, 255, 255, 0.03);
            transition: background 0.2s ease;
        }
        .signal-item:last-child {
            border-bottom: none;
        }
        .signal-item:active {
            background: rgba(255, 193, 7, 0.05);
        }
        .signal-name {
            color: #e8dccc;
            font-size: 14px;
            font-weight: 500;
        }
        .whatsapp-icon {
            color: #25d366;
            font-size: 18px;
            opacity: 0.9;
        }

        /* Popular Games */ 
        .games-section { 
            margin: 0 15px 20px 15px; 
        } 
        .games-header { 
            margin-bottom: 12px; 
            color: #ffffff; 
            font-size: 18px; 
            font-weight: bold; 
        } 
        .games-grid { 
            display: grid; 
            grid-template-columns: repeat(3, 1fr); 
            gap: 10px; 
        } 
        .game-card { 
            position: relative; 
            border-radius: 12px; 
            overflow: hidden; 
            aspect-ratio: 1 / 1; 
            background-color: #1a0f0a; 
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4); 
            cursor: pointer; 
            transition: transform 0.2s ease, box-shadow 0.2s ease; 
        } 
        .game-card:active { 
            transform: scale(0.95); 
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5); 
        } 
        .game-card img { 
            width: 100%; 
            height: 100%; 
            object-fit: cover; 
            display: block; 
        } 
        
        .game-title { 
            position: absolute; 
            bottom: 0; 
            left: 0; 
            width: 100%; 
            padding: 42px 8px 8px 8px; 
            background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.7) 45%, transparent 100%); 
            color: #ffffff; 
            font-size: 12px; 
            font-weight: 600; 
            text-align: left; 
            white-space: nowrap; 
            overflow: hidden; 
            text-overflow: ellipsis; 
            z-index: 2; 
        } 

        .badge-tl { 
            position: absolute; 
            top: 0; 
            left: 0; 
            padding: 2px 8px; 
            font-size: 10px; 
            font-weight: bold; 
            color: #fff; 
            border-radius: 0 0 8px 0; 
            z-index: 3; 
        } 
        .badge-top { 
            background-color: #ff9800; 
            border-right: 1px solid #fff; 
            border-bottom: 1px solid #fff; 
        } 
        .badge-tb { background-color: #8bc34a; } 
        .badge-mg { background-color: #2196f3; } 
        .badge-jili { background-color: #e040fb; } 

        .badge-tr { 
            position: absolute; 
            top: 6px; 
            right: 6px; 
            background-color: #000000; 
            color: #ffffff; 
            padding: 2px 6px; 
            border-radius: 12px; 
            font-size: 10px; 
            font-weight: bold; 
            z-index: 3; 
        } 

        /* Black Glassy iPhone Style Toast */ 
        .custom-toast { 
            visibility: hidden; 
            min-width: auto; 
            background: rgba(20, 20, 20, 0.75); 
            backdrop-filter: blur(12px); 
            -webkit-backdrop-filter: blur(12px); 
            color: #fff; 
            text-align: center; 
            border-radius: 50px; 
            padding: 10px 24px; 
            position: fixed; 
            z-index: 9999; 
            left: 50%; 
            bottom: 50px; 
            transform: translateX(-50%); 
            font-size: 13px; 
            font-weight: 500; 
            opacity: 0; 
            transition: opacity 0.3s, bottom 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
            border: 1px solid rgba(255, 255, 255, 0.15); 
            box-shadow: 0 4px 15px rgba(0,0,0,0.3); 
            white-space: nowrap; 
        } 
        .custom-toast.show { 
            visibility: visible; 
            opacity: 1; 
            bottom: 90px; 
        } 

        /* Footer Info Block Styling */
        .bottom-info-block {
            margin: 25px 15px 40px 15px;
            padding-top: 20px;
            border-top: 1px solid rgba(255, 255, 255, 0.05);
            text-align: left;
        }
        .bottom-info-logos {
            display: flex;
            align-items: center;
            gap: 15px;
            margin-bottom: 15px;
        }
        .bottom-info-logos img.u18 {
            height: 28px;
            width: auto;
        }
        .bottom-info-logos img.app-logo {
            height: 28px;
            width: auto;
            opacity: 0.9;
        }
        .bottom-info-text {
            color: #9c8e82;
            font-size: 11px;
            line-height: 1.6;
            font-weight: 400;
        }

    </style> 
</head> 
<body> 

    <?php include 'external/header.php'; ?> 
    <?php 
    // Fetch games from DB 
    $games_stmt = $pdo->query("SELECT * FROM games ORDER BY sort_order ASC, id DESC"); 
    $db_games = $games_stmt ? $games_stmt->fetchAll(PDO::FETCH_ASSOC) : []; 
    ?> 

    <div class="top-divider"></div> 

    <div class="top-nav"> 
        <div class="top-nav-item" onclick="filterGames('Popular', this)"> 
            <i class="fa-solid fa-star top-nav-icon"></i> 
            Popular 
        </div> 
        <div class="top-nav-item" onclick="filterGames('Top Rated', this)"> 
            <i class="fa-solid fa-fire top-nav-icon"></i> 
            Top Rated 
        </div> 
        <div class="top-nav-item" onclick="filterGames('Lottery', this)"> 
            <div class="eight-ball">8</div> 
            Lottery 
        </div> 
        <div class="top-nav-item" onclick="filterGames('Best Choice', this)"> 
            <i class="fa-solid fa-ranking-star top-nav-icon"></i> 
            Best Choice 
        </div> 
        <div class="top-nav-item" onclick="window.location.href='games.php'"> 
            <i class="fa-solid fa-gamepad top-nav-icon"></i> 
            Games 
        </div> 
    </div> 

    <div class="banner" id="promoBanner" onclick="showToast('Not available')"> 
        <div class="slides-wrapper" id="slidesWrapper"> 

            <img src="https://pakclub.bet/img/6004/other/044244207-35075-file_20260503164244180.webp" class="slide-img" alt="Promo 1"> 
            <img src="https://pakclub.bet/img/6004/other/105127210-31889-file_20260418105127200.webp" class="slide-img" alt="Promo 2"> 
            <img src="https://pakclub.bet/img/6004/other/105024636-31886-file_20260418105024628.webp" class="slide-img" alt="Promo 3"> 
            <img src="https://pakclub.bet/img/6004/other/105024636-31886-file_20260418105024628.webp" class="slide-img" alt="Promo 4"> 
            <img src="https://pakclub.bet/img/6004/other/105217197-31891-file_20260418105217188.webp" class="slide-img" alt="Promo 5"> 
            <img src="https://pakclub.bet/img/6004/other/105050681-31887-file_20260418105050672.webp" class="slide-img" alt="Promo 6"> 
        </div> 
        <div class="banner-dots" id="bannerDots"> 
            <div class="dot active"></div> 
            <div class="dot"></div> 
            <div class="dot"></div> 
            <div class="dot"></div> 
            <div class="dot"></div> 
            <div class="dot"></div> 
        </div> 
    </div> 

    <div class="notice-bar" onclick="showToast('Not available')"> 
        <i class="fa-solid fa-volume-high notice-icon"></i> 
        <marquee class="ticker-text" direction="left" scrollamount="4"> 
            Congratulations! User 0321*** just won Rs 15,000 from Super Jackpot! 🎉 
        </marquee> 
    </div> 

    <div class="action-grid"> 
        <div class="action-card card-spin" onclick="showToast('Not available')"> 
            <i class="fa-solid fa-life-ring card-icon"></i> 
            Spin 
        </div> 
        <div class="action-card card-vip" onclick="showToast('Not available')"> 
            <i class="fa-solid fa-trophy card-icon"></i> 
            VIP 
        </div> 
        <div class="action-card card-deposit" onclick="window.location.href='/wallet/deposit.php'"> 
            <i class="fa-solid fa-wallet card-icon"></i> 
            Deposit 
        </div> 
        <div class="action-card card-withdraw" onclick="window.location.href='/wallet/withdraw.php'"> 
            <i class="fa-solid fa-money-bill-transfer card-icon"></i> 
            Withdraw 
        </div> 
    </div> 

    <div class="jackpot-container"> 
        <div class="jackpot-title">Super Jackpot</div> 
        <div class="jackpot-amount"><?php echo $jackpotFormatted; ?></div> 
        <div class="jackpot-sub">Past minute payout Rs<?php echo $recentPayout; ?>+</div> 
        <button class="btn-play" onclick="window.location.href='/WinGo/WinGo_30S.php'">Play Now</button> 
    </div> 

    <div class="stats-section"> 
        <div class="stats-item"> 
            <div class="stats-val"><i class="fa-solid fa-user stat-icon-blue"></i> <?php echo $online; ?></div> 
            <span>Online</span> 
        </div> 
        <div class="stats-item"> 
            <div class="stats-val"><i class="fa-solid fa-clipboard-list stat-icon-orange"></i> <?php echo $winners; ?></div> 
            <span>Winners</span> 
        </div> 
        <div class="stats-item"> 
            <div class="stats-val"><i class="fa-solid fa-chart-line stat-icon-green"></i> <?php echo $todayWinFormatted; ?></div> 
            <span>Today's Win</span> 
        </div> 
        <div class="stats-item"> 
            <div class="stats-val"><i class="fa-solid fa-chart-simple stat-icon-yellow"></i> <?php echo $winRateFormatted; ?></div> 
            <span>Win Rate</span> 
        </div> 
    </div> 

    <div class="daily-rewards" onclick="window.location.href='checkin.php'"> 
        <div class="reward-left"> 
            <img src="./img/coin.png" class="reward-coin" alt="Coin"> 
        </div> 
        <div class="reward-text"> 
            <div class="reward-title">Daily Rewards</div> 
            <div class="reward-sub">Sign in daily to claim bonuses!</div> 
        </div> 
        <button class="reward-btn">Claim</button> 
    </div> 

 
    <div class="games-section"> 
        <div class="games-header" id="gamesHeader"> 
            Popular Games 
        </div> 
        <div class="games-grid" id="gamesGrid"> 
             
            <?php foreach($db_games as $g): ?> 
            <?php  
                $catAttr = htmlspecialchars($g['categories']); 
                $link = htmlspecialchars($g['link']); 
                $onclick = strpos($link, 'javascript:') === 0 ? $link : "window.location.href='$link'"; 
            ?> 
            <div class="game-card"  
                 data-categories="<?php echo $catAttr; ?>"  
                 data-popular="<?php echo $g['is_popular']; ?>" 
                 data-top="<?php echo $g['is_top_rated']; ?>" 
                 data-best="<?php echo $g['is_best_choice']; ?>" 
                 onclick="<?php echo $onclick; ?>"> 
                 
                <img src="<?php echo htmlspecialchars($g['image_url']); ?>" alt="<?php echo htmlspecialchars($g['name']); ?>"> 
                 
                <?php if($g['badge_text']): ?> 
                <div class="badge-tl <?php echo htmlspecialchars($g['badge_color']); ?>"><?php echo htmlspecialchars($g['badge_text']); ?></div> 
                <?php endif; ?> 
                 
                <div class="badge-tr"><?php echo $g['rtp']; ?>%</div> 
                <div class="game-title"><?php echo htmlspecialchars($g['name']); ?></div> 
            </div> 
            <?php endforeach; ?> 
             
            <?php if(empty($db_games)): ?> 
                <p style="color:#a0938a;grid-column:1/-1;text-align:center;">No games available.</p> 
            <?php endif; ?> 
        </div> 
    </div> 
   <div class="signals-wrapper">
        <div class="signals-header"><i class="fa-solid fa-shield-halved"></i> Trusted Agents Live Signals Channels</div>
        
        <a href="https://whatsapp.com/channel/0029Vb7ig00G8l57QR06v412" target="_blank" class="signal-item">
            <div class="signal-name">Spidey Wingo Signals 📈</div>
            <i class="fa-brands fa-whatsapp whatsapp-icon"></i>
        </a>
        
        <a href="https://whatsapp.com/channel/0029VbCZfFA42DckfVMN5X2h" target="_blank" class="signal-item">
            <div class="signal-name">𝐏𝐀𝐊𝐂𝐋𝐔𝐁24 LiVE SINGNALS 🤑</div>
            <i class="fa-brands fa-whatsapp whatsapp-icon"></i>
        </a>
        
        <a href="https://whatsapp.com/channel/0029VbD9FyZBFLgT5hGCLS1X" target="_blank" class="signal-item">
            <div class="signal-name">Pakclub24 signals</div>
            <i class="fa-brands fa-whatsapp whatsapp-icon"></i>
        </a>
    </div>

    <div class="bottom-info-block">
        <div class="bottom-info-logos">
            <img src="https://www.fantasygems20.com/assets/png/u18-7146ab6f.webp" class="u18" alt="18+">
            <img src="https://pakclub24.club/img/logo.png" class="app-logo" alt="Pakclub Logo">
        </div>
        <div class="bottom-info-text">
            Pakclub Mainly Features Online Video Games, Slots and Casino.<br data-v-4529147b=""> 
            We work with more than 2300 video games, slot and casino providers, all of whom are certified as fair gambling, support fast deposits and withdrawals, and friendly service. <br data-v-4529147b=""> 
            Gambling Is Addictive, Please Play It Wisely. Pakclub Only Accepts Customers over the Age of 18
        </div>
    </div>

    <?php include 'external/footer.php'; ?> 

    <div id="customToast" class="custom-toast"></div> 

    <script> 
        // Games Filter Logic (Updated to handle visual state)
        function filterGames(category, element = null) { 
            const header = document.getElementById('gamesHeader'); 
            if(header) header.innerText = category + ' Games'; 
             
            // Handle Visual Active State Feedback
            if (element) {
                document.querySelectorAll('.top-nav-item').forEach(el => el.classList.remove('active'));
                element.classList.add('active');
            }

            const cards = document.querySelectorAll('.game-card'); 
            let visibleCount = 0; 
             
            cards.forEach(card => { 
                const cats = card.getAttribute('data-categories') || ''; 
                const isPop = card.getAttribute('data-popular') === '1'; 
                const isTop = card.getAttribute('data-top') === '1'; 
                const isBest = card.getAttribute('data-best') === '1'; 
                 
                let show = false; 
                if (category === 'Popular' && isPop) show = true; 
                else if (category === 'Top Rated' && isTop) show = true; 
                else if (category === 'Best Choice' && isBest) show = true; 
                else if (cats.includes(category)) show = true; 
                 
                if (show) { 
                    card.style.display = 'block'; 
                    visibleCount++; 
                } else { 
                    card.style.display = 'none'; 
                } 
            }); 
        } 
         
        // Initialize default view to Popular after DOM load and highlight the first nav item
        document.addEventListener('DOMContentLoaded', function() { 
            const firstFilterElement = document.querySelector('.top-nav-item');
            filterGames('Popular', firstFilterElement); 
        }); 

        // Smooth Auto-Scrolling Slider Logic 
        document.addEventListener('DOMContentLoaded', function() { 
            const wrapper = document.getElementById('slidesWrapper'); 
            const dots = document.getElementById('bannerDots').children; 
            let currentSlide = 0; 
            const totalSlides = dots.length; 

            if(totalSlides > 0) { 
                setInterval(() => { 
                    currentSlide = (currentSlide + 1) % totalSlides; 
                    wrapper.style.transform = `translateX(-${currentSlide * 100}%)`; 
                     
                    // Update active dot 
                    for(let i = 0; i < totalSlides; i++){ 
                        dots[i].classList.remove('active'); 
                    } 
                    dots[currentSlide].classList.add('active'); 
                }, 3500); // Changes image every 3.5 seconds 
            } 
        }); 

        // iPhone Style Glassy Toast Notification Function 
        function showToast(message) { 
            var toast = document.getElementById("customToast"); 
             
            // Clear any existing timeout to avoid glitching if clicked rapidly 
            if(window.toastTimeout) { 
                clearTimeout(window.toastTimeout); 
                toast.className = "custom-toast"; 
            } 
             
            toast.innerText = message; 
             
            // Force reflow 
            void toast.offsetWidth; 
             
            toast.className = "custom-toast show"; 
             
            window.toastTimeout = setTimeout(function(){ 
                toast.className = toast.className.replace("show", ""); 
            }, 1500); 
        } 
        <?php if(isset($_GET['err']) && $_GET['err'] === 'demo_restriction'): ?>
        document.addEventListener('DOMContentLoaded', function() {
            showToast('This account can only play WinGo');
        });
        <?php endif; ?>
    </script> 
</body> 
</html>