/* style.css */
:root {
  --bg: #050818;
  --bg-alt: #0b1024;
  --primary: #ffb700;    
  --bg-dark: #0f172a;   
  --track-color: #38bdf8;
  --primary-dark: #e19d00;
  --accent: #3ac8ff;
  --danger: #ff4d4d;
  --text: #f5f7ff;
  --muted: #9ca3af;
  --card: #111827;
  --border: #1f2933;
  --success: #22c55e;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font);
  background: radial-gradient(circle at top, #111827 0%, #020617 55%, #000 100%);
  color: var(--text);
  touch-action: manipulation;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
}

/* Layout */

.site {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap; /* Allow wrapping for mobile */
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-left:hover{
  opacity: 0.8;
}

/* NEW: Style for the Image Logo */
.logo-image {
  height: 40px; /* Adjust based on your logo's aspect ratio */
  width: auto;
  object-fit: contain;
  /* Optional: Drop shadow for better visibility on dark nav */
  filter: drop-shadow(0 0 5px rgba(255, 183, 0, 0.5)); 
}

.brand {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.9rem;
}

.brand span {
  color: var(--primary);
}

.nav-links {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.nav-links a {
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  color: var(--muted);
  border: 1px solid transparent;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  border-color: #1f2933;
  background: rgba(15, 23, 42, 0.9);
}

/* Updated Nav CTA */
.nav-cta {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* User Widget (LoggedIn State) */
.user-widget {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 8px 4px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: background 0.2s;
}

.user-widget:hover {
  background: rgba(255, 255, 255, 0.1);
}

.user-balance {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--success);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

/* Guest Actions (Login/Register) */
#guest-actions {
  display: flex;
  gap: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  border: 1px solid transparent;
  cursor: pointer;
  background: #111827;
  color: var(--text);
  transition: background 0.18s, transform 0.12s, box-shadow 0.18s;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.4);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #111827;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #ffd34f 0%, var(--primary) 100%);
}

.btn-outline {
  background: transparent;
  border-color: #1f2933;
}

.btn-danger {
  background: #7f1d1d;
  border-color: #b91c1c;
}

.btn-sm {
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
}

/* Drawer Styles */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  right: -300px;
  width: 280px;
  height: 100%;
  background: #0f172a;
  border-left: 1px solid var(--border);
  z-index: 100;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  box-shadow: -10px 0 30px rgba(0,0,0,0.5);
  overflow-y: auto; /* Handle overflow if screen is small */
}

.drawer.open {
  right: 0;
}

/* UPDATED: Clickable Drawer Header */
a.drawer-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1.5rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.5rem;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s;
}

a.drawer-header:hover {
  opacity: 0.8;
}

.drawer-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--primary);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.drawer-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.drawer-email {
  font-size: 0.85rem;
  color: var(--muted);
}

/* UPDATED: Compact Drawer Balance */
.drawer-balance-container {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 0.75rem; /* Reduced from 1rem */
  margin-bottom: 0.75rem;
  text-align: center;
}

.drawer-balance-container .label {
  display: block;
  font-size: 0.7rem; /* Reduced from 0.75rem */
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.drawer-balance-container .amount {
  display: block;
  font-size: 1.25rem; /* Reduced from 1.5rem */
  font-weight: 700;
  color: var(--success);
}

.drawer-action-buttons {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.drawer-promo {
  display: block;
  margin-top: 1rem;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: transform 0.2s;
}

.drawer-promo:hover {
  transform: scale(1.02);
}

.drawer-promo img {
  display: block;
  width: 100%;
  height: auto;
}

.drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.drawer-item {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.95rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 10px;
}

.drawer-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text);
}

.drawer-item.danger {
  color: var(--danger);
  margin-top: auto; /* Push to bottom */
}

.drawer-item.danger:hover {
  background: rgba(220, 38, 38, 0.1);
}

main {
  flex: 1;
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.5rem 1rem 2.5rem;
}

/* Common Styles (Cards, Hero, etc.) - Cards & UI */

.card {
  background: radial-gradient(circle at top left, #111827 0%, #020617 60%);
  border-radius: 1rem;
  border: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  box-shadow: 0 24px 40px rgba(15, 23, 42, 0.7);
}

.card + .card {
  margin-top: 1rem;
}

/* NEW: Stretchy card for transactions */
.card.fill-vertical {
  display: flex;
  flex-direction: column;
  /* 82vh ensures it covers most of the screen, pushing promos below fold */
  height: 82vh;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.card-title {
  font-weight: 600;
  font-size: 1.05rem;
}

.tag {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(55, 65, 81, 0.8);
  color: var(--muted);
}

/* Forms */

form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  position: relative;
}

input, select {
  background: #020617;
  border-radius: 999px;
  border: 1px solid #1f2937;
  padding: 0.55rem 0.9rem;
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
}

input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.3);
}

.form-row {
  display: flex;
  gap: 0.75rem;
}

.form-row > .input-group {
  flex: 1;
}

.helper {
  font-size: 0.75rem;
  color: var(--muted);
}

/* Alerts */

.alert {
  border-radius: 0.75rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.8rem;
  margin-bottom: 0.75rem;
}

.alert-info {
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(37, 99, 235, 0.6);
}

.alert-success {
  background: rgba(22, 163, 74, 0.12);
  border: 1px solid rgba(22, 163, 74, 0.6);
}

.alert-danger {
  background: rgba(220, 38, 38, 0.12);
  border: 1px solid rgba(220, 38, 38, 0.6);
}

/* Hero (home) */

.hero {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.3fr);
  align-items: center;
}

.hero-title {
  font-size: clamp(1.9rem, 2.4vw, 2.4rem);
  font-weight: 700;
}

.hero-highlight {
  color: var(--primary);
}

.hero-sub {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.2rem;
}

/* AeroFly game */

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1.1fr);
  gap: 1.25rem;
}

.game-screen {
  position: relative;
  height: 260px;
  border-radius: 1rem;
  background: radial-gradient(circle at bottom, #020617 0%, #020617 60%, #000 100%);
  border: 1px solid #1f2937;
  overflow: hidden;
}

.game-canvas {
  width: 100%;
  height: 100%;
  position: relative;
}

.game-graph-axis {
  position: absolute;
  left: 0.85rem;
  bottom: 0.75rem;
  right: 0.75rem;
  top: 0.85rem;
  border-left: 1px dashed rgba(148, 163, 184, 0.7);
  border-bottom: 1px dashed rgba(148, 163, 184, 0.7);
}

.game-plane {
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 20%, #e0f2fe 0%, #38bdf8 35%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #020617;
  font-size: 1.35rem;
  box-shadow: 0 0 22px rgba(56, 189, 248, 0.9);
  transform: translate(-50%, 50%);
}

.game-multiplier {
  position: absolute;
  top: 0.75rem;
  left: 0.9rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary);
  text-shadow: 0 0 18px rgba(250, 204, 21, 1);
}

.game-status {
  position: absolute;
  top: 0.75rem;
  right: 0.9rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.game-curve {
  position: absolute;
  left: 0.85rem;
  bottom: 0.75rem;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  transform-origin: left center;
}

.game-side {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* --- ROUND HISTORY (UPDATED - FIXED BUTTON & SPACING) --- */
.history-wrapper {
  position: relative;
  margin-bottom: 0.15rem;
  height: 2.5rem; /* Ensure consistent height */
  /* Do not use flex for wrapper, we use absolute positioning for children */
}

/* Normal List State */
.rounds-list {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%; /* Takes full width */
  padding-right: 40px; /* Space for button on right */
  height: 2.5rem;
  display: flex;
  gap: 0.4rem;
  align-items: center;
  overflow: hidden; /* Hide horizontal overflow */
  transition: none; /* Instant switch or manual handling */
}

/* Expanded List State */
.history-wrapper.expanded .rounds-list {
  /* Overlay properties */
  height: auto;
  max-height: 160px;
  background: rgba(17, 24, 39, 0.98); 
  backdrop-filter: blur(10px);
  z-index: 50; 
  flex-wrap: wrap; /* Grid like view */
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.5rem;
  padding-right: 40px; /* Still need space for close button */
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.8);
  overflow-y: auto;
}

/* Toggle Button - Fixed Top Right */
.history-toggle-btn {
  position: absolute;
  top: 0;
  right: 0;
  width: 32px;
  height: 32px; /* Matches normal list height approx */
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 51; /* Always above list */
  transition: background 0.2s;
}

.history-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Round Pills */
.round-pill { 
  padding: 0.3rem 0.8rem; 
  border-radius: 999px; 
  font-size: 0.75rem; 
  font-weight: 700; 
  white-space: nowrap; 
  flex-shrink: 0; 
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1f2937;
  border: 1px solid #374151;
  color: #fff;
}

/* Specific Colors Requested */
.round-pill.low { color: #38bdf8; border-color: rgba(56, 189, 248, 0.3); } /* < 2x */
.round-pill.mid { color: #facc15; border-color: rgba(250, 204, 21, 0.3); } /* < 10x */
.round-pill.high { color: #ef4444; border-color: rgba(239, 68, 68, 0.3); } /* < 100x */
.round-pill.epic { color: #ec4899; border-color: rgba(236, 72, 153, 0.3); } /* < 1000x */
.round-pill.legendary { color: #ffffff; border-color: rgba(255, 255, 255, 0.3); text-shadow: 0 0 5px rgba(255,255,255,0.5); } /* >= 1000x */

/* Animation for Slide In */
@keyframes slideInFromLeft {
  0% { opacity: 0; transform: translateX(-20px); }
  100% { opacity: 1; transform: translateX(0); }
}
.round-pill.slide-in {
  animation: slideInFromLeft 0.4s ease-out forwards;
}

/* Stats, Bets, Footer etc */
.stats-bar { display:flex; gap:1rem; margin: 1rem 0; }
.stat-box { flex:1; background:#111827; border:1px solid #1f2937; border-radius:0.75rem; padding:0.75rem; text-align:center; }
.stat-box .label { font-size:0.7rem; color:#9ca3af; text-transform:uppercase; }
.stat-box .value { font-size:1.1rem; font-weight:700; color:#f9fafb; }

/* --- COMPACT BET CONTROL STYLES (Fixed) --- */
.bet-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 0.15rem; }
.bet-section { background: #111827; border: 1px solid #1f2937; border-radius: 1rem; padding: 1rem; padding-bottom: 0rem; }
.bet-section-title { font-size: 0.8rem; color: #9ca3af; margin-bottom: 0.5rem; text-transform: uppercase; font-weight: 700; letter-spacing: 0.05em; }

/* The Grid - WIDER BUTTON COLUMN (35% - 65%) */
.bet-grid-compact {
  display: grid;
  grid-template-columns: 40% 60%; /* Left Column narrower, Right Column wider */
  grid-template-rows: auto auto auto auto;
  gap: 0.25rem; /* Tightened Gap */
}

/* 1. Input Row (Col 1) */
.bet-amount-area { grid-column: 1 / 2; grid-row: 1 / 2; }
.bet-input-wrapper { display: flex; height: 100%; width: 100%; box-sizing: border-box; }
.bet-input-wrapper button { padding: 0 0.4rem; font-size: 0.9rem; border-radius: 0.4rem; }
/* ADDED min-width: 0 to avoid overflow in small grid cells */
.bet-input-wrapper input { flex: 1; text-align: center; font-weight: 700; font-size: 0.9rem; border-radius: 0.4rem; margin: 0 2px; padding: 0; min-width: 0; width: 100%; }

/* 2. Quick Buttons 1 (Col 1) */
.bet-quick-1 { grid-column: 1 / 2; grid-row: 2 / 3; display: flex; gap: 2px; }
.bet-quick-1 button { flex: 1; padding: 0.25rem 0; font-size: 0.65rem; border-radius: 0.3rem; height: 100%; }

/* 3. Quick Buttons 2 (Col 1 - Minimized width) */
.bet-quick-2 { grid-column: 1 / 2; grid-row: 3 / 4; display: flex; gap: 2px; }
.bet-quick-2 button { flex: 1; padding: 0.25rem 0; font-size: 0.65rem; border-radius: 0.3rem; height: 100%; }

/* 4. MAIN BUTTON (Col 2 - Spans 3 Rows) */
.bet-action-area { grid-column: 2 / 3; grid-row: 1 / 4; }
.bet-main-btn {
  width: 100%; height: 100%;
  padding: 0;
  border-radius: 0.6rem;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  transition: transform 0.1s;
  /* Font sizing for the top line "PLACE BET" */
  font-size: 1rem; 
  font-weight: 800;
  text-transform: uppercase; 
  line-height: 1.3;
}
.bet-main-btn:active { transform: scale(0.98); }
.bet-main-btn.place { background: linear-gradient(135deg,#22c55e,#16a34a); color: #fff; border: none; box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4); }
.bet-main-btn.cashout { background: linear-gradient(135deg,#f59e0b,#d97706); color: #fff; border: none; box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4); }
.bet-main-btn:disabled { opacity: 0.5; cursor: not-allowed; background: #374151; box-shadow: none; color: #9ca3af; }

/* FIX: Ensure children don't capture clicks */
.bet-main-btn > * { pointer-events: none; }

.bet-btn-action { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; }
.bet-btn-val { font-size: 1.3rem; font-weight: 700; color: #fff; margin-top: 1px; }
.bet-btn-sub { font-size: 1.3rem; font-weight: 700; opacity: 0.9; margin-top: 1px; text-transform: uppercase; }

/* 5. Auto Controls (Full Width Row 4) */
.bet-auto-grid { grid-column: 1 / 3; grid-row: 4 / 5; display: grid; grid-template-columns: 40% 60%; /* Left Column narrower, Right Column wider */ gap: 0.5rem; margin-top: 0; }
.auto-box { display: flex; align-items: center; gap: 0.4rem; background: rgba(255,255,255,0.03); padding: 0.3rem 0.4rem; border-radius: 0.4rem; border: 1px solid #1f2937; }
.auto-box label { margin: 0; font-size: 0.75rem; color: #cbd5e1; cursor: pointer; flex: 1; white-space: nowrap; }
.auto-box input[type="checkbox"] { width: 0.9rem; height: 0.9rem; margin: 0; accent-color: var(--primary); cursor: pointer; }
.auto-box input[type="number"] { width: 45px; padding: 0.1rem 0.2rem; font-size: 0.8rem; height: 1.3rem; border-radius: 3px; }

/* --- NEW SNACKBAR STYLES --- */
#snackbar-container {
  position: fixed;
  top: 80px; 
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.cashout-toast {
  background: rgba(20, 83, 45, 0.95); /* Deep Green */
  border: 1px solid #22c55e;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
  color: #fff;
  padding: 0;
  border-radius: 8px;
  min-width: 280px;
  animation: slideDownFade 0.3s ease-out;
  overflow: hidden;
  pointer-events: auto;
}

.toast-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  text-align: center;
}

.toast-col {
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.toast-col:first-child {
  border-right: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.05);
}

.toast-label { font-size: 0.7rem; color: #86efac; text-transform: uppercase; margin-bottom: 2px; }
.toast-val { font-size: 1.1rem; font-weight: 800; }

@keyframes slideDownFade {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
  to { opacity: 0; transform: translateY(-10px); }
}

/* --- NEW PROMO GRID STYLES --- */
.promo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}

.promo-card {
  display: block;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s;
  background: #0f172a;
  text-decoration: none;
  height: 280px;
}

.promo-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
  border-color: var(--primary);
}

.promo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  aspect-ratio: 16/7; /* Wide banners */
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.badge-pending { background: rgba(234, 179, 8, 0.15); color: #fbbf24; border: 1px solid rgba(234, 179, 8, 0.3); }
.badge-success { background: rgba(34, 197, 94, 0.15); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.3); }
.badge-failed { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }

.tx-type-dep { color: #4ade80; } 
.tx-type-wd { color: #f3f4f6; }  

.copy-icon {
  cursor: pointer;
  opacity: 0.5;
  margin-left: 6px;
  font-size: 0.9em;
}
.copy-icon:hover { opacity: 1; color: var(--primary); }

.balance-pill {
  border-radius: 999px;
  background: radial-gradient(circle at left, #14532d 0%, #052e16 45%, #020617 100%);
  border: 1px solid rgba(22, 163, 74, 0.8);
  padding: 0.5rem 0.9rem;
  font-size: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.balance-pill span {
  font-weight: 600;
}

.bet-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.stat-pill {
  border-radius: 999px;
  border: 1px solid #1f2937;
  padding: 0.4rem 0.65rem;
  font-size: 0.75rem;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
}

.stat-pill strong {
  color: var(--text);
}



.badge-green {
  background: rgba(22, 163, 74, 0.24);
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
  font-size: 0.7rem;
  color: #bbf7d0;
}

.badge-red {
  background: rgba(220, 38, 38, 0.24);
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
  font-size: 0.7rem;
  color: #fecaca;
}

/* --- UPDATED TABLE CONTAINER --- */
.table-container {
  /* Flex 1 allows it to grow and fill the parent card's height */
  flex: 1;
  /* Scroll behavior */
  overflow-y: auto; 
  overflow-x: auto;
  /* Add border top for separation */
  border-top: 1px solid #1f2937;
  margin-top: 0.5rem;
  
  /* Scrollbar styles */
  scrollbar-width: thin;
  scrollbar-color: #334155 #0f172a;
}

.table-container::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.table-container::-webkit-scrollbar-track {
  background: #0f172a; 
}
.table-container::-webkit-scrollbar-thumb {
  background-color: #334155; 
  border-radius: 4px; 
}

/* Tables */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.table th,
.table td {
  padding: 0.45rem 0.35rem;
  border-bottom: 1px solid #111827;
}

.table thead th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
}

.table tbody tr:hover {
  background: rgba(15, 23, 42, 0.75);
}

/* Footer */

footer {
  border-top: 1px solid #111827;
  padding: 0.75rem 1rem 1rem;
  background: #020617;
  font-size: 0.75rem;
  color: var(--muted);
}

.footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Responsive */

/* Simple “plane” preview on home */

.game-container {
  position: relative;
  width: 600px; 
  height: 340px;
  background-color: var(--bg-dark);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #1e293b;
  /*transform: scale(1.1);*/ /* Shrinks it to 110% of its size */
  /*transform-origin: center;*/ /* Ensures it stays centered while shrinking */
}

/* Grid Background without static CSS animation */
.grid-bg {
  position: absolute;
  inset: -100px;
  background-image: 
    linear-gradient(rgba(30, 41, 59, 0.5) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 41, 59, 0.5) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.3;
}

.hero-plane-track {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.hero-plane-track svg {
  width: 100%;
  height: 100%;
  transform: scaleY(-1); 
}

.hero-plane-track path {
  fill: url(#areaGradient);
  stroke: #38bdf8; /* Default stroke color */
  stroke-width: 4;
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.7));
}

/* --- REPLACE the old .hero-plane-icon block with this --- */
.hero-plane-icon {
  position: absolute;
  /* Slightly larger container for the new SVG shape */
  width: 64px;
  height: 64px;
  z-index: 10;
  left: 0;
  bottom: 0;
  /* We removed background, border-radius, and font-size */
  /* Flex centering for the img inside */
  display: flex;
  align-items: center;
  justify-content: center;
  /* Optional: Add an overall glow to the whole SVG element */
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.6));
  /* Ensure smooth movement */
  transition: transform 0.1s linear;
}

/* Ensure the SVG fills the container */
.hero-plane-icon img {
    width: 100%;
    height: auto;
    display: block;
}

/* --- ADD THIS NEW SECTION below .hero-plane-icon --- */

/* The animation class added via Javascript on crash */
.hero-plane-icon.fly-away {
  /* This animation moves the plane rapidly out of the frame towards the top-right.
     'forwards' ensures it stays outside after the animation ends.
     'ease-in' makes it start slow and accelerate rapidly.
  */
  animation: shootOutOfFrame 0.8s forwards ease-in;
  /* Override JS inline styles during the crash sequence to ensure smooth exit */
  pointer-events: none;
}

#planeIcon, #planePath {
    will-change: transform, left, bottom, d;
    transform-style: preserve-3d;
}

@keyframes shootOutOfFrame {
    0% {
        /* Starts at current position defined by JS inline styles */
        opacity: 1;
        transform: scale(1) rotate(0deg); /* Assumes initial state */
    }
    100% {
        /* Moves drastically to the top right relative to its last position */
        /* Adjust 800px/-800px if you want it to fly further/shorter */
        transform: translate(800px, -800px) scale(0.5) rotate(-30deg); 
        opacity: 0; /* Fades out as it leaves */
    }
}

.hero-plane-multiplier {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-weight: 800;
  font-size: 3.5rem;
  color: var(--primary);
  text-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
  z-index: 20;
  text-align: center;
}

.hero-plane-multiplier.betting {
  font-size: 1.8rem;
  color: #ffffff !important;
  text-transform: uppercase;
  text-shadow: none;
}

.hero-plane-status {
  position: absolute;
  right: 1rem;
  top: 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  z-index: 20;
  background: rgba(15, 23, 42, 0.8);
  padding: 4px 8px;
  border-radius: 4px;
}

.loading-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--track-color);
  width: 0%; 
}

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .game-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .game-screen {
    height: 230px;
  }

  /* Allow the nav items to reorder properly on mobile */
  .nav {
    display: grid;
    grid-template-areas: 
      "left cta"
      "links links";
    grid-template-columns: minmax(0, 1fr) auto; /* Left takes space, CTA shrinks to fit */
    align-items: center;
    gap: 0.5rem;
  }

  .nav-left {
    grid-area: left;
    min-width: 0; /* Enable shrinking */
    overflow: hidden; 
    white-space: nowrap; /* Prevent brand/logo from wrapping vertically */
  }

  /* MODIFIED: Show nav-cta on mobile */
  .nav-cta {
    grid-area: cta;
    display: flex !important; /* Force visible */
    justify-content: flex-end;
    flex-wrap: nowrap;
  }

  .nav-links {
    grid-area: links;
    justify-content: center; /* Center links on new row */
    width: 100%;
    margin-top: 0.5rem;
    overflow-x: auto; /* Allow scrolling if too many links */
    padding-bottom: 5px; /* Spacing for potential scrollbar */
    scrollbar-width: none;
  }
  .nav-links::-webkit-scrollbar { display: none; }
}

@media (max-width: 768px) {
  .bet-panel { grid-template-columns:1fr; }
  .game-container { height: 300px; }
  .history-wrapper.expanded .rounds-list { max-height: 200px; }
}

/* Extra adjustments for small mobile screens (< 480px) */
@media (max-width: 640px) {
  /* Adjust user widget for small screens */
  .user-widget {
    padding: 2px 6px 2px 10px;
  }
  .user-balance {
    font-size: 0.8rem;
  }
  .user-avatar {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }

  /* Reduce button padding to fit side-by-side */
  .btn-sm {
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
  }

  .page {
    padding-inline: 0.75rem;
  }

  .card {
    padding: 1rem;
  }

  .hero-title {
    font-size: 1.6rem;
  }

  .form-row {
    flex-direction: column;
  }

  .hide-mobile { display: none; }
  /* Slightly shorter table on mobile */
  .table-container { max-height: 60vh; }

  .promo-grid { grid-template-columns: 1fr; }
  .card.fill-vertical { min-height: 75vh; }
}

/* Extra adjustments for very small mobile screens (< 480px) */
@media (max-width: 400px) {
  /* HIDE Brand Name to prevent overlap with buttons, show only Logo */
  .brand {
    display: none;
  }
}

/* Carousel Container */
.promo-carousel {
  max-width: 1200px;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 1rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  padding: 1rem 0;
}

.keen-slider {
  height: auto;
}

.keen-slider__slide {
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.5s ease;
}

.keen-slider__slide img {
  width: 100%;
  max-width: 90%;           /* prevents edge-to-edge on sides */
  height: auto;
  border-radius: 1rem;
  object-fit: cover;
  aspect-ratio: 16 / 9;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  transition: transform 0.4s, opacity 0.4s;
}

/* Center slide "pops" larger */
.keen-slider__slide:not(.keen-slider__slide--active) {
  transform: scale(0.85);
  opacity: 0.8;
}

.keen-slider__slide--active {
  transform: scale(1.08);
  z-index: 2;
}

/* Pill dots */
.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 1.2rem;
}

.carousel-dot {
  width: 20px;
  height: 6px;
  border-radius: 10px;
  background: #4b5563;
  cursor: pointer;
  transition: all 0.3s;
}

.carousel-dot.active {
  width: 30px;
  background: #FFCC00; /* mustard */
}