:root {
  --bg: #0a0d15;
  --bg-2: #0f1220;
  --card: #141826;
  --card-2: #1a1f31;
  --text: #eaf0ff;
  --muted: #8a92a8;
  --neon-cyan: #00e5ff;
  --neon-mag: #ff2bd6;
  --neon-gold: #ffd447;
  --neon-green: #26ff8f;
  --danger: #ff4b6a;
  --border: rgba(255,255,255,0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1200px 700px at 10% -10%, rgba(0,229,255,0.08), transparent 60%),
    radial-gradient(900px 600px at 110% 10%, rgba(255,43,214,0.07), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  padding-bottom: 88px;
  min-height: 100vh;
  overflow-x: hidden;
}
button { font-family: inherit; cursor: pointer; }
h2 { margin: 12px 0 8px; font-size: 20px; }
h3 { margin: 18px 0 8px; font-size: 16px; color: var(--muted); }
.muted { color: var(--muted); }

/* ---------- LOADER ---------- */
.loader {
  position: fixed; inset: 0; z-index: 9999;
  background: radial-gradient(ellipse at center, #0f1424 0%, #05070c 80%);
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  transition: opacity 0.6s ease;
}
.loader.hide { opacity: 0; pointer-events: none; }
.rocket-wrap { position: relative; height: 140px; display: flex; align-items: center; justify-content: center; }
.rocket {
  font-size: 72px;
  animation: rocket-fly 1.6s ease-in-out infinite alternate, rocket-shake 0.15s linear infinite;
  filter: drop-shadow(0 0 12px var(--neon-cyan)) drop-shadow(0 0 20px var(--neon-mag));
}
.exhaust {
  position: absolute; bottom: 0; width: 40px; height: 50px;
  background: linear-gradient(to top, var(--neon-cyan), transparent);
  filter: blur(6px);
  animation: exhaust-pulse 0.2s linear infinite alternate;
}
@keyframes rocket-fly {
  from { transform: translateY(0) rotate(-10deg); }
  to   { transform: translateY(-20px) rotate(-10deg); }
}
@keyframes rocket-shake {
  from { transform: translateX(-1px) rotate(-10deg); }
  to   { transform: translateX(1px) rotate(-10deg); }
}
@keyframes exhaust-pulse {
  from { opacity: 0.6; height: 40px; }
  to   { opacity: 1;   height: 60px; }
}
.loading-text {
  margin-top: 30px;
  font-weight: 700; letter-spacing: 6px; font-size: 20px;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px var(--neon-cyan), 0 0 20px var(--neon-cyan);
  animation: text-glow 1.4s ease-in-out infinite alternate;
}
.dots span { animation: blink 1.2s infinite; opacity: 0.2; }
.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 50% { opacity: 1; } }
@keyframes text-glow {
  from { text-shadow: 0 0 4px var(--neon-cyan), 0 0 10px var(--neon-cyan); }
  to   { text-shadow: 0 0 12px var(--neon-cyan), 0 0 26px var(--neon-mag); }
}

/* ---------- HEADER ---------- */
.app-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: rgba(10,13,21,0.7);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.user { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%;
  border: 2px solid var(--neon-cyan);
  box-shadow: 0 0 10px rgba(0,229,255,0.6);
  object-fit: cover; background: var(--card);
}
.user-info { display: flex; flex-direction: column; }
.uname { font-weight: 600; font-size: 14px; }
.online-badge { color: var(--muted); font-size: 12px; }

.balance-block { display: flex; align-items: center; gap: 8px; }
.balance-value {
  font-weight: 700; font-size: 16px; color: var(--neon-gold);
  text-shadow: 0 0 6px rgba(255,212,71,0.6);
}
.deposit-plus {
  width: 34px; height: 34px; border-radius: 50%;
  border: none; color: #001420; font-weight: 800; font-size: 22px; line-height: 1;
  background: radial-gradient(circle, #7ff3ff, var(--neon-cyan));
  box-shadow: 0 0 12px var(--neon-cyan), 0 0 24px rgba(0,229,255,0.6);
  transition: transform 0.15s ease;
}
.deposit-plus:active { transform: scale(0.94); }

/* ---------- MAIN ---------- */
.app-main { padding: 12px 14px; }
.tab { display: none; }
.tab.active { display: block; }

/* Games grid */
.games-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 600px) {
  .games-grid { grid-template-columns: repeat(4, 1fr); }
}
.game-card {
  padding: 18px 10px; min-height: 110px;
  background: linear-gradient(160deg, var(--card) 0%, var(--card-2) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  position: relative; overflow: hidden;
}
.game-card::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 50% -20%, rgba(0,229,255,0.14), transparent 60%);
  pointer-events: none;
}
.game-card:hover, .game-card:active {
  transform: translateY(-2px);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 18px rgba(0,229,255,0.35), inset 0 0 20px rgba(0,229,255,0.08);
}
.game-card .icon { font-size: 32px; }
.game-card .label { font-weight: 600; font-size: 14px; }

/* Leaders / recent */
.leaders-list { padding-left: 22px; }
.leaders-list li { padding: 8px 6px; border-bottom: 1px solid var(--border); }
.recent { list-style: none; padding: 0; }
.recent li { padding: 8px 10px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; }
.profile { background: var(--card); border-radius: 12px; padding: 12px; border: 1px solid var(--border); }

/* Bottom nav */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(10,13,21,0.9);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 6px 0 max(6px, env(safe-area-inset-bottom));
  z-index: 40;
}
.nav-item {
  background: none; border: none; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11px; padding: 6px 0;
  position: relative; transition: color 0.15s ease;
}
.nav-item .ico { font-size: 20px; }
.nav-item.active {
  color: var(--neon-cyan);
  text-shadow: 0 0 6px var(--neon-cyan);
}
.nav-item.active::before {
  content: ""; position: absolute; top: 0; left: 20%; right: 20%; height: 2px;
  background: var(--neon-cyan); border-radius: 2px;
  box-shadow: 0 0 8px var(--neon-cyan);
}

/* Modal */
.modal {
  display: none; position: fixed; inset: 0; z-index: 100;
  background: rgba(3,5,10,0.75);
  backdrop-filter: blur(8px);
  align-items: center; justify-content: center;
  padding: 16px;
}
.modal.open { display: flex; }
.modal-card {
  background: linear-gradient(160deg, var(--card) 0%, var(--card-2) 100%);
  border: 1px solid var(--neon-cyan);
  box-shadow: 0 0 28px rgba(0,229,255,0.25);
  border-radius: 18px;
  padding: 18px;
  width: 100%; max-width: 420px;
  max-height: 90vh; overflow-y: auto;
  position: relative;
}
.modal-close {
  position: absolute; top: 8px; right: 10px;
  background: none; border: none; color: var(--muted);
  font-size: 26px; line-height: 1;
}

/* Deposit tabs */
.tabs { display: flex; gap: 6px; margin: 10px 0 14px; }
.tab-btn {
  flex: 1; background: var(--card-2); color: var(--muted);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 8px; font-size: 13px;
}
.tab-btn.active {
  color: var(--neon-cyan); border-color: var(--neon-cyan);
  box-shadow: inset 0 0 12px rgba(0,229,255,0.1);
}
.dep-tab { display: none; }
.dep-tab.active { display: block; }
.dep-tab label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 6px; }
.dep-tab input, .dep-tab select {
  width: 100%; background: var(--bg-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 15px;
}
.chip-row { display: flex; gap: 6px; margin: 8px 0 4px; flex-wrap: wrap; }
.chip {
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  border-radius: 999px; padding: 6px 12px; font-size: 13px;
}
.chip:hover { border-color: var(--neon-cyan); color: var(--neon-cyan); }

.btn-neon, .btn-mag, .btn-gold {
  border: none; border-radius: 12px; padding: 12px 16px;
  font-weight: 700; font-size: 15px; color: #001420;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}
.btn-neon { background: radial-gradient(circle, #7ff3ff, var(--neon-cyan)); box-shadow: 0 0 14px var(--neon-cyan); }
.btn-mag  { background: radial-gradient(circle, #ff9df0, var(--neon-mag));  box-shadow: 0 0 14px var(--neon-mag); color: #1a0018; }
.btn-gold { background: radial-gradient(circle, #ffe98a, var(--neon-gold)); box-shadow: 0 0 14px var(--neon-gold); }
.btn-neon.big, .btn-mag.big, .btn-gold.big { width: 100%; margin-top: 12px; padding: 14px; }
.btn-neon:disabled, .btn-mag:disabled, .btn-gold:disabled { opacity: 0.4; cursor: not-allowed; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%);
  background: var(--card); border: 1px solid var(--neon-cyan);
  color: var(--text); border-radius: 10px; padding: 10px 16px;
  box-shadow: 0 0 14px rgba(0,229,255,0.3);
  opacity: 0; transition: opacity 0.25s ease;
  z-index: 200; pointer-events: none; max-width: 90%;
}
.toast.show { opacity: 1; }
.toast.err { border-color: var(--danger); box-shadow: 0 0 14px rgba(255,75,106,0.4); }
