/* ============================================================
   Crypto Airdrop Hub — Mini App
   Dark + neon-green + gold (top crypto aesthetic)
   ============================================================ */

:root {
  --bg-0: #050810;
  --bg-1: #0a0f1c;
  --bg-2: #131a2c;
  --bg-3: #1c2540;

  --neon: #00ff88;
  --neon-soft: rgba(0, 255, 136, 0.15);
  --neon-dim: rgba(0, 255, 136, 0.5);

  --gold: #ffc857;
  --gold-soft: rgba(255, 200, 87, 0.15);

  --purple: #9b6dff;
  --pink: #ff5ec7;
  --danger: #ff3b6b;

  --text-1: #ffffff;
  --text-2: #b8c0d8;
  --text-3: #6b7595;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --shadow-glow: 0 0 24px rgba(0, 255, 136, 0.25);
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.4);

  --tg-safe-top: env(safe-area-inset-top, 0px);
  --tg-safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  background: var(--bg-0);
  color: var(--text-1);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  min-height: 100vh;
  overflow-x: hidden;
  background: radial-gradient(ellipse at 50% 0%, #0f1830 0%, var(--bg-0) 55%);
}

.hidden { display: none !important; }

/* ============================================================
   Boot splash
   ============================================================ */
#boot {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle, #0c1224 0%, var(--bg-0) 70%);
  z-index: 100;
}
.boot-logo {
  font-size: 72px;
  filter: drop-shadow(0 0 30px rgba(0, 255, 136, 0.6));
  animation: float 2.4s ease-in-out infinite;
}
.boot-title { font-size: 22px; font-weight: 700; margin-top: 16px; }
.boot-sub   { font-size: 13px; color: var(--text-3); margin-top: 6px; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* ============================================================
   App layout + topbar
   ============================================================ */
#app {
  padding: calc(12px + var(--tg-safe-top)) 16px calc(20px + var(--tg-safe-bottom));
  max-width: 600px;
  margin: 0 auto;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
  gap: 8px;
}
.back-btn {
  background: var(--bg-2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-1);
  width: 36px; height: 36px;
  border-radius: 12px;
  font-size: 20px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font: inherit;
}
.back-btn:active { transform: scale(0.92); }
.brand {
  display: flex; align-items: center; gap: 8px;
  font-size: 18px; font-weight: 700;
  flex: 1;
}
.brand span {
  background: linear-gradient(90deg, #fff 0%, var(--neon) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.tier-pill {
  background: var(--bg-2);
  border: 1px solid var(--neon-soft);
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 0 12px rgba(0, 255, 136, 0.15);
  white-space: nowrap;
}

/* ============================================================
   Screens (SPA transitions)
   ============================================================ */
.screen {
  animation: screen-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes screen-in {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}
.screen-title {
  font-size: 24px; font-weight: 800;
  margin-bottom: 4px;
}
.screen-sub {
  font-size: 13px; color: var(--text-3);
}

.wheel-header {
  margin-bottom: 16px;
  text-align: center;
}

.wip-card {
  background: var(--bg-2);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  text-align: center;
  color: var(--text-3);
  margin-top: 30px;
}

/* ============================================================
   Hero balance card (main screen)
   ============================================================ */
.hero {
  background: linear-gradient(160deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid rgba(0, 255, 136, 0.18);
  border-radius: var(--radius-lg);
  padding: 24px 20px 20px;
  position: relative;
  overflow: hidden;
  margin-bottom: 18px;
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.hero::before {
  content: ""; position: absolute; inset: -50% -25% auto auto;
  width: 250px; height: 250px;
  background: radial-gradient(circle, var(--neon-soft) 0%, transparent 70%);
  pointer-events: none;
}
.hero::after {
  content: ""; position: absolute; bottom: -60%; left: -25%;
  width: 250px; height: 250px;
  background: radial-gradient(circle, var(--gold-soft) 0%, transparent 70%);
  pointer-events: none;
}
.hero-label {
  font-size: 11px; letter-spacing: 0.15em; font-weight: 700;
  color: var(--text-3);
  margin-bottom: 8px;
  position: relative;
}
.hero-balance {
  font-size: 44px; font-weight: 800;
  letter-spacing: -1px;
  display: flex; align-items: baseline; gap: 2px;
  position: relative;
  font-variant-numeric: tabular-nums;
}
.hero-balance .dot { color: var(--text-3); }
.hero-balance .unit {
  font-size: 16px; font-weight: 600; color: var(--neon);
  margin-left: 10px;
}
.hero-energy {
  display: flex; align-items: center; gap: 12px;
  margin-top: 18px;
  position: relative;
}
.energy-bar {
  flex: 1; height: 8px;
  background: var(--bg-3);
  border-radius: 100px;
  overflow: hidden;
  position: relative;
}
.energy-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--neon) 0%, var(--gold) 100%);
  border-radius: 100px;
  box-shadow: 0 0 12px var(--neon-dim);
  width: 100%;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.energy-text {
  font-size: 13px; font-weight: 600; color: var(--text-2);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   Action cards (main grid)
   ============================================================ */
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
.card-action {
  background: var(--bg-2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 16px 14px;
  display: flex; align-items: center; gap: 12px;
  text-align: left;
  color: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  font: inherit;
  position: relative;
  overflow: hidden;
  min-height: 78px;
}
.card-action:active { transform: scale(0.97); }
.card-action.primary {
  background: linear-gradient(140deg, rgba(0, 255, 136, 0.18) 0%, rgba(0, 255, 136, 0.05) 100%);
  border-color: var(--neon-dim);
  grid-column: span 2;
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.15);
}
.card-action.wide {
  grid-column: span 2;
  background: linear-gradient(140deg, rgba(155, 109, 255, 0.15) 0%, rgba(155, 109, 255, 0.04) 100%);
  border-color: rgba(155, 109, 255, 0.3);
}
.card-action.primary .ca-emoji { font-size: 32px; }
.ca-emoji { font-size: 28px; line-height: 1; flex-shrink: 0; }
.ca-text { flex: 1; min-width: 0; }
.ca-title { font-size: 15px; font-weight: 700; }
.ca-sub   { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.ca-arrow { font-size: 20px; color: var(--neon); }

/* ============================================================
   Footer stats
   ============================================================ */
.footer-stats {
  display: flex; gap: 8px;
  background: var(--bg-2);
  border-radius: var(--radius-md);
  padding: 14px 10px;
}
.fs-item {
  flex: 1; text-align: center;
  display: flex; flex-direction: column; gap: 2px;
}
.fs-item span {
  font-size: 18px; font-weight: 700;
  color: var(--neon);
  font-variant-numeric: tabular-nums;
}
.fs-item small {
  font-size: 11px; color: var(--text-3);
}

/* ============================================================
   Wheel screen
   ============================================================ */
.wheel-stage {
  position: relative;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 1;
  margin: 8px auto 24px;
  display: flex; align-items: center; justify-content: center;
}
.wheel-glow {
  position: absolute; inset: -20px;
  background: radial-gradient(circle, rgba(0, 255, 136, 0.3) 0%, transparent 60%);
  pointer-events: none;
  animation: glow-pulse 3s ease-in-out infinite;
}
@keyframes glow-pulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 0.9; transform: scale(1.05); }
}
#wheel-canvas {
  width: 100%; height: 100%;
  position: relative; z-index: 1;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.5));
}
.wheel-pointer {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 32px;
  color: var(--gold);
  z-index: 2;
  filter: drop-shadow(0 0 8px var(--gold));
}
.wheel-hub {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 60px; height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--bg-3) 0%, var(--bg-1) 100%);
  border: 3px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  z-index: 2;
  box-shadow: 0 0 20px rgba(255, 200, 87, 0.5);
}

.wheel-controls {
  display: flex; flex-direction: column; gap: 12px;
  align-items: center;
}
.wheel-info {
  font-size: 13px; color: var(--text-3);
  text-align: center;
}
.wheel-info span { color: var(--text-1); font-weight: 600; }

/* ============================================================
   Big CTA button
   ============================================================ */
.big-btn {
  background: linear-gradient(140deg, var(--neon) 0%, #00cc6d 100%);
  color: var(--bg-0);
  border: none;
  border-radius: 100px;
  padding: 18px 40px;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  display: flex; flex-direction: column; align-items: center;
  gap: 2px;
  min-width: 220px;
  box-shadow:
    0 4px 16px rgba(0, 255, 136, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.big-btn:active { transform: scale(0.96); box-shadow: 0 2px 8px rgba(0, 255, 136, 0.3); }
.big-btn:disabled {
  opacity: 0.5; cursor: not-allowed;
  background: var(--bg-3);
  color: var(--text-3);
  box-shadow: none;
}
.big-btn-sub {
  font-size: 11px; font-weight: 600;
  opacity: 0.7;
  text-transform: uppercase; letter-spacing: 0.05em;
}

/* ============================================================
   Popup (result of spin/case)
   ============================================================ */
.popup {
  position: fixed; inset: 0;
  background: rgba(5, 8, 16, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  animation: popup-in 0.25s ease;
  padding: 20px;
}
@keyframes popup-in {
  0% { opacity: 0; }
  100% { opacity: 1; }
}
.popup-card {
  background: linear-gradient(160deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid var(--neon-dim);
  border-radius: 24px;
  padding: 32px 24px;
  text-align: center;
  max-width: 320px; width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 40px var(--neon-soft);
  animation: popup-card-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes popup-card-in {
  0% { transform: scale(0.7) translateY(20px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
.popup-emoji {
  font-size: 64px;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 16px var(--neon));
  animation: bounce 0.6s ease infinite alternate;
}
@keyframes bounce {
  0% { transform: translateY(0); }
  100% { transform: translateY(-8px); }
}
.popup-title {
  font-size: 32px; font-weight: 800;
  background: linear-gradient(90deg, var(--gold) 0%, var(--neon) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
}
.popup-sub {
  font-size: 14px; color: var(--text-2);
  margin-bottom: 24px;
}
.popup-btn {
  background: linear-gradient(140deg, var(--neon) 0%, #00cc6d 100%);
  color: var(--bg-0);
  border: none;
  border-radius: 100px;
  padding: 14px 36px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  box-shadow: 0 4px 16px rgba(0, 255, 136, 0.4);
}
.popup-btn:active { transform: scale(0.96); }

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed;
  bottom: calc(30px + var(--tg-safe-bottom));
  left: 50%; transform: translateX(-50%);
  background: var(--bg-2);
  border: 1px solid var(--neon-soft);
  color: var(--text-1);
  padding: 12px 20px;
  border-radius: 100px;
  font-size: 14px; font-weight: 600;
  z-index: 60;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.25s ease;
}
@keyframes toast-in {
  0% { opacity: 0; transform: translate(-50%, 10px); }
  100% { opacity: 1; transform: translate(-50%, 0); }
}
