/* ============================================================
   BaseXP — Crypto Tamagotchi | shared.css
   Design System v2.0 — neon-dark, juicy, addictive
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700;800&display=swap');

/* ════════════════════════════════════════════════════════════
   TOKENS
   ════════════════════════════════════════════════════════════ */
:root {
  /* Backgrounds */
  --bg-deep:        #04060f;
  --bg-base:        #070b18;
  --bg-card:        #0c1426;
  --bg-card-2:      #101a31;
  --bg-card-hover:  #142340;
  --bg-modal:       #0a1322;
  --bg-elev:        #0e1830;

  /* Neon accents */
  --neon-blue:      #2bd6ff;
  --neon-cyan:      #00ffea;
  --neon-green:     #2bff9e;
  --neon-yellow:    #ffe14d;
  --neon-gold:      #ffc94d;
  --neon-purple:    #b76bff;
  --neon-pink:      #ff4d97;
  --neon-orange:    #ff8a3d;
  --neon-red:       #ff5470;

  /* Semantic */
  --color-hunger:   #ff7a45;
  --color-water:    #2bd6ff;
  --color-happy:    #ffe14d;
  --color-energy:   #2bff9e;
  --color-xp:       #b76bff;
  --color-usdc:     #3b82f6;

  /* Text */
  --text-primary:   #eef3ff;
  --text-secondary: #8ea0c9;
  --text-muted:     #4a5d8a;
  --text-accent:    #2bd6ff;

  /* Borders */
  --border-subtle:  rgba(43, 214, 255, 0.09);
  --border-glow:    rgba(43, 214, 255, 0.28);
  --border-active:  rgba(43, 214, 255, 0.65);

  /* Shadows */
  --shadow-card:    0 6px 30px rgba(0, 0, 0, 0.55);
  --shadow-deep:    0 18px 60px rgba(0, 0, 0, 0.6);
  --shadow-neon:    0 0 22px rgba(43, 214, 255, 0.32);
  --glow-blue:      0 0 34px rgba(43, 214, 255, 0.45);
  --glow-green:     0 0 34px rgba(43, 255, 158, 0.42);
  --glow-yellow:    0 0 34px rgba(255, 225, 77, 0.42);
  --glow-purple:    0 0 34px rgba(183, 107, 255, 0.45);
  --glow-pink:      0 0 34px rgba(255, 77, 151, 0.45);
  --glow-gold:      0 0 38px rgba(255, 201, 77, 0.5);

  /* Gradients */
  --grad-blue:    linear-gradient(135deg, #2bd6ff 0%, #4f7dff 100%);
  --grad-green:   linear-gradient(135deg, #2bff9e 0%, #14c6ff 100%);
  --grad-gold:    linear-gradient(135deg, #ffe14d 0%, #ff9d2f 100%);
  --grad-purple:  linear-gradient(135deg, #b76bff 0%, #6b4dff 100%);
  --grad-pink:    linear-gradient(135deg, #ff4d97 0%, #b76bff 100%);
  --grad-fire:    linear-gradient(135deg, #ff8a3d 0%, #ff4d70 100%);
  --grad-mythic:  linear-gradient(135deg, #ffe14d 0%, #ff4d97 45%, #b76bff 100%);

  /* Type */
  --font-display: 'Sora', sans-serif;
  --font-main:    'Space Grotesk', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  /* Spacing */
  --sp-xs: 4px; --sp-sm: 8px; --sp-md: 16px; --sp-lg: 24px;
  --sp-xl: 32px; --sp-2xl: 48px; --sp-3xl: 64px;

  /* Radius */
  --r-sm: 10px; --r-md: 14px; --r-lg: 18px; --r-xl: 26px; --r-full: 9999px;

  /* Easing */
  --ease-out:    cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-bounce: cubic-bezier(0.68, -0.6, 0.32, 1.6);

  /* Z */
  --z-bg: 0; --z-base: 1; --z-card: 10; --z-nav: 100;
  --z-overlay: 200; --z-modal: 300; --z-toast: 400; --z-top: 999;

  --maxw: 480px;
}

/* ════════════════════════════════════════════════════════════
   RESET
   ════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font-main);
  background-color: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }
input, select, textarea { font-family: inherit; }
img, svg { display: block; max-width: 100%; }
ul, ol { list-style: none; }

::-webkit-scrollbar { width: 0; height: 0; }
::selection { background: rgba(43, 214, 255, 0.3); color: #fff; }

.hidden { display: none !important; }

/* ════════════════════════════════════════════════════════════
   BACKGROUND SCENE
   ════════════════════════════════════════════════════════════ */
.bg-scene { position: fixed; inset: 0; z-index: var(--z-bg); pointer-events: none; overflow: hidden; }

.bg-scene::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 85% 55% at 18% 6%, rgba(43, 214, 255, 0.10) 0%, transparent 58%),
    radial-gradient(ellipse 70% 55% at 84% 88%, rgba(183, 107, 255, 0.09) 0%, transparent 56%),
    radial-gradient(ellipse 55% 45% at 52% 48%, rgba(43, 255, 158, 0.05) 0%, transparent 52%);
  animation: bgPulse 14s ease-in-out infinite alternate;
}
.bg-scene::after {
  content: ''; position: absolute; inset: -50%; width: 200%; height: 200%;
  background-image:
    linear-gradient(rgba(43, 214, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(43, 214, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 30%, #000 30%, transparent 80%);
  animation: gridScroll 24s linear infinite;
}
@keyframes bgPulse { 0% { opacity: 0.65; transform: scale(1); } 100% { opacity: 1; transform: scale(1.06); } }
@keyframes gridScroll { 0% { transform: translate(0,0); } 100% { transform: translate(44px,44px); } }

.bg-orb { position: absolute; border-radius: 50%; filter: blur(70px); animation: orbFloat 17s ease-in-out infinite; }
.bg-orb--1 { width: 320px; height: 320px; background: rgba(43,214,255,0.10); top: -110px; left: -90px; }
.bg-orb--2 { width: 270px; height: 270px; background: rgba(183,107,255,0.09); bottom: 90px; right: -70px; animation-delay: -6s; }
.bg-orb--3 { width: 220px; height: 220px; background: rgba(43,255,158,0.06); top: 48%; left: 50%; transform: translate(-50%,-50%); animation-delay: -11s; }
@keyframes orbFloat { 0%,100% { transform: translateY(0) scale(1); } 33% { transform: translateY(-34px) scale(1.06); } 66% { transform: translateY(22px) scale(0.94); } }

/* Star field */
.bg-stars { position: fixed; inset: 0; z-index: var(--z-bg); pointer-events: none; }
.bg-star { position: absolute; width: 2px; height: 2px; background: #fff; border-radius: 50%; opacity: 0.5; animation: twinkle 3s ease-in-out infinite; }
@keyframes twinkle { 0%,100% { opacity: 0.15; } 50% { opacity: 0.8; } }

/* ════════════════════════════════════════════════════════════
   LAYOUT
   ════════════════════════════════════════════════════════════ */
.app-wrapper {
  position: relative; z-index: var(--z-base);
  max-width: var(--maxw); margin: 0 auto;
  padding: 0 var(--sp-md) calc(96px + env(safe-area-inset-bottom));
  min-height: 100dvh;
}

.page-bottom { height: 24px; }

/* ════════════════════════════════════════════════════════════
   HEADER
   ════════════════════════════════════════════════════════════ */
.app-header {
  position: sticky; top: 0; z-index: var(--z-nav);
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 14px) 2px 12px;
  margin-bottom: var(--sp-sm);
  background: linear-gradient(180deg, var(--bg-deep) 60%, transparent);
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 9px; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--grad-blue); display: grid; place-items: center;
  font-size: 20px; box-shadow: var(--glow-blue);
  animation: logoBob 3.5s var(--ease-out) infinite;
}
@keyframes logoBob { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-3px) rotate(3deg); } }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 19px; letter-spacing: -0.03em; }
.brand-name b { background: var(--grad-blue); -webkit-background-clip: text; background-clip: text; color: transparent; }

.wallet-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 13px; border-radius: var(--r-full);
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  transition: all 0.25s var(--ease-out);
}
.wallet-chip:active { transform: scale(0.96); }
.wallet-chip.connected { border-color: var(--border-glow); box-shadow: var(--shadow-neon); }
.wallet-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); transition: all 0.3s; }
.wallet-chip.connected .wallet-dot { background: var(--neon-green); box-shadow: 0 0 10px var(--neon-green); animation: dotPulse 2s infinite; }
@keyframes dotPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.wallet-balance { color: var(--neon-green); font-weight: 700; }

/* ════════════════════════════════════════════════════════════
   TYPOGRAPHY HELPERS
   ════════════════════════════════════════════════════════════ */
.text-gradient-blue { background: var(--grad-blue); -webkit-background-clip: text; background-clip: text; color: transparent; }
.text-gradient-gold { background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; color: transparent; }
.text-gradient-purple { background: var(--grad-purple); -webkit-background-clip: text; background-clip: text; color: transparent; }
.text-gradient-mythic { background: var(--grad-mythic); -webkit-background-clip: text; background-clip: text; color: transparent; background-size: 200% auto; animation: shimmerText 4s linear infinite; }
@keyframes shimmerText { to { background-position: 200% center; } }
.mono { font-family: var(--font-mono); }

.section-header { display: flex; align-items: center; justify-content: space-between; margin: 22px 2px 12px; }
.section-title { font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.section-badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 4px 9px; border-radius: var(--r-full);
  background: rgba(43,255,158,0.12); color: var(--neon-green); border: 1px solid rgba(43,255,158,0.25);
}
.section-badge--usdc { background: rgba(59,130,246,0.14); color: #6ea8ff; border-color: rgba(59,130,246,0.3); }

/* Flex utils */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-sm { gap: var(--sp-sm); }
.gap-md { gap: var(--sp-md); }

/* ════════════════════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 20px; border-radius: var(--r-md);
  font-family: var(--font-main); font-weight: 700; font-size: 15px;
  letter-spacing: -0.01em; position: relative; overflow: hidden;
  transition: transform 0.18s var(--ease-spring), box-shadow 0.25s, filter 0.2s;
  white-space: nowrap;
}
.btn::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at var(--mx,50%) var(--my,50%), rgba(255,255,255,0.25), transparent 60%);
  opacity: 0; transition: opacity 0.3s;
}
.btn:hover::after { opacity: 1; }
.btn:active { transform: scale(0.95); }
.btn:disabled { opacity: 0.4; pointer-events: none; filter: grayscale(0.5); }

.btn--primary { background: var(--grad-blue); color: #00121f; box-shadow: var(--glow-blue); }
.btn--green   { background: var(--grad-green); color: #00200f; box-shadow: var(--glow-green); }
.btn--gold    { background: var(--grad-gold); color: #2a1800; box-shadow: var(--glow-gold); }
.btn--yellow  { background: var(--grad-gold); color: #2a1800; box-shadow: var(--glow-gold); }
.btn--purple  { background: var(--grad-purple); color: #fff; box-shadow: var(--glow-purple); }
.btn--ghost   { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border-subtle); }
.btn--ghost:hover { border-color: var(--border-glow); background: var(--bg-card-hover); }
.btn--full { width: 100%; }
.btn--lg { padding: 16px 24px; font-size: 16px; }
.btn--sm { padding: 9px 14px; font-size: 13px; border-radius: var(--r-sm); }

/* Sheen sweep on premium buttons */
.btn--shine::before {
  content: ''; position: absolute; top: 0; left: -120%; width: 60%; height: 100%;
  background: linear-gradient(110deg, transparent, rgba(255,255,255,0.35), transparent);
  transform: skewX(-20deg); animation: sheen 3.2s ease-in-out infinite;
}
@keyframes sheen { 0% { left: -120%; } 55%,100% { left: 160%; } }

/* ════════════════════════════════════════════════════════════
   CARDS
   ════════════════════════════════════════════════════════════ */
.card {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg); padding: var(--sp-md);
  box-shadow: var(--shadow-card); position: relative; overflow: hidden;
}
.card--glow { border-color: var(--border-glow); box-shadow: var(--shadow-card), var(--shadow-neon); }

/* ════════════════════════════════════════════════════════════
   CHARACTER STAGE
   ════════════════════════════════════════════════════════════ */
.char-section { position: relative; margin-top: 6px; }

.critical-banner {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  padding: 10px 14px; margin-bottom: 12px; border-radius: var(--r-md);
  background: linear-gradient(90deg, rgba(255,84,112,0.16), rgba(255,138,61,0.12));
  border: 1px solid rgba(255,84,112,0.4); color: var(--neon-red);
  font-weight: 600; font-size: 13px; animation: bannerPulse 1.6s ease-in-out infinite;
}
@keyframes bannerPulse { 0%,100% { box-shadow: 0 0 0 rgba(255,84,112,0); } 50% { box-shadow: 0 0 22px rgba(255,84,112,0.4); } }

.char-stage {
  display: flex; flex-direction: column; align-items: center;
  padding: 26px 18px 18px; position: relative;
  background:
    radial-gradient(ellipse 70% 50% at 50% 38%, rgba(43,214,255,0.12), transparent 70%),
    var(--bg-card);
  border: 1px solid var(--border-subtle); border-radius: var(--r-xl);
  box-shadow: var(--shadow-deep); overflow: hidden;
}
.char-stage::before {
  content: ''; position: absolute; inset: 0;
  background: conic-gradient(from 0deg, transparent, rgba(43,214,255,0.06), transparent 30%);
  animation: stageSpin 8s linear infinite;
}
@keyframes stageSpin { to { transform: rotate(360deg); } }

.char-emoji-wrap { position: relative; width: 150px; height: 150px; display: grid; place-items: center; z-index: 1; }
.char-ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 90deg, var(--neon-blue), var(--neon-purple), var(--neon-green), var(--neon-blue));
  padding: 3px; -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  animation: ringSpin 6s linear infinite; opacity: 0.7;
}
@keyframes ringSpin { to { transform: rotate(360deg); } }
.char-ring::after {
  content: ''; position: absolute; inset: -8px; border-radius: 50%;
  background: radial-gradient(circle, rgba(43,214,255,0.22), transparent 70%); filter: blur(8px);
}

#char-emoji {
  font-size: 92px; line-height: 1; cursor: pointer; user-select: none;
  filter: drop-shadow(0 8px 24px rgba(43,214,255,0.4));
  transition: transform 0.2s var(--ease-spring); z-index: 2;
}
#char-emoji:active { transform: scale(0.9); }

.char-idle  { animation: charIdle 3.5s ease-in-out infinite; }
.char-happy { animation: charHappy 0.5s var(--ease-bounce); }
.char-dance { animation: charDance 0.6s ease-in-out infinite; }
.char-cry   { animation: charCry 0.5s ease-in-out infinite; }
.char-sleep { animation: charSleep 3s ease-in-out infinite; filter: grayscale(0.4) brightness(0.7); }
.char-pop   { animation: charPop 0.45s var(--ease-bounce); }
@keyframes charIdle { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-10px) rotate(2deg); } }
@keyframes charHappy { 0% { transform: scale(1); } 40% { transform: scale(1.25) rotate(-8deg); } 100% { transform: scale(1); } }
@keyframes charDance { 0%,100% { transform: rotate(-10deg) translateY(0); } 50% { transform: rotate(10deg) translateY(-8px); } }
@keyframes charCry { 0%,100% { transform: translateX(0) rotate(0); } 25% { transform: translateX(-4px) rotate(-3deg); } 75% { transform: translateX(4px) rotate(3deg); } }
@keyframes charSleep { 0%,100% { transform: scale(1) rotate(-2deg); } 50% { transform: scale(1.03) rotate(2deg); } }
@keyframes charPop { 0% { transform: scale(0.4); opacity: 0; } 60% { transform: scale(1.18); } 100% { transform: scale(1); opacity: 1; } }

/* Floating tap-XP particles */
.tap-xp {
  position: absolute; font-family: var(--font-mono); font-weight: 800; font-size: 18px;
  color: var(--neon-green); pointer-events: none; z-index: 5; text-shadow: 0 0 10px var(--neon-green);
  animation: tapFloat 0.9s var(--ease-out) forwards;
}
@keyframes tapFloat { 0% { opacity: 1; transform: translateY(0) scale(0.6); } 100% { opacity: 0; transform: translateY(-60px) scale(1.2); } }

/* Char info */
.char-info { width: 100%; margin-top: 18px; z-index: 1; }
.char-name-row { display: flex; align-items: center; justify-content: center; gap: 9px; margin-bottom: 12px; }
.char-name { font-family: var(--font-display); font-weight: 700; font-size: 19px; }
.evo-tag {
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: var(--r-full);
  background: var(--grad-purple); color: #fff; box-shadow: var(--glow-purple);
}
.xp-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.lvl-num { font-family: var(--font-mono); font-weight: 800; font-size: 13px; color: var(--neon-blue); white-space: nowrap; }
.xp-track { flex: 1; height: 11px; border-radius: var(--r-full); background: rgba(255,255,255,0.06); overflow: hidden; position: relative; }
.xp-fill {
  height: 100%; border-radius: var(--r-full); background: var(--grad-purple);
  box-shadow: 0 0 12px rgba(183,107,255,0.7); transition: width 0.6s var(--ease-out); position: relative;
}
.xp-fill::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
  animation: xpShine 2s linear infinite;
}
@keyframes xpShine { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.xp-num { font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary); white-space: nowrap; }

.badges-row { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.streak-pill, .boost-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: var(--r-full);
}
.streak-pill { background: rgba(255,138,61,0.14); color: var(--neon-orange); border: 1px solid rgba(255,138,61,0.3); }
.boost-pill { background: rgba(43,255,158,0.14); color: var(--neon-green); border: 1px solid rgba(43,255,158,0.3); animation: boostGlow 1.5s ease-in-out infinite; }
@keyframes boostGlow { 0%,100% { box-shadow: 0 0 0 rgba(43,255,158,0); } 50% { box-shadow: 0 0 16px rgba(43,255,158,0.5); } }

/* Speech bubble */
.speech-wrap { display: flex; justify-content: center; min-height: 44px; margin-top: 14px; }
#speech-bubble {
  max-width: 84%; padding: 10px 16px; border-radius: var(--r-lg);
  background: var(--bg-card-2); border: 1px solid var(--border-glow);
  font-size: 14px; font-weight: 500; position: relative; opacity: 0;
  transform: translateY(8px) scale(0.95); transition: all 0.35s var(--ease-spring);
}
#speech-bubble.show { opacity: 1; transform: translateY(0) scale(1); }
#speech-bubble::after {
  content: ''; position: absolute; top: -7px; left: 50%; transform: translateX(-50%) rotate(45deg);
  width: 12px; height: 12px; background: var(--bg-card-2);
  border-left: 1px solid var(--border-glow); border-top: 1px solid var(--border-glow);
}

/* Sleep overlay */
.sleep-overlay {
  position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; border-radius: var(--r-xl);
  background: rgba(4,6,15,0.78); backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity 0.4s;
}
.sleep-overlay.visible { opacity: 1; pointer-events: auto; }
.zzz-row { display: flex; gap: 6px; }
.zzz { font-family: var(--font-display); font-weight: 800; color: var(--neon-blue); animation: zzzFloat 2s ease-in-out infinite; }
.zzz:nth-child(1) { font-size: 20px; animation-delay: 0s; }
.zzz:nth-child(2) { font-size: 28px; animation-delay: 0.3s; }
.zzz:nth-child(3) { font-size: 36px; animation-delay: 0.6s; }
@keyframes zzzFloat { 0%,100% { transform: translateY(0); opacity: 0.4; } 50% { transform: translateY(-12px); opacity: 1; } }
.sleep-label { color: var(--text-secondary); font-size: 13px; font-weight: 600; }

/* ════════════════════════════════════════════════════════════
   NEEDS BARS
   ════════════════════════════════════════════════════════════ */
.needs-section { margin-top: 18px; }
.needs-title { font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--text-secondary); margin: 0 2px 10px; }
.needs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.need-row {
  display: flex; align-items: center; gap: 9px; padding: 11px 13px;
  background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--r-md);
}
.need-ico { font-size: 18px; }
.need-track { flex: 1; height: 8px; border-radius: var(--r-full); background: rgba(255,255,255,0.06); overflow: hidden; }
.need-fill { height: 100%; border-radius: var(--r-full); transition: width 0.5s var(--ease-out), background 0.3s; }
.nf-hunger { background: var(--color-hunger); box-shadow: 0 0 8px var(--color-hunger); }
.nf-water  { background: var(--color-water);  box-shadow: 0 0 8px var(--color-water); }
.nf-happy  { background: var(--color-happy);  box-shadow: 0 0 8px var(--color-happy); }
.nf-energy { background: var(--color-energy); box-shadow: 0 0 8px var(--color-energy); }
.need-fill.low { background: var(--neon-red) !important; box-shadow: 0 0 10px var(--neon-red) !important; animation: needBlink 0.9s infinite; }
@keyframes needBlink { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
.need-val { font-family: var(--font-mono); font-size: 12px; font-weight: 700; min-width: 24px; text-align: right; color: var(--text-secondary); }

/* ════════════════════════════════════════════════════════════
   FREE ACTIVITY GRID
   ════════════════════════════════════════════════════════════ */
.free-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.act-btn {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 14px 6px; border-radius: var(--r-md); cursor: pointer;
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  transition: all 0.22s var(--ease-spring); position: relative; overflow: hidden;
}
.act-btn:active { transform: scale(0.93); }
.act-btn:not(.done):hover { border-color: var(--border-glow); background: var(--bg-card-hover); transform: translateY(-2px); }
.act-icon { font-size: 26px; transition: transform 0.2s; }
.act-btn:active .act-icon { transform: scale(1.2); }
.act-name { font-size: 11px; font-weight: 600; }
.act-xp { font-family: var(--font-mono); font-size: 10px; font-weight: 700; color: var(--neon-green); }
.act-btn.done { opacity: 0.45; pointer-events: none; }
.act-btn.done::after {
  content: '✓'; position: absolute; top: 6px; right: 8px; font-size: 12px;
  color: var(--neon-green); font-weight: 800;
}

/* ════════════════════════════════════════════════════════════
   PAID / PREMIUM CARDS
   ════════════════════════════════════════════════════════════ */
.paid-scroll {
  display: grid; grid-auto-flow: column; grid-auto-columns: 150px; gap: 11px;
  overflow-x: auto; padding: 4px 2px 8px; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.paid-card {
  scroll-snap-align: start; cursor: pointer; position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 5px; padding: 16px 14px 14px;
  background: linear-gradient(160deg, var(--bg-card-2), var(--bg-card));
  border: 1px solid var(--border-subtle); border-radius: var(--r-lg);
  transition: all 0.25s var(--ease-spring);
}
.paid-card::before {
  content: ''; position: absolute; inset: 0; opacity: 0; transition: opacity 0.3s;
  background: radial-gradient(circle at 50% 0%, rgba(43,214,255,0.16), transparent 70%);
}
.paid-card:hover { transform: translateY(-4px); border-color: var(--border-glow); box-shadow: var(--shadow-neon); }
.paid-card:hover::before { opacity: 1; }
.paid-card:active { transform: scale(0.96); }
.paid-icon { font-size: 38px; line-height: 1; filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4)); }
.paid-name { font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.paid-desc { font-size: 11px; color: var(--text-secondary); line-height: 1.4; flex: 1; }
.paid-price {
  font-family: var(--font-mono); font-weight: 800; font-size: 13px; margin-top: 6px;
  color: #6ea8ff; display: inline-flex; align-items: center; gap: 4px;
}
.paid-badge {
  position: absolute; top: 10px; right: 10px; font-size: 9px; font-weight: 800;
  letter-spacing: 0.06em; padding: 3px 7px; border-radius: var(--r-full);
  background: var(--grad-fire); color: #fff; box-shadow: var(--glow-pink); z-index: 2;
}
.paid-badge--mythic { background: var(--grad-mythic); background-size: 200% auto; animation: shimmerText 3s linear infinite; }
.paid-badge--hot { background: var(--grad-fire); animation: hotPulse 1.2s ease-in-out infinite; }
@keyframes hotPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.1); } }

/* ════════════════════════════════════════════════════════════
   BOTTOM NAV
   ════════════════════════════════════════════════════════════ */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--maxw); z-index: var(--z-nav);
  display: flex; justify-content: space-around; align-items: center;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  background: rgba(10,19,34,0.85); backdrop-filter: blur(18px);
  border-top: 1px solid var(--border-subtle);
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 12px; border-radius: var(--r-md); flex: 1;
  color: var(--text-muted); transition: all 0.22s var(--ease-out); position: relative;
}
.nav-item .nav-icon { font-size: 21px; transition: transform 0.25s var(--ease-spring); filter: grayscale(0.6); }
.nav-item span:last-child { font-size: 10px; font-weight: 600; }
.nav-item.active { color: var(--neon-blue); }
.nav-item.active .nav-icon { transform: translateY(-2px) scale(1.12); filter: grayscale(0); }
.nav-item.active::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 22px; height: 3px; border-radius: var(--r-full); background: var(--neon-blue); box-shadow: 0 0 10px var(--neon-blue);
}
.nav-item:active { transform: scale(0.9); }

/* ════════════════════════════════════════════════════════════
   TOASTS
   ════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed; top: calc(env(safe-area-inset-top) + 12px); left: 50%; transform: translateX(-50%);
  z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px;
  width: calc(100% - 32px); max-width: 420px; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 15px;
  border-radius: var(--r-md); background: var(--bg-elev);
  border: 1px solid var(--border-glow); box-shadow: var(--shadow-deep);
  backdrop-filter: blur(12px); pointer-events: auto;
  animation: toastIn 0.4s var(--ease-spring);
}
.toast.removing { animation: toastOut 0.3s var(--ease-out) forwards; }
@keyframes toastIn { 0% { opacity: 0; transform: translateY(-20px) scale(0.9); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-16px) scale(0.92); } }
.toast-icon { font-size: 20px; }
.toast-text { flex: 1; font-size: 13px; font-weight: 600; line-height: 1.35; }
.toast-close { color: var(--text-muted); font-size: 20px; line-height: 1; cursor: pointer; padding: 0 2px; }
.toast--success { border-color: rgba(43,255,158,0.45); }
.toast--error   { border-color: rgba(255,84,112,0.5); }
.toast--warning { border-color: rgba(255,201,77,0.45); }
.toast--xp      { border-color: rgba(183,107,255,0.5); }

/* ════════════════════════════════════════════════════════════
   MODALS / SHEETS
   ════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: var(--z-modal); display: flex; align-items: flex-end; justify-content: center;
  background: rgba(2,4,10,0.7); backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-sheet {
  width: 100%; max-width: var(--maxw); padding: 22px 20px calc(28px + env(safe-area-inset-bottom));
  background: var(--bg-modal); border: 1px solid var(--border-glow);
  border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: var(--shadow-deep);
  transform: translateY(100%); transition: transform 0.4s var(--ease-spring);
}
.modal-overlay.open .modal-sheet { transform: translateY(0); }
.modal-handle { width: 44px; height: 4px; border-radius: var(--r-full); background: var(--text-muted); margin: 0 auto 18px; }
.modal-title { font-family: var(--font-display); font-weight: 800; font-size: 22px; text-align: center; margin-bottom: 6px; }

/* ════════════════════════════════════════════════════════════
   EVOLUTION CINEMATIC
   ════════════════════════════════════════════════════════════ */
.evolution-overlay {
  position: fixed; inset: 0; z-index: var(--z-overlay); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  background: radial-gradient(circle at 50% 45%, rgba(20,30,60,0.96), rgba(2,4,10,0.99));
  opacity: 0; pointer-events: none; transition: opacity 0.5s;
}
.evolution-overlay.active { opacity: 1; pointer-events: auto; }
.evolution-rays {
  position: absolute; width: 140vmax; height: 140vmax;
  background: conic-gradient(from 0deg, transparent 0deg, rgba(255,225,77,0.14) 10deg, transparent 20deg, rgba(43,214,255,0.14) 30deg, transparent 40deg);
  animation: raySpin 9s linear infinite;
}
@keyframes raySpin { to { transform: rotate(360deg); } }
.evolution-char { font-size: 130px; z-index: 1; animation: evoReveal 1s var(--ease-bounce); filter: drop-shadow(0 0 40px rgba(255,225,77,0.6)); }
@keyframes evoReveal { 0% { transform: scale(0) rotate(-180deg); opacity: 0; } 60% { transform: scale(1.3) rotate(10deg); } 100% { transform: scale(1) rotate(0); opacity: 1; } }
.evolution-text { z-index: 1; font-family: var(--font-display); font-weight: 800; font-size: 30px; text-align: center; }
.evolution-text--name { background: var(--grad-mythic); background-size: 200% auto; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmerText 3s linear infinite; }

/* ════════════════════════════════════════════════════════════
   CONFETTI
   ════════════════════════════════════════════════════════════ */
.confetti-particle { position: fixed; top: -20px; z-index: var(--z-top); pointer-events: none; animation: confettiFall linear forwards; }
@keyframes confettiFall { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(105vh) rotate(720deg); opacity: 0; } }

/* ════════════════════════════════════════════════════════════
   GENERIC PANELS / TABS / STATS
   ════════════════════════════════════════════════════════════ */
.page-title { font-family: var(--font-display); font-weight: 800; font-size: 26px; margin: 4px 2px 4px; letter-spacing: -0.03em; }
.page-sub { color: var(--text-secondary); font-size: 13px; margin: 0 2px 16px; }

.tab-row { display: flex; gap: 7px; padding: 5px; background: var(--bg-card); border-radius: var(--r-md); margin-bottom: 16px; border: 1px solid var(--border-subtle); }
.tab {
  flex: 1; text-align: center; padding: 9px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 700; color: var(--text-secondary);
  transition: all 0.22s var(--ease-out); cursor: pointer;
}
.tab.active { background: var(--grad-blue); color: #00121f; box-shadow: var(--glow-blue); }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-bottom: 8px; }
.stat-box { padding: 14px 10px; background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--r-md); text-align: center; }
.stat-val { font-family: var(--font-mono); font-weight: 800; font-size: 19px; }
.stat-label { font-size: 10px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 3px; }

/* Reveal-on-load stagger */
.reveal { opacity: 0; transform: translateY(16px); animation: revealUp 0.6s var(--ease-out) forwards; }
@keyframes revealUp { to { opacity: 1; transform: translateY(0); } }
.reveal:nth-child(1) { animation-delay: 0.05s; }
.reveal:nth-child(2) { animation-delay: 0.12s; }
.reveal:nth-child(3) { animation-delay: 0.19s; }
.reveal:nth-child(4) { animation-delay: 0.26s; }
.reveal:nth-child(5) { animation-delay: 0.33s; }
.reveal:nth-child(6) { animation-delay: 0.40s; }

/* Empty / skeleton */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state .emoji { font-size: 44px; margin-bottom: 10px; }
.skeleton { background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%); background-size: 200% 100%; animation: skel 1.4s infinite; border-radius: var(--r-md); }
@keyframes skel { to { background-position: -200% 0; } }

/* Connect overlay */
.connect-gate {
  position: fixed; inset: 0; z-index: var(--z-overlay); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px; padding: 30px; text-align: center;
  background: radial-gradient(circle at 50% 40%, rgba(12,20,38,0.96), rgba(4,6,15,0.99));
  opacity: 0; pointer-events: none; transition: opacity 0.4s;
}
.connect-gate.show { opacity: 1; pointer-events: auto; }
.connect-gate .gate-egg { font-size: 90px; animation: charIdle 3s ease-in-out infinite; filter: drop-shadow(0 0 30px rgba(43,214,255,0.5)); }
.connect-gate .gate-title { font-family: var(--font-display); font-weight: 800; font-size: 26px; }
.connect-gate .gate-sub { color: var(--text-secondary); font-size: 14px; max-width: 280px; line-height: 1.5; }

/* ════════════════════════════════════════════════════════════
   SHOP PAGE
   ════════════════════════════════════════════════════════════ */
.shop-hero {
  position: relative; overflow: hidden; border-radius: var(--r-xl); padding: 20px;
  margin-bottom: 18px; background: linear-gradient(135deg, rgba(43,214,255,0.14), rgba(183,107,255,0.12));
  border: 1px solid var(--border-glow);
}
.shop-hero::after { content: ''; position: absolute; top: -40%; right: -10%; width: 180px; height: 180px; background: radial-gradient(circle, rgba(255,201,77,0.3), transparent 70%); filter: blur(20px); }
.shop-hero h2 { font-family: var(--font-display); font-weight: 800; font-size: 22px; position: relative; }
.shop-hero p { color: var(--text-secondary); font-size: 13px; margin-top: 4px; position: relative; }
.shop-hero .bal { font-family: var(--font-mono); font-weight: 800; color: var(--neon-green); margin-top: 10px; font-size: 15px; position: relative; }

.shop-cat-title { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 700; font-size: 17px; margin: 24px 2px 12px; }
.shop-cat-title .pill { font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: var(--r-full); background: rgba(59,130,246,0.16); color: #6ea8ff; }

.shop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.shop-item {
  position: relative; overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column; gap: 5px; padding: 16px 14px;
  background: linear-gradient(160deg, var(--bg-card-2), var(--bg-card));
  border: 1px solid var(--border-subtle); border-radius: var(--r-lg);
  transition: all 0.25s var(--ease-spring);
}
.shop-item:hover { transform: translateY(-3px); border-color: var(--border-glow); box-shadow: var(--shadow-neon); }
.shop-item:active { transform: scale(0.97); }
.shop-item::before { content: ''; position: absolute; inset: 0; opacity: 0; transition: opacity 0.3s; background: radial-gradient(circle at 50% 0%, rgba(43,214,255,0.14), transparent 70%); }
.shop-item:hover::before { opacity: 1; }
.shop-item .ico { font-size: 40px; line-height: 1; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.4)); }
.shop-item .nm { font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.shop-item .ds { font-size: 11px; color: var(--text-secondary); line-height: 1.4; flex: 1; min-height: 30px; }
.shop-item .pr { font-family: var(--font-mono); font-weight: 800; font-size: 13px; color: #6ea8ff; margin-top: 6px; }
.shop-item.owned { border-color: rgba(43,255,158,0.4); }
.shop-item.owned .pr { color: var(--neon-green); }
.rarity-tag { position: absolute; top: 10px; right: 10px; font-size: 8px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; padding: 3px 7px; border-radius: var(--r-full); z-index: 2; }

/* ════════════════════════════════════════════════════════════
   GAMES PAGE
   ════════════════════════════════════════════════════════════ */
.game-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.game-card {
  cursor: pointer; position: relative; overflow: hidden; aspect-ratio: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(160deg, var(--bg-card-2), var(--bg-card));
  border: 1px solid var(--border-subtle); border-radius: var(--r-lg);
  transition: all 0.25s var(--ease-spring);
}
.game-card:hover { transform: translateY(-3px) scale(1.02); border-color: var(--border-glow); box-shadow: var(--shadow-neon); }
.game-card:active { transform: scale(0.96); }
.game-card .gico { font-size: 46px; transition: transform 0.3s var(--ease-spring); }
.game-card:hover .gico { transform: scale(1.15) rotate(-6deg); }
.game-card .gname { font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.game-card .gxp { font-family: var(--font-mono); font-size: 10px; color: var(--neon-green); font-weight: 700; }
.game-card .gbest { position: absolute; top: 8px; right: 10px; font-family: var(--font-mono); font-size: 10px; color: var(--neon-yellow); }

.game-modal { position: fixed; inset: 0; z-index: var(--z-modal); display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(2,4,10,0.92); backdrop-filter: blur(6px); }
.game-modal.open { display: flex; }
.game-panel { width: 100%; max-width: 420px; background: var(--bg-modal); border: 1px solid var(--border-glow); border-radius: var(--r-xl); padding: 18px; box-shadow: var(--shadow-deep); }
.game-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.game-head .gt { font-family: var(--font-display); font-weight: 800; font-size: 18px; }
.game-close { font-size: 26px; color: var(--text-muted); cursor: pointer; line-height: 1; }
.score-display { font-family: var(--font-mono); font-weight: 800; font-size: 30px; text-align: center; color: var(--neon-yellow); }
#game-canvas { width: 100%; border-radius: var(--r-md); background: var(--bg-deep); display: block; touch-action: none; }
.game-over { text-align: center; padding: 20px 0; }
.go-title { font-family: var(--font-display); font-weight: 800; font-size: 24px; }
.go-score { font-family: var(--font-mono); font-size: 28px; font-weight: 800; color: var(--neon-yellow); margin: 8px 0; }

/* Quiz / memory */
.quiz-q { font-size: 17px; font-weight: 600; margin-bottom: 14px; text-align: center; }
.quiz-opt { padding: 13px; border-radius: var(--r-md); background: var(--bg-card); border: 1px solid var(--border-subtle); margin-bottom: 8px; font-weight: 600; cursor: pointer; transition: all 0.18s; }
.quiz-opt:active { transform: scale(0.97); }
.quiz-opt.correct { background: rgba(43,255,158,0.2); border-color: var(--neon-green); }
.quiz-opt.wrong { background: rgba(255,84,112,0.2); border-color: var(--neon-red); }
.mem-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; }
.mem-cell { aspect-ratio: 1; border-radius: var(--r-md); background: var(--bg-card); border: 1px solid var(--border-subtle); display: grid; place-items: center; font-size: 28px; cursor: pointer; transition: all 0.25s; }
.mem-cell.flipped { background: var(--bg-card-hover); border-color: var(--border-glow); }
.mem-cell.matched { background: rgba(43,255,158,0.15); border-color: var(--neon-green); }

/* ════════════════════════════════════════════════════════════
   WORLD PAGE
   ════════════════════════════════════════════════════════════ */
.world-map { display: flex; flex-direction: column; gap: 13px; }
.world-zone {
  position: relative; overflow: hidden; cursor: pointer; padding: 18px;
  border-radius: var(--r-lg); border: 1px solid var(--border-subtle);
  background: linear-gradient(135deg, var(--bg-card-2), var(--bg-card));
  transition: all 0.25s var(--ease-spring);
}
.world-zone:hover { transform: translateX(4px); border-color: var(--border-glow); box-shadow: var(--shadow-neon); }
.world-zone.locked { opacity: 0.5; }
.world-zone .zhead { display: flex; align-items: center; gap: 12px; }
.world-zone .zico { font-size: 38px; }
.world-zone .ztitle { font-family: var(--font-display); font-weight: 700; font-size: 17px; }
.world-zone .zdesc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.world-zone .zlock { margin-left: auto; font-size: 12px; color: var(--neon-yellow); font-family: var(--font-mono); font-weight: 700; }
.world-zone .zprog { margin-top: 12px; height: 7px; border-radius: var(--r-full); background: rgba(255,255,255,0.06); overflow: hidden; }
.world-zone .zprog-fill { height: 100%; background: var(--grad-blue); border-radius: var(--r-full); }

/* ════════════════════════════════════════════════════════════
   SOCIAL PAGE
   ════════════════════════════════════════════════════════════ */
.lb-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); background: var(--bg-card); border: 1px solid var(--border-subtle); margin-bottom: 8px; transition: all 0.2s; }
.lb-row.me { border-color: var(--border-active); box-shadow: var(--shadow-neon); }
.lb-rank { font-family: var(--font-mono); font-weight: 800; font-size: 16px; min-width: 28px; text-align: center; color: var(--text-secondary); }
.lb-rank.gold { color: var(--neon-gold); } .lb-rank.silver { color: #cdd6e8; } .lb-rank.bronze { color: #d4915a; }
.lb-emoji { font-size: 28px; }
.lb-info { flex: 1; }
.lb-name { font-weight: 700; font-size: 14px; }
.lb-meta { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.lb-xp { font-family: var(--font-mono); font-weight: 800; color: var(--neon-purple); font-size: 14px; }

.ref-card { padding: 18px; border-radius: var(--r-lg); background: linear-gradient(135deg, rgba(183,107,255,0.14), rgba(255,77,151,0.1)); border: 1px solid var(--border-glow); margin-bottom: 14px; }
.ref-code-box { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 12px 16px; background: var(--bg-deep); border-radius: var(--r-md); border: 1px dashed var(--border-glow); }
.ref-code { font-family: var(--font-mono); font-weight: 800; font-size: 20px; letter-spacing: 0.1em; flex: 1; color: var(--neon-cyan); }
.input-field { width: 100%; padding: 13px 16px; border-radius: var(--r-md); background: var(--bg-deep); border: 1px solid var(--border-subtle); color: var(--text-primary); font-size: 15px; font-family: var(--font-mono); }
.input-field:focus { outline: none; border-color: var(--border-active); box-shadow: var(--shadow-neon); }

.af-row { display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: var(--r-md); background: var(--bg-card); border: 1px solid var(--border-subtle); margin-bottom: 7px; }
.af-avatar { font-size: 26px; }
.af-info { flex: 1; }
.af-msg { font-size: 13px; font-weight: 500; }
.af-time { font-size: 10px; color: var(--text-muted); margin-top: 1px; }
.af-xp { font-family: var(--font-mono); font-weight: 700; font-size: 12px; color: var(--neon-green); }
