:root {
  /* Layout Dimensions */
  --side-width: 23.5rem; /* ~376px */
  --header-height: 3.5rem;
  
  /* Color System */
  --Primary-Primary-base: #FCDD12;
  --Primary-Primary-dark: #CAB10E;
  --Primary-Primary-light: #FDE441;
  --Primary-Primary-op-15: rgba(252, 221, 18, 0.15);

  --Green-Green-base: #2BD35C;
  --Green-Green-dark: #20A446;
  --Green-Green-light: #52E27B;

  --Red-base: #FC2A47;
  --Red-Red-dark: #E81633;

  --background-layout-Pure: #131317;
  --background-layout-Surface-1: #1B1B22;
  --background-layout-Surface-2: #24242E;
  --background-layout-Surface-3: #2C2C38;

  --background-components-Default: rgba(255, 255, 255, 0.07);
  --background-components-Hover: rgba(255, 255, 255, 0.14);
  --background-components-Press: rgba(255, 255, 255, 0.20);

  --Text-Icons-Primary: #FFFFFF;
  --Text-Icons-Secondary: rgba(255, 255, 255, 0.70);
  --Text-Icons-Tertiary: rgba(255, 255, 255, 0.45);

  /* Typography */
  --font-family: 'Roboto', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background-color: var(--background-layout-Pure);
  color: var(--Text-Icons-Primary);
  font-family: var(--font-family);
  overflow-x: hidden;
  height: 100vh;
  width: 100vw;
}

/* App Wrapper */
.app-container {
  display: flex;
  flex-direction: row;
  height: 100vh;
  width: 100vw;
  background-color: var(--background-layout-Pure);
  position: relative;
  overflow: hidden;
}

/* Main Gameplay Area */
.main-stage-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
  position: relative;
  overflow: hidden;
  background-color: #121217;
}

/* 1. Header */
.game-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  background: #17171E;
  z-index: 10;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.header-left {
  display: flex;
  align-items: center;
}

.brand-logo {
  font-size: 1.85rem;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -0.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.brand-logo span.jet {
  color: #FFFFFF;
}

.brand-logo span.x {
  color: var(--Primary-Primary-base);
  text-shadow: 0 0 12px rgba(252, 221, 18, 0.6);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.latency-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--Green-Green-base);
  padding: 0.2rem 0.5rem;
  background: rgba(43, 211, 92, 0.12);
  border-radius: 9999px;
}

.balance-pill {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.9rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  font-weight: 700;
  font-size: 0.95rem;
}

.balance-pill .currency {
  color: var(--Text-Icons-Tertiary);
  font-weight: 600;
}

.header-icon-btn {
  background: transparent;
  border: none;
  color: var(--Text-Icons-Secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  position: relative;
  transition: all 0.15s ease;
}

.header-icon-btn:hover {
  background: var(--background-components-Hover);
  color: var(--Text-Icons-Primary);
}

.badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background-color: var(--Red-base);
  border-radius: 50%;
  border: 1.5px solid #17171E;
}

/* 2. History Sub-Bar */
.history-sub-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.75rem;
  background: #14141A;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  gap: 0.5rem;
  z-index: 9;
}

.history-bar-container {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.history-bar-container::-webkit-scrollbar {
  display: none;
}

.history-pill {
  padding: 0.22rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  background: #23232C;
  color: var(--Text-Icons-Secondary);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: transform 0.15s ease;
}

.history-pill.green {
  background: rgba(43, 211, 92, 0.18);
  color: var(--Green-Green-base);
  border-color: rgba(43, 211, 92, 0.35);
}

.history-pill.gold {
  background: rgba(252, 221, 18, 0.22);
  color: var(--Primary-Primary-base);
  border-color: rgba(252, 221, 18, 0.45);
}

.history-dropdown-btn {
  background: #23232C;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--Text-Icons-Secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  flex-shrink: 0;
}

/* 3. Flight Stage Area */
.flight-stage-container {
  flex: 1;
  position: relative;
  width: 100%;
  overflow: hidden;
  min-height: 260px;
}

#flight-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.stage-hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

/* Countdown Overlay */
.countdown-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.countdown-circle-wrap {
  position: relative;
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.countdown-svg {
  width: 96px;
  height: 96px;
  transform: rotate(-90deg);
}

.countdown-circle-bg {
  stroke: rgba(255, 255, 255, 0.14);
  stroke-width: 5;
  fill: rgba(18, 18, 26, 0.72);
}

.countdown-circle-progress {
  stroke: var(--Primary-Primary-base);
  stroke-width: 5;
  fill: none;
  stroke-linecap: round;
  stroke-dasharray: 276.46;
  stroke-dashoffset: 0;
  filter: drop-shadow(0 0 10px rgba(252, 221, 18, 0.7));
  transition: stroke-dashoffset 0.15s linear;
}

.countdown-number {
  position: absolute;
  font-size: 3.2rem;
  font-weight: 900;
  color: #FFFFFF;
  text-shadow: 0 0 18px rgba(252, 221, 18, 0.75);
  line-height: 1;
}

.countdown-label {
  font-size: 1.35rem;
  font-weight: 800;
  color: #FFFFFF;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
  letter-spacing: 0.5px;
}

.status-dot-green {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--Green-Green-base);
  box-shadow: 0 0 7px var(--Green-Green-base);
  display: inline-block;
  flex-shrink: 0;
}

/* Multiplier Hero Display */
.multiplier-hero-display {
  font-size: 5.0rem;
  font-weight: 900;
  font-style: normal;
  color: #FFFFFF;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: baseline;
  line-height: 1;
  letter-spacing: -1px;
}

.multiplier-hero-display .unit {
  font-size: 2.6rem;
  font-weight: 700;
  font-style: italic;
  margin-left: 0.25rem;
}

.multiplier-hero-display.boom {
  color: var(--Red-base);
  text-shadow: 0 0 35px rgba(252, 42, 71, 0.85);
}

/* Stage Bets Badge (e.g. 117 Bets) */
.stage-bets-badge {
  background: rgba(22, 22, 28, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  padding: 0.25rem 0.95rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: #FFFFFF;
  backdrop-filter: blur(4px);
}

/* Stage Status Badge (FLEW AWAY) */
.stage-status-badge {
  background: rgba(30, 30, 38, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.35rem 1.1rem;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 0.85rem;
  backdrop-filter: blur(6px);
}

.stage-status-badge.flew-away {
  background: rgba(232, 22, 51, 0.9);
  color: #FFFFFF;
  font-weight: 900;
  letter-spacing: 1px;
  box-shadow: 0 0 20px rgba(252, 42, 71, 0.6);
  border: none;
}

/* Promotion Banner */
.promo-banner {
  pointer-events: auto;
  cursor: pointer;
  background: #252418;
  border: 1px solid rgba(255, 214, 0, 0.25);
  border-radius: 9999px;
  padding: 0.22rem 0.85rem;
  margin: 0 auto 0.6rem auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #FFD600;
  transition: transform 0.15s ease;
}

.promo-banner:hover {
  transform: scale(1.03);
}

.badge-new {
  background: #FF2B44;
  color: #FFFFFF;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0.1rem 0.5rem;
  border-radius: 9999px;
}

/* 4. Betting Dock */
.bet-dock-container {
  padding: 0.5rem 1rem 0.85rem 1rem;
  background: #111217;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 5;
}

.bet-panels-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  background: #181920;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 18px;
  padding: 0.75rem 1rem;
  width: 100%;
  max-width: 960px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

.bet-panel {
  background: transparent;
  border: none;
  padding: 0 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.bet-panel:not(:last-child) {
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
  color: #8E92A4;
  height: 26px;
}

.toggle-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.auto-label {
  color: #8E92A4;
  font-size: 0.82rem;
  font-weight: 600;
}

.autoplay-btn-wrap {
  display: flex;
  align-items: center;
}

.btn-autoplay-icon {
  background: transparent;
  border: none;
  color: #8E92A4;
  cursor: pointer;
  padding: 3px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, transform 0.15s ease;
}

.btn-autoplay-icon:hover,
.btn-autoplay-icon.active {
  color: #FFD600;
  transform: rotate(30deg);
}

/* Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #2F3140;
  transition: .2s;
  border-radius: 20px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 3px;
  bottom: 3px;
  background-color: #8E92A4;
  transition: .2s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #00C254;
}

input:checked + .slider:before {
  transform: translateX(14px);
  background-color: #FFFFFF;
}

.auto-cashout-val-input {
  width: 52px;
  padding: 0.15rem 0.35rem;
  background: #252733;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #FFFFFF;
  font-weight: 700;
  font-size: 0.8rem;
  text-align: center;
}

/* Action Row */
.panel-action-row {
  display: flex;
  gap: 0.65rem;
}

.stepper-col {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1.15;
}

.stepper-box {
  display: flex;
  align-items: center;
  background: #252733;
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  height: 38px;
  padding: 0 4px;
}

.stepper-btn {
  background: transparent;
  border: none;
  color: #8E92A4;
  font-size: 1.3rem;
  font-weight: 700;
  width: 30px;
  height: 100%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stepper-btn:hover {
  color: #FFFFFF;
}

.bet-amount-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #FFFFFF;
  font-weight: 800;
  font-size: 1.25rem;
  text-align: center;
  outline: none;
  width: 100%;
}

/* Quick Pills */
.quick-pills-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
}

.quick-pill {
  background: #252733;
  border: none;
  color: #8E92A4;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 0;
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.quick-pill:hover {
  background: #323545;
  color: #FFFFFF;
}

/* Big Action Button */
.btn-primary-action {
  flex: 1.25;
  height: 78px;
  min-width: 140px;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0.4rem;
  transition: transform 0.1s ease, filter 0.15s ease;
}

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

.action-top-text {
  line-height: 1.1;
  font-weight: 900;
}

.action-bottom-text {
  line-height: 1;
  font-weight: 700;
  text-transform: none;
}

.btn-primary-action.state-bet {
  background-color: #FFD600;
  color: #000000;
  box-shadow: 0 4px 18px rgba(255, 214, 0, 0.3);
}

.btn-primary-action.state-bet .action-top-text {
  font-size: 1.45rem;
  font-weight: 900;
  color: #000000;
}

.btn-primary-action.state-bet .action-bottom-text {
  font-size: 0.95rem;
  font-weight: 700;
  color: #222222;
}

.btn-primary-action.state-cashout {
  background-color: #00C254;
  color: #FFFFFF;
  box-shadow: 0 4px 20px rgba(0, 194, 84, 0.4);
  animation: pulseGreen 1.2s infinite ease-in-out;
}

.btn-primary-action.state-cashout .action-top-text {
  font-size: 1.45rem;
  font-weight: 900;
  color: #FFFFFF;
}

.btn-primary-action.state-cashout .action-bottom-text {
  font-size: 0.95rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
}

.btn-primary-action.state-cancel {
  background-color: #E52E3E;
  color: #FFFFFF;
  box-shadow: 0 4px 18px rgba(229, 46, 62, 0.4);
}

.btn-primary-action.state-cancel .action-top-text {
  font-size: 1.35rem;
  font-weight: 900;
  color: #FFFFFF;
}

.btn-primary-action.state-cancel .action-bottom-text {
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.88);
  margin-top: 2px;
}

/* 5. Sidebar (Multiplayer Table) */
.sidebar-container {
  width: var(--side-width);
  height: 100%;
  background: #17171E;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
}

.sidebar-tabs {
  display: flex;
  background: #131318;
  padding: 0.35rem;
  margin: 0.75rem 0.75rem 0.5rem 0.75rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--Text-Icons-Secondary);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.45rem 0;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sidebar-tab-btn.active {
  background: #2B2B36;
  color: #FFFFFF;
}

.sidebar-summary-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.85rem;
  margin: 0 0.75rem 0.4rem 0.75rem;
  background: #1B1B22;
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.summary-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge-bets-count {
  background: #252530;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  padding: 0.22rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #FFFFFF;
}

.summary-right {
  text-align: right;
}

.total-win-val {
  font-size: 0.95rem;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: 0.3px;
}

/* Table */
.table-header {
  display: grid;
  grid-template-columns: 2.1fr 1.2fr 1fr 1.3fr;
  padding: 0.45rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--Text-Icons-Tertiary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.table-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.15rem 0;
}

.table-row,
.bet-row {
  display: grid;
  grid-template-columns: 2.1fr 1.2fr 1fr 1.3fr;
  align-items: center;
  padding: 0.38rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.025);
  transition: background 0.15s ease;
}

.table-row:hover,
.bet-row:hover {
  background: rgba(255, 255, 255, 0.025);
}

.player-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #FFFFFF;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar-icon {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #FFFFFF;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.avatar-icon svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.bet-cell {
  color: var(--Text-Icons-Secondary);
  font-weight: 700;
  font-size: 0.82rem;
}

.mult-cell {
  color: var(--Text-Icons-Tertiary);
  font-weight: 700;
  font-size: 0.82rem;
}

.mult-cell.cashed-out,
.mult-cell.cashed {
  color: var(--Green-Green-base);
  font-weight: 800;
}

.win-cell {
  text-align: right;
  color: var(--Text-Icons-Tertiary);
  font-weight: 700;
  font-size: 0.82rem;
}

.win-cell.win-green {
  color: var(--Green-Green-base);
  font-weight: 800;
  text-shadow: 0 0 8px rgba(43, 211, 92, 0.35);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #1E1E26;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 1rem;
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--Text-Icons-Secondary);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  line-height: 1.6;
  font-size: 0.9rem;
  color: var(--Text-Icons-Secondary);
}

@keyframes pulseGreen {
  0% { box-shadow: 0 0 10px rgba(43, 211, 92, 0.4); }
  50% { box-shadow: 0 0 25px rgba(43, 211, 92, 0.8); }
  100% { box-shadow: 0 0 10px rgba(43, 211, 92, 0.4); }
}

/* ==============================================================
   RESPONSIVE MOBILE VIEW (Matching Target Screenshot media_1792577221225.png)
   ============================================================== */
@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100vh;
  }

  .fullscreen-btn-desktop {
    display: none;
  }

  .main-stage-wrapper {
    flex: none;
    width: 100%;
    overflow: visible;
  }

  .flight-stage-container {
    height: 310px;
    min-height: 310px;
  }

  .multiplier-hero-display {
    font-size: 4.4rem;
  }

  .multiplier-hero-display .unit {
    font-size: 2.2rem;
  }

  .bet-panels-grid {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .sidebar-container {
    width: 100%;
    flex: none;
    height: auto;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .table-body {
    max-height: 350px;
  }
}
