/* ==========================================================================
   Spribe Aviator Official Theme & Universal Responsive Design System
   Matches Authentic Spribe Aviator Layout, Color Tiers, & Ergonomics
   Responsive across Mobile (320px+), Tablet, Desktop, and Ultrawide
   ========================================================================== */

:root {
  /* Spribe Dark Aesthetic */
  --bg-app: #0e0f12;
  --bg-header: #141518;
  --bg-panel: #1b1c21;
  --bg-panel-sub: #141519;
  --bg-panel-elevated: #24262d;
  --bg-input: #121317;
  
  --border-main: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.04);
  --border-focus: #ff003b;

  /* Spribe Brand Colors */
  --spribe-red: #ff003b;
  --spribe-red-dark: #b80026;
  --spribe-red-glow: rgba(255, 0, 59, 0.4);

  /* Spribe Action Button Colors */
  --spribe-green-start: #2ecc71;
  --spribe-green-end: #28a745;
  --spribe-green-glow: rgba(40, 167, 69, 0.45);

  --spribe-orange-start: #ff9800;
  --spribe-orange-end: #f57c00;
  --spribe-orange-glow: rgba(255, 152, 0, 0.55);

  --spribe-cancel-start: #e53935;
  --spribe-cancel-end: #c62828;

  /* Multiplier History Color Tiers (Official Spribe) */
  --mult-low: #34b4ff;       /* < 2.00x Blue */
  --mult-mid: #913ef8;       /* 2.00x - 9.99x Purple */
  --mult-high: #c017b4;      /* 10.00x+ Hot Pink / Magenta */

  --accent-cyan: #00e5ff;
  --accent-amber: #f59e0b;
  --accent-emerald: #10b981;

  --text-primary: #ffffff;
  --text-secondary: #9aa1ad;
  --text-muted: #5e6573;

  --font-display: 'Outfit', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 9999px;

  --header-height: 52px;
  --shadow-panel: 0 4px 20px rgba(0, 0, 0, 0.45);
}

/* Base Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.4;
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Utilities */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  color: #ffffff;
}

.font-emerald { color: var(--accent-emerald) !important; }
.font-crimson { color: var(--spribe-red) !important; }
.font-cyan { color: var(--accent-cyan) !important; }
.font-bold { font-weight: 700 !important; }

/* Custom Sleek Scrollbar */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: var(--bg-app);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ==========================================================================
   HEADER NAVIGATION (Spribe Official Style)
   ========================================================================== */
.app-header {
  height: var(--header-height);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

/* Authentic Spribe Aviator Brand */
.brand-container {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.brand-logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.02em;
  color: #ff003b;
  text-shadow: 0 0 12px rgba(255, 0, 59, 0.4);
}

/* "How to play?" button */
.header-btn-how-to-play {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.header-btn-how-to-play:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}

.how-icon {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #ff003b;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 900;
}

/* Sub-Nav Tabs */
.main-nav-tabs {
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 4px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-main);
}

.nav-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: transparent;
  border: none;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-tab-btn:hover {
  color: #ffffff;
}

.nav-tab-btn.active {
  color: #ffffff;
  background: var(--bg-panel-elevated);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.nav-tab-btn .badge-pill {
  font-size: 9px;
  padding: 1px 4px;
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-emerald);
  border-radius: var(--radius-pill);
  font-weight: 800;
}

/* Header Right Area */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-tvl-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-main);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-emerald);
}
.live-dot.pulse {
  box-shadow: 0 0 6px var(--accent-emerald);
  animation: pulseDot 2s infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

.tvl-label {
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
}
.tvl-val {
  color: #ffffff;
  font-weight: 700;
  font-size: 11px;
}

.header-btn-pf {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 0, 59, 0.08);
  border: 1px solid rgba(255, 0, 59, 0.25);
  color: var(--spribe-red);
  padding: 5px 9px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.header-btn-pf:hover {
  background: rgba(255, 0, 59, 0.18);
  border-color: var(--spribe-red);
}

.header-btn-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}
.header-btn-icon:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}
.header-btn-icon.muted {
  color: var(--spribe-red);
  border-color: rgba(255, 0, 59, 0.4);
}

/* User Balance Pill */
.header-balance-card {
  display: flex;
  align-items: center;
  background: rgba(40, 167, 69, 0.12);
  border: 1px solid rgba(40, 167, 69, 0.35);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  user-select: none;
}

.bal-amount {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  color: #2ecc71;
  letter-spacing: 0.02em;
}

.btn-top-up {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2ecc71, #28a745);
  border: none;
  color: #ffffff;
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(40, 167, 69, 0.35);
  transition: transform 0.12s ease, filter 0.15s ease;
}
.btn-top-up:hover {
  filter: brightness(1.15);
  transform: scale(1.05);
}

/* Hamburger Settings Menu Wrapper */
.menu-dropdown-wrapper {
  position: relative;
}

.btn-hamburger {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn-hamburger:hover {
  background: rgba(255, 255, 255, 0.12);
}
.btn-hamburger span {
  display: block;
  width: 16px;
  height: 2px;
  background: #ffffff;
  border-radius: 1px;
}

/* Dropdown Popup Menu */
.spribe-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 230px;
  background: #18191f;
  border: 1px solid var(--border-main);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  padding: 8px 0;
  display: none;
  flex-direction: column;
  z-index: 200;
  animation: menuDrop 0.15s ease-out;
}
.spribe-dropdown-menu.show {
  display: flex;
}
@keyframes menuDrop {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.menu-header {
  padding: 6px 14px 8px;
  border-bottom: 1px solid var(--border-main);
}
.menu-brand {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.menu-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.spribe-switch {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
}
.spribe-switch input { display: none; }
.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  transition: 0.15s;
}
.switch-slider::before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  border-radius: 50%;
  transition: 0.15s;
}
.spribe-switch input:checked + .switch-slider {
  background-color: #28a745;
}
.spribe-switch input:checked + .switch-slider::before {
  transform: translateX(14px);
}

.menu-divider {
  height: 1px;
  background: var(--border-main);
  margin: 4px 0;
}

.menu-link-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}
.menu-link-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}
.menu-link-icon {
  font-size: 13px;
  width: 18px;
  text-align: center;
}
.menu-reset-btn {
  color: var(--spribe-red);
}

/* ==========================================================================
   MAIN APP BODY & SECTIONS
   ========================================================================== */
.app-main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 8px 10px 16px;
}

.view-section {
  display: none;
}
.view-section.active {
  display: block;
  animation: fadeIn 0.2s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   VIEW 1: SPRIBE AVIATOR CONSOLE (Desktop 2-Column Grid)
   ========================================================================== */
.aviator-console-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 10px;
  align-items: stretch;
}

/* --- Left Sidebar (Community Bets) --- */
.console-sidebar {
  background: var(--bg-panel);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-panel);
  height: 596px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-tabs-header {
  display: flex;
  background: var(--bg-panel-sub);
  padding: 4px;
  border-bottom: 1px solid var(--border-main);
  gap: 4px;
}

.stakers-tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  padding: 6px 0;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s ease;
}
.stakers-tab-btn.active {
  background: var(--bg-panel-elevated);
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.sidebar-feed-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.stakers-summary-bar {
  display: flex;
  justify-content: space-between;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-main);
}
.summary-metric {
  display: flex;
  flex-direction: column;
}
.metric-label {
  font-size: 8px;
  font-weight: 700;
  color: var(--text-muted);
}
.metric-value {
  font-size: 11px;
  font-weight: 800;
  color: #ffffff;
}

.stakers-table-header {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr;
  padding: 6px 12px;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-main);
}

.stakers-list-body {
  flex: 1;
  overflow-y: auto;
  padding: 2px 0;
}

.staker-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr;
  align-items: center;
  padding: 6px 12px;
  font-size: 11px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  transition: background 0.12s ease;
}
.staker-row:hover {
  background: rgba(255, 255, 255, 0.03);
}
.staker-row.row-cashed {
  background: rgba(40, 167, 69, 0.07);
}
.staker-row.row-lost {
  background: rgba(255, 0, 59, 0.04);
}

.staker-user-cell {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
}
.avatar-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.staker-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  color: var(--text-primary);
}

.staker-stake-cell {
  text-align: right;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-weight: 700;
}

.staker-payout-cell {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.cashout-badge {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  background: rgba(40, 167, 69, 0.2);
  color: #2ecc71;
  padding: 1px 5px;
  border-radius: var(--radius-xs);
}
.cashout-amount {
  font-size: 9px;
  color: #2ecc71;
  font-weight: 700;
}
.waiting-badge {
  font-size: 10px;
  color: var(--text-muted);
}

/* --- Right Stage (Canvas & Terminals) --- */
.console-main-stage {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0; /* Prevent flex blowout */
}

/* Multiplier History Ribbon */
.arena-history-bar {
  height: 36px;
  background: var(--bg-panel);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 6px;
  overflow: hidden;
}

.history-ribbon-wrapper {
  flex: 1;
  overflow: hidden;
  min-width: 0;
}

.history-scroll-container {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.history-scroll-container::-webkit-scrollbar {
  display: none;
}

/* Spribe Multiplier Pills */
.history-pill {
  border: none;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.12s ease;
  white-space: nowrap;
  flex-shrink: 0;
}
.history-pill:hover {
  transform: scale(1.06);
}

/* Official Spribe Tiers */
.badge-low {
  background: rgba(52, 180, 255, 0.15);
  color: var(--mult-low);
  border: 1px solid rgba(52, 180, 255, 0.35);
}
.badge-high {
  background: rgba(145, 62, 248, 0.2);
  color: var(--mult-mid);
  border: 1px solid rgba(145, 62, 248, 0.4);
}
.badge-legendary {
  background: rgba(192, 23, 180, 0.25);
  color: var(--mult-high);
  border: 1px solid rgba(192, 23, 180, 0.5);
}

/* History Dropdown Button */
.btn-round-history {
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-pill);
  padding: 4px 8px;
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.btn-round-history:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

/* Flight Canvas Container */
.flight-canvas-container {
  height: 405px;
  background: #090c13;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-main);
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 70px rgba(0, 0, 0, 0.8);
}

#flight-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.canvas-watermark {
  position: absolute;
  bottom: 12px;
  right: 16px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.15em;
  color: rgba(255, 255, 255, 0.04);
  pointer-events: none;
  user-select: none;
}

.canvas-skip-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  background: rgba(255, 0, 59, 0.15);
  border: 1px solid rgba(255, 0, 59, 0.4);
  color: #ffffff;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  backdrop-filter: blur(8px);
  transition: all 0.15s ease;
  z-index: 10;
}
.canvas-skip-btn:hover {
  background: var(--spribe-red);
  box-shadow: 0 0 15px var(--spribe-red-glow);
}

/* ==========================================================================
   DUAL BETTING TERMINALS (Exact Spribe Design)
   ========================================================================== */
.dual-betting-terminals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.betting-terminal {
  background: var(--bg-panel);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  box-shadow: var(--shadow-panel);
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 142px;
  min-height: 142px;
  box-sizing: border-box;
}

/* Top Tab Bar */
.terminal-tab-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 22px;
  flex-shrink: 0;
}

.tab-pill-switch {
  display: flex;
  background: rgba(0, 0, 0, 0.45);
  padding: 2px;
  border-radius: var(--radius-pill);
}

.tab-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.tab-btn.active {
  background: var(--bg-panel-elevated);
  color: #ffffff;
}

.btn-toggle-second-terminal {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-main);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-toggle-second-terminal:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
}

.btn-close-terminal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.12s ease;
}
.btn-close-terminal:hover {
  color: #ffffff;
}

/* Main Bet Content Grid */
.terminal-grid-content {
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: 10px;
  align-items: stretch;
  height: 78px;
}

.terminal-left-controls {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 5px;
  height: 78px;
}

/* Stepper Row */
.stepper-row {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-sm);
  height: 42px;
  padding: 2px;
}

.btn-step {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  border-radius: var(--radius-xs);
  color: #ffffff;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.12s ease;
  flex-shrink: 0;
}
.btn-step:hover {
  background: rgba(255, 255, 255, 0.14);
}

.input-display-box {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.terminal-stake-input {
  width: 90px;
  background: transparent;
  border: none;
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  text-align: center;
  outline: none;
}
/* Hide number spinners */
.terminal-stake-input::-webkit-outer-spin-button,
.terminal-stake-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.currency-tag {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
}

/* Quick Chips Grid */
.quick-chips-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  height: 28px;
}

.chip-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-main);
  color: var(--text-secondary);
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.chip-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

/* Auto Controls Panel */
.auto-controls-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 28px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-xs);
  padding: 0 8px;
}

.auto-toggle-row {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  user-select: none;
}
.auto-toggle-row input { display: none; }

.toggle-track {
  width: 26px;
  height: 14px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-pill);
  position: relative;
  transition: background 0.15s ease;
  flex-shrink: 0;
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 10px; height: 10px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.15s ease;
}
.auto-toggle-row input:checked + .toggle-track {
  background: #28a745;
}
.auto-toggle-row input:checked + .toggle-track::after {
  transform: translateX(12px);
}

.toggle-name {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
}

.auto-cashout-box {
  display: flex;
  align-items: center;
  gap: 5px;
}

.mult-input-group {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-xs);
  padding: 1px 4px;
  width: 54px;
  height: 22px;
}
.input-auto-cashout {
  width: 100%;
  background: transparent;
  border: none;
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  text-align: right;
  outline: none;
}
.mult-suffix {
  font-size: 9px;
  font-weight: 800;
  color: var(--text-muted);
  margin-left: 1px;
}

/* Giant Spribe Action Button */
.terminal-right-action {
  display: flex;
  width: 140px;
  height: 78px;
}

.btn-terminal-action {
  width: 100%;
  height: 78px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px;
  user-select: none;
  transition: filter 0.15s ease, box-shadow 0.15s ease;
}

.action-btn-main {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.05em;
  line-height: 1.1;
  white-space: nowrap;
}
.action-btn-sub {
  font-size: 12px;
  font-weight: 800;
  opacity: 0.95;
  white-space: nowrap;
  margin-top: 3px;
}

/* Button States (Exact Spribe Colors) */
.state-stake {
  background: linear-gradient(135deg, var(--spribe-green-start), var(--spribe-green-end));
  color: #ffffff;
  box-shadow: 0 4px 15px var(--spribe-green-glow);
}
.state-stake:hover {
  filter: brightness(1.12);
  box-shadow: 0 4px 22px rgba(40, 167, 69, 0.6);
}

.state-cancel {
  background: linear-gradient(135deg, var(--spribe-cancel-start), var(--spribe-cancel-end));
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(229, 57, 53, 0.4);
}

.state-cashout {
  background: linear-gradient(135deg, var(--spribe-orange-start), var(--spribe-orange-end));
  color: #ffffff;
  box-shadow: 0 0 20px var(--spribe-orange-glow);
  animation: pulseCashout 0.8s infinite alternate;
}
@keyframes pulseCashout {
  0% { box-shadow: 0 0 12px var(--spribe-orange-glow); filter: brightness(1); }
  100% { box-shadow: 0 0 26px rgba(255, 152, 0, 0.85); filter: brightness(1.1); }
}

.state-cashed {
  background: rgba(40, 167, 69, 0.2);
  color: #2ecc71;
  border: 1px solid rgba(40, 167, 69, 0.4);
  cursor: default;
}
.state-lost {
  background: rgba(255, 0, 59, 0.2);
  color: var(--spribe-red);
  border: 1px solid rgba(255, 0, 59, 0.4);
  cursor: default;
}
.state-waiting-next {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* ==========================================================================
   VIEW 2 & VIEW 3: VAULTS
   ========================================================================== */
.vault-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.vault-hero {
  background: linear-gradient(135deg, #161a24, #0f121a);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  align-items: center;
}
.badge-vault-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.1);
  border: 1px solid rgba(0, 229, 255, 0.3);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  margin-bottom: 8px;
}
.vault-hero-text h1 {
  font-size: 22px;
  margin-bottom: 8px;
  line-height: 1.25;
}
.vault-hero-text p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.vault-hero-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.metric-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.metric-num {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  display: block;
}

.vault-columns-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 16px;
}
.vault-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-panel);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-main);
}
.card-head h2 { font-size: 15px; }
.live-tag {
  font-size: 9px;
  font-weight: 800;
  color: #2ecc71;
}

.position-overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}
.pos-item {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.yield-highlight {
  border-color: rgba(40, 167, 69, 0.35);
}
.pos-lbl {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}
.pos-val {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  display: block;
  margin-bottom: 8px;
}
.btn-claim-yield {
  background: #28a745;
  color: #ffffff;
  border: none;
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.actions-split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.action-box h3 {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.action-input-row {
  display: flex;
  gap: 6px;
  margin-bottom: 4px;
}
.action-input-row input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-xs);
  padding: 6px 8px;
  color: #ffffff;
  font-size: 12px;
  outline: none;
}
.btn-vault-submit {
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-xs);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.btn-primary-stake {
  background: linear-gradient(135deg, var(--mult-mid), #6b21a8);
  color: #ffffff;
}
.btn-secondary-unstake {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-main);
  color: #ffffff;
}
.sub-hint {
  font-size: 9px;
  color: var(--text-muted);
}
.rule-step {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.step-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 229, 255, 0.1);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 11px;
  flex-shrink: 0;
}
.rule-step h4 { font-size: 12px; margin-bottom: 2px; }
.rule-step p { font-size: 11px; color: var(--text-secondary); }

/* Rollover Staking */
.rollover-banner-alert {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--accent-amber);
  font-weight: 700;
  font-size: 12px;
}
.rollover-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 16px;
}
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.form-group input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-xs);
  padding: 8px 10px;
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  outline: none;
}
.input-with-tag {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-xs);
  padding-right: 10px;
}
.input-with-tag input { border: none; background: transparent; }
.tag { color: var(--text-muted); font-weight: 700; }
.rollover-btn-wrap { margin-top: 18px; }
.btn-start-rollover {
  width: 100%;
  background: linear-gradient(135deg, var(--accent-amber), #d97706);
  border: none;
  color: #ffffff;
  padding: 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.btn-stop-rollover {
  width: 100%;
  background: linear-gradient(135deg, var(--spribe-red), #990026);
  border: none;
  color: #ffffff;
  padding: 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

/* ==========================================================================
   MODALS (How to Play, Round History, Provably Fair)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal-backdrop.show {
  display: flex;
}

.modal-dialog {
  background: #181920;
  border: 1px solid var(--border-main);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-main);
}
.modal-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-header-title h2 {
  font-size: 16px;
  font-weight: 800;
}
.btn-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
}
.btn-modal-close:hover {
  color: #ffffff;
}

.modal-body {
  padding: 18px;
}
.modal-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
}

/* How to Play Modal Specifics */
.how-modal-dialog {
  max-width: 600px;
}
.how-title-badge {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ff003b;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
}
.how-intro {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
}
.how-steps-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}
.how-step-card {
  display: flex;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-md);
  padding: 12px;
}
.step-num-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ff003b;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 900;
  flex-shrink: 0;
}
.step-card-content h3 {
  font-size: 13px;
  margin-bottom: 3px;
}
.step-card-content p {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}
.how-features-box {
  background: rgba(40, 167, 69, 0.07);
  border: 1px solid rgba(40, 167, 69, 0.25);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.feat-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.feat-icon { font-size: 14px; }
.feat-item strong {
  font-size: 12px;
  color: #2ecc71;
  display: block;
}
.feat-item p {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 1px;
}

/* Round History Modal Specifics */
.history-modal-dialog {
  max-width: 680px;
}
.round-history-table-wrapper {
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid var(--border-main);
  border-radius: var(--radius-sm);
}
.round-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.round-history-table th {
  background: rgba(0, 0, 0, 0.5);
  color: var(--text-muted);
  font-weight: 700;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-main);
}
.round-history-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}
.round-history-table tr:hover {
  background: rgba(255, 255, 255, 0.03);
}
.btn-table-inspect {
  background: rgba(255, 0, 59, 0.12);
  border: 1px solid rgba(255, 0, 59, 0.3);
  color: var(--spribe-red);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}
.btn-table-inspect:hover {
  background: var(--spribe-red);
  color: #ffffff;
}

/* Provably Fair Modal */
.pf-info-card {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 16px;
}
.pf-info-card h3 {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 10px;
}
.pf-key-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}
.pf-key-name {
  font-size: 10px;
  color: var(--text-muted);
}
.pf-key-value {
  font-family: monospace;
  font-size: 11px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  word-break: break-all;
}
.pf-client-seed-editor {
  margin-top: 12px;
}
.pf-client-seed-editor label {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.input-with-action {
  display: flex;
  gap: 6px;
}
.input-with-action input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-xs);
  padding: 6px 10px;
  color: #ffffff;
  font-size: 12px;
  outline: none;
}
.btn-chip {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-main);
  color: #ffffff;
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.btn-chip:hover {
  background: rgba(255, 255, 255, 0.2);
}

.pf-verifier-tool h3 {
  font-size: 13px;
  margin-bottom: 10px;
}
.form-row {
  margin-bottom: 10px;
}
.form-row label, .form-col label {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.form-row input, .form-col input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-xs);
  padding: 6px 8px;
  color: #ffffff;
  font-size: 11px;
  outline: none;
}
.form-row-dual {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.btn-verify-action {
  width: 100%;
  background: linear-gradient(135deg, var(--spribe-red), #990026);
  border: none;
  color: #ffffff;
  padding: 10px;
  border-radius: var(--radius-xs);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.pf-result-container {
  margin-top: 10px;
  font-size: 12px;
}

/* ==========================================================================
   UNIVERSAL RESPONSIVE BREAKPOINTS (All Screen Sizes)
   ========================================================================== */

/* 1. Large Tablets & Medium Laptops (1024px and below) */
@media (max-width: 1024px) {
  .app-main {
    padding: 6px 8px 16px;
  }

  .aviator-console-layout {
    grid-template-columns: 260px 1fr;
    gap: 8px;
  }

  .console-sidebar {
    height: 560px;
  }

  .flight-canvas-container {
    height: 370px;
  }

  .terminal-grid-content {
    grid-template-columns: 1fr 125px;
  }
  .terminal-right-action {
    width: 125px;
  }

  .vault-hero {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .vault-columns-grid, .rollover-grid {
    grid-template-columns: 1fr;
  }
}

/* 2. Tablets & Mobile Devices (768px and below) */
@media (max-width: 768px) {
  :root {
    --header-height: 48px;
  }

  .app-header {
    padding: 0 10px;
  }

  .desktop-only {
    display: none !important;
  }

  .brand-title {
    font-size: 19px;
  }

  .header-left {
    gap: 10px;
  }
  .header-right {
    gap: 6px;
  }

  /* Single Column Stack: Flight Arena on Top, Bet Panels, then Community Bets Below */
  .aviator-console-layout {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  /* Main Flight Stage takes first position */
  .console-main-stage {
    order: 1;
  }

  /* Sidebar takes second position below betting terminals */
  .console-sidebar {
    order: 2;
    height: 380px;
    margin-top: 4px;
  }

  /* Responsive Canvas Height */
  .flight-canvas-container {
    height: auto;
    aspect-ratio: 16 / 10;
    max-height: 300px;
    min-height: 210px;
  }

  /* Dual Bet Terminals on Tablet/Mobile */
  .dual-betting-terminals {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .betting-terminal {
    height: 138px;
    min-height: 138px;
    padding: 8px 10px;
  }

  .terminal-grid-content {
    grid-template-columns: 1fr 115px;
    height: 74px;
  }
  .terminal-left-controls {
    height: 74px;
  }
  .terminal-right-action {
    width: 115px;
    height: 74px;
  }
  .btn-terminal-action {
    height: 74px;
  }
  .action-btn-main {
    font-size: 16px;
  }
  .action-btn-sub {
    font-size: 11px;
  }

  .stepper-row {
    height: 38px;
  }
  .btn-step {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }
  .terminal-stake-input {
    width: 70px;
    font-size: 15px;
  }

  .quick-chips-grid {
    height: 26px;
  }
  .chip-btn {
    height: 26px;
    font-size: 10px;
  }
}

/* 3. Small Mobile Phones (480px and below, e.g. iPhone SE, Pixel, Galaxy S) */
@media (max-width: 480px) {
  .app-main {
    padding: 4px 6px 12px;
  }

  .header-btn-how-to-play .how-text {
    display: none;
  }
  .header-btn-how-to-play {
    padding: 4px 6px;
  }

  .bal-amount {
    font-size: 12px;
  }

  /* On small phones, stack the betting terminals vertically or allow smooth full-width buttons */
  .dual-betting-terminals {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .betting-terminal {
    height: 136px;
    min-height: 136px;
    padding: 6px 10px;
  }

  .terminal-grid-content {
    grid-template-columns: 1fr 130px;
    height: 74px;
  }
  .terminal-right-action {
    width: 130px;
  }

  .flight-canvas-container {
    aspect-ratio: 16 / 10;
    max-height: 240px;
    min-height: 190px;
  }

  .modal-dialog {
    max-width: 96vw;
    padding: 0;
  }
  .modal-body {
    padding: 14px;
  }
}

/* 4. Mobile Landscape (< 900px width with small height) */
@media (max-height: 550px) and (orientation: landscape) {
  :root {
    --header-height: 40px;
  }

  .app-header {
    padding: 0 8px;
  }

  .brand-title {
    font-size: 17px;
  }

  .aviator-console-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 6px;
  }

  .console-sidebar {
    height: calc(100vh - 56px);
  }

  .flight-canvas-container {
    height: 200px;
  }

  .dual-betting-terminals {
    grid-template-columns: 1fr 1fr;
  }

  .betting-terminal {
    height: 120px;
    min-height: 120px;
    padding: 6px 8px;
  }
  .terminal-grid-content {
    height: 66px;
    grid-template-columns: 1fr 110px;
  }
  .terminal-left-controls {
    height: 66px;
  }
  .stepper-row {
    height: 34px;
  }
  .btn-step {
    width: 28px;
    height: 28px;
  }
  .quick-chips-grid {
    height: 24px;
  }
  .chip-btn {
    height: 24px;
    font-size: 9px;
  }
  .terminal-right-action {
    width: 110px;
    height: 66px;
  }
  .btn-terminal-action {
    height: 66px;
  }
}
