/* =========================
   1. FONT + BASE
========================= */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

* {
  font-family: 'Press Start 2P', monospace;
  image-rendering: pixelated;
  box-sizing: border-box;
  font-size: 10px;
}

body {
  margin: 0;
  background: #0f172a;
  color: white;
  overflow-x: hidden;
}


/* =========================
   2. APP LAYOUT
========================= */

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.header {
  background: #1e293b;
  padding: 15px;
  display: flex;
  justify-content: space-between;
  font-weight: bold;
  border-bottom: 2px solid #ff7a18;
}

.header img { 
  height: 16px;
}

.content {
  position: relative;
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  background: url(images/bg1.gif) no-repeat;
  background-size: cover;  
  padding-bottom: 70px; /*height of nav */
}

.nav {
  position: fixed;
  bottom: 0;
  width: 100%;
  width: 100vw;
  height: 70px;
  display: flex;
  background: #1e293b;
  border-top: 2px solid #ff7a18;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav button {
  flex: 1;
  padding: 5px;
  background: none;
  border: none;
  color: white;
}

.nav button img {
  height: 28px;
  max-width: 100%;
  object-fit: contain;
}

.nav button img:hover, .nav button:active img {
  transform: scale(1.2);
}

.hidden { display: none !important; }

/* =========================
   3. BUTTONS
========================= */

.btn {
  width: 100%;
  padding: 12px;
  margin: 5px 0;
  background: #ff7a18;
  color: #000;
  border: 2px solid #000;
  box-shadow: 0 4px 0 #8b3a00;
  font-size: 10px;
  text-transform: uppercase;
  position: relative;
}

.btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #8b3a00;
}

.btn-notallowed {
  opacity:0.4; cursor:not-allowed;
}

.btn-glow {
  background: #00ffaa;
  color: #ff7a18;
  box-shadow:
    0 0 10px #00ffaa,
    0 0 20px #ff7a18,
    0 6px 0 #000;
  animation: glowPulse 1s infinite;
}

#btn-claim {
  position: absolute;
  top: 0;
  right: 5px;
  width: calc(100% - 10px);
}

#btn-claim.cooldown {
  opacity: 0.6;
  filter: grayscale(0.6);
}


/* =========================
   4. ICON BUTTONS
========================= */

.avatar-buttons {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 10px 0;
  flex-wrap: wrap;
}

.icon-btn {
  position: relative;
  width: 52px;
  height: 52px;
  background: #1e293b;
  border: 2px solid #ff7a18;
  box-shadow: 0 3px 0 #000;
}

.icon-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #000;
}

.icon-btn img {
  width: 26px;
  height: 26px;
}


/* =========================
   5. BADGES
========================= */

.tier-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ff7a18;
  color: #000;
  font-size: 8px;
  padding: 3px 5px;
  border: 2px solid #000;
  box-shadow: 0 2px 0 #8b3a00;
}


/* =========================
   6. PANELS / UI
========================= */

.panel {
  padding: 10px;
  margin-bottom: 10px;
  background: #1e293bcc;
  border: 1px solid #ff7a18;
  line-height: 16px;
}

.player-name {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  text-shadow: 2px 2px #000;
}

.edit-icon {
  width: 16px;
  height: 16px;
  cursor: pointer;
}


/* =========================
   7. HERO LAYOUT
========================= */

.hero-layout {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.hero-avatar {
  flex: 1.2;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 250px;
  position: relative;
  overflow: hidden;
  background: url(images/bg2.gif);
  background-position: bottom;
  margin-bottom: 0px !important;
}

.hero-avatar .avatar {
  transform: scale(2.5);
}

.hero-stats {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#farm-area { 
  width: 100%;
  position: absolute;
  bottom: 50px;
}

/* =========================
   9. STATS (NEW GRID)
========================= */

.hero-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat-card {
  background: #1e293bcc;
  border: 2px solid #ff7a18;
  box-shadow: 0 0 0 2px #000;
  padding: 8px;
}

.stat-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 9px;
}

.stat-upgrade {
  width: 100%;
  padding: 6px;
  background: #0f172a;
  color: #00ffaa;
  border: 1px solid #ff7a18;
  font-size: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 2px 0 #000;
}

.stat-upgrade:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #000;
}

.stat-upgrade .cost {
  font-size: 7px;
  color: #ff7a18;
  opacity: 0.8;
}

.cost img {
  height: 16px;;
}

/* MAIN ACTIONS */
.main-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

/* SLOTS */
.slot-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.slot {
  position: relative;
  height: 50px;
  background: #0f172a;
  border: 2px dashed #ff7a18;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  opacity: 0.7;
}

.slot:hover {
  opacity: 1;
  border-style: solid;
}

.slot-badge {
  position: absolute;
  bottom: -10px;
  background: #ff7a18;
  color: #000;
  font-size: 8px;
  padding: 0px 5px;
  border: 2px solid #000;
  box-shadow: 0 2px 0 #8b3a00;
}


/* COMPACT STATS */
.stats-compact {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  margin-bottom: 10px;
}

.stat-row {
  display: grid;
  grid-template-columns: 40px 1fr 50px 30px;
  align-items: center;
  gap: 6px;
  background: #1e293bcc;
  border: 1px solid #ff7a18;
  padding: 6px;
  font-size: 9px;
}

/* NAME */
.stat-name {
  text-align: center;
}

/* BAR */
.stat-bar {
  height: 8px;
  background: #000;
  border: 1px solid #ff7a18;
  position: relative;
}

.stat-fill {
  height: 100%;
}
.hp  { background: #ff4d4d; box-shadow: 0 0 4px #ff4d4d; }
.str { background: #ff7a18; box-shadow: 0 0 4px #ff7a18; }
.def { background: #4da6ff; box-shadow: 0 0 4px #4da6ff; }
.agi { background: #ffd700; box-shadow: 0 0 4px #ffd700; }

/* VALUE */
.stat-value {
  text-align: right;
  color: #00ffaa;
}

/* PLUS BUTTON */
.stat-plus {
  height: 24px;
  background: #ff7a18;
  border: 2px solid #000;
  font-size: 12px;
  cursor: pointer;
}

.stat-plus:active {
  transform: translateY(2px);
}


/* =========================
   11. PLAYER / ENEMY POS
========================= */
#player { position: absolute; left: 20px; bottom: 10px; z-index: 2; }
.enemy { position: absolute; right: 20px; bottom: 10px; z-index: 1; }


/* =========================
   12. COMBAT FX
========================= */

.avatar.hit {
  transform: scale(2.9);
}

.fighter {
  transition: transform 0.2s;
  position: relative;
  filter: drop-shadow(0 0 6px rgba(255,122,24,0.7));
}

.fighter.hit {
  transform: scale(1.2);
}

.dmg {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  color: red;
  animation: dmgUp 0.6s forwards;
}

@keyframes dmgUp {
  0% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -40px); }
}


/* =========================
   13. ANIMATIONS
========================= */
@keyframes glowPulse { 0% { transform: translateY(0); filter: brightness(0.9); } 50% { transform: translateY(-1px); filter: brightness(0.95); } 100% { transform: translateY(0); filter: brightness(1); } }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.08); } 100% { transform: scale(1); } }


/* =========================
   AVATAR SYSTEM
========================= */

@keyframes avatarIdle {
  from { background-position: 0 0; }
  to { background-position: var(--end) 0; }
}

.avatar {
  background-repeat: no-repeat;
  image-rendering: pixelated;
  margin: auto;
  transform: scale(1.1);
  filter: drop-shadow(0 0 4px rgba(255,122,24,0.6));
}


/* =========================
   IDLE ANIMATION
========================= */
.avatar-idle-1  { width:96px;  height:96px;  --end:-960px;  animation:avatarIdle 1s steps(10) infinite; }
.avatar-idle-2  { width:96px;  height:96px;  --end:-480px;  animation:avatarIdle 0.5s steps(5) infinite; }
.avatar-idle-3  { width:106px; height:84px;  --end:-1484px; animation:avatarIdle 1.4s steps(14) infinite; }
.avatar-idle-4  { width:96px;  height:96px;  --end:-480px;  animation:avatarIdle 0.5s steps(5) infinite; }
.avatar-idle-5  { width:96px;  height:96px;  --end:-480px;  animation:avatarIdle 0.5s steps(5) infinite; }
.avatar-idle-6  { width:98px;  height:64px;  --end:-490px;  animation:avatarIdle 0.5s steps(5) infinite; }
.avatar-idle-7  { width:96px;  height:96px;  --end:-1344px; animation:avatarIdle 1.4s steps(14) infinite; }
.avatar-idle-8  { width:130px; height:92px;  --end:-1560px; animation:avatarIdle 1.2s steps(12) infinite; }
.avatar-idle-9  { width:128px; height:64px;  --end:-1024px; animation:avatarIdle 0.8s steps(8) infinite; }
.avatar-idle-10 { width:128px; height:108px; --end:-768px;  animation:avatarIdle 0.6s steps(6) infinite; }
.avatar-idle-50 { width:115px; height:78px;  --end:-690px;  animation:avatarIdle 0.6s steps(6) infinite; }
.avatar-idle-70 { width:128px; height:128px; --end:-768px;  animation:avatarIdle 0.6s steps(6) infinite; }
.avatar-idle-80 { width:144px; height:96px;  --end:-1296px; animation:avatarIdle 0.9s steps(9) infinite; }
.avatar-idle-90 { width:162px; height:148px; --end:-648px;  animation:avatarIdle 0.4s steps(4) infinite; }


/* =========================
   RUN ANIMATION
========================= */

.avatar-run-1  { width:96px;  height:96px;  --end:-1536px; animation:avatarIdle 0.8s steps(16) infinite; }
.avatar-run-2  { width:96px;  height:96px;  --end:-672px;  animation:avatarIdle 0.7s steps(7) infinite; }
.avatar-run-3  { width:106px; height:84px;  --end:-848px;  animation:avatarIdle 0.8s steps(8) infinite; }
.avatar-run-4  { width:96px;  height:96px;  --end:-768px;  animation:avatarIdle 0.8s steps(8) infinite; }
.avatar-run-5  { width:96px;  height:96px;  --end:-768px;  animation:avatarIdle 0.8s steps(8) infinite; }
.avatar-run-6  { width:98px;  height:64px;  --end:-784px;  animation:avatarIdle 0.8s steps(8) infinite; }
.avatar-run-7  { width:96px;  height:96px;  --end:-768px;  animation:avatarIdle 0.8s steps(8) infinite; }
.avatar-run-8  { width:130px; height:92px;  --end:-1560px; animation:avatarIdle 1s steps(12) infinite; }
.avatar-run-9  { width:128px; height:64px;  --end:-1024px; animation:avatarIdle 0.8s steps(8) infinite; }
.avatar-run-10 { width:128px; height:108px; --end:-1024px; animation:avatarIdle 0.8s steps(8) infinite; }
.avatar-run-50 { width:115px; height:78px; --end:-690px; animation:avatarIdle 0.6s steps(6) infinite; }
.avatar-run-70 { width:128px; height:128px; --end:-1024px;  animation:avatarIdle 0.8s steps(8) infinite; }
.avatar-run-80 { width:144px; height:96px;  --end:-1152px; animation:avatarIdle 0.8s steps(8) infinite; }
.avatar-run-90 { width:162px; height:148px; --end:-648px;  animation:avatarIdle 0.4s steps(4) infinite; }


/* =========================
   ATTACK ANIMATION
========================= */
.avatar-attack-1  { width:96px;  height:96px;  --end:-672px;  animation:avatarIdle 0.5s steps(7) infinite; }
.avatar-attack-2  { width:96px;  height:96px;  --end:-480px;  animation:avatarIdle 0.5s steps(5) infinite; }
.avatar-attack-3  { width:106px; height:84px;  --end:-530px;  animation:avatarIdle 0.5s steps(5) infinite; }
.avatar-attack-4  { width:96px;  height:96px;  --end:-576px;  animation:avatarIdle 0.5s steps(6) infinite; }
.avatar-attack-5  { width:96px;  height:96px;  --end:-672px;  animation:avatarIdle 0.5s steps(7) infinite; }
.avatar-attack-6  { width:98px;  height:64px;  --end:-490px;  animation:avatarIdle 0.5s steps(5) infinite; }
.avatar-attack-7  { width:96px;  height:96px;  --end:-1056px; animation:avatarIdle 0.6s steps(11) infinite; }
.avatar-attack-8  { width:130px; height:92px;  --end:-1430px; animation:avatarIdle 0.6s steps(11) infinite; }
.avatar-attack-9  { width:128px; height:64px;  --end:-896px;  animation:avatarIdle 0.6s steps(7) infinite; }
.avatar-attack-10 { width:128px; height:108px; --end:-896px;  animation:avatarIdle 0.6s steps(7) infinite; }
.avatar-attack-50 { width:115px; height:78px;  --end:-690px;  animation:avatarIdle 0.6s steps(6) infinite; }
.avatar-attack-70 { width:128px; height:128px; --end:-768px;  animation:avatarIdle 0.6s steps(6) infinite; }
.avatar-attack-80 { width:144px; height:96px;  --end:-1872px; animation:avatarIdle 1.3s steps(13) infinite; }
.avatar-attack-90 { width:162px; height:148px; --end:-972px;  animation:avatarIdle 0.6s steps(6) infinite; }

/* =========================
   DEAD ANIMATION
========================= */
.avatar-dead-1  { width:96px;  height:96px;  --end:-672px;  animation:avatarIdle 0.5s steps(9) infinite; }
.avatar-dead-2  { width:96px;  height:96px;  --end:-480px;  animation:avatarIdle 0.5s steps(10) infinite; }
.avatar-dead-3  { width:106px; height:84px;  --end:-530px;  animation:avatarIdle 0.5s steps(10) infinite; }
.avatar-dead-4  { width:96px;  height:96px;  --end:-576px;  animation:avatarIdle 0.5s steps(10) infinite; }
.avatar-dead-5  { width:96px;  height:96px;  --end:-672px;  animation:avatarIdle 0.5s steps(10) infinite; }
.avatar-dead-6  { width:98px;  height:64px;  --end:-490px;  animation:avatarIdle 0.5s steps(9) infinite; }
.avatar-dead-7  { width:96px;  height:96px;  --end:-1056px; animation:avatarIdle 0.6s steps(11) infinite; }
.avatar-dead-8  { width:130px; height:92px;  --end:-1430px; animation:avatarIdle 0.6s steps(11) infinite; }
.avatar-dead-9  { width:128px; height:64px;  --end:-896px;  animation:avatarIdle 0.6s steps(9) infinite; }
.avatar-dead-10 { width:128px; height:108px; --end:-896px;  animation:avatarIdle 0.6s steps(26) infinite; }
.avatar-dead-50 { width:115px; height:78px;  --end:-690px;  animation:avatarIdle 0.6s steps(10) 1 forwards; }
.avatar-dead-70 { width:128px; height:128px; --end:-768px;  animation:avatarIdle 0.6s steps(6) infinite; }
.avatar-dead-80 { width:144px; height:96px;  --end:-1008px; animation:avatarIdle 0.7s steps(7) infinite; }
.avatar-dead-90 { width:162px; height:148px; --end:-1620px;  animation:avatarIdle 1.0s steps(10) infinite; }



/* =========================
   LEADERBOARD
========================= */

.leaderboard {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lb-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1e293bcc;
  border: 2px solid #ff781880;
  box-shadow: 0 0 0 2px #000;
  padding: 8px;
  font-size: 9px;
}

.lb-rank {
  width: 40px;
  text-align: center;
}

.lb-player {
  flex: 1;
  text-align: left;
}

.lb-stats {
  width: 90px;
  text-align: right;
  color: #00ffaa;
}

.lb-reward {
  width: 100px;
  text-align: right;
}

.lb-reward img {
  height: 12px;
}

/* TOP 3 SPECIAL */

.lb-gold {
  border-color: gold;
  box-shadow: 0 0 10px gold;
}

.lb-silver {
  border-color: #c0c0c0;
  box-shadow: 0 0 8px #c0c0c0;
}

.lb-bronze {
  border-color: #cd7f32;
  box-shadow: 0 0 6px #cd7f32;
}



/* =========================
   BATTLE
========================= */
#battle-screen-bg { position: absolute; top: 0; left: 0; height: calc(100%); width: calc(100%); }
#battle-screen { overflow: hidden; }
#battle-you { width: 45%; text-align: left; }
#battle-enemy { width: 45%; text-align:right; }
#hp-text-a { position:absolute; left: 0; top: 4px; font-size:10px; padding-left: 5px; }
#hp-text-b { position:absolute; right: 0; top: 4px; font-size:10px; padding-right: 5px; }
#stats-a, #stats-b { line-height: 15px; font-size:8px;opacity:0.8;background: rgba(0, 0, 0, 0.6);padding: 5px 5px 2px 5px; }
#battle-log { display: none; position:absolute; opacity: 0.8; left:50%; transform:translateX(-50%); width:35%; max-height:100px; overflow:hidden; font-size:10px; background:rgba(0,0,0,0.6); backdrop-filter: blur(4px); padding:20px 8px; border:1px solid rgba(255,255,255,0.2); }
#battle-log p { margin:4px 0; line-height: 14px; }
.battle-log-turn { margin-top: 15px !important; margin-bottom: 5px !important; }
.battle-display-name { width: 100%; overflow:hidden; font-size: 10px; padding: 10px 5px 5px 5px; display: inline-block; color: #ffd700; }
#hp-character-a-bg, #hp-character-b-bg { background:#222; height:20px; position:relative; }
#hp-character-a-bg { border:2px solid #4dd2ff; }
#hp-character-b-bg { border:2px solid #ff4d4d; }
#hp-character-a, #hp-character-b { position: absolute; top: 0; height: 100%; }
#hp-character-a { right: 0; left: auto; }
#hp-character-b { left: 0; right: auto; }
.screen-shake { animation: screenShake 0.2s; }
@keyframes screenShake { 0% { transform: translate(0,0); } 25% { transform: translate(-8px,2px); } 50% { transform: translate(8px,-2px); } 75% { transform: translate(-4px,1px); } 100% { transform: translate(0,0); } }
.hit-spark { position: absolute; pointer-events: none; border-radius: 50%; animation: sparkAnim 0.2s ease-out; }
.pixel-spark { position: absolute; width: 4px; height: 4px; image-rendering: pixelated; pointer-events: none; z-index: 999; }
.hit-pixel { image-rendering: pixelated; box-shadow: 0 0 0 1px #000; }
@keyframes sparkAnim { 0% { transform: scale(0.5); opacity: 1; filter: brightness(2); } 100% { transform: scale(1.8); opacity: 0; filter: brightness(1); } }
.hitstop * { animation-play-state: paused !important; transition: none !important; }
@keyframes shake { 0% { transform: translate(0,0); } 20% { transform: translate(-6px,2px); } 40% { transform: translate(6px,-2px); } 60% { transform: translate(-4px,1px); } 80% { transform: translate(4px,-1px); } 100% { transform: translate(0,0); } }
.damage-popup { animation: popupFloat 0.6s ease-out; }
@keyframes popupFloat { 0% { transform: translate(-50%, 0) scale(0.6); opacity: 0; } 20% { transform: translate(-50%, -10px) scale(1.2); opacity: 1; } 100% { transform: translate(-50%, -40px) scale(1); opacity: 0; } }
.popup-crit { text-shadow: 0 0 5px #ffcc00, 0 0 10px #ffcc00, 2px 2px #000; }
.slot-pvp { border: 2px dashed #ff7a18; }
.slot-pvp img { width: 100%; }










/* XP CONTAINER */
.xp-container {
  position: absolute;
  bottom: 2px;
  left: 5px;
  width: calc(100% - 10px);
}

/* XP BAR */
.xp-bar {
  position: relative;
  height: 20px;
  background: #000;
  border: 2px solid #ff7a18;
  margin-bottom: 4px;
  line-height: 15px;
}

.xp-fill {
  height: 100%;
  background: #ffd700;
}

.xp-text {
  position: absolute;
  width: 100%;
  text-align: center;
  top: 1px;
  font-size: 8px;
}

/* XP BUTTON */
.btn-xp {
  width: 100%;
  padding: 6px;
  font-size: 8px;
}







/* =========================
   POPUP
========================= */
.popup { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; z-index: 999; }
.popup-box { background: #1e293b; border: 2px solid #ff7a18; box-shadow: 0 0 0 3px #000; padding: 15px; text-align: center; width: 80%; }
.popup-text { font-size: 10px; margin-bottom: 12px; line-height: 20px; }
.popup-actions { display: flex; gap: 6px; }
.popup-actions .btn { flex: 1; padding: 8px; }
.popup-text img { height: 12px; vertical-align: middle; margin: 0 2px; }











/* =========================
   SHOP
========================= */
.shop-panel { padding: 10px; }
.shop-title { font-size: 10px; text-align: center; margin-bottom: 8px; color: #ff7a18; text-shadow: 2px 2px #000; }
.shop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.shop-item { background: #0f172a; border: 2px solid #ff7a18; box-shadow: 0 0 0 2px #000; padding: 8px; text-align: center; transition: 0.15s; }
.shop-item:hover { transform: translateY(-2px); box-shadow: 0 4px 0 #000; }
.shop-item-header { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 4px; }
.shop-item-name { font-size: 9px; color: #fff; }
.shop-item-desc { font-size: 7px; opacity: 0.7; margin-bottom: 6px; }
.shop-item-footer { justify-content: space-between; align-items: center; }
.shop-buy { font-size: 9px; padding: 6px 12px; width: auto; }
.shop-header { text-align: center; margin-bottom: 8px; }
.shop-title { font-size: 10px; color: #ff7a18; text-shadow: 2px 2px #000; }
.shop-category-desc { font-size: 9px; opacity: 0.6; margin-top: 3px; line-height: 10px; text-align: center; margin-bottom: 10px; }















/* =========================
   LEVEL UP EFFECT
========================= */
.levelup-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; display: flex; align-items: center; justify-content: center; z-index: 9999; }
.levelup-box { text-align: center; animation: levelUpPop 0.6s ease-out; }
.levelup-text { font-size: 22px; color: #ffd700; text-shadow: 0 0 5px #ffd700, 0 0 10px #ff7a18, 2px 2px #000; animation: levelGlow 1s infinite alternate; }
.levelup-sub { font-size: 12px; margin-top: 8px; color: #00ffaa; text-shadow: 1px 1px #000; }
@keyframes levelUpPop { 0% { transform: scale(0.5); opacity: 0; } 60% { transform: scale(1.3); opacity: 1; } 100% { transform: scale(1); } }
@keyframes levelGlow { from { filter: brightness(1); } to { filter: brightness(1.5); } }
.levelup-overlay.fade-out { animation: levelFade 0.6s forwards; }
@keyframes levelFade { to { opacity: 0; } }
.levelup-particle { position: absolute; width: 4px; height: 4px; background: #ffd700; box-shadow: 0 0 4px #ff7a18; animation: particleFly 0.8s ease-out forwards; }
@keyframes particleFly { to { transform: translate(var(--x), var(--y)); opacity: 0; } }













/* =========================
   REFERRAL DASHBOARD
========================= */

.referral-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.ref-card {
  background: #0f172a;
  border: 2px solid #ff7a18;
  box-shadow: 0 0 0 2px #000;
  padding: 8px;
  text-align: center;
}

.ref-title {
  font-size: 8px;
  opacity: 0.7;
  margin-bottom: 4px;
}

.ref-value {
  font-size: 10px;
  color: #00ffaa;
}

/* LINK */
.ref-link {
  font-size: 8px;
  word-break: break-all;
  background: #000;
  padding: 8px;
  border: 1px solid #ff7a18;
  margin-bottom: 8px;
}

/* TABLE */
.ref-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ref-table-header {
  display: grid;
  grid-template-columns: 1fr 60px 100px;
  font-size: 8px;
  opacity: 0.6;
  padding: 4px;
  align-items: center;
}

.ref-row {
  display: grid;
  grid-template-columns: 1fr 60px 100px;
  background: #1e293bcc;
  border: 1px solid #ff7a18;
  padding: 6px;
  font-size: 8px;
  align-items: center;
}

.ref-row span { align-items: center; overflow-wrap: anywhere; }
.ref-table-header span { display: flex; align-items: center; }

.ref-level { text-align: center;}

.ref-money {
  color: #00ffaa;
  text-align: right;
}
















.common { border-color: #9ca3af !important; box-shadow: 0 0 6px #9ca3af33; }
.rare { border-color: #3b82f6 !important; box-shadow: 0 0 10px #3b82f655; }
.epic { border-color: #a855f7 !important; box-shadow: 0 0 14px #a855f777; }
.legendary { border-color: #f59e0b !important; box-shadow: 0 0 18px #f59e0baa; animation: legendaryGlow 1.2s infinite alternate; }
@keyframes legendaryGlow { from { filter: brightness(1); } to { filter: brightness(1.3); } }

.common-text { color:#9ca3af !important; }
.rare-text { color:#3b82f6 !important; }
.epic-text { color:#a855f7 !important; }
.legendary-text { color:#f59e0b !important; }

.common-glow { filter: drop-shadow(0 0 6px #9ca3af) !important; animation: legendaryGlow 1.2s infinite alternate; }
.rare-glow { filter: drop-shadow(0 0 6px #3b82f6) !important; animation: legendaryGlow 1.2s infinite alternate; }
.epic-glow { filter: drop-shadow(0 0 6px #a855f7) !important; animation: legendaryGlow 1.2s infinite alternate; }
.legendary-glow { filter: drop-shadow(0 0 6px #f59e0b) !important; animation: legendaryGlow 1.2s infinite alternate; }



/* =========================
   GEAR POPUP
========================= */
#gear-popup.popup { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.75); display: flex; align-items: center; justify-content: center; z-index: 9999; }
.gear-popup-box { background: #1e293b; border: 2px solid #ff7a18; box-shadow: 0 0 0 3px #000; padding: 14px; text-align: center; width: 85%; max-width: 320px; animation: popIn 0.25s ease-out; }
#gear-popup-title { font-size: 10px; color: #ff7a18; margin-bottom: 6px; text-shadow: 2px 2px #000; letter-spacing: 1px; }
.gear-popup-rarity { font-size: 9px; margin-bottom: 8px; color: #00ffaa; text-transform: uppercase; }
.gear-popup-rarity.common { color: #9ca3af; }
.gear-popup-rarity.rare { color: #3b82f6; }
.gear-popup-rarity.epic { color: #a855f7; }
.gear-popup-rarity.legendary { color: #f59e0b; text-shadow: 0 0 6px #f59e0b; }
.gear-popup-img img { width: 80px; height: 80px; image-rendering: pixelated; margin: 8px 0; filter: drop-shadow(0 0 6px rgba(255,122,24,0.6)); }
.gear-popup-name { font-size: 9px; margin-bottom: 8px; color: #fff; }
.gear-popup-stats { gap: 4px; font-size: 10px; opacity: 0.9; margin-bottom: 10px; color: #00ffaa; }
@keyframes popIn { from { transform: scale(0.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.gear-compare { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px; }
.gear-card { background: #0f172a; border: 2px solid #ff7a18; padding: 8px; text-align: center; }
.gear-card img { width: 64px; height: 64px; image-rendering: pixelated; }
.gear-title { font-size: 8px; color: #fff; margin-bottom: 4px; }
.gear-rarity { font-size: 7px; color: #00ffaa; }
.gear-stats { font-size: 7px; margin-top: 4px; opacity: 0.8; }
.gear-vs { font-size: 10px; color: #ff7a18; }

#gear-img { image-rendering: pixelated; transform: scaleX(1); }
.gear-flip { transform: scaleX(-1); }












.skin-box {
  border: 2px solid #00ffaa;
  box-shadow: 0 0 0 2px #000, 0 0 10px #00ffaa55;
}

.skin-text {
  color: #00ffaa;
  text-shadow: 2px 2px #000;
  font-size: 14px;
}

.skin-preview {
  width: 90px;
  image-rendering: pixelated;
  margin-top: 8px;
  filter: drop-shadow(0 0 6px #00ffaa55);
}