:root {
  --bg-top: #071226;
  --bg-mid: #0c1e3e;
  --bg-bottom: #061022;
  --card-bg: rgba(17, 34, 64, 0.92);
  --card-bg-elevated: rgba(23, 44, 82, 0.95);
  --card-border: rgba(96, 189, 255, 0.16);
  --card-border-strong: rgba(0, 212, 255, 0.34);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --cyan-primary: #00d4ff;
  --cyan-dark: #0284c7;
  --purple-promo: #9333ea;
  --purple-light: #c084fc;
  --gold-accent: #f59e0b;
  --gold-light: #fbbf24;
  --emerald-reward: #10b981;
  --emerald-light: #34d399;
  --rose-danger: #f43f5e;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

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

html,
body {
  width: 100%;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 50%, var(--bg-bottom) 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  font-size: 14px;
  line-height: 1.45;
  overflow-x: hidden;
}

/* Desktop frame wrapper so mobile-first 360px+ layout looks great on both mobile and desktop */
.app-shell {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  padding-top: calc(10px + var(--safe-top));
  padding-bottom: calc(116px + var(--safe-bottom));
  padding-left: 14px;
  padding-right: 14px;
  position: relative;
}

@media (min-width: 768px) {
  body {
    padding: 16px 0;
  }
  .app-shell {
    max-width: 520px;
    border: 1px solid rgba(96, 189, 255, 0.18);
    border-radius: 28px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
    background: linear-gradient(180deg, #08152d 0%, #0d2144 52%, #071226 100%);
  }
}

/* Top Brand Header */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 4px 12px;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.brand-logo-svg {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35);
  flex-shrink: 0;
}

.brand-title {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #ffffff 0%, #7dd3fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 10px;
  color: var(--text-secondary);
  display: block;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.balance-pill {
  min-height: 44px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(15, 31, 58, 0.92);
  border: 1px solid rgba(16, 185, 129, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.balance-pill:hover {
  border-color: var(--emerald-light);
}

.icon-btn-44 {
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(17, 34, 64, 0.85);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.icon-btn-44.active-admin {
  border-color: rgba(245, 158, 11, 0.5);
  color: var(--gold-light);
}

/* Sample Economy Disclaimer Banner */
.sample-banner {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.32);
  border-radius: 14px;
  padding: 8px 12px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: #fde68a;
}

.demo-switcher-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(15, 29, 56, 0.88);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 6px 10px;
  margin-bottom: 12px;
  font-size: 12px;
}

/* Cards & Grid Layouts */
.nv-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 10px 26px rgba(2, 8, 23, 0.42);
}

.nv-card-purple {
  background: linear-gradient(145deg, rgba(59, 21, 97, 0.88) 0%, rgba(28, 25, 68, 0.94) 100%);
  border: 1px solid rgba(168, 85, 247, 0.38);
}

.nv-card-gold {
  background: linear-gradient(145deg, rgba(45, 35, 20, 0.92) 0%, rgba(19, 31, 58, 0.95) 100%);
  border: 1px solid rgba(245, 158, 11, 0.36);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

@media (max-width: 359px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

.card-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.amount-lg {
  font-size: 24px;
  font-weight: 800;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.amount-emerald {
  color: var(--emerald-light);
}

.amount-gold {
  color: var(--gold-light);
}

.usdt-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.22);
  color: var(--emerald-light);
  font-size: 11px;
  font-weight: 800;
}

.subtext-sm {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Progress Bar */
.progress-track {
  width: 100%;
  height: 8px;
  background: rgba(15, 23, 42, 0.85);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #00d4ff 0%, #10b981 100%);
  transition: width 0.25s ease;
}

/* Buttons (All >= 44px touch target) */
.btn {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
  text-decoration: none;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

.btn-block {
  width: 100%;
}

.btn-cyan {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.32);
}

.btn-purple {
  background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(147, 51, 234, 0.38);
}

.btn-gold {
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  color: #0f172a;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.34);
}

.btn-emerald {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
}

.btn-slate {
  background: rgba(30, 48, 82, 0.9);
  border-color: rgba(148, 163, 184, 0.24);
  color: var(--text-primary);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.18);
  border-color: rgba(244, 63, 94, 0.45);
  color: #fda4af;
}

/* Section Headers & Pills */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 2px 10px;
}

.section-title {
  font-size: 17px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.badge-gold {
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.42);
  color: var(--gold-light);
}

.badge-emerald {
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.38);
  color: var(--emerald-light);
}

.badge-purple {
  background: rgba(168, 85, 247, 0.2);
  border: 1px solid rgba(168, 85, 247, 0.42);
  color: #d8b4fe;
}

.badge-slate {
  background: rgba(51, 65, 85, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #cbd5e1;
}

/* Segmented Tabs */
.segmented-tabs {
  display: flex;
  background: rgba(10, 22, 44, 0.92);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 14px;
}

.seg-tab {
  flex: 1;
  min-height: 44px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 8px;
}

.seg-tab.active {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(14, 165, 233, 0.35);
}

/* Contest Podium (Top 3) */
.podium-grid {
  display: grid;
  grid-template-columns: 1fr 1.12fr 1fr;
  align-items: end;
  gap: 8px;
  margin: 18px 0 14px;
}

.podium-col {
  text-align: center;
}

.podium-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  margin: 0 auto 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  position: relative;
}

.podium-rank-1 .podium-avatar {
  width: 58px;
  height: 58px;
  background: rgba(245, 158, 11, 0.22);
  border: 2px solid var(--gold-light);
  color: var(--gold-light);
}

.podium-rank-2 .podium-avatar {
  background: rgba(148, 163, 184, 0.22);
  border: 2px solid #cbd5e1;
  color: #f1f5f9;
}

.podium-rank-3 .podium-avatar {
  background: rgba(217, 119, 6, 0.22);
  border: 2px solid #f59e0b;
  color: #fde68a;
}

.podium-pedestal {
  border-radius: 16px;
  padding: 14px 8px;
  margin-top: 8px;
  border: 1px solid var(--card-border);
}

.podium-rank-1 .podium-pedestal {
  min-height: 118px;
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.24) 0%, rgba(120, 83, 24, 0.32) 100%);
  border-color: rgba(245, 158, 11, 0.45);
}

.podium-rank-2 .podium-pedestal {
  min-height: 98px;
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.2) 0%, rgba(51, 65, 85, 0.35) 100%);
}

.podium-rank-3 .podium-pedestal {
  min-height: 92px;
  background: linear-gradient(180deg, rgba(180, 83, 9, 0.2) 0%, rgba(68, 40, 22, 0.35) 100%);
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 12px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(8, 18, 38, 0.9);
  color: var(--text-primary);
  font-size: 13.5px;
}

.form-input:focus {
  outline: none;
  border-color: var(--cyan-primary);
}

/* Bottom Navigation Bar (5 items, center floating badge) */
.bottom-nav-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 12px calc(10px + var(--safe-bottom));
  z-index: 40;
  pointer-events: none;
}

.bottom-nav {
  max-width: 460px;
  margin: 0 auto;
  height: 68px;
  background: rgba(12, 25, 49, 0.96);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(96, 189, 255, 0.22);
  border-radius: 24px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  padding: 0 6px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
  pointer-events: auto;
}

.nav-item {
  min-height: 52px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 16px;
}

.nav-item.active {
  color: var(--cyan-primary);
  background: rgba(14, 165, 233, 0.14);
}

.nav-item-center {
  position: relative;
  top: -14px;
}

.nav-center-orb {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00d4ff 0%, #0284c7 100%);
  border: 3px solid #0a1933;
  box-shadow: 0 6px 18px rgba(0, 212, 255, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 900;
  font-size: 16px;
}

.nav-item-center.active .nav-center-orb {
  box-shadow: 0 0 22px rgba(0, 212, 255, 0.85);
}

/* Modal & Toast */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 9, 23, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 80;
}

.modal-card {
  width: 100%;
  max-width: 420px;
  background: #102140;
  border: 1px solid var(--card-border-strong);
  border-radius: 22px;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65);
}

.toast-banner {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 440px;
  width: calc(100% - 28px);
  background: #0f2942;
  border: 1px solid var(--cyan-primary);
  color: #ffffff;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 600;
  z-index: 90;
  pointer-events: none;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

.toast-banner.error {
  background: #3b1224;
  border-color: var(--rose-danger);
  color: #fecdd3;
}
