
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --gold: #c9a84c;
  --gold-light: #f0d080;
  --gold-dim: #7a6030;
  --dark: #0a0d13;
  --dark2: #131820;
  --dark3: #1c2330;
  --dark4: #242d3d;
  --cell-light: #e8d5a3;
  --cell-dark: #4a7c59;
  --red: #c0392b;
  --red-light: #e74c3c;
  --green: #27ae60;
  --green-light: #2ecc71;
  --blue: #2980b9;
  --blue-light: #3498db;
  --border: #2a3448;
  --text: #e8eef8;
  --text-dim: #7a8aaa;
  --success: #00c853;
  --danger: #ff3d57;
  --warning: #ffb300;
  --trc20: #ef0027;
}

body {
  font-family: 'Tajawal', sans-serif;
  background-color: var(--dark);
  color: var(--text);
  min-height: 100vh;
  /* خلفية صورة الفضاء — تملأ الشاشة كاملةً على الجوال والكمبيوتر */
  background-image:
    linear-gradient(rgba(10,13,19,0.45), rgba(10,13,19,0.65)),
    url('../img/app_background.jpg?v=2');
  background-size: cover;            /* تملأ كل الشاشة دون تشوّه */
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: fixed;      /* ثابتة لا تتحرك مع التمرير */
}
/* على الكمبيوتر/الشاشات العريضة: نُظهر منتصف السديم الملوّن */
@media (min-width: 768px) {
  body { background-position: center 42%; }
}

/* ===== SCREENS ===== */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; align-items: center; }

/* ===== AUTH SCREEN ===== */
#auth-screen {
  justify-content: center;
  padding: 20px;
}
.auth-box {
  background: var(--dark2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(201,168,76,0.1);
  position: relative;
  overflow: hidden;
}
.auth-box::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle at 50% 0%, rgba(201,168,76,0.06), transparent 60%);
  pointer-events: none;
}
.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo .logo-icon { font-size: 3rem; }
.auth-logo h1 {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(201,168,76,0.4);
  margin: 6px 0 4px;
}
.auth-logo p { color: var(--text-dim); font-size: 0.85rem; }

.auth-tabs {
  display: flex;
  background: var(--dark3);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1;
  padding: 8px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: 'Tajawal', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
}
.auth-tab.active { background: var(--gold); color: #000; }

.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  padding: 11px 14px;
  background: var(--dark3);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: 'Tajawal', sans-serif;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.form-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.15);
}
.form-input::placeholder { color: var(--text-dim); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 20px;
  border-radius: 10px;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-block { width: 100%; }
.btn-gold {
  background: linear-gradient(135deg, #f0d080, var(--gold), #a07830);
  color: #000;
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(201,168,76,0.4); }
.btn-dark {
  background: var(--dark3);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-dark:hover { background: var(--dark4); }
.btn-green {
  background: linear-gradient(135deg, #2ecc71, #1a8a4a);
  color: #fff;
}
.btn-green:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(46,204,113,0.3); }
.btn-red {
  background: linear-gradient(135deg, #e74c3c, #8B0000);
  color: #fff;
}
.btn-red:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(231,76,60,0.3); }
.btn-blue {
  background: linear-gradient(135deg, #3498db, #1a5c8a);
  color: #fff;
}
.btn-blue:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(52,152,219,0.3); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; border-radius: 7px; }

.auth-divider {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8rem;
  margin: 12px 0;
  position: relative;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 35%;
  height: 1px;
  background: var(--border);
}
.auth-divider::before { right: 0; }
.auth-divider::after { left: 0; }

/* ===== TOP NAVBAR ===== */
#main-screen { padding: 0; }
.navbar {
  width: 100%;
  background: var(--dark2);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.navbar-brand {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--gold);
}
.navbar-wallet {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--dark3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  cursor: pointer;
  transition: border-color 0.2s;
}
.navbar-wallet:hover { border-color: var(--gold); }
.navbar-balance { font-size: 0.88rem; font-weight: 700; color: var(--gold); }
.navbar-balance-icon { display: inline-flex; align-items: center; flex: 0 0 auto; }
.navbar-balance-icon img { height: 22px !important; width: 22px !important; max-width: 22px; max-height: 22px; display: block; object-fit: contain; }
.navbar-user {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #7a5020);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  font-weight: 900;
  color: #000;
  border: 2px solid var(--gold-dim);
}
.vip-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffd700, #b8860b);
  color: #000;
}
/* ── شارة VIP بالأيقونة + رقم المستوى ── */
.vip-icon-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.vip-icon-badge img {
  height: 34px;
  width: auto;
  display: block;
  object-fit: contain;
}
.vip-icon-badge .vip-level-num {
  position: absolute;
  bottom: -2px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #c0392b;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1;
  border-radius: 9px;
  border: 1.5px solid #0d1117;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* ======================================================
   شريط الداما العلوي — التصميم الاحترافي بالإطارات
   ====================================================== */
.tb-navbar{
  width:100%;
  background:var(--dark2);
  border-bottom:1px solid var(--border);
  padding:8px 12px;
  display:flex;
  align-items:center;
  gap:8px;
  position:sticky;
  top:0;
  z-index:50;
  direction:ltr;
}

/* ---------- VIP ---------- */
.tb-vip{
  flex:0 0 auto;
  width:52px;height:46px;
  border-radius:12px;
  background:linear-gradient(160deg,#fbe7a1 0%,#e7c25f 38%,#c79a3f 70%,#a87e2c 100%);
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  box-shadow:inset 0 1px 2px rgba(255,255,255,.55),inset 0 -3px 6px rgba(120,80,10,.5),0 4px 10px rgba(0,0,0,.5);
  position:relative;cursor:pointer;line-height:1;
}
.tb-vip::before{content:"";position:absolute;inset:3px;border-radius:9px;border:1px solid rgba(255,255,255,.35);pointer-events:none;}
.tb-vip-crown{font-size:0.7rem;margin-bottom:1px;filter:drop-shadow(0 1px 1px rgba(120,80,0,.6));}
.tb-vip-lbl{font-weight:900;font-size:0.78rem;color:#5a3d05;letter-spacing:.3px;text-shadow:0 1px 0 rgba(255,255,255,.4);}
.tb-vip-num{font-weight:800;font-size:0.66rem;color:#5a3d05;}

/* ---------- البروفايل (الأيقونة الدائرية الفعلية) ---------- */
.tb-profile{
  flex:0 0 auto;
  width:46px;height:46px;
  background-image:url("../img/topbar_profile_circle.png?v=1");
  background-size:contain;background-position:center;background-repeat:no-repeat;
  display:flex;align-items:center;justify-content:center;
  filter:drop-shadow(0 3px 8px rgba(0,0,0,.5));
  cursor:pointer;transition:transform .18s ease;
}
.tb-profile:active{transform:scale(.95);}
.tb-profile-avatar{
  font-family:'Tajawal',sans-serif;font-weight:900;
  font-size:1.05rem;color:#e9e3d6;text-shadow:0 1px 4px rgba(0,0,0,.85);
  margin-top:1px;text-transform:uppercase;
}

/* ---------- حبّة الإطار المشتركة (المتجر/الرصيد) ---------- */
.tb-pill{
  flex:1 1 auto;
  min-width:0;
  position:relative;
  border-radius:999px;
  padding:2.5px;
  cursor:pointer;
  transition:transform .18s ease,filter .18s ease;
}
.tb-pill:active{transform:scale(.98);}
.tb-face{
  border-radius:999px;
  background:linear-gradient(180deg,#11161d,#0a0d12);
  height:46px;
  display:flex;align-items:center;justify-content:center;
  padding:0 12px;
  box-shadow:inset 0 1px 1px rgba(255,255,255,.04),inset 0 -6px 14px rgba(0,0,0,.5);
}
.tb-row{display:flex;align-items:center;gap:8px;min-width:0;direction:rtl;}
.tb-txt{display:flex;flex-direction:column;align-items:flex-end;line-height:1.1;min-width:0;}

/* الإطار الذهبي */
.tb-gold{
  background:linear-gradient(160deg,#fbe7a1 0%,#e7c25f 30%,#9c7427 60%,#6f5320 100%);
  box-shadow:0 4px 12px rgba(0,0,0,.5),0 0 0 1px rgba(0,0,0,.4);
}
.tb-gold::after{content:"";position:absolute;inset:1.5px;border-radius:999px;border:1px solid rgba(255,240,200,.35);pointer-events:none;}

/* الإطار الأخضر المتوهج */
.tb-green{
  background:linear-gradient(150deg,#5fe6ad 0%,#1fcf99 45%,#0c8f6c 100%);
  box-shadow:0 0 14px rgba(31,207,153,.45),0 4px 12px rgba(0,0,0,.5),0 0 0 1px rgba(0,0,0,.35);
}
.tb-green .tb-face{background:linear-gradient(180deg,#0c1a16,#08110d);}

/* نصوص المتجر */
.tb-store-title{
  font-weight:900;font-size:0.95rem;
  background:linear-gradient(180deg,#5fe6ad,#1fcf99);
  -webkit-background-clip:text;background-clip:text;color:transparent;
  text-shadow:0 0 14px rgba(34,210,150,.3);white-space:nowrap;
}
.tb-store-sub{font-weight:700;font-size:0.62rem;color:#cfeee2;opacity:.85;white-space:nowrap;}

/* نصوص الرصيد */
.tb-balance-amt{
  font-weight:900;font-size:0.98rem;
  background:linear-gradient(180deg,#fbe7a1,#d3a849);
  -webkit-background-clip:text;background-clip:text;color:transparent;
  text-shadow:0 0 12px rgba(225,180,80,.3);letter-spacing:.3px;white-space:nowrap;
}
.tb-balance-cur{font-weight:700;font-size:0.62rem;color:#e7d3a0;opacity:.9;white-space:nowrap;}

.tb-emoji{font-size:1.25rem;filter:drop-shadow(0 2px 4px rgba(0,0,0,.5));flex:0 0 auto;}

/* ---------- شعار الموقع ---------- */
.tb-user{
  flex:0 0 auto;min-width:0;
  margin-left:auto;
  display:flex;flex-direction:column;align-items:flex-end;line-height:1.1;
  cursor:pointer;padding-left:2px;
  direction:rtl;
}
.tb-user-name{
  display:flex;align-items:center;gap:6px;
  font-weight:900;font-size:1.05rem;
  background:linear-gradient(180deg,#fbe7a1,#cda64a);
  -webkit-background-clip:text;background-clip:text;color:transparent;
  white-space:nowrap;
}
.tb-user-pawn{
  height:26px;width:auto;display:block;flex:0 0 auto;
  filter:drop-shadow(0 2px 4px rgba(0,0,0,.5)) drop-shadow(0 0 6px rgba(225,180,80,.3));
}
.tb-user-pic{font-size:0.9rem;-webkit-text-fill-color:#d9b766;filter:drop-shadow(0 1px 2px rgba(0,0,0,.5));flex:0 0 auto;}
.tb-user-role{font-weight:800;font-size:0.72rem;color:#e7d3a0;letter-spacing:.5px;margin-top:1px;white-space:nowrap;}

/* ====== شاشات أصغر (جوال ضيق) ====== */
@media (max-width:430px){
  .tb-navbar{gap:6px;padding:7px 9px;}
  .tb-vip{width:46px;height:42px;}
  .tb-profile{width:42px;height:42px;}
  .tb-face{height:42px;padding:0 9px;}
  .tb-store-title,.tb-balance-amt{font-size:0.86rem;}
  .tb-store-sub,.tb-balance-cur{font-size:0.58rem;}
  .tb-emoji{font-size:1.1rem;}
  .tb-user-name{font-size:0.92rem;}
  .tb-user-pawn{height:22px;}
  .tb-user-role{font-size:0.66rem;}
}
@media (max-width:360px){
  .tb-user-name{font-size:0.82rem;}
  .tb-user-pawn{height:19px;}
  .tb-user-role{font-size:0.6rem;}
}


/* ===== TABS ===== */
.main-tabs {
  width: calc(100% - 20px);
  margin: 10px auto 0;
  display: flex;
  background: linear-gradient(180deg,#141b26,#0d121a);
  border: 1px solid rgba(201,168,76,0.18);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0,0,0,0.45), inset 0 1px 1px rgba(255,255,255,0.03);
}
.main-tab {
  flex: 1;
  min-width: 0;
  padding: 12px 6px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: 'Tajawal', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
/* فاصل عمودي رفيع بين التبويبات */
.main-tab:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 0;
  top: 22%;
  height: 56%;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(201,168,76,0.22), transparent);
}
.main-tab .tab-icon { font-size: 1.1rem; display: flex; align-items: center; justify-content: center; height: 26px; }
.main-tab .tab-icon img { height: 24px; width: auto; max-width: 30px; object-fit: contain; display: block; transition: filter 0.2s, transform 0.2s; filter: grayscale(35%) opacity(0.78); }
.main-tab.active .tab-icon img { filter: none; transform: scale(1.08); }
.main-tab:hover .tab-icon img { filter: none; }
.main-tab.active { color: var(--gold); }
.main-tab.active::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 40%;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

/* ===== شريط التبويبات السفلي المثبت ===== */
.main-tabs-bottom {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 760px;
  margin: 0;
  border-radius: 18px 18px 0 0;
  border-bottom: none;
  z-index: 1000;
  box-shadow: 0 -6px 24px rgba(0,0,0,0.55), inset 0 1px 1px rgba(255,255,255,0.03);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.main-tabs-bottom .main-tab.active::before {
  bottom: auto;
  top: 0;
  border-radius: 0 0 3px 3px;
}
/* مساحة سفلية لمنع اختفاء المحتوى خلف الشريط المثبت */
#main-screen {
  padding-bottom: 84px;
}

/* ===== شريط اربح 20$ - يوتيوب (إطار معدني) ===== */
.yt-promo-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(100% - 20px);
  max-width: 620px;
  aspect-ratio: 1200 / 231;          /* نسبة الإطار الأصلية لمنع التشوّه */
  margin: 12px auto 0;
  background-image: url('../img/yt_frame.png?v=1');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  text-decoration: none;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5));
  transition: transform 0.15s, filter 0.15s;
}
.yt-promo-bar:active { transform: scale(0.99); }
.yt-promo-bar:hover { filter: drop-shadow(0 4px 14px rgba(0,0,0,0.55)) brightness(1.05); }
/* النص داخل المنطقة الوسطى الفارغة بين زر التشغيل والهدية */
.yt-promo-text {
  position: absolute;
  left: 14.5%;
  right: 13.5%;
  top: 12%;
  bottom: 12%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: 'Tajawal', sans-serif;
  font-weight: 900;
  font-size: clamp(0.8rem, 3.3vw, 1.3rem);
  white-space: nowrap;
  color: #ffd34d;
  text-shadow:
    0 0 4px rgba(0,0,0,0.95),
    0 2px 5px rgba(0,0,0,0.9),
    0 0 14px rgba(255,180,60,0.4);
  letter-spacing: 0.2px;
  overflow: hidden;
}

.tab-content { display: none; width: 100%; flex: 1; }
.tab-content.active { display: block; }

/* ===== GAME TAB ===== */
.game-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 10px;
  gap: 10px;
}
.bet-selector {
  width: 100%;
  max-width: 520px;
  background: var(--dark2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
}
.bet-selector h3 {
  font-size: 0.88rem;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.bet-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.bet-option {
  flex: 1;
  min-width: 70px;
  padding: 8px 6px;
  background: var(--dark3);
  border: 2px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'Tajawal', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}
.bet-option.selected { border-color: var(--gold); color: var(--gold); background: rgba(201,168,76,0.1); }
.bet-option:hover { border-color: var(--gold-dim); }

/* Scorebar */
.scorebar {
  display: flex;
  width: 100%;
  max-width: 520px;
  gap: 8px;
  align-items: center;
}
.player-card {
  flex: 1;
  background: var(--dark2);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: border-color 0.3s, box-shadow 0.3s;
  position: relative;
  overflow: hidden;
}
.player-card::before {
  content: ''; position: absolute; inset: 0; opacity: 0; transition: opacity 0.3s;
}
.player-card.red::before { background: linear-gradient(135deg, rgba(192,57,43,0.15), transparent); }
.player-card.green::before { background: linear-gradient(135deg, rgba(39,174,96,0.15), transparent); }
.player-card.active { border-color: var(--gold); box-shadow: 0 0 16px rgba(201,168,76,0.3); }
.player-card.active::before { opacity: 1; }
.piece-icon {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(0,0,0,0.5);
}
.piece-icon.red { background: radial-gradient(circle at 35% 35%, #e74c3c, #7b241c); }
.piece-icon.green { background: radial-gradient(circle at 35% 35%, #2ecc71, #1a6b3a); }
.player-info { flex: 1; }
.player-name { font-size: 0.78rem; font-weight: 700; opacity: 0.8; }
.player-score { font-size: 1.2rem; font-weight: 900; color: var(--gold); }
.turn-badge {
  font-size: 0.6rem; font-weight: 700;
  background: var(--gold); color: #000;
  padding: 2px 5px; border-radius: 4px;
  opacity: 0; transition: opacity 0.3s;
}
.player-card.active .turn-badge { opacity: 1; }

.status-bar {
  background: var(--dark2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 0.83rem;
  font-weight: 700;
  text-align: center;
  width: 100%;
  max-width: 520px;
  color: var(--gold);
  min-height: 34px;
  display: flex; align-items: center; justify-content: center;
}

.board-container {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,0.7), 0 0 0 3px var(--gold), 0 0 0 5px var(--dark3);
}
#board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: min(90vw, 480px);
  height: min(90vw, 480px);
  user-select: none;
}
.cell {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  cursor: default;
}
.cell.light { background: var(--cell-light); }
.cell.dark  { background: var(--cell-dark); }
.cell.dark.possible { background: #5a9e72; cursor: pointer; }
.cell.dark.possible::after {
  content: '';
  position: absolute;
  width: 30%; height: 30%;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  pointer-events: none;
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{transform:scale(1);opacity:.8} 50%{transform:scale(1.3);opacity:.4} }
.cell.dark.selected { background: #3d8a5a; }
.piece {
  width: 76%; height: 76%;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex; align-items: center; justify-content: center;
  z-index: 1;
}
.piece:hover { transform: scale(1.08); }
.piece.selected { transform: scale(1.12); }
.piece.red-piece {
  background: radial-gradient(circle at 35% 30%, #f05540, #8B0000);
  box-shadow: 0 4px 12px rgba(0,0,0,0.6), inset 0 1px 2px rgba(255,180,160,0.4);
  border: 2px solid rgba(255,100,80,0.3);
}
.piece.red-piece.selected { box-shadow: 0 0 0 3px #fff, 0 4px 16px rgba(255,80,60,0.6); }
.piece.green-piece {
  background: radial-gradient(circle at 35% 30%, #4de080, #155d2a);
  box-shadow: 0 4px 12px rgba(0,0,0,0.6), inset 0 1px 2px rgba(150,255,180,0.4);
  border: 2px solid rgba(80,220,120,0.3);
}
.piece.green-piece.selected { box-shadow: 0 0 0 3px #fff, 0 4px 16px rgba(80,200,120,0.6); }
.piece.king::after {
  content: '♛';
  position: absolute;
  font-size: min(5vw, 26px);
  line-height: 1;
  color: rgba(255,215,0,0.95);
  text-shadow: 0 1px 3px rgba(0,0,0,0.9), 0 0 6px rgba(0,0,0,0.7);
  pointer-events: none;
}
.controls { display: flex; gap: 8px; }

/* ===== WALLET TAB ===== */
.wallet-section { padding: 16px; max-width: 520px; width: 100%; margin: 0 auto; }
.balance-card {
  background: linear-gradient(135deg, var(--dark3), var(--dark4));
  border: 1px solid var(--gold-dim);
  border-radius: 18px;
  padding: 24px 20px;
  text-align: center;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.balance-card::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle at 50% 0%, rgba(201,168,76,0.08), transparent 60%);
  pointer-events: none;
}
.balance-label { font-size: 0.82rem; color: var(--text-dim); margin-bottom: 6px; }
.balance-amount {
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(201,168,76,0.3);
}
.balance-amount span { font-size: 1rem; color: var(--text-dim); }
.balance-sub { font-size: 0.78rem; color: var(--text-dim); margin-top: 4px; }

.wallet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.section-card {
  background: var(--dark2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 16px;
  margin-bottom: 14px;
}
.section-title {
  font-size: 0.95rem;
  font-weight: 900;
  color: var(--gold);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.deposit-address {
  background: var(--dark3);
  border: 1px dashed var(--gold-dim);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
}
.deposit-address p {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.address-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.address-text {
  flex: 1;
  font-size: 0.72rem;
  color: var(--gold-light);
  font-family: monospace;
  word-break: break-all;
  line-height: 1.4;
}
.trc20-badge {
  background: var(--trc20);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.txid-input { margin-top: 10px; }
.txid-status {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  display: none;
}
.txid-status.pending {
  background: rgba(255,179,0,0.15);
  border: 1px solid var(--warning);
  color: var(--warning);
  display: block;
}
.txid-status.approved {
  background: rgba(0,200,83,0.15);
  border: 1px solid var(--success);
  color: var(--success);
  display: block;
}

/* ===== TURN TIMER ===== */
.player-timer {
  font-size: 1rem;
  font-weight: 900;
  color: var(--gold);
  min-width: 28px;
  text-align: center;
  transition: color 0.3s;
}
.player-timer.urgent { color: var(--danger); animation: timerPulse 0.5s ease-in-out infinite alternate; }
@keyframes timerPulse { from { transform: scale(1); } to { transform: scale(1.2); } }
.timer-bar-wrap {
  width: 32px;
  height: 4px;
  background: var(--dark3);
  border-radius: 2px;
  overflow: hidden;
}
.timer-bar {
  height: 100%;
  width: 100%;
  border-radius: 2px;
  background: var(--gold);
  transition: width 1s linear, background 0.3s;
}
.timer-bar.urgent { background: var(--danger); }

/* ===== BET CARDS ===== */
.bet-card {
  background: var(--dark2);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.bet-card:hover {
  border-color: var(--gold-dim);
  transform: translateY(-2px);
}
.bet-card.selected {
  border-color: var(--gold);
  background: rgba(201,168,76,0.1);
  box-shadow: 0 0 18px rgba(201,168,76,0.2);
}
.bet-card.selected::after {
  content: '✓';
  position: absolute;
  top: 7px; left: 10px;
  font-size: 0.75rem;
  font-weight: 900;
  color: var(--gold);
  background: rgba(201,168,76,0.2);
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  line-height: 18px;
}
.bet-card.locked {
  opacity: 0.4;
  cursor: not-allowed;
}
.bet-card.locked::before {
  content: '🔒';
  position: absolute;
  top: 7px; right: 8px;
  font-size: 0.8rem;
}
.bet-card-icon { font-size: 1.8rem; margin-bottom: 6px; }
.bet-card-name { font-size: 1rem; font-weight: 900; color: var(--text); }
.bet-card-sub { font-size: 0.7rem; color: var(--text-dim); margin-top: 2px; }
.bet-card-prize {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--success);
  margin-top: 6px;
  background: rgba(0,200,83,0.1);
  border-radius: 6px;
  padding: 3px 6px;
}
.bet-card:first-child .bet-card-prize { color: var(--text-dim); background: transparent; }

/* ===== MODE BUTTONS (AI difficulty / friend) ===== */
.mode-btn {
  background: var(--dark3);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 8px 6px;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s;
  user-select: none;
}
.mode-btn:hover { border-color: var(--gold-dim); }
.mode-btn.selected { border-color: var(--gold); background: rgba(201,168,76,0.12); }

/* ===== TRANSACTIONS TABLE ===== */
.tx-table { width: 100%; border-collapse: collapse; }
.tx-table th {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-align: right;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}
.tx-table td {
  font-size: 0.8rem;
  padding: 8px;
  border-bottom: 1px solid rgba(42,52,72,0.5);
  vertical-align: middle;
}
.tx-type { font-weight: 700; display: flex; align-items: center; gap: 5px; }
.tx-deposit { color: var(--success); }
.tx-withdraw { color: var(--danger); }
.tx-game-win { color: var(--gold); }
.tx-game-loss { color: var(--red-light); }
.tx-transfer { color: var(--blue-light); }
.tx-referral { color: #b48aff; }
.tx-status-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
}
.status-pending { background: rgba(255,179,0,0.15); color: var(--warning); }
.status-done { background: rgba(0,200,83,0.15); color: var(--success); }
.status-fail { background: rgba(255,61,87,0.15); color: var(--danger); }

/* ===== REFERRAL TAB ===== */
.referral-section { padding: 16px; max-width: 520px; width: 100%; margin: 0 auto; }
.ref-card {
  background: linear-gradient(135deg, #1a2340, #0f1a2e);
  border: 1px solid #3a4a6a;
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  margin-bottom: 14px;
}
.ref-code-display {
  background: var(--dark);
  border: 2px dashed var(--gold-dim);
  border-radius: 10px;
  padding: 12px;
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 4px;
  margin: 10px 0;
}
.ref-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}
.ref-stat {
  background: var(--dark3);
  border-radius: 10px;
  padding: 12px 8px;
  text-align: center;
}
.ref-stat-val { font-size: 1.3rem; font-weight: 900; color: var(--gold); }
.ref-stat-label { font-size: 0.7rem; color: var(--text-dim); margin-top: 2px; }

/* ===== VIP TAB ===== */
.vip-section { padding: 16px; max-width: 520px; width: 100%; margin: 0 auto; }
.vip-levels {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.vip-level-card {
  background: var(--dark2);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: border-color 0.2s;
}
.vip-level-card.current { border-color: var(--gold); background: rgba(201,168,76,0.06); }
.vip-icon { font-size: 2rem; flex-shrink: 0; }
.vip-info { flex: 1; }
.vip-name { font-size: 1rem; font-weight: 900; }
.vip-desc { font-size: 0.75rem; color: var(--text-dim); margin-top: 2px; }
.vip-progress-bar {
  height: 5px;
  background: var(--dark3);
  border-radius: 3px;
  margin-top: 6px;
  overflow: hidden;
}
.vip-progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  transition: width 0.5s;
}

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--dark3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 20px;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.5s forwards;
  pointer-events: auto;
  max-width: 320px;
  text-align: center;
}
.toast.success { border-color: var(--success); color: var(--success); }
.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.info { border-color: var(--gold); color: var(--gold); }
.toast.warning { border-color: var(--warning); color: var(--warning); }
@keyframes toastIn { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:translateY(0)} }
@keyframes toastOut { from{opacity:1} to{opacity:0} }

/* ===== MODAL ===== */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 200;
  align-items: center; justify-content: center;
  padding: 16px;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--dark2);
  border: 2px solid var(--gold);
  border-radius: 18px;
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.8), 0 0 30px rgba(201,168,76,0.2);
  animation: modalIn 0.3s ease;
  max-width: 340px;
  width: 100%;
}
@keyframes modalIn { from{transform:scale(0.85);opacity:0} to{transform:scale(1);opacity:1} }
.modal h2 { font-size: 1.5rem; color: var(--gold); margin-bottom: 8px; }
.modal p { opacity: 0.8; margin-bottom: 20px; font-size: 0.9rem; }
.modal .trophy { font-size: 3rem; margin-bottom: 10px; }

/* ===== TRANSFER MODAL ===== */
.modal-sheet {
  background: var(--dark2);
  border: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
  padding: 24px 20px;
  width: 100%;
  max-width: 480px;
  margin-top: auto;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.7);
  animation: sheetIn 0.3s ease;
}
@keyframes sheetIn { from{transform:translateY(50px);opacity:0} to{transform:translateY(0);opacity:1} }

/* ===== PROFILE ===== */
.profile-section { padding: 16px; max-width: 520px; width: 100%; margin: 0 auto; }
.profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--dark2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 14px;
}
.profile-avatar {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #7a5020);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  font-weight: 900;
  color: #000;
  border: 3px solid var(--gold-dim);
  flex-shrink: 0;
}
.profile-info { flex: 1; }
.profile-username { font-size: 1.2rem; font-weight: 900; }
.profile-joined { font-size: 0.75rem; color: var(--text-dim); margin-top: 2px; }
.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.profile-stat {
  background: var(--dark2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 8px;
  text-align: center;
}
.profile-stat-val { font-size: 1.3rem; font-weight: 900; color: var(--gold); }
.profile-stat-label { font-size: 0.7rem; color: var(--text-dim); margin-top: 2px; }

/* Small helpers */
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.text-dim { color: var(--text-dim); }
.text-gold { color: var(--gold); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap { display: flex; align-items: center; gap: 8px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.empty-state { text-align: center; padding: 30px 20px; color: var(--text-dim); font-size: 0.85rem; }
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 10px; }



/* ===== ADMIN STYLES ===== */
#admin-screen { background: var(--dark); }
.adm-tab {
  flex:1; min-width:80px;
  padding:10px 6px;
  border:none; background:transparent;
  color:var(--text-dim);
  font-family:'Tajawal',sans-serif;
  font-size:0.72rem; font-weight:700;
  cursor:pointer;
  border-bottom:2px solid transparent;
  display:flex; flex-direction:column; align-items:center; gap:3px;
  white-space:nowrap; transition:all 0.2s;
}
.adm-tab span { font-size:1.1rem; }
.adm-tab.active { color:var(--gold); border-bottom-color:var(--gold); }
.adm-content { display:none; width:100%; flex:1; overflow-y:auto; }
.adm-content.active { display:block; }
.adm-stats-grid {
  display:grid; grid-template-columns:repeat(2,1fr); gap:10px;
}
.adm-stat-card {
  background:var(--dark2); border:1px solid var(--border);
  border-radius:14px; padding:14px 12px; text-align:center;
}
.adm-stat-card.urgent { border-color:var(--warning); background:rgba(255,179,0,0.05); }
.adm-stat-icon { font-size:1.6rem; margin-bottom:4px; }
.adm-stat-val { font-size:1.4rem; font-weight:900; color:var(--gold); }
.adm-stat-label { font-size:0.72rem; color:var(--text-dim); margin-top:2px; }
.adm-section-title {
  font-size:0.9rem; font-weight:900; color:var(--gold);
  margin-bottom:10px; display:flex; align-items:center; gap:6px;
}
.adm-table-wrap { overflow-x:auto; border-radius:10px; border:1px solid var(--border); }
.adm-table { width:100%; border-collapse:collapse; min-width:500px; }
.adm-table th {
  font-size:0.72rem; color:var(--text-dim); text-align:right;
  padding:8px 10px; background:var(--dark3);
  border-bottom:1px solid var(--border);
}
.adm-table td {
  font-size:0.8rem; padding:9px 10px;
  border-bottom:1px solid rgba(42,52,72,0.4);
  vertical-align:middle;
}
.adm-table tr:last-child td { border-bottom:none; }
.adm-table tr:hover td { background:rgba(255,255,255,0.02); }
.adm-toolbar {
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:12px; gap:8px;
}
.adm-search {
  flex:1; padding:9px 12px;
  background:var(--dark3); border:1px solid var(--border);
  border-radius:8px; color:var(--text);
  font-family:'Tajawal',sans-serif; font-size:0.85rem; outline:none;
}
.adm-search:focus { border-color:var(--gold); }
.adm-btn-tiny {
  padding:3px 8px; border-radius:5px; font-size:0.7rem;
  font-family:'Tajawal',sans-serif; font-weight:700;
  cursor:pointer; border:none; margin:1px;
}
.adm-btn { padding:8px 14px; border-radius:8px; font-family:'Tajawal',sans-serif; font-size:0.82rem; font-weight:700; cursor:pointer; border:none; }
.adm-btn-gold { background:var(--gold); color:#000; }
.adm-btn-green { background:var(--green); color:#fff; }
.adm-btn-red { background:var(--red-light); color:#fff; }
.adm-vip-badge { font-size:0.65rem; font-weight:700; padding:2px 7px; border-radius:5px; background:rgba(201,168,76,0.2); color:var(--gold); }
.adm-pass-cell { font-family:monospace; font-size:0.85rem; letter-spacing:2px; }


/* ============================================================
   RESPONSIVE — TABLET & DESKTOP (768px+)
   ============================================================ */

/* --- Shared wrapper for centred max-width content --- */
.page-wrapper {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- TABLET (≥768px) ---- */
@media (min-width: 768px) {

  /* Auth: larger, centred card */
  #auth-screen { background-image:
    radial-gradient(ellipse at 20% 20%, rgba(201,168,76,0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(39,174,96,0.07) 0%, transparent 50%);
  }
  .auth-box {
    max-width: 440px;
    padding: 48px 40px;
    border-radius: 24px;
  }
  .auth-logo h1 { font-size: 2.2rem; }

  /* Navbar */
  .navbar { padding: 12px 32px; }
  .navbar-brand { font-size: 1.3rem; }

  /* Main tabs — wider, bigger text */
  .main-tabs { max-width: 760px; }
  .main-tab { padding: 14px 12px; font-size: 0.88rem; flex: 1; }
  .main-tab .tab-icon { font-size: 1.25rem; height: 30px; }
  .main-tab .tab-icon img { height: 28px; max-width: 34px; }

  /* Game section: widen board area */
  .game-section { padding: 20px 16px; gap: 14px; }
  .bet-selector { max-width: 640px; }
  .scorebar { max-width: 640px; }
  .status-bar { max-width: 640px; }
  #board {
    width: min(70vw, 560px);
    height: min(70vw, 560px);
  }

  /* Wallet */
  .wallet-section { max-width: 640px; padding: 20px; }
  .balance-amount { font-size: 3rem; }

  /* Referral, VIP, Profile */
  .referral-section, .vip-section, .profile-section { max-width: 640px; padding: 20px; }

  /* Modals */
  .modal { max-width: 420px; padding: 36px 32px; }
  .modal-sheet { max-width: 560px; border-radius: 18px; margin: auto; }
}

/* ---- DESKTOP (≥1024px) ---- */
@media (min-width: 1024px) {

  /* Full-width navbar with max container */
  .navbar { padding: 14px 48px; }
  .navbar-brand { font-size: 1.5rem; letter-spacing: 0.5px; }
  .avatar { width: 40px; height: 40px; font-size: 1rem; }

  /* Main tabs: horizontal bar, bigger */
  .main-tab { padding: 16px 12px; font-size: 0.95rem; flex: 1; }

  /* Game layout: board + sidebar side by side */
  #game-tab .game-section {
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 28px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px 24px;
  }

  /* Left column: board */
  #game-tab .game-section > .board-container {
    flex-shrink: 0;
  }

  /* Right column: bet, scorebar, status, controls */
  #game-tab .game-section > :not(.board-container) {
    width: 100%;
    max-width: 320px;
  }

  #board {
    width: min(50vw, 560px);
    height: min(50vw, 560px);
  }

  .bet-selector { max-width: 320px; }
  .scorebar { max-width: 320px; }
  .status-bar { max-width: 320px; }
  .controls { max-width: 320px; width: 100%; }

  /* Wallet — two column layout */
  .wallet-section { max-width: 860px; }
  .wallet-actions { grid-template-columns: repeat(4, 1fr); }

  /* Referral stats — 3 even cols */
  .referral-section { max-width: 860px; }
  .ref-stats { grid-template-columns: repeat(3, 1fr); gap: 16px; }

  /* VIP */
  .vip-section { max-width: 860px; }
  .vip-levels { flex-direction: row; flex-wrap: wrap; gap: 14px; }
  .vip-level-card { width: calc(50% - 7px); }

  /* Profile */
  .profile-section { max-width: 860px; }
  .profile-stats { grid-template-columns: repeat(3, 1fr); gap: 14px; }

  /* Admin: wider tables */
  .adm-stats-grid { grid-template-columns: repeat(4, 1fr); }

  /* Toast: bottom-right on desktop */
  .toast-container {
    bottom: 32px;
    left: auto;
    right: 32px;
    transform: none;
    align-items: flex-end;
  }
}

/* ---- LARGE DESKTOP (≥1280px) ---- */
@media (min-width: 1280px) {

  .navbar { padding: 16px 64px; }

  /* Game: bigger board */
  #board {
    width: 600px;
    height: 600px;
  }

  /* Wallet two-panel */
  .wallet-section { max-width: 1000px; }

  /* Referral */
  .referral-section { max-width: 1000px; }

  /* VIP — 3 per row */
  .vip-level-card { width: calc(33.333% - 10px); }

  /* Profile */
  .profile-section { max-width: 1000px; }

  /* Admin */
  .adm-stats-grid { grid-template-columns: repeat(5, 1fr); }
}

/* ---- HOVER effects only on non-touch ---- */
@media (hover: hover) {
  .bet-option:hover { background: var(--dark4); }
  .btn:hover { opacity: 0.92; }
  .main-tab:hover:not(.active) { color: var(--text); background: rgba(255,255,255,0.03); }
  .vip-level-card:hover { border-color: var(--gold-dim); }
}

/* ---- Smooth scrollbar on desktop ---- */
@media (min-width: 768px) {
  ::-webkit-scrollbar { width: 6px; height: 6px; }
  ::-webkit-scrollbar-track { background: var(--dark2); }
  ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
  ::-webkit-scrollbar-thumb:hover { background: var(--gold-dim); }
}

/* ---- Prevent overflow on small phones ---- */
@media (max-width: 380px) {
  .auth-box { padding: 28px 20px; }
  .main-tab { min-width: 0; padding: 10px 3px; font-size: 0.68rem; flex: 1; }
  .balance-amount { font-size: 2rem; }
  #board {
    width: min(95vw, 340px);
    height: min(95vw, 340px);
  }
}

/* ============================================================
   DESKTOP GAME BOARD — overrides inline styles
   ============================================================ */
@media (min-width: 1024px) {

  /* Lobby: widen bet grid */
  #bet-lobby {
    max-width: 700px !important;
  }
  #bet-cards-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  #bet-cards-grid > .bet-card:first-child {
    grid-column: 1 / -1 !important;
  }

  /* Game board section: side-by-side layout */
  #game-board-section {
    flex-direction: row !important;
    align-items: flex-start !important;
    justify-content: center !important;
    gap: 32px !important;
    padding: 24px 32px !important;
    max-width: 1100px !important;
    margin: 0 auto !important;
    flex-wrap: wrap;
  }

  /* Board stays centred */
  #game-board-section .board-container {
    order: 1;
    flex-shrink: 0;
  }

  /* Sidebar: scorebar + status + controls */
  #game-board-section > :not(.board-container) {
    order: 2;
    max-width: 300px !important;
    width: 300px !important;
  }

  /* Active bet banner spans full width above layout */
  #active-bet-banner {
    order: 0;
    flex-basis: 100% !important;
    max-width: 100% !important;
  }

  #board {
    width: 560px !important;
    height: 560px !important;
  }
}

@media (min-width: 1280px) {
  #board {
    width: 620px !important;
    height: 620px !important;
  }
  #bet-lobby {
    max-width: 800px !important;
  }
}

/* ══════════════════════════════════════════════════════════════
   SPECTATE ROOMS — REDESIGN
   ══════════════════════════════════════════════════════════════ */

/* Loading state */
.spec-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  color: var(--text-dim);
  font-size: 0.8rem;
}
.spec-loading-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--gold);
  animation: specPulse 1.2s ease-in-out infinite;
}
@keyframes specPulse {
  0%,100% { opacity:1; transform:scale(1); }
  50%      { opacity:0.3; transform:scale(0.6); }
}

/* ── Room Card ── */
.spec-room-card {
  background: #161929;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 14px;
  padding: 13px 14px;
  display: flex;
  align-items: center;
  gap: 11px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  position: relative;
  overflow: hidden;
  margin-bottom: 8px;
}
.spec-room-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 55%, rgba(167,139,250,0.04));
  pointer-events: none;
}
.spec-room-card:hover {
  border-color: rgba(255,255,255,0.13);
  background: #1e2338;
  transform: translateY(-1px);
}
.spec-room-card-bet {
  border-color: rgba(245,197,66,0.18);
}
.spec-room-card-bet::after {
  background: linear-gradient(135deg, transparent 55%, rgba(245,197,66,0.05));
}

/* avatars */
.spec-avatars {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.spec-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 900;
  border: 2px solid #0a0c14;
  flex-shrink: 0;
  letter-spacing: 0;
}
.spec-avatar-p1 {
  background: rgba(248,113,113,0.15);
  color: #f87171;
  border-color: rgba(248,113,113,0.3);
  z-index: 2;
}
.spec-avatar-p2 {
  background: rgba(52,211,153,0.15);
  color: #34d399;
  border-color: rgba(52,211,153,0.3);
  margin-right: -8px;
}

/* room info */
.spec-room-info { flex: 1; min-width: 0; }
.spec-players-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
  flex-wrap: nowrap;
}
.spec-pname {
  font-size: 0.83rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
}
.spec-pname-p1 { color: #f87171; }
.spec-pname-p2 { color: #34d399; }
.spec-vs {
  font-size: 0.63rem;
  color: var(--text-dim);
  font-weight: 500;
  flex-shrink: 0;
}
.spec-turn-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  animation: specPulse 1.3s ease-in-out infinite;
}
.spec-turn-dot-p1 { background: #f87171; box-shadow: 0 0 5px #f87171; }
.spec-turn-dot-p2 { background: #34d399; box-shadow: 0 0 5px #34d399; }

.spec-chips-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.spec-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.67rem;
  font-weight: 700;
}
.spec-chip-bet {
  background: rgba(245,197,66,0.15);
  color: #f5c542;
  border: 1px solid rgba(245,197,66,0.25);
}
.spec-chip-free {
  background: rgba(107,114,128,0.15);
  color: var(--text-dim);
  border: 1px solid rgba(107,114,128,0.2);
}
.spec-chip-spec {
  background: rgba(167,139,250,0.12);
  color: #a78bfa;
  border: 1px solid rgba(167,139,250,0.2);
}

/* watch button */
.spec-watch-btn {
  flex-shrink: 0;
  background: linear-gradient(135deg, #4c1d95, #5b21b6);
  color: #ddd6fe;
  border: 1px solid rgba(167,139,250,0.3);
  border-radius: 10px;
  padding: 8px 13px;
  font-size: 0.77rem;
  font-weight: 800;
  font-family: 'Tajawal', sans-serif;
  cursor: pointer;
  transition: background 0.18s, transform 0.12s, box-shadow 0.18s;
  white-space: nowrap;
}
.spec-watch-btn:hover {
  background: linear-gradient(135deg, #5b21b6, #6d28d9);
  box-shadow: 0 4px 16px rgba(124,58,237,0.4);
  transform: scale(1.04);
}
.spec-watch-btn:active { transform: scale(0.97); }

/* ══ Spectator View ══ */
.og-spec-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 10px;
  padding: 10px 0;
  animation: ogSpecFadeIn 0.3s ease;
}
@keyframes ogSpecFadeIn {
  from { opacity:0; transform:translateY(8px); }
  to   { opacity:1; transform:translateY(0); }
}

/* top bar */
.og-spec-topbar {
  width: 100%;
  background: linear-gradient(135deg, #0d1428, #12183a);
  border: 1px solid rgba(167,139,250,0.25);
  border-radius: 14px;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.og-spec-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.og-spec-eye-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(167,139,250,0.12);
  border: 1px solid rgba(167,139,250,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.og-spec-title-text {
  font-size: 0.82rem;
  font-weight: 900;
  color: #a78bfa;
}
.og-spec-match-names {
  font-size: 0.71rem;
  color: #6b7280;
  margin-top: 1px;
}
.og-spec-exit-btn {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.25);
  color: #f87171;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.74rem;
  font-weight: 800;
  font-family: 'Tajawal', sans-serif;
  cursor: pointer;
  transition: background 0.15s;
}
.og-spec-exit-btn:hover { background: rgba(239,68,68,0.2); }

/* player cards grid */
.og-spec-players {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
}
.og-spec-player-card {
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
  transition: border-color 0.3s, background 0.3s, box-shadow 0.3s;
}
.og-spec-card-p1 {
  background: rgba(248,113,113,0.1);
  border: 2px solid rgba(248,113,113,0.2);
}
.og-spec-card-p1.spec-active-turn {
  border-color: #f87171;
  background: rgba(248,113,113,0.17);
  box-shadow: 0 0 16px rgba(248,113,113,0.2);
}
.og-spec-card-p2 {
  background: rgba(52,211,153,0.1);
  border: 2px solid rgba(52,211,153,0.2);
}
.og-spec-card-p2.spec-active-turn {
  border-color: #34d399;
  background: rgba(52,211,153,0.17);
  box-shadow: 0 0 16px rgba(52,211,153,0.2);
}
.og-spec-pname {
  font-size: 0.75rem;
  font-weight: 800;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.og-spec-pname-p1 { color: #f87171; }
.og-spec-pname-p2 { color: #34d399; }
.og-spec-score {
  font-size: 2rem;
  font-weight: 900;
  color: #fff;
  line-height: 1;
}
.og-spec-score-label {
  font-size: 0.6rem;
  color: var(--text-dim);
  margin-top: 2px;
}
.og-spec-timer {
  font-size: 0.68rem;
  color: #fbbf24;
  margin-top: 3px;
  min-height: 14px;
}
.og-spec-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.og-spec-turn-big { font-size: 1.7rem; }
.og-spec-bet-pill {
  background: rgba(245,197,66,0.15);
  color: #f5c542;
  border: 1px solid rgba(245,197,66,0.2);
  border-radius: 20px;
  padding: 2px 8px;
  font-size: 0.64rem;
  font-weight: 800;
  white-space: nowrap;
}

/* board */
.og-spec-board-wrap {
  width: 100%;
  max-width: 400px;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid rgba(167,139,250,0.35);
  box-shadow: 0 0 28px rgba(124,58,237,0.22);
}

/* status bar */
.og-spec-status-bar {
  font-size: 0.8rem;
  color: #a78bfa;
  text-align: center;
  padding: 4px 0 2px;
  font-weight: 600;
  min-height: 22px;
}

/* ===== قسم اختيار مستوى التدرّب ضد الذكاء الاصطناعي ===== */
.ai-diff-box {
  width: 100%;
  background: linear-gradient(180deg, #0e1726, #0a111d);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.03);
}
.ai-diff-title {
  text-align: right;
  color: #c9d3e6;
  font-family: 'Tajawal', sans-serif;
  font-weight: 900;
  font-size: 1rem;
  margin-bottom: 14px;
}
.ai-diff-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.ai-diff-card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 400 / 484;
  background-size: cover;
  background-position: center;
  border: 1.5px solid rgba(255,255,255,0.06);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.ai-diff-card:active { transform: scale(0.97); }
.ai-diff-card:hover { transform: translateY(-3px); }
.ai-diff-card.selected,
.ai-diff-card.ai-diff-featured {
  border-color: #e7c25f;
  box-shadow: 0 0 0 1px #e7c25f, 0 0 18px rgba(231,194,95,0.35);
}
.ai-diff-top, .ai-diff-bottom {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  font-family: 'Tajawal', sans-serif;
  font-weight: 900;
  color: #dfe6f2;
  text-shadow: 0 2px 6px rgba(0,0,0,0.85);
  font-size: clamp(0.85rem, 3.6vw, 1.1rem);
}
.ai-diff-top { top: 9%; }
.ai-diff-bottom { bottom: 9%; }
.ai-diff-card.selected .ai-diff-top,
.ai-diff-card.selected .ai-diff-bottom,
.ai-diff-card.ai-diff-featured .ai-diff-top,
.ai-diff-card.ai-diff-featured .ai-diff-bottom {
  color: #f5d98b;
}

/* ═══════════════════════════════════════════════
   قسم المحفظة الفاخر (Glassmorphism + أزرار لامعة)
   ═══════════════════════════════════════════════ */
.wallet-lux { padding: 14px; max-width: 540px; }

/* بطاقة الرصيد الزجاجية */
.lux-balance-card {
  position: relative;
  border-radius: 20px;
  padding: 26px 22px;
  text-align: center;
  margin-bottom: 14px;
  background: linear-gradient(160deg, rgba(255,255,255,0.10), rgba(255,255,255,0.03));
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.18), 0 8px 28px rgba(0,0,0,0.4);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  overflow: hidden;
}
.lux-balance-card::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(120% 80% at 50% -10%, rgba(255,255,255,0.14), transparent 60%);
  pointer-events: none;
}
.lux-balance-label { font-size: 0.92rem; color: #cdd6e6; margin-bottom: 8px; font-weight: 600; }
.lux-balance-amount {
  font-size: 2.6rem; font-weight: 900; color: #fff;
  text-shadow: 0 2px 10px rgba(0,0,0,0.4);
  letter-spacing: 0.5px;
}
.lux-balance-amount span:first-child { font-size: 1.5rem; opacity: 0.95; }

/* أزرار العمليات الملوّنة */
.lux-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.lux-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  font-family: 'Tajawal', sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  box-shadow: 0 5px 14px rgba(0,0,0,0.35), inset 0 1px 1px rgba(255,255,255,0.3), inset 0 -3px 6px rgba(0,0,0,0.25);
  transition: transform 0.14s, filter 0.14s;
  overflow: hidden;
}
.lux-btn::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 45%;
  background: linear-gradient(180deg, rgba(255,255,255,0.28), transparent);
  pointer-events: none;
}
.lux-btn:active { transform: scale(0.97); }
.lux-btn:hover { filter: brightness(1.08); }
.lux-btn-text { flex: 1; text-align: center; }
.lux-btn-ic {
  font-size: 1.05rem;
  background: rgba(255,255,255,0.22);
  border-radius: 8px;
  padding: 3px 7px;
  box-shadow: inset 0 0 8px rgba(255,255,255,0.25);
}
.lux-btn-green { background: linear-gradient(165deg, #2fd06f 0%, #16a34a 55%, #0b7a35 100%); }
.lux-btn-red   { background: linear-gradient(165deg, #c0392b 0%, #962219 55%, #6e1610 100%); }
.lux-btn-blue  { background: linear-gradient(165deg, #2f6fd0 0%, #1d4fb0 55%, #14306e 100%); }

/* البطاقات الزجاجية (إيداع/سجل) */
.lux-card {
  position: relative;
  border-radius: 18px;
  padding: 18px 16px;
  margin-bottom: 14px;
  background: linear-gradient(165deg, rgba(20,27,38,0.78), rgba(10,14,22,0.82));
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.06), 0 6px 22px rgba(0,0,0,0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.lux-card-head {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px; margin-bottom: 16px;
}
.lux-card-title { font-size: 1.05rem; font-weight: 900; color: #fff; }
.lux-card-ic {
  font-size: 1rem;
  background: rgba(255,255,255,0.08);
  border-radius: 7px; padding: 2px 6px;
}

/* بطاقات طرق الدفع */
.lux-pm-label { font-size: 0.82rem; color: #aab4c6; margin-bottom: 8px; text-align: right; }
.lux-pm-list { display: flex; flex-direction: column; gap: 9px; margin-bottom: 14px; }
.lux-pm-card {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px;
  background: linear-gradient(160deg, rgba(28,36,50,0.7), rgba(14,19,28,0.75));
  border: 1.5px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  cursor: pointer; width: 100%;
  font-family: 'Tajawal', sans-serif;
  transition: all 0.15s;
}
.lux-pm-card:hover { border-color: rgba(255,255,255,0.18); }
.lux-pm-card.selected {
  border-color: var(--gold);
  background: linear-gradient(160deg, rgba(201,168,76,0.14), rgba(14,19,28,0.78));
  box-shadow: 0 0 0 1px rgba(201,168,76,0.5), 0 0 16px rgba(201,168,76,0.2);
}
.lux-pm-check {
  font-size: 1.1rem; color: var(--gold); font-weight: 900;
  flex-shrink: 0; width: 20px;
}
.lux-pm-info { flex: 1; text-align: right; }
.lux-pm-name { font-size: 1rem; font-weight: 800; color: #fff; }
.lux-pm-card.selected .lux-pm-name { color: var(--gold-light); }
.lux-pm-desc { font-size: 0.7rem; color: #99a3b5; margin-top: 1px; }
.lux-pm-coin {
  width: 42px; height: 42px; flex-shrink: 0;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.4));
}

.lux-pm-note { font-size: 0.82rem; color: #aab4c6; margin-bottom: 10px; text-align: right; }

/* عنوان الإيداع */
.lux-address {
  background: rgba(0,0,0,0.25);
  border: 1.5px dashed rgba(201,168,76,0.45);
  border-radius: 12px;
  padding: 13px;
  margin-bottom: 14px;
}
.lux-address p { font-size: 0.78rem; color: #aab4c6; margin-bottom: 9px; text-align: right; }
.lux-address-row { display: flex; align-items: center; gap: 9px; }
.lux-trc-badge {
  background: linear-gradient(180deg, #e0463a, #b0271c);
  color: #fff; font-size: 0.62rem; font-weight: 800;
  padding: 4px 8px; border-radius: 6px; flex-shrink: 0;
  box-shadow: 0 2px 5px rgba(176,39,28,0.4);
  white-space: nowrap;
}
.lux-address-text {
  flex: 1; font-size: 0.82rem; color: #e9eef7;
  font-family: monospace; word-break: break-all; line-height: 1.4;
}
.lux-copy-btn {
  background: linear-gradient(180deg, #2a3344, #1a2230);
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff; font-family: 'Tajawal', sans-serif;
  font-size: 0.82rem; font-weight: 700;
  padding: 8px 12px; border-radius: 9px; cursor: pointer;
  flex-shrink: 0; display: flex; align-items: center; gap: 4px;
  transition: filter 0.15s;
}
.lux-copy-btn:hover { filter: brightness(1.15); }

/* الحقول */
.lux-field { margin-bottom: 13px; }
.lux-field-label {
  display: block; font-size: 0.88rem; font-weight: 700;
  color: #dbe2ee; margin-bottom: 7px; text-align: right;
}
.lux-input {
  width: 100%;
  background: rgba(0,0,0,0.28);
  border: 1.5px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  padding: 14px 15px;
  color: #fff;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.95rem;
  text-align: right;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.lux-input::placeholder { color: #6b7589; }
.lux-input:focus {
  outline: none;
  border-color: rgba(201,168,76,0.6);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.12);
}

/* زر التأكيد الذهبي */
.lux-confirm-btn {
  width: 100%;
  margin-top: 4px;
  padding: 15px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  font-family: 'Tajawal', sans-serif;
  font-weight: 900;
  font-size: 1.1rem;
  color: #3a2c08;
  background: linear-gradient(180deg, #fbe9a4 0%, #e7c25f 40%, #c79a3f 75%, #a87e2c 100%);
  box-shadow: 0 5px 16px rgba(180,140,40,0.45), inset 0 1px 2px rgba(255,255,255,0.6), inset 0 -3px 6px rgba(120,80,10,0.4);
  text-shadow: 0 1px 0 rgba(255,255,255,0.3);
  transition: transform 0.14s, filter 0.14s;
}
.lux-confirm-btn:active { transform: scale(0.98); }
.lux-confirm-btn:hover { filter: brightness(1.05); }

/* ════════════════════════════════════════════════════════════
   WITHDRAW & TRANSFER — REDESIGNED CENTERED MODALS (wx-*)
   Matches reference designs: gold border + colored glow,
   custom icons, balance pill, fee summary, action buttons.
   ════════════════════════════════════════════════════════════ */

/* الخلفية: توسيط كامل + قابلية التمرير على الشاشات الصغيرة
   (يصحّح مشكلة عدم الظهور الكامل وثبوت النافذة بالأسفل) */
.wx-overlay {
  align-items: center !important;
  justify-content: center !important;
  padding: 18px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.wx-overlay.show { display: flex; }

/* البطاقة */
.wx-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  margin: auto;
  background: linear-gradient(180deg, #18202c 0%, #10151d 100%);
  border: 2px solid var(--gold);
  border-radius: 20px;
  padding: 20px 18px 18px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.75);
  animation: wxIn 0.28s cubic-bezier(.2,.8,.25,1);
  text-align: right;
  direction: rtl;
}
.wx-card-red  { box-shadow: 0 18px 60px rgba(0,0,0,0.78), 0 0 34px rgba(231,60,60,0.22); }
.wx-card-blue { box-shadow: 0 18px 60px rgba(0,0,0,0.78), 0 0 34px rgba(52,152,219,0.22); }
@keyframes wxIn { from{transform:scale(0.9);opacity:0} to{transform:scale(1);opacity:1} }

/* الترويسة */
.wx-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(201,168,76,0.28);
}
.wx-head-title {
  font-size: 1.32rem;
  font-weight: 900;
  color: var(--gold-light);
  letter-spacing: .3px;
}
.wx-head-title-blue { color: var(--gold-light); }
.wx-head-ic { width: 30px; height: 30px; flex: none; background-size: contain; background-repeat: no-repeat; background-position: center; }

/* أيقونة السهم المزدوج الذهبي (سحب) */
.wx-ic-up {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23f6dd8e'/%3E%3Cstop offset='1' stop-color='%23c9a84c'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath fill='url(%23g)' d='M16 3l9 9h-5v6h-8v-6H7z'/%3E%3Cpath fill='url(%23g)' d='M9 21h14v3H9zM11 26h10v3H11z'/%3E%3C/svg%3E");
}
/* أيقونة التحويل الزرقاء (سهمان متعاكسان داخل مربع) */
.wx-ic-transfer {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect x='2' y='2' width='28' height='28' rx='7' fill='%23dfeaf7'/%3E%3Cpath fill='%232b80c8' d='M9 12h10l-3-3 1.6-1.6L24 13l-5.4 5.6L17 17l3-3H9z'/%3E%3Cpath fill='%232b80c8' d='M23 20H13l3 3-1.6 1.6L8 19l5.4-5.6L15 15l-3 3h11z' opacity='.0'/%3E%3Cpath fill='%232b80c8' d='M23 20H13l3-3-1.6-1.6L9 20l5.4 5.6L16 24l-3-3h10z'/%3E%3C/svg%3E");
}

/* شريط الرصيد (سحب) */
.wx-balance-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
}
.wx-balance-lbl { color: var(--text); font-weight: 700; font-size: 0.98rem; }
.wx-balance-amt { color: var(--gold-light); font-weight: 900; font-size: 1.05rem; }
.wx-balance-amt #withdraw-balance-show { font-weight: 900; }

/* الحقول */
.wx-field { margin-bottom: 14px; }
.wx-label {
  display: block;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
}
.wx-input-wrap { position: relative; display: block; }
.wx-input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255,255,255,0.045);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: 'Tajawal', sans-serif;
  font-size: 1rem;
  text-align: right;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.wx-input::placeholder { color: var(--text-dim); }
.wx-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,168,76,0.16); }
.wx-input-haseic { padding-left: 50px; }

/* أيقونات داخل الحقل (يسار، حسب اتجاه التصميم) */
.wx-input-ic {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  width: 26px; height: 26px;
  background-size: contain; background-repeat: no-repeat; background-position: center;
  pointer-events: none;
}
/* QR (سحب) */
.wx-ic-qr {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c9a84c' stroke-width='1.7'%3E%3Crect x='3' y='3' width='7' height='7' rx='1'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1'/%3E%3Cpath d='M14 14h3v3h-3zM20 14v3M14 20h3M20 20h1'/%3E%3C/svg%3E");
}
/* أفاتار المستخدم (تحويل) */
.wx-ic-user {
  width: 32px; height: 32px; left: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Ccircle cx='20' cy='20' r='20' fill='%232a3a52'/%3E%3Ccircle cx='20' cy='15' r='6' fill='%23e7c9a8'/%3E%3Cpath d='M8 34c1.5-7 7-10 12-10s10.5 3 12 10z' fill='%23e7c9a8'/%3E%3C/svg%3E");
}

/* توهّج أزرق لحقل اسم المستخدم (كما في التصميم) */
.wx-input-wrap-glow .wx-input {
  border-color: #3aa0e6;
  box-shadow: 0 0 0 2px rgba(58,160,230,.35), 0 0 16px rgba(58,160,230,.30);
}

/* سطر التحقق من اللاعب */
.wx-verify-line {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 9px;
  color: var(--text-dim);
  font-size: 0.86rem;
}
.wx-verify-badge {
  width: 16px; height: 16px; flex: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%237a8aaa' d='M12 1l2.4 1.8 3-.3 1 2.8 2.6 1.4-.6 3 1.6 2.6-2 2.2.2 3-2.9.8-1.4 2.6-2.9-.7L12 23l-2.6-1.4-2.9.7-1.4-2.6-2.9-.8.2-3-2-2.2 1.6-2.6-.6-3L4.6 4.3l1-2.8 3 .3z'/%3E%3Cpath fill='%23131820' d='M10.6 14.6l-2.3-2.3-1.3 1.3 3.6 3.6 6-6-1.3-1.3z'/%3E%3C/svg%3E");
  background-size: contain; background-repeat: no-repeat;
}

/* حقل المبلغ مع أزرار الزيادة/النقصان */
.wx-input-num { padding-left: 46px; padding-right: 16px; }
.wx-input-num::-webkit-outer-spin-button,
.wx-input-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.wx-input-num { -moz-appearance: textfield; }
/* عندما لا يوجد ستيبر (حقل سحب): مساحة كافية للاحقة على اليسار */
.wx-input-wrap > .wx-input-num:first-child { padding-left: 120px; }
.wx-stepper {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  display: flex; flex-direction: column;
  gap: 2px;
}
.wx-step-btn {
  width: 22px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; cursor: pointer;
  color: var(--text-dim); font-size: 0.6rem; line-height: 1; padding: 0;
}
.wx-step-btn:hover { color: var(--gold-light); }
.wx-input-suffix {
  position: absolute;
  right: 16px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 0.82rem;
  pointer-events: none;
}

/* سطر رسم الشبكة (سحب) */
.wx-summary-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 2px 16px;
}
.wx-sum-key { color: #6fa8d6; font-size: 0.92rem; font-weight: 700; }
.wx-sum-val { font-size: 0.92rem; font-weight: 700; }
.wx-sum-blue { color: #6fa8d6; }

/* الأزرار */
.wx-actions { display: flex; align-items: stretch; gap: 12px; }
.wx-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  border: none; cursor: pointer;
  font-family: 'Tajawal', sans-serif;
  font-weight: 900; font-size: 1.05rem;
  border-radius: 14px;
  padding: 15px 18px;
  transition: transform .12s, filter .15s, box-shadow .15s;
}
.wx-btn:active { transform: scale(.97); }
.wx-btn-ic { width: 22px; height: 22px; background-size: contain; background-repeat: no-repeat; background-position: center; }

.wx-btn-confirm-red {
  flex: 1;
  background: linear-gradient(180deg, #ff4848 0%, #c81d1d 100%);
  color: #fff;
  box-shadow: 0 0 22px rgba(231,40,40,0.55), inset 0 1px 0 rgba(255,255,255,0.25);
}
.wx-btn-confirm-red:hover { filter: brightness(1.06); }

.wx-btn-confirm-blue {
  flex: 1;
  background: linear-gradient(180deg, #4db1f0 0%, #2575c0 100%);
  color: #fff;
  box-shadow: 0 0 22px rgba(52,152,219,0.5), inset 0 1px 0 rgba(255,255,255,0.3);
}
.wx-btn-confirm-blue:hover { filter: brightness(1.06); }

.wx-btn-cancel {
  background: #1b2330;
  color: var(--gold-light);
  border: 1px solid var(--border);
  min-width: 92px;
  flex: none;
}
.wx-btn-cancel:hover { background: var(--dark4); }

/* تخطيط أزرار التحويل + صندوق الملخص */
.wx-actions-transfer { align-items: center; flex-wrap: wrap; }
.wx-tsummary {
  flex: 1 1 100%;
  order: 3;
  background: rgba(255,255,255,0.035);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--text-dim);
  font-size: 0.84rem;
  line-height: 1.9;
  text-align: right;
  margin-top: 4px;
}
.wx-tsummary span { color: var(--text); font-weight: 700; }

/* شرح مختصر تحت ملخص الرسوم (سحب/تحويل) */
.wx-fee-hint {
  flex: 1 1 100%;
  order: 4;
  font-size: 0.72rem;
  color: var(--text-dim);
  line-height: 1.6;
  margin-top: 6px;
  padding: 0 2px;
}

/* على الشاشات الأوسع: الملخص بجانب الأزرار كما في الصورة */
@media (min-width: 480px) {
  .wx-actions-transfer .wx-btn-confirm-blue { order: 2; }
  .wx-actions-transfer .wx-btn-cancel { order: 1; }
  .wx-tsummary { flex: 1 1 auto; order: 3; margin-top: 0; }
}

/* قسم الإيداع البنكي المغربي */
.mor-note{ font-size:0.82rem; color:#4ade80; margin-bottom:12px; line-height:1.7;
  background:rgba(74,222,128,.1); border:1px solid rgba(74,222,128,.25); border-radius:10px; padding:10px 12px; }
.mor-bank{ background:var(--dark3); border:1px solid var(--gold-dim); border-radius:12px; padding:12px 14px; margin-bottom:10px; }
.mor-bank-name{ font-weight:900; color:var(--gold-light); font-size:0.92rem; margin-bottom:8px; }
.mor-bank-row{ display:flex; align-items:center; gap:8px; padding:5px 0; font-size:0.85rem; }
.mor-bank-row .l{ color:var(--text-dim); min-width:90px; }
.mor-bank-row .v{ color:var(--text); font-weight:700; flex:1; word-break:break-all; }
.mor-bank-row .v.mono{ font-family:ui-monospace,Menlo,Consolas,monospace; direction:ltr; text-align:left; }

/* تبويبات طريقة السحب (المغرب) */
.wx-method-tabs{ display:flex; gap:8px; background:rgba(0,0,0,.25); padding:5px; border-radius:12px; }
.wx-method-tab{ flex:1; padding:10px 6px; border:1px solid transparent; border-radius:9px; background:transparent;
  color:var(--text-dim); font-family:'Tajawal',sans-serif; font-weight:800; font-size:.85rem; cursor:pointer; transition:.15s; }
.wx-method-tab.active{ background:var(--gold); color:#1a1400; }
#wd-bank{ appearance:auto; }

/* جعل نوافذ الإيداع/السحب قابلة للتمرير حتى يظهر كل المحتوى */
.modal-sheet{ max-height:90vh; overflow-y:auto; -webkit-overflow-scrolling:touch; }
.wx-card{ max-height:90vh; overflow-y:auto; -webkit-overflow-scrolling:touch; }
.modal-overlay{ overflow-y:auto; }
