/* ============================================================
   Som Blast - Main Stylesheet
   Mobile-first, Telegram WebApp optimized
   ============================================================ */

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

:root {
  --bg:          #0a0a0f;
  --bg-card:     #111118;
  --bg-elevated: #1a1a28;
  --border:      #ffffff12;
  --border-glow: #6c63ff40;
  --accent:      #6c63ff;
  --accent2:     #f72585;
  --gold:        #f7c948;
  --green:       #10b981;
  --text:        #e8e8f0;
  --text-muted:  #8888aa;
  --text-dim:    #44445a;
  --radius:      16px;
  --radius-sm:   10px;
  --nav-h:       72px;
  --header-h:    60px;
  --font:        'Sora', -apple-system, sans-serif;
  --mono:        'JetBrains Mono', monospace;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Telegram theme adaptation ─────────────────────────────── */
body.tg-light {
  --bg:          #f0f0f8;
  --bg-card:     #ffffff;
  --bg-elevated: #e8e8f4;
  --border:      #00000012;
  --text:        #1a1a2e;
  --text-muted:  #666680;
  --text-dim:    #aaaacc;
}

/* ── Loading Screen ─────────────────────────────────────────── */
#loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.loading-logo {
  animation: pulse-scale 1.5s ease-in-out infinite;
}
@keyframes pulse-scale {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
.loading-title {
  font-size: 24px;
  font-weight: 800;
  background: linear-gradient(135deg, #6c63ff, #f72585);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}
.loading-bar {
  width: 160px;
  height: 3px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.loading-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #6c63ff, #f72585);
  border-radius: 99px;
  animation: loading-fill 2s ease-in-out infinite;
}
@keyframes loading-fill {
  0% { width: 0%; }
  60% { width: 85%; }
  100% { width: 100%; }
}
.loading-text {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Error Screen ───────────────────────────────────────────── */
#error-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}
.error-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px;
  text-align: center;
  max-width: 300px;
}
.error-inner h2 { font-size: 20px; font-weight: 700; }
.error-inner p { color: var(--text-muted); font-size: 14px; }

/* ── App Container ──────────────────────────────────────────── */
#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Header ─────────────────────────────────────────────────── */
#app-header {
  height: var(--header-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
  position: relative;
  z-index: 100;
}
.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--border-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--text-muted);
  flex-shrink: 0;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  letter-spacing: 0.5px;
  width: fit-content;
}
.badge-VERIFIED {
  background: linear-gradient(135deg, #6c63ff22, #6c63ff44);
  color: #a5a1ff;
  border: 1px solid #6c63ff44;
}
.badge-CEO {
  background: linear-gradient(135deg, #f7c94822, #f7c94844);
  color: #f7c948;
  border: 1px solid #f7c94844;
}
.header-coins {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--gold);
}

/* ── Pages ──────────────────────────────────────────────────── */
.page {
  display: none;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: calc(var(--nav-h) + 8px);
  -webkit-overflow-scrolling: touch;
}
.page.active {
  display: flex;
  flex-direction: column;
}
.page-header {
  padding: 20px 16px 12px;
}
.page-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
}
.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}
.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 16px 16px 8px;
}

/* ── Home / Tap Page ────────────────────────────────────────── */
.home-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px 0;
  align-items: center;
}
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 16px;
  width: 100%;
  margin-bottom: 12px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
}
.stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.stat-value {
  font-size: 16px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--text);
}

/* ── Tap Button ─────────────────────────────────────────────── */
.tap-area {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 16px 0;
  flex: 1;
}
.tap-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid var(--accent);
  opacity: 0.2;
  animation: ring-pulse 3s ease-in-out infinite;
}
.tap-ring-outer {
  width: 240px;
  height: 240px;
  animation-delay: 0.5s;
}
.tap-ring-inner {
  width: 190px;
  height: 190px;
}
@keyframes ring-pulse {
  0%,100% { opacity: 0.1; transform: scale(1); }
  50% { opacity: 0.25; transform: scale(1.03); }
}
.tap-button {
  position: relative;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #1e1a3a, #0a0a1a);
  border: 2px solid var(--border-glow);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.08s ease;
  box-shadow: 0 0 40px #6c63ff22, 0 8px 32px rgba(0,0,0,0.5);
  -webkit-user-select: none;
  user-select: none;
}
.tap-button:active {
  transform: scale(0.94);
}
.tap-button.tapping {
  box-shadow: 0 0 60px #6c63ff44, 0 8px 32px rgba(0,0,0,0.5);
}
.tap-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-muted);
}

/* Floating coin animations */
.tap-floats {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: 50%;
}
.float-coin {
  position: absolute;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--gold);
  animation: float-up 0.9s ease-out forwards;
  pointer-events: none;
  white-space: nowrap;
}
@keyframes float-up {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-80px) scale(0.8); }
}

/* ── Energy Bar ─────────────────────────────────────────────── */
.energy-section {
  width: 100%;
  padding: 0 16px 16px;
}
.energy-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.energy-text {
  font-size: 13px;
  font-weight: 600;
  font-family: var(--mono);
  color: #f59e0b;
}
.energy-bar-track {
  height: 8px;
  background: var(--bg-elevated);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.energy-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #ef4444);
  border-radius: 99px;
  transition: width 0.3s ease;
}

/* ── Quick Actions ──────────────────────────────────────────── */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 0 16px;
  width: 100%;
}
.quick-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 10px;
  font-weight: 600;
  transition: all 0.2s;
}
.quick-btn:active {
  transform: scale(0.96);
  border-color: var(--border-glow);
  color: var(--accent);
}

/* ── Tasks ──────────────────────────────────────────────────── */
.tasks-list {
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.task-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color 0.2s;
}
.task-card.completed {
  opacity: 0.5;
}
.task-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
}
.task-info {
  flex: 1;
  min-width: 0;
}
.task-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-reward {
  font-size: 12px;
  color: var(--gold);
  font-weight: 600;
  margin-top: 2px;
  font-family: var(--mono);
}
.task-action {
  padding: 8px 14px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
  font-size: 12px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  white-space: nowrap;
  flex-shrink: 0;
  transition: opacity 0.2s;
}
.task-action:active { opacity: 0.8; }
.task-action:disabled {
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: not-allowed;
}
.task-done-icon { color: var(--green); }

/* ── Videos ─────────────────────────────────────────────────── */
.videos-list {
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.video-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s;
}
.video-card:active { border-color: var(--border-glow); }
.video-thumb {
  width: 100%;
  height: 140px;
  background: var(--bg-elevated);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.video-thumb img { width: 100%; height: 100%; object-fit: cover; }
.video-play-btn {
  position: absolute;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  border: 2px solid rgba(255,255,255,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}
.video-watched-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--green);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
}
.video-info {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.video-meta { flex: 1; }
.video-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.video-stats {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.video-reward-badge {
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  font-family: var(--mono);
  background: #f7c94820;
  border: 1px solid #f7c94840;
  padding: 4px 10px;
  border-radius: 6px;
}

/* ── Video Modal ────────────────────────────────────────────── */
.video-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 500;
  display: flex;
  align-items: flex-end;
}
.video-modal-inner {
  width: 100%;
  background: var(--bg-card);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 16px;
  max-height: 85vh;
  overflow-y: auto;
}
.video-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-weight: 600;
  font-size: 15px;
}
.video-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}
.video-wrapper iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.video-overlay {
  position: absolute;
  inset: 0;
  cursor: default;
}
.video-timer-section {
  margin-top: 14px;
}
.video-timer-bar-track {
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 8px;
}
.video-timer-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 99px;
  width: 100%;
  transform-origin: left;
  transition: none;
}
.video-timer-text {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}
.video-reward-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-muted);
}
.video-reward-row strong { color: var(--gold); font-size: 18px; }

/* ── Leaderboard ────────────────────────────────────────────── */
.my-rank-card {
  margin: 0 16px 16px;
  background: linear-gradient(135deg, var(--bg-elevated), var(--bg-card));
  border: 1px solid var(--border-glow);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.rank-label { font-size: 13px; color: var(--text-muted); }
.rank-number { font-size: 28px; font-weight: 800; font-family: var(--mono); color: var(--accent); }
.league-prizes {
  margin: 0 16px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.prize-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.prize-row:last-child { border-bottom: none; }
.prize-rank {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.rank-gold { background: linear-gradient(135deg, #f7c948, #f97316); color: white; }
.rank-silver { background: linear-gradient(135deg, #94a3b8, #64748b); color: white; }
.rank-bronze { background: linear-gradient(135deg, #cd7c46, #92400e); color: white; }
.prize-amount { font-size: 14px; font-weight: 600; color: var(--gold); font-family: var(--mono); }
.leaderboard-list {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lb-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.lb-item.is-me {
  border-color: var(--border-glow);
  background: var(--bg-elevated);
}
.lb-rank {
  width: 28px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--text-muted);
  flex-shrink: 0;
}
.lb-rank.top-3 { color: var(--gold); }
.lb-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}
.lb-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-coins {
  font-size: 13px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--gold);
}

/* ── Wallet ──────────────────────────────────────────────────── */
.wallet-balance-card {
  margin: 0 16px 16px;
  background: linear-gradient(135deg, #16162a, #0d0d1e);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.wallet-balance-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 50% 50%, #6c63ff08, transparent 70%);
  pointer-events: none;
}
.wallet-balance-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.wallet-balance-amount {
  font-size: 40px;
  font-weight: 800;
  font-family: var(--mono);
  background: linear-gradient(135deg, #f7c948, #f97316);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}
.wallet-badge {
  margin-top: 8px;
  display: inline-block;
}
.wallet-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 16px 16px;
}
.wallet-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
}
.ws-label { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.ws-value { font-size: 18px; font-weight: 700; font-family: var(--mono); color: var(--text); }

/* Withdraw */
.withdraw-section {
  margin: 0 16px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.withdraw-locked {
  margin: 0 16px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  color: var(--text-muted);
}
.withdraw-locked p { font-size: 13px; }
.withdraw-locked strong { color: var(--text); }
.withdraw-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.withdraw-tab {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.withdraw-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* Transactions */
.txn-list {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.txn-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  border: 1px solid var(--border);
}
.txn-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.txn-desc { flex: 1; font-size: 13px; color: var(--text); }
.txn-date { font-size: 11px; color: var(--text-muted); }
.txn-amount {
  font-size: 14px;
  font-weight: 700;
  font-family: var(--mono);
}
.txn-amount.positive { color: var(--green); }
.txn-amount.negative { color: #ef4444; }

/* ── Boost ───────────────────────────────────────────────────── */
.boost-grid {
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.boost-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.boost-card:active { border-color: var(--border-glow); }
.boost-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.boost-info { flex: 1; }
.boost-name { font-size: 15px; font-weight: 700; color: var(--text); }
.boost-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.boost-level { font-size: 11px; color: var(--accent); font-weight: 600; margin-top: 4px; }
.boost-cost {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  font-family: var(--mono);
}

/* ── Challenges ─────────────────────────────────────────────── */
.challenge-hero {
  padding: 24px 16px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  background: linear-gradient(180deg, #16131a, transparent);
}
.challenge-jackpot-icon {
  filter: drop-shadow(0 0 24px #f7c94840);
}
.challenge-hero-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.challenge-hero-sub {
  font-size: 13px;
  color: var(--text-muted);
}
.challenge-entry-cost {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}
.challenge-entry-cost strong { color: var(--gold); }
.challenges-list {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.challenge-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.challenge-img {
  width: 100%;
  height: 120px;
  background: linear-gradient(135deg, #1a1030, #0d0d1a);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.challenge-img svg { opacity: 0.8; }
.challenge-status-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.status-active { background: #10b98133; color: var(--green); border: 1px solid #10b98144; }
.status-upcoming { background: #6c63ff33; color: #a5a1ff; border: 1px solid #6c63ff44; }
.challenge-body { padding: 14px; }
.challenge-title { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.challenge-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.challenge-prize {
  font-size: 18px;
  font-weight: 800;
  font-family: var(--mono);
  color: var(--gold);
}
.challenge-entries { font-size: 12px; color: var(--text-muted); }
.challenge-timer { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }
.challenge-join-btn {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--gold), #f97316);
  color: white;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s;
}
.challenge-join-btn:active { opacity: 0.85; }
.challenge-join-btn.joined {
  background: var(--bg-elevated);
  color: var(--green);
  cursor: default;
  border: 1px solid #10b98140;
}

/* ── Referral ────────────────────────────────────────────────── */
.referral-card {
  margin: 0 16px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.referral-rewards {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.ref-reward-item { text-align: center; }
.ref-reward-val {
  font-size: 28px;
  font-weight: 800;
  font-family: var(--mono);
  color: var(--gold);
}
.ref-reward-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.ref-reward-sep { font-size: 28px; color: var(--text-dim); font-weight: 300; }
.referral-link-section {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ref-link-label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.ref-link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.ref-link-box code {
  flex: 1;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.copy-btn:active { color: var(--accent); }
.referrals-list {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.referral-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.referral-item .ref-name { flex: 1; font-size: 14px; font-weight: 600; }
.referral-item .ref-bonus { font-size: 13px; font-weight: 700; color: var(--gold); font-family: var(--mono); }

/* ── Missions ────────────────────────────────────────────────── */
.missions-list {
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mission-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.mission-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.mission-title { font-size: 14px; font-weight: 700; }
.mission-reward { font-size: 14px; font-weight: 700; color: var(--gold); font-family: var(--mono); }
.mission-progress-bar {
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 6px;
}
.mission-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 99px;
  transition: width 0.5s ease;
}
.mission-progress-text { font-size: 11px; color: var(--text-muted); }

/* ── Bottom Nav ─────────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: color 0.2s;
  padding: 0 4px;
}
.nav-btn.active {
  color: var(--accent);
}
.nav-btn:active { opacity: 0.7; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  outline: none;
  margin-bottom: 10px;
  transition: border-color 0.2s;
}
.form-input:focus { border-color: var(--border-glow); }
.form-input::placeholder { color: var(--text-dim); }
.btn-primary {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-primary:active { opacity: 0.85; }

/* ── Popup ───────────────────────────────────────────────────── */
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.popup-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: 20px;
  padding: 28px 24px;
  text-align: center;
  max-width: 320px;
  width: 100%;
  animation: popup-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes popup-in {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.popup-icon { margin-bottom: 16px; display: flex; justify-content: center; }
.popup-title { font-size: 18px; font-weight: 800; margin-bottom: 8px; }
.popup-message { font-size: 14px; color: var(--text-muted); margin-bottom: 20px; line-height: 1.5; }
.close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  display: flex;
}

/* ── Toast ───────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: calc(var(--header-h) + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 800;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  animation: toast-in 0.3s ease, toast-out 0.3s ease 2.7s forwards;
  pointer-events: none;
}
.toast.success { border-color: #10b98144; color: var(--green); }
.toast.error { border-color: #ef444444; color: #ef4444; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(-10px); }
}

/* ── Skeleton ────────────────────────────────────────────────── */
.skeleton-list { padding: 0; display: flex; flex-direction: column; gap: 10px; }
.skeleton-item {
  height: 72px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}
.skeleton-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent);
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ── Spin Wheel Modal ────────────────────────────────────────── */
.spin-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.spin-modal-inner {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: 24px;
  padding: 28px 24px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.spin-title { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.spin-subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }
.spin-wheel-container {
  position: relative;
  width: 220px;
  height: 220px;
  margin: 0 auto 20px;
}
.spin-wheel-svg { width: 100%; height: 100%; }
.spin-pointer {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 24px solid var(--accent);
  filter: drop-shadow(0 2px 4px rgba(108,99,255,0.5));
}
.spin-btn {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  margin-bottom: 10px;
}
.spin-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.spin-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
  padding: 8px;
}
