/* ==========================================================================
   AVIATOR CRASH GAME - EXACT REFERENCE REPRODUCTION STYLESHEET
   Conforme à 100% à l'audit matriciel et visuel (Résolution ref: 568x1024 / 580x1034)
   ========================================================================== */

:root {
  /* Couleurs Fondamentales du Thème Sombre */
  --bg-deep-space: #090e2a;        /* Fond externe / marges latérales */
  --bg-card: #181c3a;              /* Fond des panneaux, consoles et tableau */
  --bg-chip: #2e335c;              /* Boutons de montants rapides (Quick chips) */
  --bg-chip-hover: #3b4275;
  --bg-kpi-banner: #cd4c30;        /* Bandeau terracotta des statistiques */

  /* Couleurs d'Accentuation et d'Action */
  --accent-orange: #f06514;        /* Orange saturé CTA "PLACER UN PARI" & bordures */
  --accent-orange-hover: #ff7524;
  --accent-coral: #eb562d;         /* Onglet Historique & dégradés */
  --accent-green: #43a047;         /* Bouton dépôt "+" dans le solde */
  --accent-green-active: #4caf50;
  --text-cote-green: #74a32f;      /* Cotes encaissées avec succès dans le tableau */
  --gold-trajectory: #ffd200;      /* Courbe de vol de l'avion */
  --gold-glow: rgba(255, 210, 0, 0.45);

  /* Typographie & États Neutres */
  --text-white: #ffffff;
  --text-black: #111638;           /* Chiffres dans l'input blanc */
  --text-muted: #7e86aa;           /* Titres de colonnes et cotes passives x0 */
  --text-peach: #fce8dd;           /* Sous-titre "(sur le prochain tour)" */
  --border-amber: #c8621d;         /* Contour du bouton auto-jeu */

  /* Polices */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'Roboto', monospace;
}

/* Reset Global */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  background-color: #050716;
  font-family: var(--font-primary);
  color: var(--text-white);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  font-smooth: always;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   SIMULATEUR DE PORTABLE (MOBILE VIEWPORT 568x1024)
   ========================================================================== */
.mobile-viewport {
  width: 100%;
  max-width: 568px;
  height: 100vh;
  max-height: 1024px;
  background-color: var(--bg-deep-space);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

@media (min-width: 600px) {
  .mobile-viewport {
    height: 96vh;
    border-radius: 20px;
  }
}

/* ==========================================================================
   1. BARRE DE STATUT SYSTÈME (24px / 2.34%)
   ========================================================================== */
.status-bar {
  height: 24px;
  background-color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 14px;
  z-index: 100;
  flex-shrink: 0;
}

.status-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-time {
  font-size: 12px;
  font-weight: 500;
  color: #3c4043;
  letter-spacing: 0.1px;
}

.status-icon {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
}

.sound-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 2px;
}

.icon-svg {
  width: 15px;
  height: 15px;
}

/* ==========================================================================
   2. EN-TÊTE APPLICATIF & SOLDE (56px / 5.47%)
   ========================================================================== */
.app-header {
  height: 56px;
  background-color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  z-index: 90;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.back-btn {
  background: none;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s ease;
}

.back-btn:hover {
  background-color: rgba(61, 108, 151, 0.1);
}

.icon-back {
  width: 22px;
  height: 22px;
}

/* Capsule de Solde (Split-Button 139px x 31px) */
.balance-capsule {
  display: flex;
  align-items: center;
  background-color: #43474f;
  border-radius: 16px;
  height: 32px;
  padding-left: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.balance-display {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding-right: 10px;
}

.balance-amount {
  font-size: 13.5px;
  font-weight: 700;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.2px;
}

.currency-symbol {
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
}

.btn-deposit {
  width: 34px;
  height: 32px;
  background-color: var(--accent-green);
  border: none;
  border-top-right-radius: 16px;
  border-bottom-right-radius: 16px;
  color: #ffffff;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease;
}

.btn-deposit:hover {
  background-color: var(--accent-green-active);
}

.support-badge {
  background: none;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.support-svg {
  width: 24px;
  height: 24px;
}

/* ==========================================================================
   ZONE DE SCROLL PRINCIPALE
   ========================================================================== */
.game-scroll-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-chip) var(--bg-deep-space);
}

.game-scroll-container::-webkit-scrollbar {
  width: 4px;
}

.game-scroll-container::-webkit-scrollbar-thumb {
  background: var(--bg-chip);
  border-radius: 2px;
}

/* ==========================================================================
   3. ONGLETS DE JEU (RÈGLES / HISTORIQUE - 38px / 3.71%)
   ========================================================================== */
.game-tabs-bar {
  height: 38px;
  background-color: var(--bg-card);
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 6px;
  flex-shrink: 0;
}

.tab-btn {
  height: 26px;
  border-radius: 13px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.tab-rules {
  flex: 0.9;
  background-color: transparent;
  border: 1px solid var(--accent-orange);
  color: var(--accent-orange);
  font-weight: 600;
}

.tab-history {
  flex: 1.1;
  background: linear-gradient(90deg, #ff6a0e 0%, var(--accent-coral) 100%);
  border: none;
  color: #ffffff;
  font-weight: 700;
  gap: 5px;
  letter-spacing: 0.8px;
}

.clock-icon {
  font-size: 13px;
}

/* ==========================================================================
   4. ARÈNE GRAPHIQUE DE VOL (CANVAS - 156px / 15.23%)
   ========================================================================== */
.flight-arena {
  height: 156px;
  background-color: var(--bg-card);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  border-bottom: 2px solid #090e2a;
}

#flightCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Multiplicateur géant Superposition */
.multiplier-overlay {
  position: absolute;
  right: 18px;
  bottom: 12px;
  pointer-events: none;
  z-index: 10;
}

.multiplier-text {
  font-size: 34px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
  font-variant-numeric: tabular-nums;
  transition: color 0.15s ease;
}

.multiplier-text.crash {
  color: #ff3344;
}

/* Compte à rebours central/droit */
.countdown-overlay {
  position: absolute;
  right: 28px;
  bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 15;
}

.countdown-spinner {
  width: 60px;
  height: 60px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.countdown-digit {
  position: absolute;
  font-size: 30px;
  font-weight: 900;
  color: #ffffff;
}

/* Bandeau de Crash */
.crash-banner {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(235, 86, 45, 0.85);
  padding: 4px 16px;
  border-radius: 12px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  animation: pulseCrash 0.6s infinite alternate;
}

@keyframes pulseCrash {
  from { transform: translateX(-50%) scale(1); }
  to { transform: translateX(-50%) scale(1.06); }
}

/* ==========================================================================
   5. CONSOLES DE PARI (DUAL BET CONSOLES)
   ========================================================================== */
.betting-section {
  background-color: var(--bg-deep-space);
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

/* Carte de pari : 431px (75.88%) x 131px */
.bet-card {
  width: 76%;
  max-width: 432px;
  height: 132px;
  background-color: var(--bg-card);
  border-radius: 8px;
  padding: 11px;
  display: grid;
  grid-template-columns: 246fr 157fr;
  grid-template-rows: 38px 65px;
  column-gap: 7px;
  row-gap: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease;
}

/* Colonne Gauche : Input + 6 Jetons */
.bet-left-col {
  grid-column: 1;
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-wrapper {
  height: 38px;
  background-color: #ffffff;
  border-radius: 5px;
  display: flex;
  align-items: center;
  padding: 0 8px 0 12px;
  position: relative;
}

.bet-input {
  width: 100%;
  background: transparent;
  border: none;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-black);
  outline: none;
  font-family: var(--font-primary);
  font-variant-numeric: tabular-nums;
}

.bet-input::-webkit-outer-spin-button,
.bet-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.btn-clear-input {
  background: none;
  border: none;
  color: #434863;
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quick-chips-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 29px);
  gap: 6px 7px;
  flex: 1;
}

.chip-btn {
  background-color: var(--bg-chip);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chip-btn:hover {
  background-color: var(--bg-chip-hover);
  transform: translateY(-1px);
}

.chip-btn:active {
  transform: translateY(0);
}

/* Colonne Droite : Auto-Jeu + Bouton CTA */
.bet-right-col {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.btn-auto-bet {
  height: 38px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-amber);
  border-radius: 6px;
  color: var(--accent-orange);
  font-size: 9.5px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1.15;
  letter-spacing: 0.3px;
  transition: all 0.2s ease;
}

.btn-auto-bet.active {
  background-color: rgba(240, 101, 20, 0.2);
  border-color: #ff9100;
  color: #ff9100;
}

.btn-action-bet {
  height: 65px;
  background-color: var(--accent-orange);
  border: none;
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(240, 101, 20, 0.4);
  transition: all 0.15s ease;
  position: relative;
  overflow: hidden;
}

.btn-action-bet:hover {
  background-color: var(--accent-orange-hover);
  box-shadow: 0 6px 16px rgba(240, 101, 20, 0.6);
}

.btn-action-bet:active {
  transform: scale(0.98);
}

/* Mode CASHOUT / ENCAISSER (Pari en cours) */
.btn-action-bet.cashout {
  background-color: #ff9100;
  box-shadow: 0 4px 16px rgba(255, 145, 0, 0.6);
  animation: pulseCashout 0.8s infinite alternate;
}

@keyframes pulseCashout {
  from { background-color: #ff9100; }
  to { background-color: #ff6d00; }
}

.btn-main-text {
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.4px;
}

.btn-sub-text {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-peach);
  margin-top: 1px;
}

/* ==========================================================================
   6. BANDEAU DES MÉTRIQUES (KPI BANNER - 60px / 5.86%)
   ========================================================================== */
.kpi-banner {
  height: 60px;
  background-color: var(--bg-kpi-banner);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 0 8px;
  flex-shrink: 0;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.kpi-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.kpi-label {
  font-size: 11px;
  font-weight: 400;
  color: #ffffff;
  margin-bottom: 2px;
}

.kpi-value-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.kpi-value-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.kpi-icon {
  font-size: 12px;
}

.kpi-number {
  font-size: 13.5px;
  font-weight: 700;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

.kpi-currency {
  font-size: 10.5px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1;
}

/* ==========================================================================
   7. TABLEAU DES PARIS EN DIRECT (LEADERBOARD)
   ========================================================================== */
.live-bets-table-section {
  background-color: var(--bg-card);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 380px;
}

.table-header-row {
  height: 25px;
  display: grid;
  grid-template-columns: 32% 14% 28% 26%;
  align-items: center;
  padding: 0 16px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.th-user { text-align: left; }
.th-cote { text-align: center; }
.th-bet  { text-align: right; }
.th-gain { text-align: right; }

.table-body-rows {
  display: flex;
  flex-direction: column;
}

/* Ligne individuelle de pari (Pas de 24.8px) */
.table-row {
  height: 25px;
  display: grid;
  grid-template-columns: 32% 14% 28% 26%;
  align-items: center;
  padding: 0 16px;
  font-size: 11.5px;
  font-weight: 600;
  transition: background 0.2s ease;
}

.table-row:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.td-user {
  color: #ffffff;
  text-align: left;
  letter-spacing: 0.5px;
}

.td-cote {
  text-align: center;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  transition: color 0.25s ease;
}

.td-cote.win {
  color: var(--text-cote-green);
  font-weight: 700;
}

.td-bet {
  color: #ffffff;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.td-gain {
  color: #ffffff;
  text-align: right;
  font-variant-numeric: tabular-nums;
  transition: color 0.25s ease;
}

.td-gain.win {
  color: var(--text-white);
  font-weight: 700;
}

/* ==========================================================================
   MODAL RÈGLES & TOAST NOTIFICATION
   ========================================================================== */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal-card {
  background-color: var(--bg-card);
  border-radius: 12px;
  width: 100%;
  max-width: 380px;
  border: 1px solid var(--accent-orange);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.modal-header {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: rgba(240, 101, 20, 0.15);
  border-bottom: 1px solid rgba(240, 101, 20, 0.3);
}

.modal-header h3 {
  font-size: 14px;
  color: var(--accent-orange);
  font-weight: 800;
}

.btn-close-modal {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 16px;
  cursor: pointer;
}

.modal-content {
  padding: 16px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #d1d5db;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-content strong {
  color: #ffffff;
}

/* Toast de gain */
.win-toast {
  position: absolute;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #2e7d32, #43a047);
  padding: 8px 24px;
  border-radius: 20px;
  color: #ffffff;
  text-align: center;
  z-index: 150;
  box-shadow: 0 8px 24px rgba(67, 160, 71, 0.5);
  animation: bounceIn 0.4s ease;
}

@keyframes bounceIn {
  from { transform: translateX(-50%) scale(0.6); opacity: 0; }
  to { transform: translateX(-50%) scale(1); opacity: 1; }
}

.win-toast-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
}

.win-toast-amount {
  font-size: 16px;
  font-weight: 900;
}

/* Utilitaires */
.hidden {
  display: none !important;
}
