/* =========================================================================
   TuniBet365 — Mobile-First Multi-Module iGaming Design System
   ("Obsidian & Emerald Neon" — Full LTR + RTL Support)
   ========================================================================= */

:root {
  --bg-base: #090c12;
  --bg-elev: #0f141e;
  --surface-1: #151c2a;
  --surface-2: #1c2536;
  --surface-3: #243046;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);

  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-faint: #64748b;

  --primary: #00e785;
  --primary-hover: #1aff9c;
  --primary-ink: #04160e;
  --accent-cyan: #00b8ff;
  --accent-amber: #f59e0b;
  --danger: #ef4444;
  --success: #10b981;

  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-pill: 9999px;

  --header-h: 60px;
  --bottom-nav-h: 64px;
  --sidebar-w: 250px;

  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 8px 25px -6px rgba(0, 231, 133, 0.35);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Arabic", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
* { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  background: var(--bg-base);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(800px 400px at 15% -5%, rgba(0, 231, 133, 0.07), transparent 60%),
    radial-gradient(700px 380px at 85% -5%, rgba(0, 184, 255, 0.06), transparent 60%),
    var(--bg-base);
  color: var(--text);
  overflow-x: hidden;
  padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 1024px) {
  body { padding-bottom: 0; }
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Sticky Top Header (Mobile-First) ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--header-h);
  background: rgba(9, 12, 18, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  gap: 8px;
}

@media (min-width: 768px) {
  .topbar { padding: 0 20px; gap: 16px; }
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

@media (max-width: 640px) {
  .topbar {
    padding: 0 10px !important;
    gap: 6px !important;
  }
  .topbar-left, .topbar-right {
    gap: 5px !important;
  }
  .brand, html[data-theme="bet365"] .brand {
    font-size: 15px !important;
    gap: 5px !important;
  }
  .brand small, .hide-xs {
    display: none !important;
  }
  .brand-mark, html[data-theme="bet365"] .brand-mark {
    width: 26px !important;
    height: 26px !important;
    font-size: 13px !important;
  }
  .lang-select {
    height: 30px !important;
    padding: 0 5px !important;
    font-size: 11px !important;
    flex-shrink: 0;
  }
  .wallet-badge {
    height: 30px !important;
    padding: 0 7px !important;
    gap: 4px !important;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .wallet-amount {
    font-size: 11px !important;
    white-space: nowrap;
  }
  .topbar-right .btn-sm {
    min-height: 30px !important;
    padding: 0 8px !important;
    font-size: 11px !important;
    flex-shrink: 0;
  }
  #adminNavBtn, #resellerNavBtn, #logoutBtn {
    display: none !important;
  }
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
  font-size: 17px;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent-cyan));
  color: var(--primary-ink);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 16px;
  box-shadow: var(--shadow-glow);
}

.brand em {
  font-style: normal;
  color: var(--primary);
}

/* Module Switcher Pills (Casino | Sportsbook) */
.module-switcher {
  display: none;
  align-items: center;
  background: var(--surface-1);
  border: 1px solid var(--border);
  padding: 3px;
  border-radius: var(--r-pill);
  gap: 2px;
}

@media (min-width: 640px) {
  .module-switcher { display: inline-flex; }
}

.module-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.module-tab.is-active {
  background: var(--surface-3);
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

/* Wallet Pill (Read-Only Balance + Opens Wallet Drawer) */
.wallet-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  background: var(--surface-1);
  border: 1px solid rgba(0, 231, 133, 0.3);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.wallet-badge:hover {
  background: var(--surface-2);
  border-color: var(--primary);
}

.wallet-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary);
}

.wallet-amount {
  font-weight: 800;
  font-size: 13.5px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Language & Theme Switcher */
.lang-select, .theme-select {
  height: 36px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.theme-select:hover, .lang-select:hover {
  border-color: var(--primary);
}

/* ---------- Buttons & Inputs ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn:hover:not(:disabled) {
  background: var(--surface-3);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #00c470);
  color: var(--primary-ink);
  border-color: transparent;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--primary-hover), var(--primary));
  color: var(--primary-ink);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.35);
}

.btn-sm { min-height: 34px; padding: 0 12px; font-size: 12px; }
.btn-xs { min-height: 28px; padding: 0 10px; font-size: 11.5px; border-radius: 6px; }

.input, .select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--text);
  font-size: 13.5px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus, .select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 231, 133, 0.15);
}

/* ---------- App Shell (Sidebar + Main Stage) ---------- */
.app-shell {
  display: grid;
  grid-template-columns: 1fr;
  min-height: calc(100dvh - var(--header-h));
}

@media (min-width: 1024px) {
  .app-shell {
    grid-template-columns: var(--sidebar-w) 1fr;
  }
}

.sidebar {
  display: none;
  background: var(--bg-elev);
  border-inline-end: 1px solid var(--border);
  padding: 16px 12px;
  position: sticky;
  top: var(--header-h);
  height: calc(100dvh - var(--header-h));
  overflow-y: auto;
}

@media (min-width: 1024px) {
  .sidebar { display: flex; flex-direction: column; gap: 18px; }
}

.sidebar.is-mobile-open {
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: fixed;
  inset: var(--header-h) 0 var(--bottom-nav-h) 0;
  z-index: 55;
  height: auto;
}

.nav-group-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  padding: 0 10px;
  margin-bottom: 6px;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  text-align: start;
  transition: all 0.14s ease;
}

.nav-item:hover {
  background: var(--surface-1);
  color: var(--text);
}

.nav-item.is-active {
  background: rgba(0, 231, 133, 0.12);
  color: var(--primary);
  font-weight: 700;
}

.nav-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.nav-item.is-active .nav-badge {
  background: rgba(0, 231, 133, 0.2);
  color: var(--primary);
}

/* ---------- Main Stage ---------- */
.main-stage {
  padding: 14px 12px 32px;
  max-width: 1520px;
  width: 100%;
  margin: 0 auto;
  overflow-x: hidden;
}

@media (min-width: 768px) {
  .main-stage { padding: 22px 24px 48px; }
}

/* Notice Banner */
.notice-bar {
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fde68a;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 600;
}

/* Hero Banner */
.hero-banner {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-lg);
  background:
    radial-gradient(600px 260px at 85% 20%, rgba(0, 231, 133, 0.22), transparent 65%),
    radial-gradient(500px 240px at 15% 90%, rgba(0, 184, 255, 0.18), transparent 65%),
    linear-gradient(135deg, #121a28 0%, #0d131d 100%);
  border: 1px solid var(--border-strong);
  padding: 20px 18px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

@media (min-width: 768px) {
  .hero-banner {
    flex-direction: row;
    align-items: center;
    padding: 28px 32px;
  }
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: rgba(0, 231, 133, 0.14);
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.hero-title {
  font-size: clamp(20px, 4vw, 32px);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 6px;
}

.hero-title span { color: var(--primary); }
.hero-sub { color: var(--text-muted); font-size: 13.5px; max-width: 560px; }

.hero-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
  width: 100%;
}

@media (min-width: 768px) {
  .hero-kpis {
    gap: 10px;
    width: auto;
    min-width: 280px;
  }
}

.hero-kpi {
  background: rgba(15, 20, 30, 0.72);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 8px;
  text-align: center;
  min-width: 0;
}

.hero-kpi b {
  display: block;
  font-size: clamp(14px, 3.8vw, 18px);
  font-weight: 900;
  color: var(--primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-kpi span {
  font-size: 10.5px;
  color: var(--text-muted);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Filter, Search & Sort Control Bar ---------- */
.control-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

@media (min-width: 768px) {
  .control-bar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.search-box {
  position: relative;
  flex: 1;
  max-width: 460px;
}

.search-box input {
  padding-inline-start: 38px;
  padding-inline-end: 36px;
}

.search-icon {
  position: absolute;
  inset-inline-start: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}

.search-clear {
  position: absolute;
  inset-inline-end: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 0;
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
}

.control-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Horizontal Swipeable Pills (Mobile-First) */
.pill-rail {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 14px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.pill-rail::-webkit-scrollbar { display: none; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 12.5px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.14s ease;
}

.pill:hover {
  background: var(--surface-2);
  color: var(--text);
}

.pill.is-active {
  background: var(--primary);
  color: var(--primary-ink);
  border-color: transparent;
  box-shadow: var(--shadow-glow);
}

.pill-count {
  font-size: 11px;
  opacity: 0.8;
}

/* ---------- Game Poster Grid (Mobile-First 2/3 cols -> Desktop 6 cols) ---------- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title {
  font-size: 17px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-meta {
  font-size: 12.5px;
  color: var(--text-muted);
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (min-width: 480px) {
  .game-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
}
@media (min-width: 768px) {
  .game-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
}
@media (min-width: 1200px) {
  .game-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; }
}

.game-card {
  position: relative;
  border-radius: var(--r-md);
  background: var(--surface-1);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.game-card:hover {
  transform: translateY(-4px);
  border-color: rgba(0, 231, 133, 0.45);
  box-shadow: var(--shadow-card);
}

.game-thumb-wrap {
  position: relative;
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, #1b2436, #0f1522);
  overflow: hidden;
}

.game-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.28s ease;
}

.game-card:hover .game-thumb-wrap img {
  transform: scale(1.06);
}

.game-thumb-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 12px;
  text-align: center;
  font-weight: 800;
  font-size: 13px;
  color: var(--text-muted);
}

.game-provider-tag {
  position: absolute;
  top: 8px;
  inset-inline-start: 8px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: rgba(9, 12, 18, 0.82);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  font-size: 10px;
  font-weight: 800;
  color: var(--text);
  z-index: 2;
}

.game-fav-btn {
  position: absolute;
  top: 6px;
  inset-inline-end: 6px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(9, 12, 18, 0.82);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 4;
  transition: all 0.15s;
}

.game-fav-btn.is-fav, .game-fav-btn:hover {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.5);
}

.game-overlay {
  position: absolute;
  inset: 0;
  background: rgba(9, 12, 18, 0.76);
  backdrop-filter: blur(3px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.18s ease;
  padding: 12px;
}

.game-card:hover .game-overlay,
.game-card:focus-within .game-overlay {
  opacity: 1;
}

.game-mobile-actions {
  display: none;
  grid-template-columns: 1fr auto;
  gap: 5px;
  padding: 0 8px 8px;
}

@media (max-width: 768px), (hover: none) {
  .game-overlay {
    display: none;
  }
  .game-mobile-actions {
    display: grid;
  }
  .game-info {
    padding: 8px 10px 6px;
  }
}

.game-info {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.game-title {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Full Numbered Pagination Bar ---------- */
.pagination-bar {
  margin-top: 22px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--surface-1);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

@media (min-width: 768px) {
  .pagination-bar { flex-direction: row; }
}

.pagination-info {
  font-size: 12.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.pagination-pages {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: center;
}

.page-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: var(--r-xs);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.14s;
}

.page-btn:hover:not(:disabled) {
  background: var(--surface-3);
  border-color: var(--primary);
}

.page-btn.is-active {
  background: var(--primary);
  color: var(--primary-ink);
  border-color: transparent;
}

.page-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.pagination-Jump {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.pagination-Jump input, .pagination-Jump select {
  width: 66px;
  min-height: 34px;
  padding: 0 8px;
  border-radius: var(--r-xs);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  font-size: 12px;
}

/* ---------- Tables, Cards & Badges ---------- */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

@media (min-width: 768px) {
  .kpi-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; }
}

.kpi-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
}

.kpi-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-val {
  font-size: clamp(18px, 2.5vw, 24px);
  font-weight: 900;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-1);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th, .data-table td {
  padding: 11px 14px;
  text-align: start;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table th {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: rgba(15, 20, 30, 0.6);
}

.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.badge-green { background: rgba(16, 185, 129, 0.16); color: #34d399; }
.badge-amber { background: rgba(245, 158, 11, 0.16); color: #fbbf24; }
.badge-red { background: rgba(239, 68, 68, 0.16); color: #f87171; }
.badge-cyan { background: rgba(0, 184, 255, 0.16); color: #38bdf8; }
.badge-purple { background: rgba(168, 85, 247, 0.16); color: #c084fc; }

/* ---------- Modals & Drawers (Mobile Bottom-Sheet Ready) ---------- */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(4, 6, 10, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

@media (min-width: 640px) {
  .backdrop { align-items: center; padding: 20px; }
}

.modal {
  width: 100%;
  max-width: 460px;
  max-height: 90dvh;
  overflow-y: auto;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 20px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85);
}

@media (min-width: 640px) {
  .modal { border-radius: var(--r-lg); padding: 24px; }
}

.modal-lg { max-width: 680px; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-title { font-size: 17px; font-weight: 800; }

.close-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

/* ---------- Mobile Fixed Bottom Navigation Bar ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  inset-inline: 0;
  z-index: 65;
  height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(13, 18, 28, 0.95);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}

@media (min-width: 1024px) {
  .bottom-nav { display: none; }
}

.bottom-nav-btn {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
}

.bottom-nav-btn.is-active { color: var(--primary); }
.bottom-nav-icon { font-size: 18px; line-height: 1; }

/* ---------- Toast Stack ---------- */
.toast-stack {
  position: fixed;
  top: 72px;
  inset-inline-end: 16px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
}

.toast {
  padding: 12px 16px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-card);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast-success { border-inline-start: 4px solid var(--primary); }
.toast-error { border-inline-start: 4px solid var(--danger); }

/* =========================================================================
   SPORTSBOOK MODULE UI (bet365 3-Column In-Play & Pre-Match Matrix + Bet Slip)
   ========================================================================= */
.b365-sports-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  min-width: 0;
  max-width: 100%;
}

.b365-sports-layout > *,
.b365-center-feed,
#sportsListView,
#sportsMatchCenterView,
.b365-betslip-col {
  min-width: 0;
  max-width: 100%;
}

@media (min-width: 960px) {
  .b365-sports-layout {
    grid-template-columns: minmax(0, 1fr) 310px;
  }
}

@media (min-width: 1240px) {
  .b365-sports-layout {
    grid-template-columns: 210px minmax(0, 1fr) 320px;
  }
}

.b365-sports-nav {
  display: none;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 8px;
  position: sticky;
  top: calc(var(--header-h) + 12px);
}

@media (min-width: 1240px) {
  .b365-sports-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
}

.b365-nav-header {
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #00ffb6;
  padding: 6px 10px 4px;
  text-transform: uppercase;
}

.b365-sport-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: start;
  transition: background 0.12s, color 0.12s;
}

.b365-sport-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.b365-sport-item.is-active {
  background: #126e51;
  color: #ffffff;
  font-weight: 800;
}

.b365-inplay-banner {
  background: linear-gradient(90deg, #126e51 0%, #0d4a37 60%, #1c2422 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  color: #ffffff;
}

.b365-live-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: #ffdf1b;
  color: #141414;
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

/* League Block & Match Coupon Rows (Exact bet365 Coupon Structure) */
.b365-league-block {
  background: #2e2e2e;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 12px;
}

.b365-league-head {
  background: #14805e;
  color: #ffffff;
  padding: 7px 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(3, 52px);
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 800;
}

.b365-league-head > span:first-child {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 480px) {
  .b365-league-head {
    padding: 7px 12px;
    grid-template-columns: minmax(0, 1fr) repeat(3, 60px);
    font-size: 11.5px;
  }
}

@media (min-width: 680px) {
  .b365-league-head {
    grid-template-columns: minmax(0, 1fr) repeat(5, 64px);
  }
}

.b365-col-lbl {
  text-align: center;
  color: rgba(255, 255, 255, 0.85);
  font-size: 11px;
}

.b365-match-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(3, 52px);
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  background: #282828;
  border-bottom: 1px solid #383838;
  transition: background 0.12s;
}

@media (min-width: 480px) {
  .b365-match-row {
    padding: 9px 12px;
    grid-template-columns: minmax(0, 1fr) repeat(3, 60px);
  }
}

@media (min-width: 680px) {
  .b365-match-row {
    grid-template-columns: minmax(0, 1fr) repeat(5, 64px);
  }
}

.b365-match-row:last-child { border-bottom: 0; }
.b365-match-row:hover { background: #303030; }

.b365-match-info {
  min-width: 0;
  padding-inline-end: 8px;
}

.b365-match-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #a8a8a8;
  margin-bottom: 3px;
}

.b365-clock-live {
  color: #ffdf1b;
  font-weight: 800;
}

.b365-team-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #e4e4e4;
  line-height: 1.35;
}

.b365-team-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.b365-team-score {
  color: #ffdf1b;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  padding-inline-end: 4px;
}

/* Iconic bet365 Odds Cell Button (#383838 with #ffdf1b yellow odds) */
.b365-odds-btn {
  height: 44px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: #383838;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  transition: background 0.12s, transform 0.1s;
}

.b365-odds-btn:hover {
  background: #464646;
}

.b365-odds-lbl {
  font-size: 10px;
  color: #b5b5b5;
  font-weight: 600;
}

.b365-odds-val {
  font-size: 13px;
  font-weight: 800;
  color: #ffdf1b;
  font-variant-numeric: tabular-nums;
}

/* Selected state in Bet Slip: Solid bet365 Yellow with Charcoal Ink */
.b365-odds-btn.is-selected {
  background: #ffdf1b !important;
  border-color: #ffdf1b !important;
}
.b365-odds-btn.is-selected .b365-odds-lbl,
.b365-odds-btn.is-selected .b365-odds-val {
  color: #141414 !important;
  font-weight: 900;
}

.b365-extra-col { display: none; }
@media (min-width: 680px) { .b365-extra-col { display: flex; } }

/* Right Column: Sticky bet365 Bet Slip & My Bets (Mobile Slide-Up Bottom Sheet on <960px) */
.b365-betslip-col {
  position: sticky;
  top: calc(var(--header-h) + 12px);
}

.b365-slip-close-btn {
  display: none;
  width: 38px;
  height: 42px;
  border: 0;
  background: rgba(0, 0, 0, 0.25);
  color: #ffffff;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

@media (max-width: 959px) {
  .b365-betslip-col {
    position: fixed;
    inset: auto 0 calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px)) 0;
    top: auto;
    z-index: 82;
    max-height: 78dvh;
    transform: translateY(115%);
    transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
  }
  .b365-betslip-col.is-mobile-open {
    transform: translateY(0);
    pointer-events: auto;
  }
  .b365-betslip-col .b365-betslip-card {
    border-radius: 16px 16px 0 0;
    border: 1px solid rgba(255, 223, 27, 0.35);
    border-bottom: 0;
    box-shadow: 0 -16px 45px rgba(0, 0, 0, 0.85);
    max-height: 78dvh;
    display: flex;
    flex-direction: column;
  }
  .b365-slip-tabs {
    grid-template-columns: 1fr 1fr 42px !important;
  }
  .b365-slip-close-btn {
    display: inline-flex;
  }
  .b365-slip-list, .b365-mybets-list {
    max-height: 36dvh;
  }
}

.b365-betslip-card {
  background: #282828;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.b365-slip-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #126e51;
}

.b365-slip-tab {
  height: 42px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 800;
  font-size: 12.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-bottom: 3px solid transparent;
}

.b365-slip-tab.is-active {
  color: #ffffff;
  border-bottom-color: #ffdf1b;
  background: rgba(0, 0, 0, 0.15);
}

.b365-slip-count {
  background: #ffdf1b;
  color: #141414;
  font-size: 11px;
  font-weight: 900;
  padding: 1px 6px;
  border-radius: 99px;
}

.b365-slip-list, .b365-mybets-list {
  max-height: 360px;
  overflow-y: auto;
  divide-y: 1px solid #383838;
}

.b365-slip-item {
  padding: 10px 12px;
  background: #303030;
  border-bottom: 1px solid #3d3d3d;
  position: relative;
}

.b365-slip-footer {
  padding: 12px;
  background: #222222;
  border-top: 1px solid #383838;
}

.b365-place-btn {
  background: #ffdf1b !important;
  color: #141414 !important;
  border-color: #ffdf1b !important;
  font-weight: 900 !important;
  font-size: 14px !important;
}
.b365-place-btn:hover {
  background: #ffe85c !important;
}

/* Match Center (50+ Markets) & Live Pitch Scoreboard Visualizer */
.b365-more-markets-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #333333;
  color: #00ffb6;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.b365-more-markets-btn:hover {
  background: #126e51;
  color: #ffdf1b;
}

.b365-mc-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: #14805e;
  border-radius: 6px 6px 0 0;
  color: #ffffff;
}

.b365-pitch-tracker {
  background:
    radial-gradient(circle at 50% 50%, rgba(18, 110, 81, 0.45), rgba(15, 28, 24, 0.95)),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.03) 0, rgba(255,255,255,0.03) 40px, transparent 40px, transparent 80px);
  border: 1px solid rgba(0, 255, 182, 0.25);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  padding: 20px 16px;
  margin-bottom: 14px;
  text-align: center;
}

.b365-pitch-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  max-width: 680px;
  margin: 0 auto 12px;
}

.b365-pitch-team {
  font-size: clamp(15px, 2.5vw, 20px);
  font-weight: 900;
  color: #ffffff;
}

.b365-pitch-scorebox {
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 223, 27, 0.45);
  border-radius: 8px;
  padding: 8px 18px;
  min-width: 110px;
}

.b365-pitch-score {
  font-size: 26px;
  font-weight: 900;
  color: #ffdf1b;
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
}

.b365-pitch-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #cbd5e1;
}

.b365-market-box {
  background: #282828;
  border: 1px solid #383838;
  border-radius: 6px;
  margin-bottom: 10px;
  overflow: hidden;
}

.b365-market-box-head {
  background: #333333;
  padding: 9px 14px;
  font-size: 12.5px;
  font-weight: 800;
  color: #e4e4e4;
  border-bottom: 1px solid #3d3d3d;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.b365-market-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 1px;
  background: #383838;
}

.b365-market-opt-btn {
  border: 0;
  background: #282828;
  padding: 11px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  transition: background 0.12s;
}

.b365-market-opt-btn:hover {
  background: #323232;
}

.b365-market-opt-btn.is-selected {
  background: #ffdf1b !important;
}
.b365-market-opt-btn.is-selected span,
.b365-market-opt-btn.is-selected b {
  color: #141414 !important;
  font-weight: 900;
}

/* Mobile Floating Bet Slip Trigger Pill */
.b365-mobile-slip-bar {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px) + 10px);
  inset-inline: 14px;
  z-index: 64;
  height: 46px;
  padding: 0 16px;
  border-radius: 999px;
  border: 2px solid #141414;
  background: #ffdf1b;
  color: #141414;
  font-weight: 900;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.65);
  cursor: pointer;
}

@media (min-width: 960px) {
  .b365-mobile-slip-bar { display: none !important; }
}

/* =========================================================================
   OFFICIAL BET365 THEME (data-theme="bet365")
   Mirrors casino.bet365.com/home (Casino) & www.bet365.com (Sportsbook)
   ========================================================================= */
html[data-theme="bet365"] {
  --bg-base: #181f1d;
  --bg-elev: #1e2624;
  --surface-1: #282828;
  --surface-2: #333333;
  --surface-3: #3d3d3d;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);

  --text: #e4e4e4;
  --text-muted: #a8a8a8;
  --text-faint: #757575;

  --primary: #ffdf1b;
  --primary-hover: #ffe74d;
  --primary-ink: #141414;
  --accent-cyan: #00ffb6;
  --accent-amber: #ffdf1b;
  --danger: #e53935;
  --success: #26a67e;

  --r-xs: 3px;
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --r-pill: 4px;

  --shadow-card: 0 6px 18px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 2px 10px rgba(255, 223, 27, 0.25);
}

html[data-theme="bet365"] body {
  background: #181f1d;
}

html[data-theme="bet365"] .topbar {
  background: #126e51 !important;
  border-bottom: 1px solid #0b4f3a !important;
}

html[data-theme="bet365"] .brand {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: #ffffff;
}

html[data-theme="bet365"] .brand-mark {
  background: #0b4f3a;
  color: #ffdf1b;
  border: 1px solid rgba(255, 223, 27, 0.4);
  box-shadow: none;
}

html[data-theme="bet365"] .brand em {
  color: #ffdf1b !important;
}

html[data-theme="bet365"] .module-switcher {
  background: #0b4f3a;
  border-color: rgba(255, 255, 255, 0.12);
}

html[data-theme="bet365"] .module-tab {
  color: rgba(255, 255, 255, 0.82);
}

html[data-theme="bet365"] .module-tab.is-active {
  background: #126e51;
  color: #ffdf1b;
  border-bottom: 2px solid #ffdf1b;
  border-radius: 3px;
}

html[data-theme="bet365"] .nav-item.is-active {
  background: rgba(18, 110, 81, 0.35);
  color: #00ffb6;
  border-inline-start: 3px solid #ffdf1b;
}

/* Mobile Responsive Refinements for bet365 Header & Quick Menu Drawer */
@media (max-width: 767px) {
  .b365-product-nav {
    display: none !important;
  }
  html[data-theme="bet365"] .brand span {
    font-size: 18px !important;
  }
}

.mobile-menu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.mobile-menu-link {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
  text-align: start;
}

.mobile-menu-link:hover, .mobile-menu-link.is-active {
  border-color: var(--primary);
  color: var(--primary);
}



