/* ═══════════════════════════════════════════════════
   PvZ3 — main.css
   Global styles, name screen, menu, world map,
   collection, shop, minigame hub
═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Bangers&family=Nunito:wght@400;600;700;800&display=swap');
@import url('inventory.css');
@import url('shop_screen.css');
@import url('effects.css');
@import url('setting.css');
@import url('mobile.css');

/* ─── CSS Variables ─────────────────────────────── */
:root {
  --bg-dark:      #0a0010;
  --bg-mid:       #12001f;
  --purple-deep:  #2a005f;
  --purple:       #6a00c8;
  --purple-light: #a855f7;
  --orange:       #ff6a00;
  --orange-light: #ffb347;
  --green:        #22c55e;
  --green-dark:   #15803d;
  --ice-blue:     #67e8f9;
  --gold:         #fbbf24;
  --red:          #ef4444;
  --white:        #f0e6ff;
  --gray:         #9ca3af;
  --cell-size:    72px;
  --font-display: 'Fredoka', sans-serif;
  --font-body: 'Fredoka', sans-serif, 'Bangers', cursive;
  --font-body:    'Nunito', sans-serif;
  --shadow-glow:  0 0 20px rgba(168,85,247,0.6);
  --shadow-card:  0 4px 24px rgba(0,0,0,0.6);
}

/* ─── Reset & Base ───────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }


html, body {
  width: 100%; height: 100%;
  font-family: 'Fredoka', sans-serif;
  overflow: hidden;
  background: var(--bg-dark);
  color: var(--white);
  font-family: var(--font-body);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
/* img{
  mix-blend-mode: multiply;
} */
 .pvz2-currency-icon img{
  width: 100%;
 }
.game-icon{
  width: 24px;
  height: 24px;
  object-fit: contain;
}
/* ─── Screen System ──────────────────────────────── */
.screen {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  overflow: hidden;
}
.screen.active {
  opacity: 1;
  pointer-events: all;
  z-index: 10;
}
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.overlay.hidden { display: none; }
.overlay-box {
  background: var(--bg-mid);
  border: 2px solid var(--purple-light);
  border-radius: 16px;
  padding: 32px 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-glow);
}

/* ─── Logo ───────────────────────────────────────── */
.game-logo {
  text-align: center;
  line-height: 1;
}
.logo-pvz {
  font-family: var(--font-display);
  font-size: 72px;
  color: var(--green);
  text-shadow: 0 0 30px var(--green), 3px 3px 0 var(--green-dark);
  letter-spacing: 4px;
}
.logo-3 {
  font-family: var(--font-display);
  font-size: 72px;
  color: var(--orange);
  text-shadow: 0 0 30px var(--orange), 3px 3px 0 #c04000;
}
.logo-sub {
  font-size: 14px;
  letter-spacing: 3px;
  color: var(--purple-light);
  text-transform: uppercase;
  margin-top: 4px;
}
.game-logo.small .logo-pvz,
.game-logo.small .logo-3 { font-size: 36px; }

/* ─── Buttons ────────────────────────────────────── */
.btn-primary {
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: #fff;
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 2px;
  border: none;
  border-radius: 12px;
  padding: 14px 36px;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--green-dark), var(--shadow-card);
  transition: transform 0.1s, box-shadow 0.1s;
  width: 100%;
}
.btn-primary:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--green-dark);
}
.btn-secondary {
  background: linear-gradient(135deg, #444, #222);
  color: var(--white);
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 2px;
  border: 2px solid #666;
  border-radius: 12px;
  padding: 12px 32px;
  cursor: pointer;
  transition: transform 0.1s;
  width: 100%;
}
#btn-back-shop{
  padding: 0 !important;
}
.btn-secondary:active { transform: translateY(2px); }
.btn-back {
  background: none;
  border: none;
  color: var(--white);
  font-size: 21px;
  border-radius: 8px;
  /* padding: 8px 16px; */
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 700;
}
.btn-menu {
  background: linear-gradient(135deg, var(--purple-deep), #1a0040);
  color: var(--white);
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: 2px;
  border: 2px solid var(--purple);
  border-radius: 14px;
  padding: 16px 24px;
  cursor: pointer;
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255,255,255,0.1);
  transition: all 0.15s;
  text-align: left;
}
.btn-menu:hover {
  border-color: var(--purple-light);
  box-shadow: var(--shadow-glow), var(--shadow-card);
  transform: translateX(4px);
}

/* ─── Coin Display ───────────────────────────────── */
.coin-display {
  background: rgba(251,191,36,0.15);
  border: 1px solid var(--gold);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 16px;
  font-weight: 800;
  color: var(--gold);
}

/* ─── Toast ──────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  border: 1px solid var(--purple-light);
  color: var(--white);
  padding: 6px 15px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 8px;
  z-index: 999;
  pointer-events: none;
  transition: opacity 0.4s;
}
.toast.hidden { opacity: 0; }

/* ═══════════════════════════════════════════════════
   NAME SCREEN
═══════════════════════════════════════════════════ */
.name-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 80%, rgba(34,197,94,0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(168,85,247,0.2) 0%, transparent 60%),
    linear-gradient(180deg, #0a0010 0%, #12001f 100%);
  animation: bgPulse 6s ease-in-out infinite alternate;
}
@keyframes bgPulse {
  from { filter: brightness(1); }
  to   { filter: brightness(1.15); }
}
.name-container {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  padding: 40px 24px;
}
.name-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 360px;
  align-items: center;
}
.name-form label {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 3px;
  color: var(--purple-light);
  text-transform: uppercase;
}
.name-form input {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 2px solid var(--purple);
  border-radius: 12px;
  padding: 14px 20px;
  font-size: 20px;
  font-family: var(--font-display);
  letter-spacing: 3px;
  color: var(--white);
  outline: none;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.name-form input:focus {
  border-color: var(--purple-light);
  box-shadow: 0 0 20px rgba(168,85,247,0.4);
}
.name-form input::placeholder { color: rgba(255,255,255,0.3); }

/* ═══════════════════════════════════════════════════
   MAIN MENU
═══════════════════════════════════════════════════ */
/* ══════════════════════════════════════════════
   MENU SCREEN — PvZ2 Style
══════════════════════════════════════════════ */
.menu-bg-img {
  position: absolute;
  inset: 0;
  background: url('../assets/homepage/home.jpeg') center center / cover no-repeat;
  /* fallback color while image loads */
  background-color: #5a9e2f;
  z-index: 0;
}
.menu-bg-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom,
      rgba(0,0,0,0.25) 0%,
      transparent 30%,
      transparent 55%,
      rgba(0,0,0,0.45) 100%);
  z-index: 1;
}

/* ── Top Bar ────────────────────────────────── */
.menu-topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  z-index: 10;
}
.menu-player-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,0,0,0.55);
  border: 2px solid rgba(255,200,50,0.6);
  border-radius: 20px;
  padding: 4px 10px 4px 4px;
}
.menu-avatar {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  border: 1px solid #4ade80;
}
.menu-playername {
  font-family: var(--font-display);
  font-size: 12px;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.5px;
  max-width: 80px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.menu-topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}
.menu-currency-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(0,0,0,0.6);
  border: 2px solid rgba(255,180,0,0.5);
  border-radius: 16px;
  padding: 3px 10px 3px 5px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: #fde68a;
  min-width: 52px;
}
.menu-curr-icon {
  width: 16px; height: 16px;
  object-fit: contain;
}

/* ── Center area: logo + buttons ────────────── */
.menu-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -54%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  z-index: 10;
  width: 90%;
  max-width: 340px;
}

/* ── PvZClassic logo ─────────────────────────── */
.menu-pvz-logo {
  text-align: center;
  line-height: 1;
  margin-bottom: 6px;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,0.7));
}
.pvz-logo-pvz {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 900;
  color: #22c55e;
  text-shadow:
    -2px -2px 0 #14532d,
     2px -2px 0 #14532d,
    -2px  2px 0 #14532d,
     2px  2px 0 #14532d,
     0 4px 0 #0a2e18,
     0 0 20px rgba(34,197,94,0.6);
  letter-spacing: 1px;
}
.pvz-logo-classic {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 900;
  color: #fbbf24;
  text-shadow:
    -2px -2px 0 #78350f,
     2px -2px 0 #78350f,
    -2px  2px 0 #78350f,
     2px  2px 0 #78350f,
     0 4px 0 #451a03,
     0 0 20px rgba(251,191,36,0.5);
}
.pvz-logo-sub {
  font-family: var(--font-display);
  font-size: 11px;
  color: #a7f3d0;
  letter-spacing: 3px;
  text-transform: uppercase;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  margin-top: 2px;
}

/* ── ADVENTURE button ───────────────────────── */
.menu-btn-adventure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 260px;
  padding: 10px 20px;
  background: linear-gradient(180deg, #3bbfff 0%, #1a90e8 40%, #1270c0 100%);
  border: 3px solid #7de0ff;
  border-bottom-color: #0a5090;
  border-radius: 12px;
  color: #fff;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 2px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  box-shadow:
    0 5px 0 #0a4a80,
    0 6px 12px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.3);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}
.menu-btn-adventure:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #0a4a80, 0 3px 6px rgba(0,0,0,0.4);
}
.menu-btn-icon { font-size: 20px; }

/* ── PLAY button (orange) ────────────────────── */
.menu-btn-play {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 260px;
  padding: 9px 20px;
  background: linear-gradient(180deg, #f97316 0%, #c2510a 60%, #9a3c06 100%);
  border: 3px solid #fbbf24;
  border-bottom-color: #7c2d12;
  border-radius: 12px;
  color: #fff;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 3px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  box-shadow:
    0 5px 0 #7c2d12,
    0 6px 12px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.2);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}
.menu-btn-play:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #7c2d12, 0 3px 6px rgba(0,0,0,0.4);
}

/* ── Row: ARENA + ALMANAC ───────────────────── */
.menu-btn-row {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 260px;
}
.menu-btn-secondary {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 10px;
  background: linear-gradient(180deg, #a16207 0%, #78350f 100%);
  border: 2px solid #fbbf24;
  border-bottom-color: #451a03;
  border-radius: 10px;
  color: #fde68a;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  box-shadow: 0 3px 0 #451a03, 0 4px 8px rgba(0,0,0,0.4);
  cursor: pointer;
  transition: transform 0.1s;
}
.menu-btn-secondary:active { transform: translateY(2px); }

/* ── Bottom icon bar ─────────────────────────── */
.menu-bottombar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  display: flex;
  align-items: flex-end;
  padding: 0 10px 6px;
  z-index: 10;
  gap: 4px;
}
.menu-bottom-spacer { flex: 1; }
.menu-bottom-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  background: rgba(0,0,0,0.65);
  border: 2px solid rgba(255,200,50,0.5);
  border-radius: 12px;
  padding: 6px 10px 4px;
  color: #fff;
  font-family: var(--font-display);
  font-size: 8px;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
  min-width: 44px;
}
.menu-bottom-btn:active { transform: scale(0.92); background: rgba(0,0,0,0.85); }
.menu-bottom-icon { font-size: 18px; line-height: 1; }
.menu-bottom-icon-img { width: 18px; height: 18px; object-fit: contain; }
.menu-bottom-label {
  font-size: 8px;
  color: #fde68a;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* keep old deco/bg classes harmless */
.menu-bg { display: none; }
.menu-container { display: none; }
.menu-deco { display: none; }
.deco-plant { display: none; }

/* ═══════════════════════════════════════════════════
   WORLD MAP
═══════════════════════════════════════════════════ */
.worldmap-bg {
  position: absolute;
  inset: 0;
  background:
    url('../assets/homepage/home.jpeg') center center / cover no-repeat;
  overflow: hidden;
  pointer-events: none;
}
/* Soft warm overlay so cards pop */
.worldmap-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0,0,0,0.15) 0%,
    rgba(0,0,0,0.05) 40%,
    rgba(0,0,0,0.35) 100%
  );
  pointer-events: none;
  z-index: 0;
}
.worldmap-container {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
  gap: 12px;
}
.worldmap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.worldmap-header h2 {
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: 3px;
  color: #fff;
  text-shadow:
    -2px -2px 0 #3a5a10,
     2px -2px 0 #3a5a10,
    -2px  2px 0 #3a5a10,
     2px  2px 0 #3a5a10,
     0 3px 8px rgba(0,0,0,0.6);
}
.levelselect-header, .collection-header,
.minigames-header, .shop-header, .picker-header {
  display: flex;
  margin: 10px 20px;
  align-items: center;
  justify-content: space-between;
}
.shop-header{
  margin: 0 !important;
  margin-top: 10px !important;
}
.levelselect-header h2,
.collection-header h2, .minigames-header h2,
.shop-header h2 {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 3px;
  color: var(--purple-light);
}

/* Horizontal scrolling worlds */
.worlds-grid {
  display: flex;
  flex-direction: row;
  gap: 24px;
  margin-top: 15px;
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1;
  padding: 20px 30px 30px;
  align-items: center;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  cursor: grab;
}
.worlds-grid::-webkit-scrollbar { display: none; }

/* ── World card — PvZ wooden frame style ── */
.world-card {
  flex-shrink: 0;
  scroll-snap-align: center;
  width: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  outline: none;
  border: none;
  background: none;
  animation: islandFloat 4s ease-in-out infinite;
  transition: transform 0.25s cubic-bezier(0.175,0.885,0.32,1.275);
}
.world-card:nth-child(2) { animation-delay: 0.5s; }
.world-card:nth-child(3) { animation-delay: 1s; }
.world-card:nth-child(4) { animation-delay: 1.5s; }

/* Wooden frame wrapper */
.world-frame {
  position: relative;
  width: 100%;
  border-radius: 12px;
  /* Outer wooden border */
  background: linear-gradient(180deg, #8b5e1a 0%, #6b4010 50%, #8b5e1a 100%);
  padding: 5px;
  box-shadow:
    0 0 0 2px #c8941a,
    0 0 0 4px #5a3008,
    0 8px 24px rgba(0,0,0,0.55),
    inset 0 1px 0 rgba(255,220,80,0.3);
}

/* Unlocked frame gets green leaf glow */
.world-card.unlocked .world-frame {
  box-shadow:
    0 0 0 2px #c8941a,
    0 0 0 4px #5a3008,
    0 8px 24px rgba(0,0,0,0.5),
    0 0 20px rgba(80,180,30,0.4),
    inset 0 1px 0 rgba(255,220,80,0.3);
}

/* Locked frame — darker, greyed wood */
.world-card.locked .world-frame {
  background: linear-gradient(180deg, #4a3a20 0%, #342810 50%, #4a3a20 100%);
  box-shadow:
    0 0 0 2px #6a5828,
    0 0 0 4px #2a1e08,
    0 6px 16px rgba(0,0,0,0.6);
}

/* Inner cream mat — like picture frame */
.world-frame-inner {
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid rgba(255,220,80,0.25);
}

/* Image */
.world-img-wrap {
  width: 100%;
  height: 150px;
  position: relative;
  overflow: hidden;
}
.world-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

/* Lock overlay */
.world-lock-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  pointer-events: none;
}

/* Nameplate — brown banner below image */
.world-name {
  font-family: var(--font-display);
  font-size: 13px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border-radius: 0 0 6px 6px;
}
.world-sub {
  font-size: 9px;
  color: #d4c080;
  letter-spacing: 0.5px;
}
.world-difficulty {
  font-size: 11px;
  letter-spacing: 1px;
}
.world-progress {
  font-size: 10px;
  color: #fde68a;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(212,180,60,0.4);
  border-radius: 8px;
  padding: 2px 8px;
  margin-top: 2px;
}
.world-progress.locked-prog { color: #a09060; }

/* Leaf corner decorations */
.world-frame-leaves {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.wfl {
  position: absolute;
  font-size: 18px;
  line-height: 1;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5));
}
.wfl-tl { top: -8px;  left: -6px;  transform: rotate(-30deg); }
.wfl-tr { top: -8px;  right: -6px; transform: rotate(30deg) scaleX(-1); }
.wfl-bl { bottom: -8px; left: -6px;  transform: rotate(30deg); }
.wfl-br { bottom: -8px; right: -6px; transform: rotate(-30deg) scaleX(-1); }

/* Remove old shadow div */
.world-shadow { display: none; }
.world-info   { display: none; }

/* ═══════════════════════════════════════════════════
   LEVEL SELECT
═══════════════════════════════════════════════════ */
.levelselect-bg {
  position: absolute;
  inset: 0;
}
/* World themed backgrounds for level select */
.levelselect-bg.world-1 { background: linear-gradient(160deg, #1a0008, #2d000f, #1a0508); }
.levelselect-bg.world-2 { background: linear-gradient(160deg, #001020, #001830, #000818); }
.levelselect-bg.world-3 { background: linear-gradient(160deg, #001510, #002820, #000f0a); }
.levelselect-bg.world-4 { background: linear-gradient(160deg, #0f000f, #1a0020, #08000a); }

.levelselect-container {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
  gap: 12px;
  z-index: 2;
}

/* Horizontal scrollable level path */
.levels-grid {
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1;
  position: relative;
  -webkit-overflow-scrolling: touch;
  min-height: 320px;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE */
}
.levels-grid::-webkit-scrollbar { display: none; } /* Chrome/Safari */
.levels-grid::-webkit-scrollbar { height: 5px; }
.levels-grid::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); }
.levels-grid::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 3px; }
.levels-grid::-webkit-scrollbar { height: 4px; }
.levels-grid::-webkit-scrollbar-track { background: transparent; }
.levels-grid::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }
.level-btn {
  background: linear-gradient(135deg, #1a0040, #0d0025);
  border: 2px solid var(--purple);
  border-radius: 12px;
  padding: 12px 8px;
  cursor: pointer;
  text-align: center;
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--white);
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.level-btn:hover, .level-btn:active {
  border-color: var(--orange);
  box-shadow: 0 0 12px rgba(255,106,0,0.4);
}
.level-btn.locked {
  opacity: 0.4;
  cursor: not-allowed;
}
.level-btn.completed { border-color: var(--gold); }
.level-btn .level-stars { font-size: 12px; letter-spacing: 1px; }
.level-btn .level-coins { font-size: 11px; color: var(--gold); }
.level-btn .level-reward {
  position: absolute;
  top: 4px; right: 4px;
  font-size: 14px;
  background: rgba(34,197,94,0.2);
  border-radius: 50%;
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
}

/* ═══════════════════════════════════════════════════
   PLANT PICKER
═══════════════════════════════════════════════════ */
.picker-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #060012, #0d0028);
}
.picker-container {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 14px;
}
.picker-header h2 {
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--green);
  letter-spacing: 2px;
}
.picker-slots-info {
  font-size: 13px;
  color: var(--gray);
}
.picker-selected {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  min-height: 90px;
  background: rgba(255,255,255,0.04);
  border: 2px dashed rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 10px;
  align-items: center;
}
.picker-available {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 10px;
  overflow-y: auto;
  flex: 0 0 1;
}
.plant-card {
  background: linear-gradient(135deg, #1a0040, #0d0020);
  border: 2px solid var(--purple);
  border-radius: 12px;
  padding: 8px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  position: relative;
}
.plant-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  display: block;
}
.plant-card .plant-card-name {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--white);
  margin-top: 4px;
}
.plant-card .plant-card-level {
  font-size: 10px;
  color: var(--gold);
}
.plant-card.selected {
  border-color: var(--green);
  box-shadow: 0 0 10px rgba(34,197,94,0.5);
}
.plant-card.locked {
  filter: grayscale(1) brightness(0.4);
  cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════
   BATTLE RESULT
═══════════════════════════════════════════════════ */
.result-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, #1a0040 0%, #04000e 100%);
}
.result-container {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 30px;
  padding: 40px 24px;
}
.result-title {
  font-family: var(--font-display);
  font-size: 64px;
  letter-spacing: 4px;
  text-shadow: 0 0 40px currentColor;
  animation: resultPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.result-title.win  { color: var(--gold); }
.result-title.lose { color: var(--red); }
@keyframes resultPop {
  from { transform: scale(0.3); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.result-rewards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  width: 100%;
  max-width: 320px;
}
.reward-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 18px;
  font-weight: 700;
}
.result-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 320px;
}

/* ═══════════════════════════════════════════════════
   COLLECTION
═══════════════════════════════════════════════════ */
.collection-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #060018, #0a0028);
}
.collection-container {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 20px;
}
.collection-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  overflow-y: auto;
  flex: 1;
  padding-bottom: 20px;
}
/* Collection Grid Upgrade Button */
.cc-grid-upgrade-btn {
  transition: all 0.2s ease;
}

.cc-grid-upgrade-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.5) !important;
  filter: brightness(1.1);
}

.cc-grid-upgrade-btn:active {
  transform: translateY(0);
}
.collection-card {
  background: linear-gradient(135deg, #1a0040, #0a0020);
  border: 2px solid var(--purple);
  border-radius: 14px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}
.collection-card:hover { border-color: var(--purple-light); }
.collection-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
}
.collection-card .cc-name {
  font-family: var(--font-display);
  font-size: 14px;
  margin-top: 6px;
}
.collection-card .cc-level {
  font-size: 12px;
  color: var(--gold);
}
.collection-card .cc-seeds {
  font-size: 11px;
  color: var(--green);
  margin-top: 2px;
}
.seed-progress-bar {
  height: 5px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  margin-top: 6px;
  overflow: hidden;
}
.seed-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--green-dark));
  border-radius: 3px;
  transition: width 0.3s;
}
.collection-card.locked {
  filter: grayscale(0.8) brightness(0.4);
}

/* ═══════════════════════════════════════════════════
   MINIGAMES HUB
═══════════════════════════════════════════════════ */
.minigames-grid {
  display: grid;
  grid-template-columns: repeat(4, 23%);
  gap: 18px;
  padding: 16px;
  overflow-y: auto;
}

.mg-card {
  background: rgba(255,255,255,0.05);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.mg-card:not(.locked):hover {
  transform: translateY(-4px);
  border-color: var(--orange, #f97316);
  box-shadow: 0 8px 32px rgba(249,115,22,0.3);
}

.mg-card.locked {
  cursor: default;
  opacity: 0.6;
  filter: grayscale(0.5);
}

.mg-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #111;
  overflow: hidden;
}

.mg-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mg-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
}

.mg-lock-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
}

.mg-play-btn {
  display: none;
}

.mg-card:not(.locked):hover .mg-play-btn {
  opacity: 1;
}

.mg-info {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mg-name {
  font-family: var(--font-display, sans-serif);
  font-size: 17px;
  color: var(--white, #fff);
  font-weight: 700;
}

.mg-desc {
  font-size: 12px;
  color: var(--gray, #9ca3af);
  line-height: 1.4;
}

.mg-reward {
  font-size: 12px;
  color: var(--gold, #fbbf24);
  margin-top: 2px;
}
/* ═══════════════════════════════════════════════════
   SEED SHOP
═══════════════════════════════════════════════════ */
.shop-bg {
  position: absolute;
  inset: 0;
  background: url('../assets/homepage/home.jpeg') center center / cover no-repeat;
  background-color: #4a8a20;
}
.shop-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    rgba(0,0,0,0.2) 0%,
    rgba(0,0,0,0.1) 40%,
    rgba(0,0,0,0.35) 100%);
  pointer-events: none;
}
.shop-container {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 0;
  z-index: 1;
}
.shop-grid {
  display: grid;
  gap: 14px;
  overflow-y: auto;
  flex: 1;
  padding-bottom: 20px;
}
.shop-item {
  background: linear-gradient(180deg, rgba(90,55,15,0.88) 0%, rgba(55,30,6,0.93) 100%);
  border: 2px solid #8b6530;
  border-bottom: 3px solid #5a3808;
  border-radius: 12px;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 4px 0 rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,200,80,0.1);
}
.shop-item:hover {
  border-color: #c8941a;
  transform: translateY(-2px);
  box-shadow: 0 6px 0 rgba(0,0,0,0.4), 0 0 14px rgba(200,148,26,0.35);
}
.shop-item img { width: 64px; height: 64px; object-fit: contain; }
.shop-item .si-name {
  font-family: var(--font-display);
  font-size: 15px;
  text-align: center;
  color: #fef3c7;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}
.shop-item .si-seeds { font-size: 12px; color: #86efac; font-weight: 700; }
.shop-item .si-price {
  background: linear-gradient(180deg, #78400a 0%, #5a2e06 100%);
  border: 2px solid #c8941a;
  border-bottom-color: #3e2405;
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 14px;
  font-weight: 800;
  color: #fde68a;
  box-shadow: 0 2px 0 #2a1608;
}

/* ═══════════════════════════════════════════════════
   SCROLLBAR
═══════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--purple);
  border-radius: 2px;
}
/* ═══════════════════════════════════════════════════
   COLLECTION — Grid + List views
═══════════════════════════════════════════════════ */
.collection-grid {
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
  grid-template-columns: unset !important;
  overflow-y: auto;
  flex: 1;
  padding-bottom: 20px;
}

/* Toggle buttons */
.cc-toggle {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--gray);
  border-radius: 8px;
  padding: 6px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.cc-toggle.active {
  background: var(--purple);
  border-color: var(--purple-light);
  color: #fff;
}

/* ── GRID CARD ───────────────────────────────── */
.cc-grid-card {
  background: linear-gradient(135deg, #1a0040, #0d0020);
  border: 2px solid var(--purple);
  border-radius: 14px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  transition: border-color 0.15s;
}
.cc-grid-card:hover { border-color: var(--purple-light); }
.cc-grid-card.locked { opacity: 0.4; }
.cc-grid-name {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--white);
  letter-spacing: 1px;
}

/* ── LIST CARD ───────────────────────────────── */
.cc-list-card {
  background: linear-gradient(135deg, #1a0040, #0d0020);
  border: 2px solid var(--purple);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
  transition: border-color 0.15s;
}
.cc-list-card:hover { border-color: var(--purple-light); }
.cc-list-card.locked {
  opacity: 0.4;
  flex-direction: row;
  align-items: center;
}
.cc-list-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Stat rows */
.cc-list-stats {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-left: 4px;
}
.cc-srow {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cc-slabel {
  font-size: 11px;
  color: var(--gray);
  width: 80px;
  flex-shrink: 0;
  white-space: nowrap;
}
.cc-sbar-bg {
  flex: 1;
  height: 9px;
  background: rgba(255,255,255,0.06);
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}
.cc-sbar-curr {
  position: absolute;
  left: 0; top: 0; height: 100%;
  background: linear-gradient(90deg, #6a00c8, #a855f7);
  border-radius: 5px;
  transition: width 0.4s ease;
}
.cc-sbar-next {
  position: absolute;
  left: 0; top: 0; height: 100%;
  background: linear-gradient(90deg, #15803d, #22c55e);
  border-radius: 5px;
  opacity: 0.5;
}
.cc-sval {
  font-size: 11px;
  color: var(--white);
  font-weight: 700;
  width: 52px;
  text-align: right;
  flex-shrink: 0;
}
.cc-snext {
  font-size: 11px;
  color: var(--green);
  font-weight: 700;
  width: 52px;
  flex-shrink: 0;
}

/* Shared bits */
.cc-level-badge {
  position: absolute;
  bottom: -4px; left: 50%;
  transform: translateX(-50%);
  background: var(--purple);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  border-radius: 8px;
  padding: 2px 8px;
  white-space: nowrap;
}
.cc-name {
  font-family: var(--font-display);
  letter-spacing: 1px;
  color: var(--white);
}
.cc-cost-badge {
  background: rgba(251,191,36,0.15);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 800;
  color: var(--gold);
}
.cc-seed-bar {
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.cc-seed-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), #86efac);
  border-radius: 3px;
  transition: width 0.4s ease;
}
.cc-max-badge {
  background: rgba(251,191,36,0.2);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 10px;
  color: var(--gold);
  font-weight: 800;
  white-space: nowrap;
}
.cc-lvlup-btn {
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  animation: lvlPulse 1.2s ease-in-out infinite;
}
@keyframes lvlPulse {
  0%,100% { box-shadow: 0 0 6px rgba(34,197,94,0.4); }
  50%      { box-shadow: 0 0 14px rgba(34,197,94,0.9); }
}
/* ═══════════════════════════════════════════════════
   GLOBAL POPUP SYSTEM
═══════════════════════════════════════════════════ */
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.popup-overlay.popup-open {
  opacity: 1;
}
.popup-overlay.popup-closing {
  opacity: 0;
}
.popup-box {
  background: linear-gradient(135deg, #1a0040, #0d0020);
  border: 2px solid var(--purple-light);
  border-radius: 20px;
  padding: 0;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 60px rgba(168,85,247,0.35), 0 20px 60px rgba(0,0,0,0.8);
  transform: scale(0.85) translateY(30px);
  transition: transform 0.28s cubic-bezier(0.175,0.885,0.32,1.275), opacity 0.25s ease;
}
.popup-overlay.popup-open .popup-box {
  transform: scale(1) translateY(0);
}
.popup-overlay.popup-closing .popup-box {
  transform: scale(0.9) translateY(20px);
}
.popup-wide { max-width: 620px; }
.popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid rgba(168,85,247,0.2);
  flex-shrink: 0;
}
.popup-title {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 2px;
  color: var(--white);
}
.popup-close {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--white);
  font-size: 16px;
  border-radius: 8px;
  padding: 4px 12px;
  cursor: pointer;
  transition: background 0.15s;
}

/* King minion spawn — no box on the cell */
.demon-entity {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
}
/* suppress any grid-cell box that shows through demons-layer */
.grid-cell {
  outline: none;
}
.grid-cell:not(.occupied) {
  background: transparent;
}
.popup-close:hover { background: rgba(255,255,255,0.15); }
.popup-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.popup-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(168,85,247,0.2);
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}
.popup-btn {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  border: none;
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: transform 0.1s;
}
.popup-btn:active { transform: scale(0.97); }
.popup-btn.primary {
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: #fff;
}
.popup-btn.secondary {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--white);
}
.popup-btn.danger {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fff;
}
/* ═══════════════════════════════════════════════════
   LEVEL ORB NODES
═══════════════════════════════════════════════════ */
.level-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  position: relative;
  scroll-snap-align: center;
}

/* Vine connector between orbs */
.level-connector {
  width: 55px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 4px;
  position: relative;
  z-index: 1;
  align-self: flex-start;
}
.level-connector.done    { background: linear-gradient(90deg, #22c55e, #15803d); }
.level-connector.current { background: linear-gradient(90deg, #22c55e, #3b82f6); }
.level-connector.locked  { background: rgba(255,255,255,0.1); }

/* Orb button */
.level-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  position: relative;
  background: none;
  border: none;
  padding: 0;
  z-index: 2;
}
.level-btn.locked  { cursor: not-allowed; }
.level-btn:hover:not(.locked) .level-orb { transform: scale(1.12) translateY(-4px); }

/* The orb itself */
.level-orb {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 20px;
  color: #fff;
  position: relative;
  transition: transform 0.2s cubic-bezier(0.175,0.885,0.32,1.275);
  /* Bottom shadow rings */
  box-shadow:
    0 6px 0 rgba(0,0,0,0.35),
    0 10px 0 rgba(0,0,0,0.2),
    0 14px 20px rgba(0,0,0,0.4);
}

/* Glass shine */
.level-orb::before {
  content: '';
  position: absolute;
  top: 6px; left: 10px;
  width: 22px; height: 14px;
  background: rgba(255,255,255,0.35);
  border-radius: 50%;
  transform: rotate(-30deg);
  pointer-events: none;
}

/* Bottom colored ring */
.level-orb::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 4px; right: 4px;
  height: 10px;
  border-radius: 50%;
  opacity: 0.6;
  pointer-events: none;
}

/* ── LOCKED ── */
.level-btn.locked .level-orb {
  background: radial-gradient(circle at 40% 35%, #3a3a4a, #1a1a28);
  box-shadow: 0 6px 0 #0d0d16, 0 10px 0 rgba(0,0,0,0.2), 0 14px 20px rgba(0,0,0,0.4);
  color: rgba(255,255,255,0.25);
  font-size: 22px;
}
.level-btn.locked .level-orb::after { background: #111122; }

/* ── COMPLETED ── */
.level-btn.completed .level-orb {
  background: radial-gradient(circle at 40% 35%, #6ee7a0, #16a34a);
  box-shadow: 0 6px 0 #14532d, 0 10px 0 rgba(0,0,0,0.2), 0 0 20px rgba(34,197,94,0.5), 0 14px 20px rgba(0,0,0,0.4);
}
.level-btn.completed .level-orb::after { background: #14532d; }

/* ── CURRENT ── */
.level-btn.current .level-orb {
  background: radial-gradient(circle at 40% 35%, #93c5fd, #2563eb);
  box-shadow: 0 6px 0 #1e3a8a, 0 10px 0 rgba(0,0,0,0.2), 0 0 24px rgba(59,130,246,0.7), 0 14px 20px rgba(0,0,0,0.4);
  animation: currentOrbPulse 1.5s ease-in-out infinite;
}
#effects-layer,
#demons-layer {
  background: transparent !important;
  border: none !important;
  pointer-events: none;
  overflow: visible;
}
.level-btn.current .level-orb::after { background: #1e3a8a; }
@keyframes currentOrbPulse {
  0%,100% { box-shadow: 0 6px 0 #1e3a8a, 0 10px 0 rgba(0,0,0,0.2), 0 0 18px rgba(59,130,246,0.6), 0 14px 20px rgba(0,0,0,0.4); }
  50%      { box-shadow: 0 6px 0 #1e3a8a, 0 10px 0 rgba(0,0,0,0.2), 0 0 36px rgba(59,130,246,0.9), 0 14px 20px rgba(0,0,0,0.4); }
}

/* ── ELITE (every 5th) ── */
.level-btn.elite.completed .level-orb {
  background: radial-gradient(circle at 40% 35%, #fde68a, #d97706);
  box-shadow: 0 6px 0 #92400e, 0 10px 0 rgba(0,0,0,0.2), 0 0 24px rgba(251,191,36,0.6), 0 14px 20px rgba(0,0,0,0.4);
}
.level-btn.elite.current .level-orb {
  background: radial-gradient(circle at 40% 35%, #fef08a, #eab308);
  box-shadow: 0 6px 0 #713f12, 0 10px 0 rgba(0,0,0,0.2), 0 0 30px rgba(234,179,8,0.8), 0 14px 20px rgba(0,0,0,0.4);
}

/* Number label */
.level-num {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 900;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  pointer-events: none;
}

/* ── Click Spark Effect ───────────────────────── */
@keyframes sparkLine {
  0%   { transform: translate(-50%,-50%) rotate(var(--a)) scaleX(1); opacity: 1; }
  100% { transform: translate(-50%,-50%) rotate(var(--a)) translateX(var(--d)) scaleX(0.2); opacity: 0; }
}
@keyframes sparkCenter {
  0%   { transform: translate(-50%,-50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%,-50%) scale(0); opacity: 0; }
}
.click-spark-line {
  position: fixed;
  width: 10px;
  height: 1.5px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 9999;
  transform-origin: left center;
  animation: sparkLine 0.28s ease-out forwards;
}
.click-spark-center {
  position: fixed;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  animation: sparkCenter 0.18s ease-out forwards;
}

/* Stars under orb */
.level-stars-row {
  font-size: 11px;
  letter-spacing: 1px;
  line-height: 1;
}

/* Reward badge above orb */
.level-reward-badge {
  position: absolute;
  top: -18px;
  background: rgba(0,0,0,0.75);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  padding: 2px 7px;
  font-size: 13px;
  white-space: nowrap;
  pointer-events: none;
}

/* Current bounce arrow */
.level-arrow {
  font-size: 16px;
  animation: arrowBounce 0.8s ease-in-out infinite;
  color: #93c5fd;
}
@keyframes arrowBounce {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-5px); }
}

/* World color overrides for locked/completed per world */
/* W1 Fire — completed = orange */
.world-theme-1 .level-btn.completed .level-orb {
  background: radial-gradient(circle at 40% 35%, #fca05a, #c2410c);
  box-shadow: 0 6px 0 #7c2d12, 0 10px 0 rgba(0,0,0,0.2), 0 0 20px rgba(249,115,22,0.5), 0 14px 20px rgba(0,0,0,0.4);
}
.world-theme-1 .level-btn.completed .level-orb::after { background: #7c2d12; }
.world-theme-1 .level-connector.done { background: linear-gradient(90deg, #f97316, #c2410c); }

/* W2 Desert — completed = amber */
.world-theme-2 .level-btn.completed .level-orb {
  background: radial-gradient(circle at 40% 35%, #fde68a, #b45309);
  box-shadow: 0 6px 0 #78350f, 0 10px 0 rgba(0,0,0,0.2), 0 0 20px rgba(245,158,11,0.5), 0 14px 20px rgba(0,0,0,0.4);
}
.world-theme-2 .level-btn.completed .level-orb::after { background: #78350f; }
.world-theme-2 .level-connector.done { background: linear-gradient(90deg, #f59e0b, #b45309); }

/* W3 Ocean — completed = teal */
.world-theme-3 .level-btn.completed .level-orb {
  background: radial-gradient(circle at 40% 35%, #5eead4, #0f766e);
  box-shadow: 0 6px 0 #134e4a, 0 10px 0 rgba(0,0,0,0.2), 0 0 20px rgba(20,184,166,0.5), 0 14px 20px rgba(0,0,0,0.4);
}
.world-theme-3 .level-btn.completed .level-orb::after { background: #134e4a; }
.world-theme-3 .level-connector.done { background: linear-gradient(90deg, #14b8a6, #0f766e); }

/* W4 Shadow — completed = purple */
.world-theme-4 .level-btn.completed .level-orb {
  background: radial-gradient(circle at 40% 35%, #d8b4fe, #7c3aed);
  box-shadow: 0 6px 0 #4c1d95, 0 10px 0 rgba(0,0,0,0.2), 0 0 20px rgba(139,92,246,0.5), 0 14px 20px rgba(0,0,0,0.4);
}
.world-theme-4 .level-btn.completed .level-orb::after { background: #4c1d95; }
.world-theme-4 .level-connector.done { background: linear-gradient(90deg, #8b5cf6, #7c3aed); }


@media (max-height: 500px) and (orientation: landscape) {
  /* Logo */
  .logo-pvz, .logo-3 { font-size: 42px; }
  .game-logo.small .logo-pvz,
  .game-logo.small .logo-3 { font-size: 28px; }

  /* Menu */
  .menu-container { padding: 8px 16px; gap: 6px; }
  .btn-menu { font-size: 18px; padding: 10px 16px; }
  .player-info-bar { font-size: 13px; }

  /* Name screen */
  .name-container { gap: 16px; padding: 16px; }
  .name-form { gap: 10px; }
  .name-form label { font-size: 16px; }
  .name-form input { padding: 10px 16px; font-size: 16px; }

  /* World map */
  .worldmap-container { padding: 8px; gap: 0px; }
  .worldmap-header { margin-bottom: 6px; }
  .worldmap-header h2 { font-size: 12px; }
  .worlds-grid { gap: 8px; }
  .world-card .world-name{ font-size: 12px; }
  .level-orb::before{top: 5px; left: 5px;}
  .world-lock-overlay{font-size: 15px;}
  .world-difficulty { font-size: 6px !important; }  
  .worlds-grid { 
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px; 
    padding: 0 8px 8px 8px;
  }
  .hidden{display: none !important;}
  .world-card { height: 100%; width: 22%; ; border-radius: 10px;}
  .world-img-wrap {box-shadow: none !important; }
  .world-card-name { font-size: 13px; padding: 6px; }
  .inv-left{min-width: 169px; width: 169px;}
  /* .shop-packet-rarity,
  .shop-packet-seeds,
  .shop-packet-desc { display: none !important; } */
  .shop-packets-grid { grid-template-columns: repeat(5, 1fr); }
  .world-lock { font-size: 28px; }
  /* Level select */
  .levelselect-container { padding: 8px; }
  .levelselect-header h2 { font-size: 16px; }
  .level-orb { width: 38px; height: 38px; font-size: 16px; }
  .sun-token.sky-sun, .sun-token { width: 20px !important; height: 20px !important; }
  /* Demon preview overrides removed */
  .level-num { font-size: 16px; }
  .tray-card , .shovel-btn{width: auto !important; height: auto !important; border-radius: 5px !important;}
  .plant-tray{ height: auto !important; }
  /* Coin display */
  .coin-display { font-size: 13px; padding: 4px 10px; }

  /* Shop */
  .shop-header h2 { font-size: 18px; margin: 0 !important; }
  .shop-tab { font-size: 8px; padding: 3px 8px; }
  .packet-card { padding: 10px 8px; }
  .packet-img { width: 56px; height: 56px; }
  .packet-name { font-size: 14px; }
  .packet-price { font-size: 13px; }

  /* Minigames hub */
  .mg-card { padding: 10px; }
  .mg-card-icon { font-size: 28px; }
  .mg-card-name { font-size: 14px; }
  #screen-minigames{
  overflow: scroll !important;
  }
  /* Buttons */
  .btn-primary { font-size: 18px; padding: 10px 24px; }
  .btn-secondary { font-size: 16px; padding: 8px 20px; }

  /* Result screen */
  .result-title { font-size: 36px; }
  .result-container { padding: 16px; gap: 12px; }
}

.plant-hp-bar{display: none;}

.boost-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.boost-popup-box {
  background: #1a0a2e;
  border: 2px solid #7c3aed;
  border-radius: 16px;
  padding: 24px;
  max-width: 480px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  color: white;
  font-family: sans-serif;
}

.boost-popup-title {
  font-size: 20px;
  font-weight: bold;
  color: #a78bfa;
  margin-bottom: 4px;
}

.boost-popup-sub {
  font-size: 13px;
  color: #9ca3af;
  margin-bottom: 12px;
}

.boost-selected-display {
  background: #2d1b4e;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: #d1d5db;
  margin-bottom: 16px;
  min-height: 36px;
}

.boost-section-title {
  font-size: 13px;
  font-weight: bold;
  color: #7c3aed;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.boost-cards-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.boost-card {
  background: #2d1b4e;
  border: 2px solid #4c1d95;
  border-radius: 10px;
  padding: 10px;
  width: 100px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
}

.boost-card:hover { border-color: #7c3aed; }
.boost-card.boost-selected { border-color: #a78bfa; background: #3b1f6e; }
.boost-card.boost-empty { opacity: 0.4; cursor: default; }

.boost-icon { font-size: 28px; margin-bottom: 4px; }
.boost-name { font-size: 11px; font-weight: bold; color: #e5e7eb; }
.boost-qty  { font-size: 11px; color: #a78bfa; }
.boost-desc { font-size: 10px; color: #9ca3af; margin-top: 4px; }
.boost-none-label { font-size: 10px; color: #6b7280; margin-top: 4px; }

.boost-popup-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}

.bp-btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
}

.bp-btn-skip  { background: #374151; color: #9ca3af; }
.bp-btn-start { background: #7c3aed; color: white; }
.bp-btn-start:hover { background: #6d28d9; }

/* ── PvZ2-style currency pill ───────────────── */
.pvz2-currency-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pvz2-player-name {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--white);
  letter-spacing: 1px;
  opacity: 0.85;
}
.pvz2-currency-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(251,191,36,0.3);
  border-radius: 20px;
  box-shadow: 0 0 8px rgba(251,191,36,0.2);
  padding: 2px 3px;
}
.pvz2-currency-icon { line-height: 1; }
.pvz2-currency-val {
  font-family: var(--font-display);
  font-size: 10px;
  color: #fbbf24;
  font-weight: 700;
  min-width: 24px;
}

/* ── Menu corner icon buttons ───────────────── */
.menu-corner-btn {
  position: absolute;
  top: 20px;
  width: 20px;
  height: 20px;
  margin: auto 20px;
  font-size: 16pxpx;
  background: rgba(0,0,0,0.45);
  border: none;
  border-radius: 2px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.15s, transform 0.15s;
}
.menu-corner-btn:active { background: rgba(255,255,255,0.15); transform: scale(0.92); }
.menu-corner-left  { left: 10px; }
.menu-corner-right { right: 10px; }

/* ── Play button — small inline style ──────── */
.btn-menu-play {
  background: linear-gradient(135deg, #15803d, #16a34a) !important;
  border-color: #22c55e !important;
  font-size: 15px !important;
  padding: 8px 28px !important;
  max-width: 180px !important;
  align-self: center;
}

/* ── World Map icon toolbar (PvZ2 style) ───── */
.wm-icon-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}
.wm-icon-btn {
  width: 20px;
  height: 20px;
  font-size: 15px;
  background: rgba(0,0,0,0.5);
  /* yellow border */
  border: none;
  border-radius: 2px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
}
.wm-icon-btn:active { background: rgba(255,255,255,0.2); transform: scale(0.91); }
.wm-currency-bar {
  margin-left: auto;
}
.worldmap-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
/* ── Menu center layout ─────────────────────── */
.menu-center-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 10px;
}
.menu-game-title {
  font-family: var(--font-display);
  font-size: 32px;
  letter-spacing: 2px;
  line-height: 1;
}
.menu-game-title .logo-pvz { color: #22c55e; }
.menu-game-title .logo-3   { color: #f97316; }

.menu-username-display {
  font-family: var(--font-display);
  font-size: 14px;
  color: rgba(255,255,255,0.5);
  letter-spacing: 2px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 4px 16px;
  pointer-events: none;
  user-select: none;
}

.btn-menu-play {
  background: linear-gradient(135deg, #15803d, #16a34a);
  border: 2px solid #22c55e;
  border-radius: 30px;
  color: white;
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 3px;
  padding: 12px 48px;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(34,197,94,0.4);
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-menu-play:active {
  transform: scale(0.95);
  box-shadow: 0 0 10px rgba(34,197,94,0.2);
}
/* ── World map right bar ────────────────────── */
.wm-right-bar {
  display: flex;
  width: 160px;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.wm-right-bar .pvz2-currency-pill {
  min-width: 64px;
}
.wm-right-bar .pvz2-currency-val {
  font-size: 10px;
  min-width: 32px;
}
/* ── Menu hero image ────────────────────────── */
.menu-hero-img {
  width: 70%;
  height: 35%;
  object-fit: cover;
  border-radius: 16px;
  border: 2px solid rgba(255,255,255,0.15);
  box-shadow: 0 0 24px rgba(100,200,100,0.25), 0 4px 16px rgba(0,0,0,0.5);
}

/* Coin icon helpers */
.icon-gold,
.icon-gold-inline {
  width: 18px;
  height: 18px;
  display: inline-block;
  vertical-align: middle;
}
.icon-gold-inline { width: 20px; height: 20px; }