<?php
require_once __DIR__ . '/auth_helper.php';
$installMissing = !check_installed();
$errorMessage = '';
try {
    $settings = all_settings();
    $user = currentUser();
    $isLoggedIn = (bool)$user;
    $games = $installMissing ? [] : home_games();
    $txs = $user ? userTransactions($user['id'], 10) : [];
    $methods = $user ? payment_methods_for_country($user['country_code']) : [];
    $withdrawOptions = $user ? withdraw_method_options($user['country_code']) : [];
} catch (Throwable $e) {
    $settings = default_settings(); $user = null; $isLoggedIn=false; $games=[]; $txs=[]; $methods=[]; $withdrawOptions=[];
    $errorMessage = $e->getMessage();
}
$siteName = 'taka26.com';
$announcement = $settings['announcement'] ?? '';
$userBal = $user ? number_format((float)$user['balance'], 2, '.', ',') : '0.00';
$userAv = $user ? (($user['avatar'] ?: strtoupper(substr(preg_replace('/\D+/', '', $user['phone']), -2)))) : '';
$userUid = $user ? (string)$user['phone'] : '';
$userBalanceRaw = $user ? (float)$user['balance'] : 0.0;
/*
   SECURITY FIX:
   Never expose phone/id or remote Aviator token from index.php.
   Aviator must always open through aviator_launch.php.
   aviator_launch.php creates a one-time/session-bound token and redirects to the remote server.
*/
$aviatorUrl = 'aviator_launch.php';
function game_url(array $g, string $aviatorUrl, ?array $user=null): string {
    if (strtolower($g['title'] ?? '') === 'aviator') {
        return 'aviator_launch.php';
    }
    return (($g['game_url'] ?? '') ?: 'game.php?game=' . urlencode($g['title'] ?? 'game'));
}
function category_icon(string $cat): string { return ['all'=>'fa-gamepad','slots'=>'fa-dice','casino'=>'fa-tv','sports'=>'fa-futbol','crash'=>'fa-plane-departure','fishing'=>'fa-fish','lottery'=>'fa-ticket-alt','pvc'=>'fa-chess'][$cat] ?? 'fa-gamepad'; }
$cats = ['all'=>'All','slots'=>'Slots','casino'=>'Live','sports'=>'Sports','crash'=>'Crash','fishing'=>'Fishing','lottery'=>'Lottery','pvc'=>'PVC'];
$depositQuickAmounts = [100,200,500,1000,3000,5000,10000,20000,30000,50000];
$depositMin = 100;
$depositMax = 50000;
?>
<!DOCTYPE html>
<html lang="bn">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<title><?= e($siteName) ?></title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800;900&family=Barlow+Condensed:wght@700;800;900&display=swap" rel="stylesheet">
<link rel="stylesheet" href="assets/index_theme.css?v=22">

<style>
/* ===== Shining Glass Game Effect: added only visual layer, no logic changed ===== */
.gc,
.game-card-pro,
.provider-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transform: translateZ(0);
}

.gc > *,
.game-card-pro > *,
.provider-card > * {
  position: relative;
  z-index: 4;
}

.gc::before,
.game-card-pro::before,
.provider-card::before {
  content: "";
  position: absolute;
  top: -35%;
  left: -80%;
  width: 70%;
  height: 170%;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(
      115deg,
      transparent 0%,
      rgba(255,255,255,0.00) 28%,
      rgba(255,255,255,0.20) 45%,
      rgba(255,255,255,0.48) 50%,
      rgba(255,255,255,0.20) 56%,
      rgba(255,255,255,0.00) 72%,
      transparent 100%
    );
  transform: translateX(-145%) skewX(-18deg);
  filter: blur(.2px);
  mix-blend-mode: screen;
  animation: pkGlassSweep 4.2s ease-in-out infinite;
}

.gc::after,
.game-card-pro::after,
.provider-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  border-radius: inherit;
  background:
    radial-gradient(circle at 18% 6%, rgba(255,255,255,.26), transparent 30%),
    linear-gradient(180deg, rgba(255,255,255,.13), rgba(255,255,255,0) 43%),
    linear-gradient(135deg, rgba(255,255,255,.08), rgba(255,255,255,0) 50%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.22),
    inset 0 0 0 1px rgba(255,255,255,.10),
    0 0 22px rgba(255,255,255,.04);
}

.gc:hover::before,
.game-card-pro:hover::before,
.provider-card:hover::before {
  animation-duration: 1.45s;
}

.gc .img-game,
.game-card-pro .img-game,
.provider-card .img-game {
  transition: transform .35s ease, filter .35s ease;
}

.gc:hover .img-game,
.game-card-pro:hover .img-game,
.provider-card:hover .img-game {
  transform: scale(1.055);
  filter: saturate(1.18) brightness(1.08) contrast(1.04);
}

@keyframes pkGlassSweep {
  0%, 35% { transform: translateX(-145%) skewX(-18deg); opacity: 0; }
  45% { opacity: .95; }
  68%, 100% { transform: translateX(305%) skewX(-18deg); opacity: 0; }
}

/* ===== DK WIN style Deposit Selector + Payment bridge, taka26 theme ===== */
.pk-deposit-wrap{padding:10px 12px 92px;background:radial-gradient(circle at 50% -10%,rgba(124,252,0,.10),transparent 42%),#050505;min-height:calc(100vh - 48px)}
.pk-deposit-panel{border:1px solid rgba(124,252,0,.18);background:linear-gradient(180deg,#111,#090909);border-radius:20px;box-shadow:0 16px 44px rgba(0,0,0,.58);overflow:hidden}
.pk-deposit-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:15px;background:linear-gradient(135deg,#0e190d,#071007 65%,#161206);border-bottom:1px solid rgba(124,252,0,.14)}
.pk-deposit-head-left small{display:block;color:#93a18e;font-size:10px;font-weight:900;letter-spacing:.6px;text-transform:uppercase}.pk-deposit-head-left b{display:block;color:#fff;font-size:24px;font-weight:900;margin-top:3px}.pk-deposit-head-left p{margin:4px 0 0;color:#a7b3a1;font-size:11px;line-height:1.35}.pk-deposit-badge{width:52px;height:52px;border-radius:18px;display:grid;place-items:center;background:linear-gradient(135deg,#5dda00,var(--green));color:#061006;font-size:22px;box-shadow:0 0 26px rgba(124,252,0,.30)}
.pk-deposit-body{display:grid;grid-template-columns:162px 1fr;min-height:350px}.pk-method-side{background:#0a0a0a;border-right:1px solid rgba(255,255,255,.07);padding:12px;display:flex;flex-direction:column;gap:10px}.pk-method-tile{position:relative;display:grid;grid-template-columns:38px 1fr 16px;align-items:center;gap:8px;border:1px solid rgba(255,255,255,.08);background:linear-gradient(180deg,#181818,#101010);border-radius:13px;padding:10px 8px;cursor:pointer;min-height:58px;transition:.18s ease}.pk-method-tile:hover{transform:translateY(-1px)}.pk-method-tile input{display:none}.pk-method-tile.active,.pk-method-tile:has(input:checked){border-color:#ff4c4c;box-shadow:inset 0 0 0 1px rgba(255,76,76,.12),0 0 18px rgba(255,76,76,.10)}.pk-method-tile.active::before,.pk-method-tile:has(input:checked)::before{content:"";position:absolute;right:0;top:0;border-top:18px solid #ff4c4c;border-left:18px solid transparent}.pk-method-tile.active::after,.pk-method-tile:has(input:checked)::after{content:"✓";position:absolute;right:2px;top:0;color:#fff;font-size:9px;font-weight:900}.pk-method-logo{width:38px;height:38px;border-radius:10px;display:grid;place-items:center;background:linear-gradient(135deg,#ff2f73,#ff8c00);color:#fff;font-size:14px;font-weight:900;box-shadow:0 8px 18px rgba(0,0,0,.22);overflow:hidden}.pk-method-logo.nagad{background:linear-gradient(135deg,#ffcc00,#ff3c00)}.pk-method-logo.bank{background:linear-gradient(135deg,#31a8ff,#0066ff)}.pk-method-title{color:#e8e8e8;font-size:11px;font-weight:900;line-height:1.15}.pk-method-sub{color:#8a8a8a;font-size:9px;font-weight:800;margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.pk-method-hot{position:absolute;right:0;top:0;background:#ff8a00;color:#fff;border-radius:0 12px 0 10px;padding:2px 4px;font-size:9px}
.pk-deposit-main{background:#101010;padding:14px 14px 18px}.pk-info-title{display:flex;align-items:center;gap:8px;color:#f5f5f5;font-size:13px;font-weight:900;border-left:3px solid var(--green);padding-left:8px;margin-bottom:12px}.pk-note{background:rgba(255,115,55,.11);border:1px solid rgba(255,115,55,.23);color:#ffdfca;border-radius:10px;padding:10px 12px;font-size:11px;font-weight:800;line-height:1.45;margin-bottom:13px}.pk-selected-method{display:inline-flex;align-items:center;gap:7px;border:1px solid rgba(255,76,76,.55);background:rgba(255,76,76,.06);color:#fff;border-radius:8px;padding:8px 10px;font-size:11px;font-weight:900;margin-bottom:13px}.pk-selected-method i{color:#ff8a00}.pk-warning-strip{display:flex;gap:8px;align-items:center;background:#333;border-radius:7px;padding:8px 10px;margin-bottom:14px;color:#fff;font-size:10px;line-height:1.35;max-width:560px;box-shadow:0 4px 10px rgba(0,0,0,.35)}.pk-warning-dot{width:19px;height:19px;border-radius:50%;display:grid;place-items:center;background:#ff3333;color:#fff;font-weight:900;flex:0 0 auto}.pk-amount-row{display:flex;align-items:flex-start;gap:9px;flex-wrap:wrap}.pk-amount-label{color:#d7d7d7;font-size:12px;margin-top:9px;min-width:70px}.pk-amounts{display:flex;flex-wrap:wrap;gap:9px;max-width:550px}.pk-amount-btn{min-width:49px;height:29px;padding:0 10px;border-radius:6px;border:1px solid rgba(255,76,76,.35);background:#161616;color:#d9d9d9;font-size:11px;font-weight:800;cursor:pointer}.pk-amount-btn.active{background:linear-gradient(135deg,#ff3030,#ff7a00);color:#fff;border-color:#ff6b00;box-shadow:0 0 15px rgba(255,78,0,.25)}.pk-custom-amount{margin:10px 0 0 79px;width:168px;height:35px;border:1px solid rgba(255,255,255,.12);background:#0b0b0b;color:#fff;border-radius:8px;padding:0 12px;font-size:12px;outline:0}.pk-custom-amount:focus{border-color:var(--green);box-shadow:0 0 0 3px rgba(124,252,0,.08)}.pk-rule-text{margin:9px 0 0 79px;color:#ff4040;font-size:11px;font-weight:900;line-height:1.7}.pk-deposit-submit{margin:70px 0 0 12px;border:0;border-radius:999px;background:linear-gradient(135deg,#ff2f48,#ff5633);color:#fff;font-size:12px;font-weight:900;padding:11px 20px;box-shadow:0 10px 24px rgba(255,47,72,.25);cursor:pointer}.pk-deposit-submit:active{transform:scale(.98)}.pk-no-method{padding:15px;border:1px solid rgba(255,80,80,.25);background:rgba(255,80,80,.08);color:#ffb7b7;border-radius:14px;font-size:12px;font-weight:800}
@media(max-width:640px){.pk-deposit-wrap{padding:8px 8px 92px}.pk-deposit-body{grid-template-columns:1fr}.pk-method-side{border-right:0;border-bottom:1px solid rgba(255,255,255,.07);display:grid;grid-template-columns:repeat(2,1fr)}.pk-deposit-main{padding:13px}.pk-warning-strip{font-size:9px}.pk-amount-row{display:block}.pk-amount-label{margin:0 0 8px}.pk-amounts{gap:7px}.pk-amount-btn{min-width:54px}.pk-custom-amount,.pk-rule-text{margin-left:0}.pk-deposit-submit{margin:24px 0 0;width:100%;border-radius:14px;height:48px}.pk-deposit-head-left b{font-size:21px}}

/* ============================================================
   PROMO PAGE — Complete Redesign (taka26 theme)
   ============================================================ */
#pg-promo {
  background: #060608;
  min-height: 100vh;
  padding-bottom: 80px;
  overflow-x: hidden;
}

/* --- Promo Header --- */
.promo-page > header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  height: 52px;
  background: rgba(6,6,8,.96);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,.06);
}

/* --- Promo Hero --- */
.promo-hero {
  position: relative;
  overflow: hidden;
  margin: 0;
  padding: 0 16px 28px;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(255,184,0,.18) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 80% 80%, rgba(255,60,0,.12) 0%, transparent 60%),
    linear-gradient(180deg, #0e0b00 0%, #060608 100%);
}
.promo-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffb800' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.promo-hero-content {
  position: relative;
  padding-top: 30px;
  text-align: center;
}
.promo-hero-label {
  display: inline-block;
  background: linear-gradient(90deg, #ffb800, #ff6d00);
  color: #000;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 4px 14px;
  border-radius: 999px;
  margin-bottom: 14px;
  animation: promoPulse 2.5s ease-in-out infinite;
}
@keyframes promoPulse {
  0%,100%{ box-shadow: 0 0 0 0 rgba(255,184,0,.4); }
  50%{ box-shadow: 0 0 0 10px rgba(255,184,0,0); }
}
.promo-hero-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 54px;
  font-weight: 900;
  line-height: .9;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: -1px;
}
.promo-hero-title span {
  background: linear-gradient(90deg, #ffb800 0%, #ff4c00 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: block;
}
.promo-hero-sub {
  color: #9a8a6a;
  font-size: 13px;
  font-weight: 500;
  margin: 10px 0 22px;
  letter-spacing: .3px;
}
.promo-stats {
  display: flex;
  justify-content: center;
  gap: 0;
  margin: 0 auto;
  max-width: 340px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  overflow: hidden;
}
.promo-stat {
  flex: 1;
  padding: 12px 4px;
  text-align: center;
  position: relative;
}
.promo-stat + .promo-stat::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 1px;
  background: rgba(255,255,255,.1);
}
.promo-stat-num {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 22px;
  font-weight: 900;
  color: #ffb800;
  line-height: 1;
}
.promo-stat-label {
  font-size: 9px;
  color: #7a6a4a;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-top: 3px;
}

/* --- Animated Live Jackpot Strip --- */
.promo-jackpot-strip {
  margin: 0 14px 18px;
  background: linear-gradient(90deg, #1a0d00, #130900, #1a0d00);
  border: 1px solid rgba(255,140,0,.28);
  border-radius: 14px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
}
.promo-jackpot-strip::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,140,0,.06), transparent);
  animation: jpSweep 3s ease-in-out infinite;
}
@keyframes jpSweep {
  0%{ transform: translateX(-100%); }
  100%{ transform: translateX(100%); }
}
.promo-jp-icon {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #ff8c00, #ffb800);
  display: grid; place-items: center;
  color: #000; font-size: 15px;
  flex-shrink: 0;
  animation: jpIconSpin 4s linear infinite;
}
@keyframes jpIconSpin {
  0%,100%{ transform: rotateY(0); }
  50%{ transform: rotateY(180deg); }
}
.promo-jp-info { flex: 1; }
.promo-jp-label { font-size: 9px; color: #a87a30; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; }
.promo-jp-amount { font-family: 'Barlow Condensed', sans-serif; font-size: 20px; font-weight: 900; color: #ffb800; line-height: 1.1; }
.promo-jp-amount .nb { display: inline-block; min-width: 12px; text-align: center; }
.promo-jp-claim {
  padding: 7px 14px;
  border-radius: 999px;
  border: 0;
  background: linear-gradient(135deg, #ff8c00, #ffb800);
  color: #000;
  font-size: 10px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* --- Filter Tabs --- */
.promo-filters {
  display: flex;
  gap: 8px;
  padding: 0 14px 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.promo-filters::-webkit-scrollbar { display: none; }
.pf-tab {
  flex-shrink: 0;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.04);
  color: #888;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s ease;
  white-space: nowrap;
}
.pf-tab.on {
  background: linear-gradient(135deg, #ff8c00, #ffb800);
  border-color: transparent;
  color: #000;
  font-weight: 900;
  box-shadow: 0 4px 16px rgba(255,184,0,.25);
}

/* --- Featured Promo Card --- */
.promo-featured {
  margin: 0 14px 18px;
  border-radius: 22px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  box-shadow: 0 16px 48px rgba(0,0,0,.5);
  border: 1px solid rgba(255,184,0,.2);
  transition: transform .25s ease, box-shadow .25s ease;
}
.promo-featured:active { transform: scale(.98); }
.promo-featured-img {
  height: 160px;
  background:
    radial-gradient(ellipse 70% 80% at 30% 40%, rgba(255,100,0,.5), transparent),
    radial-gradient(ellipse 60% 60% at 80% 60%, rgba(255,200,0,.3), transparent),
    linear-gradient(135deg, #1a0500, #0d0400, #1f0800);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.promo-featured-emoji {
  font-size: 80px;
  line-height: 1;
  filter: drop-shadow(0 0 30px rgba(255,150,0,.6));
  animation: featuredFloat 3s ease-in-out infinite;
}
@keyframes featuredFloat {
  0%,100%{ transform: translateY(0) rotate(-3deg); }
  50%{ transform: translateY(-8px) rotate(3deg); }
}
.promo-featured-badge {
  position: absolute;
  top: 12px; left: 12px;
  background: linear-gradient(135deg, #ff2200, #ff6600);
  color: #fff;
  font-size: 9px;
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 1px;
  text-transform: uppercase;
  animation: badgePop .6s ease-out;
}
@keyframes badgePop {
  0%{ transform: scale(0); opacity: 0; }
  70%{ transform: scale(1.1); }
  100%{ transform: scale(1); opacity: 1; }
}
.promo-featured-timer {
  position: absolute;
  top: 12px; right: 12px;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(6px);
  color: #ffb800;
  font-size: 11px;
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,184,0,.25);
  display: flex;
  align-items: center;
  gap: 5px;
}
.promo-featured-body {
  background: linear-gradient(180deg, #130800, #0d0500);
  padding: 16px;
}
.promo-featured-title {
  font-size: 17px;
  font-weight: 900;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 6px;
}
.promo-featured-desc {
  font-size: 12px;
  color: #9a7a50;
  line-height: 1.5;
  margin-bottom: 14px;
}
.promo-featured-footer {
  display: flex;
  align-items: center;
  gap: 10px;
}
.promo-min {
  flex: 1;
}
.promo-min span {
  display: block;
  font-size: 9px;
  color: #6a5a40;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
}
.promo-min strong {
  display: block;
  font-size: 16px;
  font-weight: 900;
  color: #ffb800;
  font-family: 'Barlow Condensed', sans-serif;
}
.promo-claim-btn {
  padding: 10px 22px;
  border-radius: 999px;
  border: 0;
  background: linear-gradient(135deg, #ff4c00, #ff8c00);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  letter-spacing: .5px;
  box-shadow: 0 6px 20px rgba(255,100,0,.35);
  transition: all .2s ease;
  white-space: nowrap;
}
.promo-claim-btn:active { transform: scale(.96); }

/* --- Section Title --- */
.promo-section-title {
  padding: 0 14px 10px;
  font-size: 12px;
  font-weight: 900;
  color: #6a5a40;
  text-transform: uppercase;
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.promo-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(255,184,0,.2), transparent);
}

/* --- Promo Cards Grid --- */
.promo-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 14px;
}

.pcard-v2 {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: linear-gradient(135deg, #111009, #0c0c0c);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 18px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.pcard-v2:hover {
  transform: translateY(-2px);
  border-color: rgba(255,184,0,.2);
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.pcard-v2:active { transform: scale(.99); }
.pcard-v2::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255,184,0,.04), transparent);
  pointer-events: none;
}

.pcard-thumb {
  width: 86px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 36px;
  position: relative;
  overflow: hidden;
}
.pcard-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.15);
}
.pcard-thumb-bg1 { background: linear-gradient(135deg, #1a2a0a, #2a4010); }
.pcard-thumb-bg2 { background: linear-gradient(135deg, #0a1a2a, #102040); }
.pcard-thumb-bg3 { background: linear-gradient(135deg, #1a0a2a, #2a1040); }
.pcard-thumb-bg4 { background: linear-gradient(135deg, #2a1a0a, #402810); }

.pcard-body {
  flex: 1;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pcard-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .8px;
  text-transform: uppercase;
  width: fit-content;
}
.tag-sports { background: rgba(33,150,243,.15); color: #64b5f6; border: 1px solid rgba(33,150,243,.2); }
.tag-slots  { background: rgba(156,39,176,.15); color: #ce93d8; border: 1px solid rgba(156,39,176,.2); }
.tag-refer  { background: rgba(76,175,80,.15);  color: #81c784; border: 1px solid rgba(76,175,80,.2); }
.tag-deposit{ background: rgba(255,152,0,.15);  color: #ffcc80; border: 1px solid rgba(255,152,0,.2); }

.pcard-title {
  font-size: 14px;
  font-weight: 800;
  color: #f0f0f0;
  line-height: 1.2;
}
.pcard-desc {
  font-size: 11px;
  color: #6a6060;
  line-height: 1.45;
  flex: 1;
}
.pcard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}
.pcard-amount {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 20px;
  font-weight: 900;
  color: #ffb800;
}
.pcard-btn {
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255,184,0,.4);
  background: rgba(255,184,0,.08);
  color: #ffb800;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: all .18s ease;
}
.pcard-btn:active {
  background: rgba(255,184,0,.2);
  transform: scale(.96);
}

/* --- Referral Section --- */
.promo-referral-box {
  margin: 18px 14px 0;
  background: linear-gradient(135deg, #0a1a0a, #050d05);
  border: 1px solid rgba(124,252,0,.15);
  border-radius: 18px;
  padding: 18px;
  position: relative;
  overflow: hidden;
}
.promo-referral-box::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124,252,0,.1), transparent);
  pointer-events: none;
}
.promo-ref-title {
  font-size: 15px;
  font-weight: 900;
  color: #fff;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.promo-ref-title i { color: var(--green, #7cfc00); }
.promo-ref-desc {
  font-size: 12px;
  color: #5a7a5a;
  margin-bottom: 14px;
  line-height: 1.5;
}
.promo-ref-code-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.promo-ref-code {
  flex: 1;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(124,252,0,.2);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--green, #7cfc00);
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 2px;
  font-family: monospace;
}
.promo-ref-copy-btn {
  padding: 10px 18px;
  border-radius: 10px;
  border: 0;
  background: linear-gradient(135deg, #3dba00, #7cfc00);
  color: #000;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
  transition: all .18s ease;
}
.promo-ref-copy-btn:active { transform: scale(.96); }
.promo-ref-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.promo-ref-stat {
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}
.promo-ref-stat-num { font-size: 18px; font-weight: 900; color: #7cfc00; font-family: 'Barlow Condensed', sans-serif; }
.promo-ref-stat-label { font-size: 10px; color: #4a6a4a; font-weight: 700; margin-top: 2px; }

/* --- Promo Modal Overlay --- */
.promo-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}
.promo-modal-overlay.show {
  opacity: 1;
  pointer-events: all;
}
.promo-modal-sheet {
  width: 100%;
  background: linear-gradient(180deg, #141208, #0c0c0c);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  border-top: 1px solid rgba(255,184,0,.2);
  padding: 24px 20px 40px;
  transform: translateY(40px);
  transition: transform .35s cubic-bezier(.34,1.56,.64,1);
}
.promo-modal-overlay.show .promo-modal-sheet {
  transform: translateY(0);
}
.promo-modal-handle {
  width: 40px; height: 4px;
  background: rgba(255,255,255,.15);
  border-radius: 2px;
  margin: 0 auto 18px;
}
.promo-modal-title {
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  margin-bottom: 8px;
}
.promo-modal-bonus {
  font-size: 36px;
  font-weight: 900;
  color: #ffb800;
  font-family: 'Barlow Condensed', sans-serif;
  margin-bottom: 10px;
}
.promo-modal-desc {
  font-size: 13px;
  color: #7a6a50;
  line-height: 1.6;
  margin-bottom: 16px;
}
.promo-modal-terms {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 18px;
}
.promo-modal-terms li {
  font-size: 11px;
  color: #5a5040;
  line-height: 1.8;
  padding-left: 14px;
  position: relative;
}
.promo-modal-terms li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: #7cfc00;
  font-weight: 900;
}
.promo-modal-claim {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: 0;
  background: linear-gradient(135deg, #ff4c00, #ff8c00);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(255,100,0,.3);
  transition: all .2s ease;
}
.promo-modal-claim:active { transform: scale(.98); }
.promo-modal-close {
  position: absolute;
  top: 18px; right: 18px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  border: 0;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

/* --- Countdown Timer (promo) --- */
#promo-timer { font-variant-numeric: tabular-nums; }

/* Entrance animations for promo cards */
.pcard-v2, .promo-featured, .promo-jackpot-strip {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .4s ease, transform .4s ease;
}
.pcard-v2.visible, .promo-featured.visible, .promo-jackpot-strip.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Floating particles in promo hero */
.promo-particle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  animation: particleFly 6s ease-in-out infinite;
}
@keyframes particleFly {
  0%{ opacity: 0; transform: translateY(0) scale(0); }
  10%{ opacity: .7; }
  90%{ opacity: .3; }
  100%{ opacity: 0; transform: translateY(-80px) scale(1.5); }
}

</style>


<script>
/*
  taka26 client protection layer
  - Blocks common DevTools shortcuts and right-click/source-save attempts.
  - Shows a security lock screen when DevTools is detected.
  - Adds a mobile bookmarklet/injection guard that removes newly injected unknown scripts/iframes.
  NOTE: Real security is still handled server-side by aviator_launch.php + aviator_bridge_api.php.
*/
(function(){
  'use strict';

  var LOCK_ID = 'taka26-security-lock-screen';
  var STYLE_ID = 'taka26-security-lock-style';
  var locked = false;
  var isSmallMobile = /Android|iPhone|iPad|iPod|Mobile/i.test(navigator.userAgent || '') || Math.min(screen.width || 9999, screen.height || 9999) <= 820;

  function lock(reason){
    if (locked) return;
    locked = true;

    function mount(){
      try {
        var css = document.getElementById(STYLE_ID);
        if (!css) {
          css = document.createElement('style');
          css.id = STYLE_ID;
          css.textContent =
            'html.taka26-locked,html.taka26-locked body{background:#050505!important;overflow:hidden!important;}' +
            'html.taka26-locked body>*:not(#'+LOCK_ID+'){display:none!important;visibility:hidden!important;opacity:0!important;pointer-events:none!important;}' +
            '#'+LOCK_ID+'{display:flex!important;visibility:visible!important;opacity:1!important;}';
          (document.head || document.documentElement).appendChild(css);
        }

        document.documentElement.classList.add('taka26-locked');

        var box = document.getElementById(LOCK_ID);
        if (!box) {
          box = document.createElement('div');
          box.id = LOCK_ID;
          box.setAttribute('role','alert');
          box.style.cssText = 'position:fixed;inset:0;z-index:2147483647;background:#050505;color:#fff;display:flex;align-items:center;justify-content:center;text-align:center;font-family:Arial,sans-serif;padding:24px;box-sizing:border-box;';
          box.innerHTML =
            '<div style="width:min(92vw,420px);background:#101113;border:1px solid #282a2e;border-radius:22px;padding:34px 22px;box-shadow:0 20px 60px rgba(0,0,0,.75)">' +
            '<div style="width:68px;height:68px;border-radius:50%;margin:0 auto 18px;background:#1b1c1d;display:flex;align-items:center;justify-content:center;border:1px solid #333;color:#ff2d2d;font-size:34px;font-weight:900">!</div>' +
            '<div style="font-size:25px;font-weight:900;margin-bottom:8px;color:#ff2d2d">Site Offline</div>' +
            '<div style="font-size:14px;line-height:1.6;color:#b8b8b8">Connection closed for security protection.<br>Please refresh the page to reconnect.</div>' +
            '<div style="margin-top:16px;font-size:11px;color:#555">Reason: '+String(reason || 'security').replace(/[<>"\']/g,'')+'</div>' +
            '</div>';
          document.body.appendChild(box);
        }
      } catch(e){}
    }

    if (document.body) mount();
    else document.addEventListener('DOMContentLoaded', mount, {once:true});
  }

  // Keyboard shortcut guard: desktop + mobile keyboard.
  window.addEventListener('keydown', function(e){
    var key = String(e.key || '').toLowerCase();
    var code = String(e.code || '').toLowerCase();
    var bad =
      key === 'f12' || code === 'f12' ||
      (e.ctrlKey && e.shiftKey && ['i','j','c','k'].indexOf(key) !== -1) ||
      (e.metaKey && e.altKey && ['i','j','c','k'].indexOf(key) !== -1) ||
      (e.ctrlKey && ['u','s','p'].indexOf(key) !== -1) ||
      (e.metaKey && ['u','s','p'].indexOf(key) !== -1);
    if (bad) {
      try { e.preventDefault(); e.stopPropagation(); e.stopImmediatePropagation(); } catch(err){}
      lock('developer-tools');
      return false;
    }
  }, true);

  document.addEventListener('contextmenu', function(e){ try { e.preventDefault(); } catch(err){} return false; }, true);
  document.addEventListener('dragstart', function(e){ try { e.preventDefault(); } catch(err){} }, true);

  // Desktop DevTools detector. Disabled on small mobile screens to avoid false lock during rotation/address-bar resize.
  function devtoolsBySize(){
    if (isSmallMobile) return false;
    var ow = Number(window.outerWidth || 0), oh = Number(window.outerHeight || 0);
    var iw = Number(window.innerWidth || 0), ih = Number(window.innerHeight || 0);
    if (!ow || !oh || !iw || !ih) return false;
    return Math.abs(ow - iw) > 170 || Math.abs(oh - ih) > 170;
  }

  function devtoolsByDebugger(){
    if (isSmallMobile) return false;
    var s = Date.now();
    try { debugger; } catch(e){}
    return (Date.now() - s) > 140;
  }

  function scanDevtools(){
    if (locked) return;
    if (devtoolsBySize() || devtoolsByDebugger()) lock('developer-tools');
  }

  setTimeout(scanDevtools, 700);
  setInterval(scanDevtools, 1800);
  window.addEventListener('resize', function(){ setTimeout(scanDevtools, 180); }, true);

  // Mobile JavaScript bookmark/injection guard.
  var allowedHosts = {
    [location.hostname]: true,
    'cdnjs.cloudflare.com': true,
    'fonts.googleapis.com': true,
    'fonts.gstatic.com': true
  };

  function safeUrl(url){
    try {
      if (!url) return true;
      var u = new URL(url, location.href);
      if (u.protocol === 'javascript:' || u.protocol === 'data:' || u.protocol === 'vbscript:') return false;
      return !!allowedHosts[u.hostname];
    } catch(e) {
      return false;
    }
  }

  document.addEventListener('click', function(e){
    var a = e.target && e.target.closest ? e.target.closest('a') : null;
    if (a && !safeUrl(a.getAttribute('href') || '')) {
      try { e.preventDefault(); e.stopPropagation(); } catch(err){}
      lock('javascript-bookmark');
      return false;
    }
  }, true);

  try {
    var mo = new MutationObserver(function(list){
      if (locked) return;
      list.forEach(function(m){
        Array.prototype.forEach.call(m.addedNodes || [], function(n){
          if (!n || n.nodeType !== 1) return;
          var tag = String(n.tagName || '').toLowerCase();
          if (tag === 'script') {
            var src = n.getAttribute('src') || '';
            if (!safeUrl(src)) {
              try { n.remove(); } catch(e){}
              lock('script-injection');
            }
          }
          if (tag === 'iframe' || tag === 'object' || tag === 'embed') {
            var src2 = n.getAttribute('src') || n.getAttribute('data') || '';
            if (src2 && !safeUrl(src2)) {
              try { n.remove(); } catch(e){}
              lock('frame-injection');
            }
          }
        });
      });
    });
    document.addEventListener('DOMContentLoaded', function(){
      mo.observe(document.documentElement, {childList:true, subtree:true});
    }, {once:true});
  } catch(e){}
})();
</script>

</head>
<body>

<div class="toast" id="toast"><i id="t-ic" class="fas fa-check-circle" style="color:var(--green)"></i><span id="t-msg">Success</span></div>

<?php if ($installMissing || $errorMessage): ?>
<div class="install-box">
  <h1 class="admin-title">taka26.com Setup Needed</h1>
  <?php if ($errorMessage): ?><div class="msg err"><?= e($errorMessage) ?></div><?php endif; ?>
  <p class="text-muted">Open <code>install.php</code> one time to prepare the site tables.</p>
  <a class="full-btn" style="display:flex;align-items:center;justify-content:center;margin-top:14px" href="install.php">Open Installer</a>
</div>
<?php else: ?>

<div id="pg-main" class="page active">
  <header>
    <div class="brand-left">
      <span class="logo"><?= e($siteName) ?></span>
    </div>
    <?php if ($isLoggedIn): ?>
    <div class="uchip">
      <div class="av" onclick="App.switchTab('me')"><?= e($userAv) ?></div>
      <div class="balpill" onclick="App.refreshBalance()">৳ <span id="topBalance"><?= e($userBal) ?></span>&nbsp;<i class="fas fa-sync-alt" style="font-size:10px"></i></div>
    </div>
    <?php else: ?>
    <div class="hdr-btns"><button class="btn-l" onclick="App.navTo('pg-login')">Login</button><button class="btn-r" onclick="App.navTo('pg-register')">Register</button></div>
    <?php endif; ?>
  </header>

  <div class="ann"><i class="fas fa-bullhorn"></i><marquee scrollamount="4" style="color:#9aa0a6;font-size:12px;font-weight:500"><?= e($announcement) ?></marquee></div>

  <div class="banner">
    <?php for($i=1;$i<=6;$i++): ?>
    <div class="sl banner-img clean-banner <?= $i===1?'on':'' ?>" style="background-image:url('assets/banners/banner-<?= $i ?>.png')"></div>
    <?php endfor; ?>
    <div class="dots"><?php for($i=0;$i<6;$i++): ?><div class="dot <?= $i===0?'on':'' ?>" onclick="App.goToSlide(<?= $i ?>)"></div><?php endfor; ?></div>
  </div>

  <div class="dw-row">
    <div class="dw-btn pro-action" onclick="<?= $isLoggedIn ? "App.navTo('pg-deposit')" : "App.navTo('pg-login')" ?>"><i class="fas fa-wallet"></i><span>Deposit</span></div>
    <div class="dw-btn pro-action gold" onclick="<?= $isLoggedIn ? "App.navTo('pg-withdraw')" : "App.navTo('pg-login')" ?>"><i class="fas fa-exchange-alt"></i><span>Withdraw</span></div>
  </div>

  <div class="cats">
    <?php foreach($cats as $key=>$name): ?><div class="cat <?= $key==='all'?'on':'' ?>" onclick="App.selectCategory(this,'<?= e($key) ?>')"><div class="cic"><i class="fas <?= e(category_icon($key)) ?>"></i></div><span><?= e($name) ?></span></div><?php endforeach; ?>
  </div>

  <div class="shdr"><div class="stitle">🔥 HOT GAMES</div><div class="sall" onclick="App.selectCategory(document.querySelector('.cat'),'all')">See All</div></div>
  <div class="grid g3" id="gameGrid">
    <?php foreach($games as $g): $url=game_url($g,$aviatorUrl,$user); $isAviator = strtolower($g['title'] ?? '') === 'aviator'; ?>
    <a class="gc game-card-pro" data-game-cat="<?= e($g['category']) ?>" href="<?= e($url) ?>" onclick="return App.openGame(event,this,<?= $isAviator ? 'true' : 'false' ?>)">
      <?php if(!empty($g['image_url'])): ?><div class="img-game" style="background-image:url('<?= e($g['image_url']) ?>')"></div><?php else: ?><div class="gic"><?= e($g['icon']) ?></div><?php endif; ?>
      <?php if((int)$g['is_hot']===1): ?><div class="hot">HOT</div><?php endif; ?><div class="name"><?= e($g['title']) ?></div><div class="prov"><?= e($g['provider']) ?></div>
    </a>
    <?php endforeach; ?>
    <?php if(!$games): ?><div class="empty-wide">No games found. Open installer once to seed games from assets.</div><?php endif; ?>
  </div>

  <div class="jp"><div class="jplbl">⚡ PLATFORM POOL</div><div class="jpctr" id="jpc"></div><button class="jpbtn" onclick="App.requireLogin()"><i class="fas fa-play"></i>&nbsp; Start Playing</button></div>

  <div class="shdr"><div class="stitle">🎥 LIVE & PROVIDERS</div><div class="sall">See All</div></div>
  <div class="grid g2 provider-grid">
    <?php $liveGames = []; foreach($games as $tmpGame){ if(in_array($tmpGame['category'], ['casino','crash','sports','fishing'], true)) $liveGames[] = $tmpGame; } foreach(array_slice($liveGames,0,6) as $g): $pUrl=game_url($g,$aviatorUrl,$user); $pIsAviator=strtolower($g['title'] ?? '')==='aviator'; ?><a class="gc glc provider-card" href="<?= e($pUrl) ?>" onclick="return App.openGame(event,this,<?= $pIsAviator ? 'true' : 'false' ?>)"><?php if($g['image_url']): ?><div class="img-game" style="background-image:url('<?= e($g['image_url']) ?>')"></div><?php else: ?><div class="gic"><?= e($g['icon']) ?></div><?php endif; ?><div class="prov"><?= e($g['provider'] ?: $g['title']) ?></div></a><?php endforeach; ?>
  </div>
</div>

<div id="pg-deposit" class="page">
  <div class="ac-topbar"><div class="bk" onclick="App.navTo('pg-main')"><i class="fas fa-chevron-left"></i></div><h1>Deposit</h1></div>
  <?php if($isLoggedIn): ?>
  <div class="pk-deposit-wrap">
    <div class="pk-deposit-panel">
      <div class="pk-deposit-head">
        <div class="pk-deposit-head-left">
          <small>Available Balance</small>
          <b>৳ <span id="depositBalance"><?= e($userBal) ?></span></b>
          <p>প্রথমে deposit amount select করুন, তারপর payment page-এ TrxID submit করুন।</p>
        </div>
        <div class="pk-deposit-badge"><i class="fas fa-wallet"></i></div>
      </div>

      <?php if($methods): ?>
      <form class="pk-deposit-body" action="payment.php" method="get" id="depositSelectForm">
        <div class="pk-method-side" id="pkMethodSide">
          <?php foreach($methods as $i=>$m): $prov=strtolower((string)($m['provider'].' '.$m['label'].' '.$m['method_key'])); $logoClass=(strpos($prov,'nagad')!==false?'nagad':(strpos($prov,'bank')!==false?'bank':'')); ?>
          <label class="pk-method-tile <?= $i===0?'active':'' ?>" onclick="App.selectDepositMethod(this)">
            <input type="radio" name="method_id" value="<?= (int)$m['id'] ?>" data-label="<?= e($m['label']) ?>" <?= $i===0?'checked':'' ?>>
            <div class="pk-method-logo <?= e($logoClass) ?>"><?= e(strtoupper(substr(trim((string)$m['label']),0,1))) ?></div>
            <div><div class="pk-method-title"><?= e($m['label']) ?></div><div class="pk-method-sub"><?= e($m['provider'] ?: 'Payment') ?></div></div>
            <span class="pk-method-hot"><i class="fas fa-fire"></i></span>
          </label>
          <?php endforeach; ?>
        </div>

        <div class="pk-deposit-main">
          <div class="pk-info-title"><i class="fas fa-info-circle"></i> জমার তথ্য</div>
          <div class="pk-note">!!! NOTE : অনুগ্রহ করে আপনার ডিপোজিট করার পূর্বে অবশ্যই amount select করবেন। payment page-এ একই amount পাঠিয়ে TrxID submit করুন। তাহলে দ্রুত আপনার score যুক্ত হবে। ⚠️⚠️⚠️</div>
          <div class="pk-selected-method"><i class="fas fa-thumbs-up"></i> <span id="selectedMethodName"><?= e($methods[0]['label'] ?? 'Payment') ?></span> <span>/ LKP</span></div>
          <div class="pk-warning-strip"><span class="pk-warning-dot">!</span><span>অনুগ্রহ করে সতর্ক থাকুন। Telegram বা Facebook ছাড়া অন্য কাউকে টাকা পাঠাবেন না। Admin panel থেকে approve হলে balance add হবে। ⚠️</span></div>

          <div class="pk-amount-row">
            <div class="pk-amount-label">জমার পরিমান:</div>
            <div class="pk-amounts">
              <?php foreach($depositQuickAmounts as $qa): ?>
              <button class="pk-amount-btn" type="button" onclick="App.pickDepositAmount(this, '<?= (int)$qa ?>')"><?= number_format((int)$qa) ?></button>
              <?php endforeach; ?>
            </div>
          </div>
          <input class="pk-custom-amount" type="number" name="amount" min="<?= (int)$depositMin ?>" max="<?= (int)$depositMax ?>" step="1" placeholder="জমার পরিমান" required oninput="App.clearDepositAmountButtons()">
          <div class="pk-rule-text">জমা সীমা: ৳ <?= number_format((int)$depositMin) ?> - ৳ <?= number_format((int)$depositMax) ?><br>জমারসময়: 24/24</div>
          <button class="pk-deposit-submit" type="submit"><i class="fas fa-paper-plane"></i> জমার জন্য আবেদন করুন</button>
        </div>
      </form>
      <?php else: ?>
      <div class="pk-deposit-main"><div class="pk-no-method">No payment method is active right now. Please add BKASH/NAGAD method from admin panel first.</div></div>
      <?php endif; ?>
    </div>
  </div>
  <?php else: ?><div class="ac-guest"><div class="ac-guest-icon"><i class="fas fa-lock"></i></div><p>Please login to deposit.</p><button class="btn-r" onclick="App.navTo('pg-login')">Login</button></div><?php endif; ?>
</div>

<div id="pg-withdraw" class="page">
  <div class="ac-topbar"><div class="bk" onclick="App.navTo('pg-main')"><i class="fas fa-chevron-left"></i></div><h1>Withdraw</h1></div>
  <?php if($isLoggedIn): ?>
  <div class="wallet-hero withdraw"><div><small>Withdrawable Balance</small><strong>৳ <span id="withdrawBalance"><?= e($userBal) ?></span></strong><p>Choose your withdraw method and submit accurate account information.</p></div><i class="fas fa-credit-card"></i></div>
  <div class="form-card pro-form"><h3>Withdraw Center</h3><p class="muted-line">Withdraw to your selected mobile wallet or bank account.</p>
    <form id="withdrawForm">
      <input type="hidden" name="action" value="withdraw_request">
      <div class="method-list compact-methods option-grid">
        <?php $j=0; foreach($withdrawOptions as $key=>$label): ?><label class="method-card dark"><input type="radio" name="method_key" value="<?= e($key) ?>" <?= $j++===0?'checked':'' ?>><div class="method-icon-big"><i class="fas fa-university"></i></div><div><div class="method-name"><?= e($label) ?></div><div class="method-country">Withdraw method</div></div></label><?php endforeach; ?>
      </div>
      <div class="select-inline"><div class="form-row"><label>Account Holder Name</label><input type="text" name="full_name" placeholder="Full name" required></div><div class="form-row"><label>Account Number</label><input type="text" name="account_number" placeholder="Wallet / bank account" required></div></div>
      <div class="form-row"><label>Amount</label><input type="number" name="amount" step="0.01" min="<?= e(get_setting('withdraw_min','500')) ?>" max="<?= e(get_setting('withdraw_max','25000')) ?>" placeholder="Min <?= e(money(get_setting('withdraw_min','500'))) ?>" required></div>
      <div class="rule-strip"><span>Min <?= e(money(get_setting('withdraw_min','500'))) ?></span><span>Max <?= e(money(get_setting('withdraw_max','25000'))) ?></span><span>Fee <?= e(get_setting('withdraw_fee','0')) ?>%</span></div>
      <button class="full-btn gold-btn" type="submit"><i class="fas fa-check-circle"></i> Submit Withdraw Request</button>
    </form><div id="withdrawMsg"></div>
  </div>
  <?php else: ?><div class="ac-guest"><div class="ac-guest-icon"><i class="fas fa-lock"></i></div><p>Please login to withdraw.</p><button class="btn-r" onclick="App.navTo('pg-login')">Login</button></div><?php endif; ?>
</div>

<!-- ════════════════════════════════════════════════════════
     PAGE: PROMOTIONS — Full Redesign with JS Functionality
     ════════════════════════════════════════════════════════ -->
<div id="pg-promo" class="page">
  <div class="promo-page">

    <!-- Sticky Header -->
    <header>
      <div style="display:flex;align-items:center;gap:10px">
        <i class="fas fa-gift" style="color:#ffb800;font-size:17px"></i>
        <span class="logo"><?= e($siteName) ?></span>
      </div>
      <?php if ($isLoggedIn): ?>
      <div class="uchip"><div class="av" onclick="App.switchTab('me')"><?= $userAv ?></div></div>
      <?php else: ?>
      <div class="hdr-btns">
        <button class="btn-l" onclick="App.navTo('pg-login')">Login</button>
        <button class="btn-r" onclick="App.navTo('pg-register')">Register</button>
      </div>
      <?php endif; ?>
    </header>

    <!-- Hero Section -->
    <div class="promo-hero" id="promoHero">
      <!-- Floating particles will be injected by JS -->
      <div class="promo-hero-content">
        <div class="promo-hero-label"><i class="fas fa-fire"></i> Exclusive Offers</div>
        <div class="promo-hero-title">PROMO<br><span>CENTER</span></div>
        <div class="promo-hero-sub">প্রতিদিন নতুন বোনাস ও রিওয়ার্ড ক্লেইম করুন</div>
        <div class="promo-stats">
          <div class="promo-stat">
            <div class="promo-stat-num" id="promoActiveCount">12</div>
            <div class="promo-stat-label">Active Promos</div>
          </div>
          <div class="promo-stat">
            <div class="promo-stat-num">৳500</div>
            <div class="promo-stat-label">Min Claim</div>
          </div>
          <div class="promo-stat">
            <div class="promo-stat-num">200%</div>
            <div class="promo-stat-label">Max Bonus</div>
          </div>
        </div>
      </div>
    </div>

    <!-- Live Jackpot Strip -->
    <div class="promo-jackpot-strip" id="promoJpStrip">
      <div class="promo-jp-icon"><i class="fas fa-trophy"></i></div>
      <div class="promo-jp-info">
        <div class="promo-jp-label">🔴 Live Jackpot Pool</div>
        <div class="promo-jp-amount" id="promoJpc">৳ ...</div>
      </div>
      <button class="promo-jp-claim" onclick="PromoPage.claimJackpot()">Claim</button>
    </div>

    <!-- Filter Tabs -->
    <div class="promo-filters" id="promoFilters">
      <div class="pf-tab on" data-filter="all" onclick="PromoPage.filterCards(this,'all')">🎯 All</div>
      <div class="pf-tab" data-filter="deposit" onclick="PromoPage.filterCards(this,'deposit')">💳 Deposit</div>
      <div class="pf-tab" data-filter="sports" onclick="PromoPage.filterCards(this,'sports')">⚽ Sports</div>
      <div class="pf-tab" data-filter="casino" onclick="PromoPage.filterCards(this,'casino')">🎰 Live Casino</div>
      <div class="pf-tab" data-filter="slots" onclick="PromoPage.filterCards(this,'slots')">🎲 Slots</div>
      <div class="pf-tab" data-filter="refer" onclick="PromoPage.filterCards(this,'refer')">👥 Referral</div>
    </div>

    <!-- Featured Promo -->
    <div class="promo-featured" id="promoFeatured" onclick="PromoPage.openModal('welcome')">
      <div class="promo-featured-img">
        <div class="promo-featured-badge"><i class="fas fa-fire"></i> FEATURED</div>
        <div class="promo-featured-timer"><i class="fas fa-clock"></i> <span id="promo-timer">23:59:41</span></div>
        <div class="promo-featured-emoji">🎰</div>
      </div>
      <div class="promo-featured-body">
        <div class="promo-featured-title">Welcome Bonus — পান ২০০% বোনাস!</div>
        <div class="promo-featured-desc">প্রথমবার ডিপোজিটে সর্বোচ্চ ৳৫০,০০০ পর্যন্ত বোনাস পাচ্ছেন। শুধুমাত্র নতুন সদস্যদের জন্য প্রযোজ্য।</div>
        <div class="promo-featured-footer">
          <div class="promo-min">
            <span>Min Deposit</span>
            <strong>৳500</strong>
          </div>
          <div class="promo-min" style="text-align:center">
            <span>Max Bonus</span>
            <strong style="color:var(--green)">৳50,000</strong>
          </div>
          <button class="promo-claim-btn" onclick="event.stopPropagation();PromoPage.openModal('welcome')">Claim Now</button>
        </div>
      </div>
    </div>

    <!-- More Promos -->
    <div class="promo-section-title">More Offers</div>

    <?php
    $promos2 = [
      ['🏅','Sports Cashback 5%','প্রতিদিন স্পোর্টসে ৫% ক্যাশব্যাক পাচ্ছেন।','tag-sports','sports','৳100+','৳5,000','sports','pcard-thumb-bg2'],
      ['🎰','Slots Free Spin 50x','প্রতি সোমবার ৫০টি ফ্রি স্পিন পাবেন।','tag-slots','slots','৳200+','50 Spins','slots','pcard-thumb-bg3'],
      ['👥','Refer & Earn ৳1000','বন্ধুকে রেফার করুন, ৳১০০০ উপার্জন করুন।','tag-refer','refer','N/A','৳1,000','refer','pcard-thumb-bg4'],
      ['💰','Daily Reload 10%','প্রতিদিন ডিপোজিটে ১০% রিলোড বোনাস।','tag-deposit','deposit','৳500+','10%','deposit','pcard-thumb-bg1'],
    ];
    ?>
    <div class="promo-list" id="promoList">
      <?php foreach($promos2 as $i => $p): ?>
      <div class="pcard-v2" data-promo-cat="<?= $p[4] ?>" onclick="PromoPage.openModal('<?= $p[4] ?>')">
        <div class="pcard-thumb <?= $p[8] ?>"><?= $p[0] ?></div>
        <div class="pcard-body">
          <div class="pcard-tag <?= $p[3] ?>"><?= $p[7] ?></div>
          <div class="pcard-title"><?= $p[1] ?></div>
          <div class="pcard-desc"><?= $p[2] ?></div>
          <div class="pcard-footer">
            <div class="pcard-amount"><?= $p[6] ?></div>
            <button class="pcard-btn" onclick="event.stopPropagation();PromoPage.openModal('<?= $p[4] ?>')">View</button>
          </div>
        </div>
      </div>
      <?php endforeach; ?>
    </div>

    <!-- Referral Box -->
    <div class="promo-referral-box" id="promoRefBox" data-promo-cat="refer">
      <div class="promo-ref-title"><i class="fas fa-share-alt"></i> Refer & Earn Program</div>
      <div class="promo-ref-desc">বন্ধুকে রেফার করুন। প্রতিটি সফল রেজিস্ট্রেশনে ৳১,০০০ বোনাস পাবেন!</div>
      <div class="promo-ref-code-row">
        <div class="promo-ref-code" id="refCodeDisplay"><?= $isLoggedIn ? strtoupper(substr(preg_replace('/\D+/','', $userUid), -6)) : 'LOGIN' ?></div>
        <button class="promo-ref-copy-btn" onclick="PromoPage.copyRefCode()"><i class="fas fa-copy"></i> Copy</button>
      </div>
      <div class="promo-ref-stats">
        <div class="promo-ref-stat">
          <div class="promo-ref-stat-num" id="refFriendsCount">0</div>
          <div class="promo-ref-stat-label">Friends Joined</div>
        </div>
        <div class="promo-ref-stat">
          <div class="promo-ref-stat-num" id="refEarningsAmt">৳0</div>
          <div class="promo-ref-stat-label">Total Earned</div>
        </div>
      </div>
    </div>

    <div style="height:10px"></div>
  </div>
</div>

<!-- Promo Detail Modal -->
<div class="promo-modal-overlay" id="promoModal" onclick="PromoPage.closeModal(event)">
  <div class="promo-modal-sheet">
    <div class="promo-modal-handle"></div>
    <button class="promo-modal-close" onclick="PromoPage.closeModal(null,true)">×</button>
    <div id="promoModalContent">
      <!-- filled by JS -->
    </div>
  </div>
</div>

<div id="pg-me" class="page"><div class="acpage"><?php if($isLoggedIn): ?><div class="ac-topbar"><div class="bk" onclick="App.navTo('pg-main')"><i class="fas fa-chevron-left"></i></div><h1>Account</h1></div><div class="ac-hero"><div class="signin-strip"><div class="signin-strip-left"><div class="signin-icon"><i class="fas fa-shield-alt"></i></div><div><div class="signin-text">VIP Member Account</div><div class="signin-sub">UID: <?= e($userUid) ?> · <?= e($user['country_name']) ?></div></div></div><div class="signin-streak"><div class="signin-streak-num">1</div><div class="signin-streak-label">Level</div></div></div><div class="ac-avatar-row"><div class="ac-avatar-wrap"><div class="ac-avatar-ring"></div><div class="ac-avatar"><?= e($userAv) ?></div><div class="ac-online-dot"></div></div><div class="ac-user-info"><div class="ac-vip-badge"><i class="fas fa-crown"></i> Member</div><div class="ac-username"><?= e($userUid) ?></div><div class="ac-uid">UID: <?= e($userUid) ?> <i class="fas fa-copy ac-uid-copy"></i></div></div></div></div><div class="ac-balance-card"><div class="ac-balance-label">Total Balance</div><div class="ac-balance-amount"><span class="currency">৳</span><span id="meBalance"><?= e($userBal) ?></span></div><div class="ac-balance-sub">Bonus: <?= e(money($user['bonus'] ?? 0)) ?> · Reward: <?= e(money($user['safe_income'] ?? 0)) ?></div></div><div class="ac-action-row"><div class="ac-action-btn" onclick="App.navTo('pg-deposit')"><div class="ac-action-icon" style="background:rgba(124,252,0,.1);color:var(--green)"><i class="fas fa-wallet"></i></div><div class="ac-action-label">Deposit</div></div><div class="ac-action-btn" onclick="App.navTo('pg-withdraw')"><div class="ac-action-icon" style="background:rgba(255,184,0,.1);color:var(--gold)"><i class="fas fa-credit-card"></i></div><div class="ac-action-label">Withdraw</div></div><div class="ac-action-btn" onclick="location.href='service.php'"><div class="ac-action-icon" style="background:rgba(33,150,243,.1);color:#64b5f6"><i class="fas fa-headset"></i></div><div class="ac-action-label">Support</div></div></div><div class="txn-section"><div class="txn-header"><div class="txn-title">Recent Transactions</div></div><div class="txn-list"><?php if(!$txs): ?><div class="txn-empty"><div class="txn-empty-icon">📄</div><div class="txn-empty-text">No transaction yet</div></div><?php endif; ?><?php foreach($txs as $t): ?><div class="txn-card"><div><b><?= e($t['type']) ?></b><small><?= e($t['note']) ?> · <?= e($t['created_at']) ?></small></div><div style="text-align:right"><b><?= e(money($t['amount'])) ?></b><br><span class="status status-<?= e($t['status']) ?>"><?= e($t['status']) ?></span></div></div><?php endforeach; ?></div></div><button class="ac-logout-btn" onclick="App.doLogout()"><i class="fas fa-sign-out-alt"></i> Logout</button><?php else: ?><div class="ac-guest"><div class="ac-guest-icon"><i class="fas fa-user"></i></div><p>Please login to view account.</p><button class="btn-r" onclick="App.navTo('pg-login')">Login</button></div><?php endif; ?></div></div>

<div id="pg-login" class="page"><div class="apage"><div class="atopbar"><div class="aback" onclick="App.navTo('pg-main')"><i class="fas fa-chevron-left"></i></div></div><div class="ahero"><span class="alogo"><?= e($siteName) ?></span><h2>স্বাগতম ফিরে এলেন 👋</h2><p>অ্যাকাউন্ট নেই? <a onclick="App.navTo('pg-register')">নিবন্ধন করুন</a></p></div><div class="abody"><div class="aerr" id="l-err"><i class="fas fa-exclamation-circle"></i><span id="l-errmsg"></span></div><div class="fld"><input type="tel" id="l-phone" placeholder="ফোন নম্বর লিখুন" autocomplete="tel"><i class="fas fa-phone fic"></i></div><div class="fld"><input type="password" id="l-pass" placeholder="পাসওয়ার্ড লিখুন" autocomplete="current-password"><i class="fas fa-lock fic"></i><i class="fas fa-eye-slash eye" id="l-eye" onclick="App.togglePassword('l-pass','l-eye')"></i></div><button class="abtn" id="l-btn" onclick="App.doLogin()"><i class="fas fa-sign-in-alt"></i>&nbsp; লগইন করুন</button></div></div></div>

<div id="pg-register" class="page"><div class="apage"><div class="atopbar"><div class="aback" onclick="App.navTo('pg-main')"><i class="fas fa-chevron-left"></i></div></div><div class="ahero"><span class="alogo"><?= e($siteName) ?></span><h2>নতুন অ্যাকাউন্ট খুলুন 🚀</h2><p>ইতিমধ্যে অ্যাকাউন্ট আছে? <a onclick="App.navTo('pg-login')">লগইন করুন</a></p></div><div class="abody"><div class="aerr" id="r-err"><i class="fas fa-exclamation-circle"></i><span id="r-errmsg"></span></div><div class="aok" id="r-ok"><i class="fas fa-check-circle"></i><span id="r-okmsg"></span></div><label class="country-label">Country / Code</label><button class="country-select-pro" id="countryBtn" type="button" onclick="App.openCountryPicker()"><span><b id="selCountryName">Bangladesh</b><small id="selCountryCode">+880</small></span><i class="fas fa-chevron-down"></i></button><input type="hidden" id="r-country" value="BD"><input type="hidden" id="r-dial" value="+880"><div class="fld phone-with-code"><span id="dialPrefix">+880</span><input type="tel" id="r-phone" placeholder="Phone number" autocomplete="tel"><i class="fas fa-phone fic"></i></div><div class="fld"><input type="password" id="r-pass" placeholder="পাসওয়ার্ড লিখুন"><i class="fas fa-lock fic"></i><i class="fas fa-eye-slash eye" id="r-eye" onclick="App.togglePassword('r-pass','r-eye')"></i></div><div class="fld"><input type="password" id="r-cpass" placeholder="আবার পাসওয়ার্ড লিখুন"><i class="fas fa-lock fic"></i></div><div class="chkrow"><div class="chkbox on" id="r-check" onclick="this.classList.toggle('on')"></div><span>I agree with Terms & Conditions.</span></div><button class="abtn" id="r-btn" onclick="App.doRegister()"><i class="fas fa-user-plus"></i>&nbsp; নিবন্ধন করুন</button></div></div></div>

<div class="country-modal-pro" id="countryModal"><div class="country-sheet-pro"><div class="country-head-pro"><h3>Select country code</h3><button onclick="App.closeCountryPicker()">×</button></div><input class="country-search-pro" id="countrySearch" placeholder="Search country"><div id="countryList" class="country-list-pro"></div></div></div>


<div class="deposit-required-modal" id="depositNeedModal">
  <div class="deposit-required-card">
    <button class="deposit-close" onclick="App.closeDepositNeeded()">×</button>
    <div class="deposit-icon"><i class="fas fa-wallet"></i></div>
    <h3>Balance Low</h3>
    <p>Your account balance is low. Please deposit to proceed.</p>
    <button class="full-btn" onclick="App.closeDepositNeeded();App.navTo('pg-deposit')"><i class="fas fa-arrow-circle-down"></i> Deposit Now</button>
  </div>
</div>

<div class="bnav">
  <button class="nb2 on" data-tab="home" onclick="App.switchTab('home')"><i class="fas fa-home"></i><span>Home</span></button>
  <button class="nb2" data-tab="promo" onclick="App.switchTab('promo')"><i class="fas fa-gift"></i><span>Promo</span></button>
  <div class="nbc" onclick="<?= $isLoggedIn ? "App.navTo('pg-deposit')" : "App.navTo('pg-login')" ?>"><div class="nbci"><i class="fas fa-wallet"></i></div><span>Deposit</span></div>
  <button class="nb2" data-tab="withdraw" onclick="<?= $isLoggedIn ? "App.navTo('pg-withdraw')" : "App.navTo('pg-login')" ?>"><i class="fas fa-credit-card"></i><span>Withdraw</span></button>
  <button class="nb2" data-tab="me" onclick="App.switchTab('me')"><i class="fas fa-user"></i><span>Account</span></button>
</div>

<?php endif; ?>
<script>
const LOGGED_IN = <?= $isLoggedIn?'true':'false' ?>;
const USER_BALANCE = <?= json_encode($userBalanceRaw) ?>;
const COUNTRY_LIST = [
  {code:'BD',name:'Bangladesh',dial:'+880',hint:'01XXXXXXXXX'},
  {code:'PK',name:'Pakistan',dial:'+92',hint:'03XXXXXXXXX'},
  {code:'IN',name:'India',dial:'+91',hint:'Phone number'},
  {code:'AE',name:'United Arab Emirates',dial:'+971',hint:'Phone number'},
  {code:'SA',name:'Saudi Arabia',dial:'+966',hint:'Phone number'},
  {code:'GB',name:'United Kingdom',dial:'+44',hint:'Phone number'},
  {code:'US',name:'United States',dial:'+1',hint:'Phone number'}
];
const App = {
  slide:0,
  init(){ this.renderJackpot(); setInterval(()=>this.nextSlide(),3500); this.bindForms(); this.renderCountries(); this.openFromHash(); this.setupBalanceAutoRefresh(); window.addEventListener('hashchange',()=>this.openFromHash()); },
  openFromHash(){ const h=(location.hash||'').replace('#',''); if(h==='login') this.navTo('pg-login'); else if(h==='register') this.navTo('pg-register'); else if(h==='deposit') this.navTo('pg-deposit'); else if(h==='withdraw') this.navTo('pg-withdraw'); else if(h==='me') this.navTo('pg-me'); },
  navTo(id){ document.querySelectorAll('.page').forEach(p=>p.classList.remove('active')); const el=document.getElementById(id); if(el) el.classList.add('active'); window.scrollTo(0,0); },
  switchTab(tab){ document.querySelectorAll('.nb2').forEach(b=>b.classList.remove('on')); const b=document.querySelector('[data-tab="'+tab+'"]'); if(b) b.classList.add('on'); const map={home:'pg-main',promo:'pg-promo',me:'pg-me',withdraw:'pg-withdraw'}; this.navTo(map[tab]||'pg-main'); },
  showToast(msg,color){ const t=document.getElementById('toast'), m=document.getElementById('t-msg'), i=document.getElementById('t-ic'); if(!t) return; m.textContent=msg; i.style.color=color||'var(--green)'; t.classList.add('show'); setTimeout(()=>t.classList.remove('show'),2500); },
  goToSlide(i){ const slides=document.querySelectorAll('.sl'), dots=document.querySelectorAll('.dot'); if(!slides.length) return; this.slide=(i+slides.length)%slides.length; slides.forEach(s=>s.classList.remove('on')); dots.forEach(d=>d.classList.remove('on')); slides[this.slide].classList.add('on'); if(dots[this.slide]) dots[this.slide].classList.add('on'); },
  nextSlide(){ this.goToSlide(this.slide+1); },
  selectCategory(el,key){ document.querySelectorAll('.cat').forEach(c=>c.classList.remove('on')); if(el) el.classList.add('on'); document.querySelectorAll('[data-game-cat]').forEach(g=>{g.style.display=(key==='all'||g.dataset.gameCat===key)?'':'none'}); },
  selectPromoTab(tab){ document.querySelectorAll('.pf-tab').forEach(x=>x.classList.remove('on')); if(tab) tab.classList.add('on'); },
  renderJackpot(){ const j=document.getElementById('jpc'); if(!j) return; let n=String(Math.floor(4200000+Math.random()*600000)); j.innerHTML='৳ '+n.split('').map(x=>`<span class="nb">${x}</span>`).join(''); },
  requireLogin(){ if(!LOGGED_IN) this.navTo('pg-login'); else this.showDepositNeeded(); },
  openGame(ev,el,isAviator){ if(!LOGGED_IN){ if(ev) ev.preventDefault(); this.navTo('pg-login'); return false; } if(isAviator){ try{sessionStorage.setItem('taka26_aviator_opened','1');sessionStorage.setItem('taka26_aviator_opened_at',String(Date.now()));}catch(e){} return true; } if(ev) ev.preventDefault(); this.showDepositNeeded(); return false; },
  showDepositNeeded(){ const m=document.getElementById('depositNeedModal'); if(m) m.classList.add('show'); else this.showToast('Your account balance is low. Please deposit to proceed.','var(--gold)'); },
  closeDepositNeeded(){ const m=document.getElementById('depositNeedModal'); if(m) m.classList.remove('show'); },
  selectDepositMethod(tile){ document.querySelectorAll('.pk-method-tile').forEach(x=>x.classList.remove('active')); if(tile) tile.classList.add('active'); const inp=tile?tile.querySelector('input[name=method_id]'):null; if(inp){inp.checked=t