/* ============================================================
   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;
}
/* In-app back-to-menu button — always visible on non-main screens */
.topbar-back {
  background: linear-gradient(140deg, var(--neon-soft), rgba(0, 255, 136, 0.05));
  border: 1px solid var(--neon-dim);
  color: var(--neon);
  padding: 7px 14px;
  border-radius: 100px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  display: flex; align-items: center;
  transition: transform 0.15s ease;
}
.topbar-back:active { transform: scale(0.94); }
.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-actions {
  display: flex; flex-direction: column; gap: 8px;
  align-items: stretch;
}
.popup-btn {
  background: linear-gradient(140deg, var(--neon) 0%, #00cc6d 100%);
  color: var(--bg-0);
  border: none;
  border-radius: 100px;
  padding: 14px 30px;
  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); }
.popup-btn-secondary {
  background: var(--bg-2);
  color: var(--text-1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 100px;
  padding: 12px 30px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font: inherit;
}
.popup-btn-secondary:active { transform: scale(0.96); }

/* ============================================================
   Mystery Box cards — hero layout с SVG-сундуками
   ============================================================ */
.cases-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 4px;
}
.case-card {
  background: linear-gradient(160deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  padding: 12px 12px 14px;
  position: relative;
  overflow: hidden;
  display: flex; flex-direction: column;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.2s ease;
}
.case-card:active { transform: scale(0.97); }

/* Tier-specific borders & glows */
.case-card.bronze  { border-color: rgba(205, 127, 50, 0.35); }
.case-card.bronze:active  { box-shadow: 0 0 24px rgba(205, 127, 50, 0.3); }

.case-card.silver  { border-color: rgba(192, 192, 192, 0.35); }
.case-card.silver:active  { box-shadow: 0 0 24px rgba(192, 192, 192, 0.3); }

.case-card.gold {
  border-color: rgba(255, 200, 87, 0.55);
  box-shadow: 0 0 18px rgba(255, 200, 87, 0.12);
}
.case-card.gold:active { box-shadow: 0 0 30px rgba(255, 200, 87, 0.45); }

.case-card.diamond {
  border-color: var(--neon-dim);
  box-shadow: 0 0 22px rgba(0, 255, 136, 0.18);
}
.case-card.diamond:active { box-shadow: 0 0 36px rgba(0, 255, 136, 0.55); }

.case-card.locked { opacity: 0.65; cursor: not-allowed; }
.case-card.cooldown { opacity: 0.85; }

/* Big tile = full-width for premium cases */
.case-card.gold, .case-card.diamond {
  grid-column: span 2;
  flex-direction: row;
  align-items: center;
  padding: 14px 18px;
  gap: 14px;
}
.case-card.gold .case-hero, .case-card.diamond .case-hero {
  flex: 0 0 130px;
  height: 130px;
  margin-bottom: 0;
}
.case-card.gold .case-info, .case-card.diamond .case-info {
  text-align: left;
  flex: 1;
}

.case-hero {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  margin: 4px auto 10px;
  display: flex; align-items: center; justify-content: center;
  animation: case-float 3.4s ease-in-out infinite;
}
@keyframes case-float {
  0%, 100% { transform: translateY(0) rotate(-0.3deg); }
  50% { transform: translateY(-5px) rotate(0.3deg); }
}
.case-card.locked .case-hero { animation: none; filter: grayscale(0.7); }
.case-card.cooldown .case-hero { animation-duration: 5s; }

.case-svg { width: 100%; height: 100%; display: block; overflow: visible; }

/* Coins float independently inside the SVG */
.case-coin {
  transform-origin: center;
  animation: coin-float 2.6s ease-in-out infinite;
}
@keyframes coin-float {
  0%, 100% { transform: translateY(0); opacity: 0.95; }
  50% { transform: translateY(-2px); opacity: 1; }
}

.case-sparkle {
  animation: sparkle-twinkle 1.8s ease-in-out infinite;
}
@keyframes sparkle-twinkle {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.case-lock-overlay {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 40px;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.8));
  z-index: 2;
}

.case-info {
  text-align: center;
  display: flex; flex-direction: column;
  gap: 4px;
}
.case-name {
  font-size: 14px; font-weight: 800;
  letter-spacing: 0.02em;
}
.case-card.gold .case-name, .case-card.diamond .case-name {
  font-size: 17px;
}
.case-prizes-range {
  font-size: 11px; color: var(--text-3);
}
.case-prizes-range b { color: var(--gold); font-weight: 700; }
.case-card.diamond .case-prizes-range b { color: var(--neon); }

.case-status {
  display: inline-block;
  margin-top: 4px;
  font-size: 10px;
  padding: 3px 9px;
  border-radius: 100px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  align-self: center;
}
.case-card.gold .case-status, .case-card.diamond .case-status {
  align-self: flex-start;
  font-size: 11px;
}
.case-status.available { background: var(--neon-soft); color: var(--neon); }
.case-status.cooldown  { background: rgba(255, 200, 87, 0.15); color: var(--gold); }
.case-status.locked    { background: rgba(255, 255, 255, 0.05); color: var(--text-3); }

/* ============================================================
   Case opening animation overlay
   ============================================================ */
.case-anim {
  position: fixed; inset: 0;
  background: rgba(5, 8, 16, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 55;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: popup-in 0.2s ease;
}
.case-anim-box {
  width: 100%;
  max-width: 480px;
  text-align: center;
}
.case-anim-header {
  display: flex; align-items: center; justify-content: center;
  gap: 12px;
  margin-bottom: 18px;
}
.case-anim-emoji { font-size: 36px; }
.case-anim-name { font-size: 20px; font-weight: 800; }

.case-anim-strip-wrap {
  position: relative;
  background: linear-gradient(90deg,
    var(--bg-0) 0%, var(--bg-2) 15%, var(--bg-2) 85%, var(--bg-0) 100%);
  border: 1px solid rgba(0, 255, 136, 0.3);
  border-radius: 18px;
  overflow: hidden;
  height: 130px;
  margin-bottom: 18px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5),
              inset 0 0 30px rgba(0, 0, 0, 0.4);
}
.case-anim-pointer {
  position: absolute;
  top: -8px; left: 50%;
  transform: translateX(-50%);
  font-size: 28px;
  color: var(--neon);
  z-index: 3;
  filter: drop-shadow(0 0 8px var(--neon));
  text-shadow: 0 0 12px var(--neon);
}
.case-anim-pointer.up {
  top: auto; bottom: -8px;
  transform: translateX(-50%) rotate(180deg);
}
.case-anim-strip {
  display: flex;
  height: 100%;
  align-items: center;
  will-change: transform;
  padding: 8px 0;
}
.strip-item {
  flex-shrink: 0;
  width: 108px; height: 116px;
  margin: 0 5px;
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  display: flex; flex-direction: column;
  align-items: center; justify-content: space-between;
  padding: 12px 8px 10px;

  background: linear-gradient(160deg, #14192a 0%, #0a0e1a 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05),
              0 4px 12px rgba(0, 0, 0, 0.4);
}
.strip-item::before {
  /* corner shine */
  content: '';
  position: absolute;
  top: -30%; right: -30%;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12) 0%, transparent 70%);
  pointer-events: none;
}
.strip-item::after {
  /* bottom shimmer line */
  content: '';
  position: absolute;
  bottom: 0; left: 8px; right: 8px;
  height: 2px;
  background: linear-gradient(90deg, transparent, currentColor, transparent);
  opacity: 0.5;
  color: var(--text-3);
}

/* Coin / token visual at top */
.strip-item .si-coin {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 900;
  letter-spacing: -0.05em;
  position: relative;
  background: radial-gradient(circle at 35% 30%, #2a3458 0%, #131a2c 100%);
  border: 2px solid rgba(255, 255, 255, 0.15);
  color: var(--text-2);
  box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.4),
              inset 0 2px 4px rgba(255, 255, 255, 0.15);
}

/* Amount + unit block */
.strip-item .si-amount {
  text-align: center;
  display: flex; flex-direction: column;
  gap: 0;
  align-items: center;
}
.strip-item .si-value {
  font-size: 22px; font-weight: 900;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1;
}
.strip-item .si-unit {
  font-size: 8px;
  color: var(--text-3);
  font-weight: 700;
  letter-spacing: 0.15em;
  margin-top: 2px;
}

/* ---- Tier visuals (common / uncommon / high / epic) ---- */
.strip-item.common {
  border-color: rgba(120, 140, 180, 0.35);
}
.strip-item.uncommon {
  border-color: rgba(180, 200, 220, 0.45);
  background: linear-gradient(160deg, #1c2540 0%, #0e1424 100%);
}
.strip-item.uncommon .si-coin {
  background: radial-gradient(circle at 35% 30%, #c0cbdf 0%, #5a6275 100%);
  color: #1c2540;
  border-color: rgba(255, 255, 255, 0.4);
}
.strip-item.uncommon .si-value { color: #d8e0ee; }
.strip-item.uncommon::after { color: rgba(192, 203, 223, 0.6); }

.strip-item.high {
  border-color: var(--gold);
  background: linear-gradient(160deg, #2a1d04 0%, #14110a 100%);
  box-shadow: inset 0 1px 0 rgba(255, 236, 122, 0.15),
              0 0 20px rgba(255, 200, 87, 0.35);
}
.strip-item.high .si-coin {
  background: radial-gradient(circle at 35% 30%, #ffec7a 0%, #8a5a00 100%);
  color: #3d2a00;
  border-color: rgba(255, 236, 122, 0.6);
  box-shadow: inset 0 -3px 6px rgba(138, 90, 0, 0.6),
              inset 0 2px 4px rgba(255, 236, 122, 0.5),
              0 0 10px rgba(255, 200, 87, 0.5);
}
.strip-item.high .si-value { color: var(--gold); text-shadow: 0 0 10px rgba(255, 200, 87, 0.6); }
.strip-item.high::after { color: var(--gold); }

.strip-item.epic {
  border-color: var(--neon);
  background: linear-gradient(160deg, #04261a 0%, #051114 100%);
  box-shadow: inset 0 1px 0 rgba(160, 255, 214, 0.2),
              0 0 26px var(--neon-dim);
  animation: epic-pulse 1.6s ease-in-out infinite;
}

/* Winning tile — extra scale + shimmer regardless of tier */
.strip-item.winner {
  transform: scale(1.06);
  animation: winner-bounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 4;
}
@keyframes winner-bounce {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.15); }
  100% { transform: scale(1.06); }
}
@keyframes epic-pulse {
  0%, 100% { box-shadow: inset 0 1px 0 rgba(160, 255, 214, 0.2), 0 0 26px var(--neon-dim); }
  50% { box-shadow: inset 0 1px 0 rgba(160, 255, 214, 0.2), 0 0 40px var(--neon); }
}
.strip-item.epic .si-coin {
  background: radial-gradient(circle at 35% 30%, #a0ffd6 0%, #00cc6d 100%);
  color: #003322;
  border-color: rgba(160, 255, 214, 0.7);
  box-shadow: inset 0 -3px 6px rgba(0, 80, 50, 0.6),
              inset 0 2px 4px rgba(255, 255, 255, 0.4),
              0 0 14px var(--neon);
}
.strip-item.epic .si-value { color: var(--neon); text-shadow: 0 0 12px rgba(0, 255, 136, 0.7); }
.strip-item.epic::after { color: var(--neon); }

/* center column highlight */
.case-anim-strip-wrap::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 3px;
  background: linear-gradient(180deg, transparent, var(--neon), transparent);
  transform: translateX(-50%);
  z-index: 2;
  box-shadow: 0 0 12px var(--neon);
  pointer-events: none;
}

.case-anim-hint {
  font-size: 14px;
  color: var(--text-2);
  font-weight: 600;
  min-height: 20px;
}

/* ============================================================
   PROFILE screen
   ============================================================ */
.profile-hero {
  text-align: center;
  padding: 20px 0 10px;
  position: relative;
}
.profile-tier-badge {
  position: relative;
  width: 120px; height: 120px;
  margin: 0 auto 8px;
  display: flex; align-items: center; justify-content: center;
}
.ptb-ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 3px solid var(--gold);
  background: radial-gradient(circle, rgba(255, 200, 87, 0.18) 0%, transparent 70%);
  box-shadow: 0 0 40px rgba(255, 200, 87, 0.4),
              inset 0 0 30px rgba(255, 200, 87, 0.2);
  animation: ptb-rotate 14s linear infinite;
}
.ptb-ring::before {
  content: ''; position: absolute; inset: -3px;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.4);
  opacity: 0.6;
}
@keyframes ptb-rotate { 0% { transform: rotate(0); } 100% { transform: rotate(360deg); } }

.ptb-emoji {
  font-size: 56px;
  filter: drop-shadow(0 4px 16px rgba(255, 200, 87, 0.6));
  position: relative;
  z-index: 1;
}

/* Tier color variants on hero */
.profile-tier-badge.bronze .ptb-ring { border-color: #cd7f32; background: radial-gradient(circle, rgba(205,127,50,0.2) 0%, transparent 70%); box-shadow: 0 0 30px rgba(205,127,50,0.3); }
.profile-tier-badge.silver .ptb-ring { border-color: #c0cbdf; background: radial-gradient(circle, rgba(192,203,223,0.22) 0%, transparent 70%); box-shadow: 0 0 35px rgba(192,203,223,0.4); }
.profile-tier-badge.gold   .ptb-ring { border-color: var(--gold); background: radial-gradient(circle, rgba(255,200,87,0.22) 0%, transparent 70%); box-shadow: 0 0 40px rgba(255,200,87,0.5); }
.profile-tier-badge.diamond .ptb-ring { border-color: var(--neon); background: radial-gradient(circle, rgba(0,255,136,0.22) 0%, transparent 70%); box-shadow: 0 0 44px rgba(0,255,136,0.5); }

.profile-tier-name {
  font-size: 26px; font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: linear-gradient(90deg, var(--gold) 0%, var(--neon) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 2px;
}
.profile-tier-mult { font-size: 13px; color: var(--text-3); margin-bottom: 14px; }

/* ----- Streak block ----- */
.profile-streak {
  background: linear-gradient(140deg, rgba(255, 87, 34, 0.15) 0%, rgba(255, 200, 87, 0.05) 100%);
  border: 1px solid rgba(255, 100, 50, 0.3);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 14px;
  box-shadow: 0 0 16px rgba(255, 100, 50, 0.15);
}
.pstreak-fires {
  font-size: 36px;
  line-height: 1;
  animation: fire-flicker 0.7s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 10px #ff6c00);
}
@keyframes fire-flicker {
  0%   { transform: scale(1)   translateY(0);    filter: drop-shadow(0 0 10px #ff6c00); }
  100% { transform: scale(1.1) translateY(-2px); filter: drop-shadow(0 0 18px #ffaa33); }
}
.pstreak-text { flex: 1; }
.pstreak-count {
  font-size: 22px; font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.pstreak-count span { color: #ffae42; }
.pstreak-sub { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; }

/* ----- Stats grid ----- */
.profile-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
.pstat {
  background: var(--bg-2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 12px 8px;
  text-align: center;
  display: flex; flex-direction: column; gap: 2px;
}
.pstat-icon { font-size: 22px; line-height: 1; margin-bottom: 4px; }
.pstat-val { font-size: 16px; font-weight: 800; color: var(--neon); font-variant-numeric: tabular-nums; }
.pstat-lbl { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }

/* ----- Next tier progress ----- */
.profile-next-tier {
  background: var(--bg-2);
  border: 1px solid var(--neon-soft);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 18px;
}
.pnt-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.pnt-title { font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.pnt-tier { font-size: 16px; font-weight: 800; }
.pnt-bar {
  height: 8px; background: var(--bg-3);
  border-radius: 100px; overflow: hidden;
  margin-bottom: 8px;
}
.pnt-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--neon) 0%, var(--gold) 100%);
  border-radius: 100px;
  box-shadow: 0 0 8px var(--neon-dim);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.pnt-req { font-size: 12px; color: var(--text-2); line-height: 1.7; }
.pnt-req b { color: var(--text-1); }

/* ----- Section headings ----- */
.profile-section-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 15px; font-weight: 800;
  margin-bottom: 12px;
}
.psec-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--neon);
  background: var(--neon-soft);
  padding: 3px 10px;
  border-radius: 100px;
}

/* ----- Achievements grid ----- */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}
.ach-card {
  aspect-ratio: 1;
  background: var(--bg-2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 8px 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  text-align: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.ach-card:active { transform: scale(0.92); }

.ach-card.unlocked {
  border-color: var(--gold);
  background: linear-gradient(140deg, rgba(255, 200, 87, 0.18) 0%, rgba(255, 200, 87, 0.02) 100%);
  box-shadow: 0 0 12px rgba(255, 200, 87, 0.15);
}
.ach-card.unlocked::before {
  /* corner shine */
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 50px; height: 50px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 236, 122, 0.4) 0%, transparent 70%);
}
.ach-card.locked { opacity: 0.5; }
.ach-card.locked .ach-emoji { filter: grayscale(1); }

.ach-emoji {
  font-size: 28px;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
  position: relative;
}
.ach-name {
  font-size: 9px;
  color: var(--text-2);
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.ach-card.unlocked .ach-name { color: var(--text-1); }
.ach-reward {
  font-size: 10px;
  font-weight: 800;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.ach-card.locked .ach-reward { color: var(--text-3); }

/* Lock badge for locked achievements */
.ach-card.locked::after {
  content: '🔒';
  position: absolute;
  bottom: 4px; right: 4px;
  font-size: 10px;
  opacity: 0.8;
}

.profile-id {
  text-align: center;
  font-size: 11px;
  color: var(--text-3);
  margin-top: 10px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}
.profile-id code {
  font-family: ui-monospace, "SF Mono", monospace;
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 8px;
  border-radius: 6px;
}

/* ============================================================
   MILESTONE banner (on main screen)
   ============================================================ */
.milestone-banner {
  background: linear-gradient(140deg, rgba(255, 87, 34, 0.25) 0%, rgba(255, 200, 87, 0.15) 100%);
  border: 1.5px solid var(--gold);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 16px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(255, 200, 87, 0.25);
  animation: ms-pulse 2.4s ease-in-out infinite;
}
@keyframes ms-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(255, 200, 87, 0.25); }
  50% { box-shadow: 0 0 32px rgba(255, 200, 87, 0.45); }
}
.milestone-banner:active { transform: scale(0.98); }
.mb-ribbon {
  position: absolute;
  top: 8px; right: -28px;
  background: var(--gold);
  color: var(--bg-0);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.1em;
  padding: 2px 30px;
  transform: rotate(35deg);
  z-index: 1;
}
.mb-emoji { font-size: 40px; animation: bounce 0.8s ease infinite alternate; }
.mb-text { flex: 1; min-width: 0; }
.mb-title { font-size: 17px; font-weight: 800; color: var(--gold); }
.mb-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.mb-arrow { font-size: 22px; color: var(--gold); font-weight: 800; }

/* ============================================================
   TOURNAMENTS
   ============================================================ */
.tour-tabs {
  display: flex; gap: 8px;
  margin-bottom: 14px;
}
.tour-tab {
  flex: 1;
  background: var(--bg-2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-2);
  padding: 12px;
  border-radius: var(--radius-md);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.tour-tab:active { transform: scale(0.97); }
.tour-tab.active {
  background: linear-gradient(140deg, rgba(0,255,136,0.18) 0%, rgba(0,255,136,0.04) 100%);
  border-color: var(--neon-dim);
  color: var(--neon);
  box-shadow: 0 0 12px rgba(0, 255, 136, 0.2);
}

.tour-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.tour-info-block {
  background: var(--bg-2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  text-align: center;
}
.til { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.tiv { font-size: 17px; font-weight: 800; color: var(--neon); font-variant-numeric: tabular-nums; }
.tiv small { font-size: 11px; color: var(--text-3); font-weight: 600; }

.tour-prizes {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 18px;
  -webkit-overflow-scrolling: touch;
}
.tour-prizes::-webkit-scrollbar { display: none; }
.tour-prize-chip {
  flex-shrink: 0;
  background: var(--bg-2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 100px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.tour-prize-chip.medal-1 { background: linear-gradient(140deg, rgba(255,200,87,0.25), rgba(255,200,87,0.08)); border-color: var(--gold); color: var(--gold); }
.tour-prize-chip.medal-2 { background: linear-gradient(140deg, rgba(192,203,223,0.2), rgba(192,203,223,0.05)); border-color: rgba(192,203,223,0.5); color: #d8e0ee; }
.tour-prize-chip.medal-3 { background: linear-gradient(140deg, rgba(205,127,50,0.2), rgba(205,127,50,0.05)); border-color: rgba(205,127,50,0.5); color: #cd7f32; }

.tour-leaderboard {
  display: flex; flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.tour-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--bg-2);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-md);
}
.tour-row.is-me {
  background: linear-gradient(140deg, rgba(0,255,136,0.15) 0%, rgba(0,255,136,0.02) 100%);
  border-color: var(--neon);
  box-shadow: 0 0 14px rgba(0, 255, 136, 0.2);
}
.tour-row.gold-1 { border-color: var(--gold); }
.tour-row.divider {
  background: transparent;
  border: none;
  text-align: center;
  color: var(--text-3);
  padding: 4px;
  font-size: 18px;
}
.tr-rank {
  width: 36px;
  text-align: center;
  font-size: 18px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.tr-name { flex: 1; font-size: 14px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tour-row.is-me .tr-name { color: var(--neon); }
.tr-score {
  font-size: 14px;
  font-weight: 800;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.tour-rules {
  font-size: 11px;
  color: var(--text-3);
  text-align: center;
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
}

/* ============================================================
   TOURNAMENT — NEW (banner, progress, feed, scrollable LB, urgency)
   ============================================================ */

/* 🆕 Prize pool banner — gold accent gradient */
.tour-pool-banner {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  margin: 12px 0;
  background: linear-gradient(135deg, rgba(255, 200, 87, 0.18), rgba(255, 100, 50, 0.10) 80%);
  border: 1px solid rgba(255, 200, 87, 0.4);
  border-radius: var(--radius-md);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.tour-pool-banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.06) 50%, transparent 70%);
  animation: tpb-shine 3.2s ease-in-out infinite;
}
.tour-pool-banner .tpb-day {
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--gold);
  text-transform: uppercase;
  font-weight: 700;
  z-index: 1;
}
.tour-pool-banner .tpb-pool {
  font-size: 20px;
  color: #fff;
  font-weight: 600;
  z-index: 1;
}
.tour-pool-banner .tpb-pool b { color: var(--gold); font-weight: 800; font-size: 26px; }
.tour-pool-banner .tpb-players {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  z-index: 1;
}
.tour-pool-banner .tpb-players b { color: var(--neon); }
@keyframes tpb-shine {
  0%, 100% { transform: translateX(-100%); }
  50%      { transform: translateX(100%); }
}

/* 🆕 Progress to next prize tier */
.tour-progress {
  padding: 10px 14px;
  margin: 6px 0 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
}
.tour-progress.in-prize {
  background: linear-gradient(135deg, rgba(0, 255, 136, 0.10), rgba(0, 255, 136, 0.03));
  border-color: rgba(0, 255, 136, 0.4);
}
.tprog-text {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 8px;
  text-align: center;
}
.tprog-text b { color: var(--gold); }
.tour-progress.in-prize .tprog-text b { color: var(--neon); }
.tprog-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
}
.tprog-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), #ffe293);
  width: 0%;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.tour-progress.in-prize .tprog-fill {
  background: linear-gradient(90deg, var(--neon), #aaffd0);
}

/* 🆕 Live activity feed (ticker) */
.tour-feed-wrap {
  margin: 14px 0 10px;
}
.tour-feed-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-3);
  padding: 0 4px 6px;
}
.tour-feed {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 120px;
}
.tour-feed-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-left: 2px solid var(--neon);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.3;
  color: var(--text-2);
  opacity: 0;
  transform: translateX(-8px);
  animation: tfeed-in 0.45s ease-out forwards;
}
.tour-feed-row.kind-overtake { border-left-color: var(--gold); background: linear-gradient(90deg, rgba(255,200,87,0.08), rgba(255,255,255,0.03)); }
.tour-feed-row.kind-top3     { border-left-color: #ff6868; background: linear-gradient(90deg, rgba(255,104,104,0.12), rgba(255,255,255,0.03)); font-weight: 600; }
.tour-feed-row .tf-msg {
  flex: 1 1 auto;
  min-width: 0;             /* allow shrinking inside flex */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;       /* one-line message, ellipsis if too long */
}
.tour-feed-row .tf-time {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
}
@keyframes tfeed-in {
  to { opacity: 1; transform: translateX(0); }
}

/* 🆕 Scrollable leaderboard for top-50 */
.tour-leaderboard.scrollable {
  max-height: 340px;
  overflow-y: auto;
  padding-right: 4px;
}
.tour-leaderboard.scrollable::-webkit-scrollbar { width: 4px; }
.tour-leaderboard.scrollable::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 4px; }

/* Row-swap animation when leaderboard re-renders */
.tour-row.was-up {
  animation: trow-flash-up 1s ease-out;
}
.tour-row.was-down {
  animation: trow-flash-down 1s ease-out;
}
@keyframes trow-flash-up {
  0%   { background: rgba(0, 255, 136, 0.25); transform: scale(1.02); }
  100% { background: initial; transform: scale(1); }
}
@keyframes trow-flash-down {
  0%   { background: rgba(255, 80, 80, 0.18); }
  100% { background: initial; }
}

/* 🆕 Urgency countdown (last 30 minutes pulse red) */
#tour-countdown.urgency {
  color: #ff5252;
  animation: countdown-pulse 1s ease-in-out infinite;
  font-weight: 800;
}
@keyframes countdown-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}

/* ============================================================
   REFERRAL
   ============================================================ */
.ref-hero {
  text-align: center;
  padding: 24px 16px;
  background: linear-gradient(160deg, rgba(155, 109, 255, 0.18) 0%, rgba(155, 109, 255, 0.02) 100%);
  border: 1px solid rgba(155, 109, 255, 0.35);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.ref-hero::before {
  content: '';
  position: absolute;
  inset: -50% -25% auto auto;
  width: 250px; height: 250px;
  background: radial-gradient(circle, rgba(155, 109, 255, 0.3), transparent 70%);
  pointer-events: none;
}
.ref-hero-emoji { font-size: 56px; margin-bottom: 8px; filter: drop-shadow(0 4px 16px rgba(155, 109, 255, 0.5)); }
.ref-hero-title { font-size: 22px; font-weight: 900; margin-bottom: 4px; position: relative; }
.ref-hero-sub { font-size: 13px; color: var(--text-2); position: relative; }
.ref-hero-sub b { color: var(--purple); }

.ref-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.ref-stat {
  background: var(--bg-2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 14px 8px;
  text-align: center;
}
.ref-stat-val { font-size: 22px; font-weight: 900; color: var(--neon); font-variant-numeric: tabular-nums; }
.ref-stat-lbl { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }

.ref-link-box {
  background: var(--bg-2);
  border: 1px solid var(--neon-soft);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 16px;
}
.ref-link-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.ref-link-text {
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 13px;
  color: var(--neon);
  word-break: break-all;
  background: rgba(0, 0, 0, 0.3);
  padding: 8px 10px;
  border-radius: 8px;
}

.ref-actions {
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 16px;
}
.ref-actions .big-btn { min-width: 0; width: 100%; }

.big-btn.secondary {
  background: var(--bg-2);
  color: var(--text-1);
  border: 1px solid var(--neon-dim);
  box-shadow: none;
}
.big-btn.secondary:active { transform: scale(0.96); }

.ref-bonus-note {
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
}
.ref-bonus-note b { color: var(--gold); }

/* ============================================================
   Subscription modal (for milestone + energy refill)
   ============================================================ */
.popup-card.sub-card {
  max-width: 360px;
  padding: 28px 22px;
}
.popup-card.sub-card .big-btn {
  width: 100%;
  min-width: 0;
  margin-bottom: 10px;
  text-decoration: none;
}
.sub-link-btn { display: flex; flex-direction: column; align-items: center; }
.sub-close {
  background: none;
  border: none;
  color: var(--text-3);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 8px;
  margin-top: 4px;
}

/* ============================================================
   TIER-UP celebration overlay
   ============================================================ */
.tier-up {
  position: fixed; inset: 0;
  background: radial-gradient(circle at 50% 40%, rgba(255, 200, 87, 0.25) 0%, rgba(5, 8, 16, 0.95) 60%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 70;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 30px;
  text-align: center;
  animation: tu-in 0.3s ease;
}
@keyframes tu-in { 0% { opacity: 0; } 100% { opacity: 1; } }

.tu-burst {
  position: absolute;
  top: 50%; left: 50%;
  width: 400px; height: 400px;
  transform: translate(-50%, -45%);
  background:
    radial-gradient(circle, rgba(0, 255, 136, 0.18) 0%, transparent 50%),
    conic-gradient(from 0deg, transparent 0deg, rgba(255, 200, 87, 0.18) 30deg, transparent 60deg,
                                rgba(255, 200, 87, 0.18) 90deg, transparent 120deg,
                                rgba(255, 200, 87, 0.18) 150deg, transparent 180deg,
                                rgba(255, 200, 87, 0.18) 210deg, transparent 240deg,
                                rgba(255, 200, 87, 0.18) 270deg, transparent 300deg,
                                rgba(255, 200, 87, 0.18) 330deg, transparent 360deg);
  border-radius: 50%;
  animation: tu-burst-spin 8s linear infinite;
  pointer-events: none;
}
@keyframes tu-burst-spin { 0% { transform: translate(-50%, -45%) rotate(0); } 100% { transform: translate(-50%, -45%) rotate(360deg); } }

.tu-badge {
  width: 140px; height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 200, 87, 0.25) 0%, transparent 70%);
  border: 4px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 24px;
  box-shadow: 0 0 60px var(--gold), inset 0 0 30px rgba(255, 200, 87, 0.4);
  animation: tu-badge-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 1;
}
@keyframes tu-badge-pop {
  0% { transform: scale(0.4) rotate(-15deg); opacity: 0; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.tu-emoji {
  font-size: 80px;
  filter: drop-shadow(0 0 20px var(--gold));
}
.tu-label {
  font-size: 13px;
  letter-spacing: 0.25em;
  color: var(--text-3);
  font-weight: 700;
  margin-bottom: 4px;
  z-index: 1;
}
.tu-name {
  font-size: 42px;
  font-weight: 900;
  letter-spacing: 0.04em;
  background: linear-gradient(90deg, var(--gold) 0%, var(--neon) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
  z-index: 1;
}
.tu-perks {
  font-size: 15px;
  color: var(--text-2);
  margin-bottom: 32px;
  z-index: 1;
}
.tu-close-btn {
  z-index: 1;
  min-width: 240px;
}

/* ============================================================
   Loading skeletons
   ============================================================ */
.sk-block {
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.04) 100%);
  background-size: 200% 100%;
  animation: sk-shimmer 1.6s ease-in-out infinite;
  border-radius: var(--radius-sm);
  display: block;
}
@keyframes sk-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Pull-to-feel: subtle bounce when reaching screen */
.screen { transform-origin: top; }

/* ============================================================
   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); }
}
