/* === BALLOON POP — Dark gaming theme === */

:root {
  --bg: #0a0e1a;
  --bg2: #111827;
  --bg3: #1e293b;
  --text: #e2e8f0;
  --text2: #94a3b8;
  --green: #10b981;
  --yellow: #eab308;
  --orange: #f97316;
  --red: #ef4444;
  --accent: #10b981;
  --gold: #ffd700;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, 'SF Pro', 'Segoe UI', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-user-select: none;
  user-select: none;
}

/* === HEADER === */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: var(--bg2);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.logo {
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
}

.balance-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg3);
  padding: 6px 12px;
  border-radius: 20px;
}

.btn-lang {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #94a3b8;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 10px;
  cursor: pointer;
  margin-left: 6px;
}
.btn-lang:active { background: rgba(255,255,255,0.15); }

.btn-sound {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 10px;
  cursor: pointer;
  margin-left: 4px;
}
.btn-sound:active { background: rgba(255,255,255,0.15); }

.balance-icon { font-size: 16px; }
#balance-value { font-weight: 700; font-size: 15px; color: var(--gold); }

.btn-deposit {
  background: var(--accent);
  border: none;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 8px 16px;
  border-radius: 16px;
  cursor: pointer;
  position: relative;
  z-index: 50;
  -webkit-tap-highlight-color: rgba(255,255,255,0.2);
  touch-action: manipulation;
}
.btn-deposit:active {
  transform: scale(0.9);
  background: var(--green);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #666;
  display: inline-block;
  margin-right: 4px;
}
.status-dot.online { background: var(--green); }

/* === HISTORY BAR === */
.history-bar {
  display: flex;
  gap: 6px;
  padding: 8px 16px;
  overflow-x: auto;
  background: var(--bg2);
  scrollbar-width: none;
}
.history-bar::-webkit-scrollbar { display: none; }

.hist-item {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  background: var(--bg3);
}
.hist-item.low { color: var(--red); }
.hist-item.mid { color: var(--yellow); }
.hist-item.high { color: var(--green); }

/* === GAME AREA === */
.game-area {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  max-height: 45vh;
  background: radial-gradient(ellipse at center, #151d2e 0%, var(--bg) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* Multiplier overlay */
#multiplier {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 42px;
  font-weight: 900;
  text-shadow: 0 2px 20px rgba(0,0,0,0.5);
  z-index: 2;
  transition: color 0.2s;
}
.mult.green { color: var(--green); }
.mult.yellow { color: var(--yellow); }
.mult.orange { color: var(--orange); }
.mult.red { color: var(--red); animation: pulse 0.3s infinite; }

@keyframes pulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.05); }
}

/* Countdown */
#countdown {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  color: var(--text);
  padding: 4px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  display: none;
  z-index: 2;
}

/* Seed hash (fairness) */
.seed-hash {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 9px;
  color: var(--text2);
  opacity: 0.5;
  cursor: pointer;
  z-index: 2;
}
.seed-hash:hover { opacity: 1; }

/* === CONTROLS === */
.controls {
  padding: 12px 16px;
  background: var(--bg2);
  border-top: 1px solid rgba(255,255,255,0.05);
}

.bet-chips {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.bet-chips::-webkit-scrollbar { display: none; }

.bet-chip {
  flex-shrink: 0;
  background: var(--bg3);
  border: 2px solid rgba(255,255,255,0.1);
  color: var(--text2);
  font-size: 14px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s;
  min-width: 42px;
  text-align: center;
}
.bet-chip:active { transform: scale(0.93); }
.bet-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 12px rgba(16,185,129,0.3);
}

/* Auto cashout */
.auto-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.auto-label {
  font-size: 12px;
  color: var(--text2);
  white-space: nowrap;
}
#auto-cashout {
  width: 80px;
  background: var(--bg3);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  padding: 6px 8px;
  border-radius: 8px;
  text-align: center;
  outline: none;
}

/* Bet / Cashout buttons */
#btn-bet {
  width: 100%;
  padding: 14px;
  font-size: 17px;
  font-weight: 800;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--green), #059669);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: transform 0.1s;
}
#btn-bet:active:not(:disabled) { transform: scale(0.97); }
#btn-bet:disabled { opacity: 0.5; cursor: default; }

#btn-cashout {
  width: 100%;
  padding: 14px;
  font-size: 17px;
  font-weight: 800;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--orange), var(--red));
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: none;
  animation: cashout-pulse 0.6s infinite;
}
@keyframes cashout-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(249,115,22,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(249,115,22,0); }
}

/* === LIVE FEED === */
.feed-section {
  padding: 8px 16px;
}
.feed-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.feed-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 10px;
  margin-bottom: 3px;
  background: var(--bg2);
  border-radius: 8px;
  font-size: 13px;
  animation: feed-in 0.3s ease;
}
.feed-item.big-win {
  background: linear-gradient(90deg, rgba(16,185,129,0.15), transparent);
  border-left: 3px solid var(--green);
}

.feed-user { color: var(--text2); font-weight: 500; }
.feed-mult { font-weight: 700; color: var(--yellow); }
.feed-profit { font-weight: 700; color: var(--green); }

@keyframes feed-in {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

/* === DEPOSIT POPUP === */
.deposit-popup {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: var(--bg2);
  border: 2px solid var(--gold);
  border-radius: 20px;
  padding: 24px;
  text-align: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  box-shadow: 0 20px 60px rgba(0,0,0,0.9);
  width: 280px;
}
.deposit-popup.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}
.deposit-title { font-size: 22px; font-weight: 900; margin-bottom: 4px; }
.deposit-subtitle { font-size: 13px; color: #94a3b8; margin-bottom: 16px; }
.deposit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.deposit-option {
  background: var(--bg);
  border: 1.5px solid #334155;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 14px 0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.deposit-option:active {
  transform: scale(0.93);
  background: var(--accent);
  border-color: var(--accent);
}
.deposit-close {
  background: none;
  border: 1px solid #475569;
  color: #94a3b8;
  font-size: 14px;
  padding: 10px 32px;
  border-radius: 12px;
  cursor: pointer;
  width: 100%;
}

/* === RESULT POPUP === */
.result-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: var(--bg2);
  border-radius: 20px;
  padding: 24px 32px;
  text-align: center;
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
  min-width: 240px;
}
.result-close {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 18px;
  color: var(--text2);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
.result-close:active { color: var(--text); }
.result-popup.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}
.result-popup.win { border: 2px solid var(--green); }
.result-popup.loss { border: 2px solid var(--red); }

.result-icon { font-size: 48px; margin-bottom: 8px; }
.result-title { font-size: 28px; font-weight: 900; margin-bottom: 4px; }
.result-popup.win .result-title { color: var(--green); }
.result-popup.loss .result-title { color: var(--red); }
.result-mult { font-size: 36px; font-weight: 900; color: var(--gold); }
.result-amount { font-size: 14px; color: var(--text2); margin: 8px 0 12px; }

.btn-share {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: none;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 24px;
  border-radius: 10px;
  cursor: pointer;
}
.btn-share:active { transform: scale(0.96); }

/* === BOTTOM NAV === */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--bg2);
  border-top: 1px solid rgba(255,255,255,0.05);
  padding: 6px 0;
  padding-bottom: max(6px, env(safe-area-inset-bottom));
}
.nav-item {
  flex: 1;
  text-align: center;
  padding: 6px;
  color: var(--text2);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.nav-item.active { color: var(--accent); }
.nav-icon { font-size: 20px; display: block; margin-bottom: 2px; }

/* === TOAST === */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--bg3);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transition: all 0.3s;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-left: 3px solid var(--red); }
.toast.success { border-left: 3px solid var(--green); }

/* === PROVABLY FAIR BADGE === */
.fair-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: 8px;
  font-size: 10px;
  color: var(--green);
  font-weight: 600;
  cursor: pointer;
  margin: 8px 16px;
}
.fair-badge:hover { background: rgba(16,185,129,0.2); }

/* === PANELS === */
.panel {
  padding: 0 16px 80px;
  animation: panel-in 0.2s ease;
}
.panel-inner {
  background: var(--bg2);
  border-radius: 12px;
  padding: 16px;
  margin-top: 8px;
}
.panel-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 12px;
}
@keyframes panel-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Game sections that hide when switching panels */
.game-section { }

/* Tabs */
.tab-row {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.tab-btn {
  flex: 1;
  background: var(--bg3);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text2);
  font-size: 12px;
  font-weight: 600;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
}
.tab-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Leaderboard */
.lb-list { }
.lb-row {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  margin-bottom: 4px;
  background: var(--bg3);
  border-radius: 8px;
}
.lb-rank {
  width: 28px;
  font-size: 14px;
  font-weight: 800;
  color: var(--text2);
}
.lb-rank.gold { color: var(--gold); }
.lb-rank.silver { color: #c0c0c0; }
.lb-rank.bronze { color: #cd7f32; }
.lb-name {
  flex: 1;
  font-weight: 600;
  font-size: 14px;
}
.lb-amount {
  font-weight: 700;
  font-size: 14px;
  color: var(--green);
}
.lb-empty {
  text-align: center;
  color: var(--text2);
  padding: 30px;
  font-size: 14px;
}

/* Invite */
.invite-desc {
  color: var(--text2);
  font-size: 14px;
  margin-bottom: 16px;
  line-height: 1.5;
}
.invite-link-box {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.ref-link-input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text);
  font-size: 12px;
  padding: 10px;
  border-radius: 8px;
  outline: none;
}
.btn-copy {
  background: var(--accent);
  border: none;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-copy:active { transform: scale(0.96); }
.btn-share-invite {
  width: 100%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: none;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 16px;
}
.btn-share-invite:active { transform: scale(0.97); }
.invite-stats {
  display: flex;
  gap: 12px;
}
.invite-stat {
  flex: 1;
  text-align: center;
  background: var(--bg3);
  padding: 12px;
  border-radius: 10px;
}
.invite-stat-num {
  font-size: 24px;
  font-weight: 800;
  color: var(--gold);
}
.invite-stat-label {
  font-size: 11px;
  color: var(--text2);
  margin-top: 4px;
}

/* Profile */
.profile-card {
  text-align: center;
  padding: 12px;
  margin-bottom: 16px;
}
.profile-name {
  font-size: 22px;
  font-weight: 800;
}
.profile-id {
  font-size: 12px;
  color: var(--text2);
  margin-top: 4px;
}
.profile-stats {
  display: flex;
  gap: 8px;
}
.profile-stat {
  flex: 1;
  text-align: center;
  background: var(--bg3);
  padding: 12px 8px;
  border-radius: 10px;
}
.profile-stat-num {
  font-size: 18px;
  font-weight: 800;
  color: var(--gold);
}
.profile-stat-label {
  font-size: 10px;
  color: var(--text2);
  margin-top: 4px;
}
.history-list { margin-top: 8px; }
.hist-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 8px;
  margin-bottom: 3px;
  background: var(--bg3);
  border-radius: 6px;
  font-size: 12px;
}
.hist-type { color: var(--text2); }
.hist-amount-pos { color: var(--green); font-weight: 700; }
.hist-amount-neg { color: var(--red); font-weight: 700; }

/* === ONBOARDING === */
.onboarding {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in 0.4s ease;
}
.onboarding.hidden { display: none; }
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.onboard-card {
  background: var(--bg2);
  border-radius: 20px;
  padding: 28px 24px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  border: 1.5px solid rgba(255,255,255,0.08);
}
.onboard-title {
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 20px;
  background: linear-gradient(135deg, var(--gold), #f59e0b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.onboard-steps { text-align: left; margin-bottom: 24px; }
.onboard-step {
  margin-bottom: 16px;
  padding-left: 4px;
}
.onboard-step-title {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 4px;
}
.onboard-step-text {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.5;
}
.onboard-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  margin-bottom: 10px;
  background: linear-gradient(135deg, var(--green), #059669);
  color: #fff;
}
.onboard-btn:active { transform: scale(0.97); }
.onboard-btn.secondary {
  background: none;
  border: 1.5px solid var(--gold);
  color: var(--gold);
}

/* === RULES === */
.rules-content { padding-bottom: 16px; }
.rules-section {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.rules-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.rules-section-title {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 8px;
}
.rules-text {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.6;
}
.rules-text strong { color: var(--text); }
.rules-list {
  padding-left: 20px;
  margin: 0;
  font-size: 13px;
  color: var(--text2);
  line-height: 1.8;
}
.rules-list strong { color: var(--text); }

/* === RESPONSIVE === */
@media (max-width: 380px) {
  #multiplier { font-size: 32px; }
  .controls { padding: 8px 12px; }
  #btn-bet, #btn-cashout { padding: 12px; font-size: 15px; }
  .bet-chip { padding: 7px 10px; font-size: 13px; min-width: 36px; }
}
