@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Rajdhani:wght@500;700&display=swap');

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

body, html {
  /* dvh = real visible height on mobile (adapts to address bar show/hide) */
  height: 100dvh;
  width: 100%;
  font-family: 'Rajdhani', Arial, sans-serif;
  color: white;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

/* ========================================================
   CUSTOM SCROLLBAR — Ghost Chase Theme
======================================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track {
  background: rgba(4,0,14,0.85);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #6600cc, #c030ff);
  border-radius: 3px;
  box-shadow: 0 0 6px rgba(192,48,255,0.6);
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #8800ff, #dd44ff);
  box-shadow: 0 0 12px rgba(192,48,255,0.9);
}
::-webkit-scrollbar-corner { background: rgba(4,0,14,0.85); }
* { scrollbar-width: thin; scrollbar-color: #c030ff rgba(4,0,14,0.85); }

/* ========================================================
   ANIMATED BACKGROUND CANVAS
======================================================== */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  display: block;
}

/* ========================================================
   START SCREEN
======================================================== */
.start-screen {
  position: fixed; inset: 0;
  display: flex; align-items: flex-start; justify-content: center;
  z-index: 100;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  overflow-y: auto;
  /* Add safe-area padding so content stays below notch */
  padding: max(24px, calc(env(safe-area-inset-top) + 16px)) 16px 24px;
  -webkit-overflow-scrolling: touch;
}
.start-card {
  background: rgba(10, 3, 24, 0.9);
  border: 1px solid rgba(160, 60, 255, 0.35);
  border-radius: 24px;
  padding: 36px 44px;
  text-align: center;
  max-width: 480px; width: 100%;
  box-shadow: 0 0 70px rgba(140,40,255,0.22), inset 0 0 40px rgba(0,0,0,0.5);
  backdrop-filter: blur(14px);
  margin: auto;               /* center vertically when space allows */
  flex-shrink: 0;
}
.ghost-float-icon {
  font-size: 4rem;
  display: block; margin-bottom: 4px;
  animation: float 2.5s ease-in-out infinite;
}
.game-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 2.8rem; font-weight: 900;
  letter-spacing: 5px;
  text-shadow: 0 0 20px rgba(200,100,255,0.7);
  line-height: 1; margin-bottom: 4px;
}
.game-title span {
  color: #c030ff;
  text-shadow: 0 0 30px #c030ff, 0 0 70px rgba(192,48,255,.45);
}
.game-subtitle {
  font-size: 0.85rem; color: #999;
  letter-spacing: 4px; text-transform: uppercase; margin-bottom: 12px;
}
.highscore-badge {
  display: inline-block;
  background: rgba(255,215,0,0.07);
  border: 1px solid rgba(255,215,0,0.28);
  border-radius: 20px; padding: 4px 16px;
  font-family: 'Orbitron', sans-serif; font-size: 0.8rem;
  color: gold; margin-bottom: 16px;
}
.start-screen input {
  display: block; width: 100%; padding: 13px 18px;
  font-size: 1.05rem; font-family: 'Rajdhani', sans-serif; font-weight: 600;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(140,50,255,0.45);
  border-radius: 12px; color: white; outline: none;
  text-align: center;
  margin-top: 4px;   /* clear gap above input */
  margin-bottom: 12px;
  transition: border-color .25s, box-shadow .25s;
  -webkit-appearance: none;  /* removes iOS inner shadow */
}
.start-screen input:focus { border-color: #c030ff; box-shadow: 0 0 18px rgba(192,48,255,.4); }
.start-screen input::placeholder { color: rgba(255,255,255,0.3); letter-spacing: 1px; }

.btn-primary {
  display: block; width: 100%; padding: 14px;
  font-family: 'Orbitron', sans-serif; font-size: 0.95rem; font-weight: 700;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #7000cc, #c030ff);
  border: none; border-radius: 12px; color: white; cursor: pointer;
  transition: transform .18s, box-shadow .18s;
  box-shadow: 0 4px 22px rgba(192,48,255,.4); margin-top: 4px;
}
.btn-primary:hover  { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(192,48,255,.6); }
.btn-primary:active { transform: scale(.97); }

.controls-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; margin-top: 18px;
}
.ctrl-item {
  background: rgba(255,255,255,0.05); border-radius: 10px;
  padding: 8px 10px; text-align: left; display: flex;
  flex-direction: column; gap: 2px;
}
.ctrl-key {
  font-family: 'Orbitron', sans-serif; font-size: 0.65rem;
  color: #c030ff; letter-spacing: 1px;
}
.ctrl-item span:last-child { font-size: 0.8rem; color: #aaa; }

/* Settings button on start screen */
.btn-start-settings {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 10px 14px; margin-top: 10px;
  font-family: 'Rajdhani', sans-serif; font-size: 0.9rem; font-weight: 700;
  letter-spacing: 1px;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(140,50,255,0.35);
  border-radius: 12px; color: #cc88ff; cursor: pointer;
  transition: background .2s, border-color .2s, transform .15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn-start-settings:hover  { background: rgba(140,50,255,0.18); border-color: rgba(192,48,255,0.6); }
.btn-start-settings:active { transform: scale(.97); }

/* Developer credit on start screen */
.start-dev-credit {
  margin-top: 18px; padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
  text-align: center;
  font-size: 0.75rem; color: rgba(255,255,255,0.35);
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 5px;
}
.start-dev-credit a {
  color: #aa66ff; text-decoration: none;
  font-weight: 700; transition: color .2s;
}
.start-dev-credit a:hover { color: #dd99ff; text-decoration: underline; }

/* ========================================================
   SAVE SLOT CARDS (Start Screen)
======================================================== */
.save-slots-row {
  display: flex; gap: 8px;
  margin: 14px 0 10px;
}

.save-slot-card {
  flex: 1; min-width: 0;
  background: rgba(255,255,255,0.04);
  border: 1.5px solid rgba(140,50,255,0.3);
  border-radius: 14px;
  padding: 12px 6px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.save-slot-card:hover  { border-color: rgba(192,48,255,0.7); background: rgba(192,48,255,0.09); transform: translateY(-2px); }
.save-slot-card:active { transform: scale(.97); }
.save-slot-card.has-save { border-color: rgba(80,200,120,0.45); background: rgba(0,255,100,0.03); }
.save-slot-card.has-save:hover { border-color: rgba(80,200,120,0.85); background: rgba(0,255,100,0.09); }

.ss-slot-num {
  font-family: 'Orbitron', sans-serif; font-size: 0.55rem;
  letter-spacing: 2px; color: rgba(200,150,255,0.55);
  margin-bottom: 6px;
}
.ss-empty-icon { font-size: 1.6rem; margin: 4px 0 2px; }
.ss-empty-text { font-size: 0.68rem; color: rgba(255,255,255,0.35); letter-spacing: 1px; text-transform: uppercase; }
.ss-name { font-size: 0.82rem; font-weight: 700; color: #00ff88; margin: 3px 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-info { font-size: 0.68rem; color: rgba(255,255,255,0.6); }
.ss-date { font-size: 0.6rem; color: rgba(255,255,255,0.3); margin: 2px 0 8px; }

.ss-actions { display: flex; gap: 4px; justify-content: center; }

.ss-continue-btn {
  flex: 1;
  background: linear-gradient(135deg, #005c28, #00aa55);
  border: none; border-radius: 8px;
  color: white; font-family: 'Orbitron', sans-serif;
  font-size: 0.5rem; font-weight: 700; letter-spacing: 1px;
  padding: 6px 2px; cursor: pointer;
  touch-action: manipulation; transition: opacity .2s;
}
.ss-continue-btn:active { opacity: 0.7; }

.ss-delete-btn {
  background: rgba(200,50,50,0.15);
  border: 1px solid rgba(200,50,50,0.35);
  border-radius: 8px; color: #ff7777;
  font-size: 0.82rem; padding: 4px 7px; cursor: pointer;
  touch-action: manipulation; transition: background .2s;
}
.ss-delete-btn:active { background: rgba(200,50,50,0.45); }

/* New-game form shown when an empty slot is selected */
.new-game-slot-label {
  font-family: 'Orbitron', sans-serif; font-size: 0.72rem;
  letter-spacing: 2px; color: rgba(200,150,255,0.65);
  text-transform: uppercase; margin-bottom: 10px; text-align: center;
}
.new-game-slot-label span { color: #c030ff; font-weight: 700; }

.btn-back {
  display: block; width: 100%; padding: 10px;
  margin-top: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 12px; color: rgba(255,255,255,0.55);
  font-family: 'Rajdhani', sans-serif; font-size: 0.9rem;
  cursor: pointer; touch-action: manipulation;
  transition: background .2s;
}
.btn-back:hover { background: rgba(255,255,255,0.11); }

/* Game Mode Selector */
.mode-row {
  display: flex; gap: 6px; margin: 10px 0 4px;
}
.mode-btn {
  flex: 1; padding: 8px 2px;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(140,50,255,0.3);
  border-radius: 10px; color: rgba(255,255,255,0.65);
  font-family: 'Rajdhani', sans-serif; font-size: 0.72rem; font-weight: 700;
  cursor: pointer; touch-action: manipulation;
  transition: border-color .2s, background .2s, color .2s;
  white-space: nowrap;
}
.mode-btn:hover  { border-color: rgba(192,48,255,0.6); background: rgba(192,48,255,0.1); }
.mode-btn.mode-active { border-color: #c030ff; background: rgba(192,48,255,0.18); color: white; }

.mode-desc {
  font-size: 0.72rem; color: rgba(200,150,255,0.6);
  text-align: center; margin-bottom: 8px; min-height: 1.2em;
  font-family: 'Rajdhani', sans-serif;
}

/* Pause — Save & Quit */
.pause-save-quit-btn {
  max-width: 220px; margin: 10px auto 0;
  background: linear-gradient(135deg, #2a0055, #7700cc);
}

/* ========================================================
   GAME CONTAINER
======================================================== */
.game-container {
  position: fixed;       /* always fills the whole screen */
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: transparent;
  /* Respect notch / dynamic island / home bar on modern phones */
  padding-top:    env(safe-area-inset-top,    0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left:   env(safe-area-inset-left,   0px);
  padding-right:  env(safe-area-inset-right,  0px);
}

/* No image texture — canvas handles all background rendering */

/* Danger warning red border pulse */
.game-container.danger::after {
  content: '';
  position: fixed; inset: 0;
  border: 4px solid rgba(255,0,0,0.7);
  box-shadow: inset 0 0 40px rgba(255,0,0,0.4), 0 0 30px rgba(255,0,0,0.3);
  pointer-events: none;
  z-index: 200;
  animation: dangerPulse 0.5s ease-in-out infinite alternate;
}
@keyframes dangerPulse {
  from { border-color: rgba(255,0,0,0.5); box-shadow: inset 0 0 25px rgba(255,0,0,0.3); }
  to   { border-color: rgba(255,0,0,0.9); box-shadow: inset 0 0 60px rgba(255,0,0,0.6), 0 0 40px rgba(255,0,0,0.4); }
}

/* ========================================================
   MAIN HUD
======================================================== */
.hud {
  position: fixed; top: 0; left: 0; right: 0; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px;
  background: rgba(4,0,14,0.8);
  border-bottom: 1px solid rgba(140,50,255,0.25);
  backdrop-filter: blur(10px); z-index: 50;
}
.hud-item   { display: flex; flex-direction: column; align-items: flex-start; min-width: 70px; }
.hud-right  { align-items: flex-end; }
.hud-center { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.hud-label  {
  font-family: 'Orbitron', sans-serif; font-size: 0.48rem;
  letter-spacing: 2.5px; color: rgba(190,140,255,0.6); text-transform: uppercase;
}
.hud-value {
  font-family: 'Orbitron', sans-serif; font-size: 1.18rem; font-weight: 700;
  text-shadow: 0 0 10px rgba(190,100,255,0.55);
}
.level-badge {
  font-family: 'Orbitron', sans-serif; font-size: 0.68rem; font-weight: 700;
  letter-spacing: 3px; color: #c030ff; text-shadow: 0 0 10px #c030ff;
  padding: 2px 12px; border: 1px solid rgba(192,48,255,.4); border-radius: 20px;
}
.lives-display { font-size: 0.9rem; letter-spacing: 3px; }

/* ========================================================
   SUB HUD (character title | weapon | coins | mines)
======================================================== */
.sub-hud {
  position: fixed; top: 56px; left: 0; right: 0; height: 32px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  background: rgba(2,0,10,0.6);
  border-bottom: 1px solid rgba(100,40,200,0.18);
  backdrop-filter: blur(6px); z-index: 49;
}
.char-title {
  font-family: 'Orbitron', sans-serif; font-size: 0.58rem;
  letter-spacing: 2px; color: #aaa;
  text-shadow: 0 0 8px rgba(200,150,255,0.4);
}
.weapon-badge {
  font-family: 'Orbitron', sans-serif; font-size: 0.68rem; font-weight: 700;
  color: white; letter-spacing: 1px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 20px; padding: 2px 12px;
  text-shadow: 0 0 8px rgba(255,200,100,0.5);
  transition: all 0.4s;
}
.coin-display {
  font-family: 'Orbitron', sans-serif; font-size: 0.72rem; font-weight: 700;
  color: gold;
  text-shadow: 0 0 8px rgba(255,215,0,0.6);
  letter-spacing: 1px;
  padding: 2px 10px;
  background: rgba(255,215,0,0.08);
  border: 1px solid rgba(255,215,0,0.25);
  border-radius: 20px;
}
.mine-counter {
  font-family: 'Orbitron', sans-serif; font-size: 0.75rem;
  letter-spacing: 3px; color: #ff9900;
  text-shadow: 0 0 8px rgba(255,150,0,.5);
}
.mode-badge {
  font-family: 'Orbitron', sans-serif; font-size: 0.55rem; font-weight: 700;
  letter-spacing: 1px; color: #ffdd44;
  background: rgba(255,200,0,0.1);
  border: 1px solid rgba(255,200,0,0.35);
  border-radius: 20px; padding: 2px 8px;
  text-shadow: 0 0 8px rgba(255,200,0,0.5);
}

/* ========================================================
   XP ZONE PROGRESS BAR
======================================================== */
.xp-bar-wrap {
  position: fixed; top: 88px; left: 0; right: 0; height: 3px;
  background: rgba(255,255,255,0.05);
  z-index: 48; overflow: hidden;
}
.xp-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #8800ff, #cc88ff);
  box-shadow: 0 0 8px #aa44ff;
  transition: width 0.55s cubic-bezier(0.22,1,0.36,1), background 0.8s;
}

/* ========================================================
   KILL FEED
======================================================== */
.kill-feed {
  position: fixed; top: 100px; right: 10px;
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 4px; z-index: 52; pointer-events: none;
}
.kf-entry {
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 3px 10px;
  font-family: 'Orbitron', sans-serif; font-size: 0.6rem;
  letter-spacing: 1px; color: rgba(255,255,255,0.85);
  backdrop-filter: blur(6px);
  animation: kf-slide-in 0.25s ease;
  white-space: nowrap;
}
.kf-entry .kf-pts { color: #ffdd44; font-weight: 700; }
.kf-fade { opacity: 0; transition: opacity 0.4s; }
@keyframes kf-slide-in {
  from { transform: translateX(60px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ========================================================
   POWER-UP BAR
======================================================== */
.powerup-bar {
  position: fixed; top: 94px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.65);
  border: 1px solid rgba(255,200,0,.35); border-radius: 20px;
  padding: 4px 16px; display: flex; align-items: center; gap: 10px;
  z-index: 48; font-family: 'Orbitron', sans-serif; font-size: 0.7rem; color: gold;
  white-space: nowrap;
}
.powerup-progress {
  width: 90px; height: 5px; background: rgba(255,255,255,0.12);
  border-radius: 3px; overflow: hidden;
}
.powerup-fill {
  height: 100%; background: linear-gradient(90deg, gold, #ff8800);
  border-radius: 3px; transition: width 0.08s linear;
}

/* ========================================================
   AMMO
======================================================== */
.ammo-display {
  position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%);
  font-family: 'Orbitron', sans-serif; font-size: 0.7rem; letter-spacing: 2px;
  color: rgba(255,150,50,0.9); text-shadow: 0 0 8px rgba(255,100,0,.5);
  z-index: 50; background: rgba(0,0,0,0.45); padding: 4px 14px;
  border-radius: 20px; backdrop-filter: blur(4px); white-space: nowrap;
}

/* ========================================================
   ICON BUTTONS (pause, sound)
======================================================== */
.icon-btn {
  position: fixed; z-index: 55;
  background: rgba(18,8,38,0.72);
  border: 1px solid rgba(140,50,255,0.38);
  border-radius: 50%; width: 38px; height: 38px; font-size: 0.95rem;
  color: white; cursor: pointer;
  transition: background .2s, transform .15s; backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: rgba(192,48,255,.3); transform: scale(1.1); }
.pause-btn { top: 64px; right: 14px; }
.sound-btn { top: 64px; right: 60px; }

/* ========================================================
   PLAYER  (CSS filter changes per level via JS)
======================================================== */
.player {
  position: absolute; width: 62px; height: 62px;
  background-image: url('user.png'); background-size: cover;
  z-index: 10; transition: filter 0.6s;
  filter: drop-shadow(0 0 8px rgba(100,200,255,0.9));
}
.player.invincible    { animation: blink .18s step-end infinite; }
.player.shield-active {
  filter: drop-shadow(0 0 18px rgba(0,200,255,1)) drop-shadow(0 0 6px rgba(0,255,200,.8)) !important;
}

/* ========================================================
   GHOST BASE
======================================================== */
.ghost {
  position: absolute; width: 68px; height: 68px;
  background-image: url('ghost.png'); background-size: cover;
  z-index: 9; animation: ghost-pulse 1.6s ease-in-out infinite;
}
.ghost.boss {
  width: 92px !important; height: 92px !important;
  animation-duration: 0.85s !important;
}

/* === GHOST LEVEL VARIANTS (CSS filter) === */
.ghost-lv1 { filter: drop-shadow(0 0 8px rgba(200,0,255,.6)); }
.ghost-lv2 { filter: hue-rotate(130deg) saturate(1.8) drop-shadow(0 0 12px rgba(255,0,50,.9)); }
.ghost-lv3 { filter: hue-rotate(200deg) brightness(1.15) drop-shadow(0 0 14px rgba(0,160,255,.9)); }
.ghost-lv4 { filter: brightness(0.35) contrast(2.2) saturate(1.6) drop-shadow(0 0 18px rgba(120,0,255,1)); }
.ghost-lv5 { filter: hue-rotate(40deg) saturate(2.5) drop-shadow(0 0 16px rgba(255,80,0,.95)); }
.ghost-lv6 { filter: saturate(0.4) contrast(1.8) drop-shadow(0 0 22px rgba(255,0,0,1)) drop-shadow(0 0 8px rgba(255,50,0,.7)); }

/* FROZEN ghost (ice bullet hit) */
.ghost-frozen {
  filter: hue-rotate(200deg) brightness(1.6) saturate(0.8)
          drop-shadow(0 0 16px rgba(0,220,255,1)) !important;
  animation: none !important;
}

/* ========================================================
   BOSS GHOST (every 10th level)
======================================================== */
.ghost-boss {
  width: 110px !important;
  height: 110px !important;
  z-index: 20;
  animation: bossFloat 1.8s ease-in-out infinite !important;
}
/* Override ghost-lv filters for boss to add extra menace */
.ghost-boss.ghost-lv1 { filter: drop-shadow(0 0 25px rgba(220,0,255,1)) drop-shadow(0 0 50px rgba(180,0,200,.5)) saturate(1.5) !important; }
.ghost-boss.ghost-lv2 { filter: hue-rotate(130deg) saturate(2.5) drop-shadow(0 0 28px rgba(255,0,50,1)) drop-shadow(0 0 55px rgba(200,0,30,.6)) !important; }
.ghost-boss.ghost-lv3 { filter: hue-rotate(200deg) brightness(1.25) drop-shadow(0 0 30px rgba(0,160,255,1)) drop-shadow(0 0 60px rgba(0,120,220,.5)) !important; }
.ghost-boss.ghost-lv4 { filter: brightness(0.4) contrast(2.5) saturate(2) drop-shadow(0 0 35px rgba(120,0,255,1)) drop-shadow(0 0 70px rgba(100,0,200,.6)) !important; }
.ghost-boss.ghost-lv5 { filter: hue-rotate(40deg) saturate(3) drop-shadow(0 0 30px rgba(255,80,0,1)) drop-shadow(0 0 60px rgba(200,50,0,.6)) !important; }
.ghost-boss.ghost-lv6 { filter: saturate(0.3) contrast(2.2) drop-shadow(0 0 40px rgba(255,0,0,1)) drop-shadow(0 0 80px rgba(200,0,0,.7)) brightness(1.1) !important; }
.ghost-boss.boss-hit  { filter: brightness(8) invert(1) !important; transition: filter 0.1s; }

@keyframes bossFloat {
  0%,100% { transform: translateY(0)   scale(1);    }
  25%      { transform: translateY(-14px) scale(1.04) rotate(-2deg); }
  75%      { transform: translateY(-8px)  scale(1.02) rotate(2deg);  }
}

/* ========================================================
   BOSS HEALTH BAR
======================================================== */
.boss-bar-wrap {
  position: absolute;
  top: 68px; left: 50%; transform: translateX(-50%);
  width: min(68%, 520px);
  display: flex; align-items: center; gap: 10px;
  background: rgba(8, 0, 15, 0.85);
  border: 1.5px solid rgba(255, 30, 30, 0.55);
  border-radius: 14px; padding: 8px 14px;
  z-index: 60;
  box-shadow: 0 0 24px rgba(255,0,0,0.25);
  backdrop-filter: blur(8px);
}
.boss-bar-name {
  font-family: 'Orbitron', sans-serif; font-size: 0.62rem;
  color: #ff5555; white-space: nowrap; letter-spacing: 1px;
  min-width: 70px; text-shadow: 0 0 10px rgba(255,0,0,.6);
}
.boss-hp-track {
  flex: 1; height: 14px;
  background: rgba(255,255,255,0.08);
  border-radius: 7px; overflow: hidden;
  border: 1px solid rgba(255,60,60,0.3);
}
.boss-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #cc0000, #ff2200, #ff6600, #ffaa00);
  border-radius: 7px;
  transition: width 0.25s ease;
  box-shadow: 0 0 10px rgba(255,100,0,0.5);
}
.boss-hp-text {
  font-family: 'Orbitron', sans-serif; font-size: 0.6rem;
  color: #ff9999; min-width: 54px; text-align: right;
}

/* ========================================================
   ABILITY BAR (Clone & Portal — last 5 boss fights)
======================================================== */
.ability-bar {
  position: absolute;
  bottom: 14px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 12px; align-items: center;
  z-index: 55; pointer-events: auto;
}
.ability-key-btn {
  font-family: 'Orbitron', sans-serif; font-size: 0.7rem;
  font-weight: 700; letter-spacing: 1px;
  border: none; border-radius: 10px; cursor: pointer;
  padding: 9px 18px; display: flex; align-items: center; gap: 7px;
  transition: transform .15s, box-shadow .15s;
}
.clone-key-btn {
  background: linear-gradient(135deg, #5000a0, #cc00ff);
  color: white; box-shadow: 0 0 18px rgba(200,0,255,.45);
}
.portal-key-btn {
  background: linear-gradient(135deg, #003080, #0090ff);
  color: white; box-shadow: 0 0 18px rgba(0,150,255,.45);
}
.ability-key-btn:hover  { transform: translateY(-2px); }
.ability-key-btn:active { transform: scale(.95); }
.key-hint {
  background: rgba(255,255,255,0.18); border-radius: 4px;
  padding: 1px 5px; font-size: 0.6rem;
}
.clone-key-btn.on-cooldown  { opacity: 0.45; cursor: not-allowed; }
.portal-key-btn.on-cooldown { opacity: 0.45; cursor: not-allowed; }

/* ========================================================
   PLAYER CLONE (Doctor Strange mirror image)
======================================================== */
.player-clone {
  position: absolute;
  width: 52px; height: 52px;
  background: url('user.png') center/cover no-repeat;
  filter: hue-rotate(280deg) saturate(2.5) drop-shadow(0 0 14px rgba(200,0,255,1));
  opacity: 0.88;
  z-index: 14;
  pointer-events: none;
  animation: clonePulse 0.9s ease-in-out infinite alternate;
  border-radius: 4px;
}
@keyframes clonePulse {
  from { filter: hue-rotate(280deg) saturate(2.5) drop-shadow(0 0 14px rgba(200,0,255,1)); opacity:.85; }
  to   { filter: hue-rotate(300deg) saturate(3)   drop-shadow(0 0 26px rgba(240,0,255,1)) brightness(1.25); opacity:1; }
}

/* ========================================================
   PORTAL RING
======================================================== */
.portal-ring {
  position: absolute;
  width: 90px; height: 90px;
  border-radius: 50%;
  border: 3px solid rgba(0, 200, 255, 0.85);
  box-shadow: 0 0 24px rgba(0,200,255,0.6),
              inset 0 0 24px rgba(0,200,255,0.3),
              0 0 60px rgba(0,100,255,0.2);
  z-index: 15; pointer-events: none;
  animation: portalSpin 1.2s linear infinite, portalGlow 1.8s ease-in-out infinite;
}
.portal-ring::before {
  content: '';
  position: absolute; inset: 10px;
  border-radius: 50%;
  border: 1.5px dashed rgba(0,220,255,0.5);
  animation: portalSpin 2.5s linear infinite reverse;
}
.portal-ring::after {
  content: '🌀';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; opacity: 0.6;
}
@keyframes portalSpin {
  from { transform: rotate(0deg);   }
  to   { transform: rotate(360deg); }
}
@keyframes portalGlow {
  0%,100% { box-shadow: 0 0 24px rgba(0,200,255,.6), inset 0 0 24px rgba(0,200,255,.3); }
  50%     { box-shadow: 0 0 48px rgba(0,200,255,.9), inset 0 0 48px rgba(0,200,255,.6); }
}

/* ========================================================
   CLONE BULLET
======================================================== */
.bullet-clone {
  position: absolute;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #ff88ff, #9900cc);
  box-shadow: 0 0 10px #ff00ff, 0 0 20px #9900cc;
  z-index: 12;
  pointer-events: none;
}

/* ========================================================
   TOUCH: BOSS ABILITY BUTTONS
======================================================== */
.boss-action-btns {
  display: flex; flex-direction: row; gap: 8px;
  align-items: flex-end;
}
.clone-touch-btn, .portal-touch-btn {
  width: 62px; height: 62px;
  border: none; border-radius: 50%;
  font-size: 1.4rem; line-height: 1.1;
  cursor: pointer; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: transform .12s;
  box-shadow: 0 2px 14px rgba(0,0,0,.5);
}
.clone-touch-btn {
  background: radial-gradient(circle at 40% 35%, #9900ff, #440077);
  color: white;
}
.portal-touch-btn {
  background: radial-gradient(circle at 40% 35%, #0088ff, #003366);
  color: white;
}
.clone-touch-btn small, .portal-touch-btn small {
  font-size: 0.5rem; letter-spacing: .5px; color: rgba(255,255,255,.8);
}
.clone-touch-btn:active, .portal-touch-btn:active { transform: scale(.92); }

/* ========================================================
   NPC (rescue target)
======================================================== */
#npc {
  filter: hue-rotate(175deg) brightness(.9)
          drop-shadow(0 0 12px rgba(0,255,220,.8)) !important;
  animation: npc-float 1.2s ease-in-out infinite alternate !important;
  z-index: 9 !important;
}

/* ========================================================
   BULLET VARIANTS
======================================================== */
/* Base bullet (level 1) */
.bullet {
  position: absolute; width: 26px; height: 17px;
  background-image: url('bullets.png'); background-size: cover;
  background-repeat: no-repeat; z-index: 11;
  filter: drop-shadow(0 0 5px rgba(255,150,0,.8));
}

/* 💣 Bomb — dark metallic sphere, no ::after */
.bullet-bomb {
  background: radial-gradient(circle at 38% 38%, #888, #444, #111) !important;
  border-radius: 50% !important;
  box-shadow: 0 0 14px rgba(255,160,0,0.8), 0 0 28px rgba(255,80,0,0.4);
  width: 30px !important;
  height: 30px !important;
  background-image: none !important;
  filter: none !important;
}

/* 🔥 Fire blast — orange fireball */
.bullet-fire {
  background: radial-gradient(circle at 40% 40%, #ffaa44, #ff4400) !important;
  border-radius: 50% !important;
  width: 22px !important;
  height: 22px !important;
  box-shadow: 0 0 12px #ff5500, 0 0 24px rgba(255,80,0,0.5);
  background-image: none !important;
  filter: none !important;
}

/* ❄️ Ice shard */
.bullet-ice {
  background-image: none !important;
  width: 22px !important; height: 10px !important;
  background: linear-gradient(90deg, #aaddff, #00aaff) !important;
  border-radius: 2px !important;
  box-shadow: 0 0 10px #00ccff, 0 0 20px rgba(0,180,255,.5);
  filter: none !important;
}

/* 🌟 Plasma beam */
.bullet-beam {
  background-image: none !important;
  width: 55px !important; height: 12px !important;
  background: linear-gradient(90deg, rgba(0,255,255,0), #00ffff, #ffffff, #00ffff, rgba(0,255,255,0)) !important;
  border-radius: 6px !important;
  box-shadow: 0 0 16px #00ffff, 0 0 32px rgba(0,255,255,.5);
  filter: none !important;
}

/* 🔱 Trident prong */
.bullet-trident {
  background-image: none !important;
  width: 20px !important; height: 20px !important;
  background: radial-gradient(circle at 50% 30%, #bbaaff, #7700ff) !important;
  border-radius: 4px 4px 50% 50% !important;
  box-shadow: 0 0 12px #aa66ff, 0 0 24px rgba(150,50,255,.5);
  filter: none !important;
}

/* 🪃 Boomerang */
.bullet-boomerang {
  background-image: none !important;
  width: 28px !important; height: 10px !important;
  background: linear-gradient(90deg, #ff9900, #ffcc00, #ff9900) !important;
  border-radius: 50% !important;
  box-shadow: 0 0 10px #ffaa00, 0 0 20px rgba(255,160,0,.5);
  filter: none !important;
}

/* ⛓ Chain bolt */
.bullet-chain { display: none !important; } /* chain uses lightning arcs directly */

/* 🌑 Black Hole projectile */
.bullet-blackhole {
  background-image: none !important;
  width: 22px !important; height: 22px !important;
  background: radial-gradient(circle, #330055, #000000) !important;
  border-radius: 50% !important;
  border: 2px solid rgba(180,0,255,0.6) !important;
  box-shadow: 0 0 18px rgba(180,0,255,.9), 0 0 6px rgba(180,0,255,.4) inset;
  filter: none !important;
}

/* 💠 Plasma Bounce */
.bullet-plasma {
  background-image: none !important;
  width: 18px !important; height: 18px !important;
  background: radial-gradient(circle at 40% 40%, #aaffff, #0088ff) !important;
  border-radius: 50% !important;
  box-shadow: 0 0 14px #00ccff, 0 0 28px rgba(0,200,255,.5);
  filter: none !important;
}

/* ☄️ Meteor */
.bullet-meteor {
  background-image: none !important;
  width: 28px !important; height: 28px !important;
  background: radial-gradient(circle at 35% 35%, #ffdd88, #ff6600, #cc2200) !important;
  border-radius: 50% 50% 50% 30% !important;
  box-shadow: 0 0 18px #ff6600, 0 0 36px rgba(255,80,0,.5);
  filter: none !important;
}

/* 🌊 Tsunami wave */
.bullet-tsunami {
  background-image: none !important;
  width: 80px !important; height: 50px !important;
  background: linear-gradient(135deg, rgba(0,120,255,0.9), rgba(0,200,255,0.7), rgba(100,230,255,0.5)) !important;
  border-radius: 0 50% 50% 0 !important;
  box-shadow: 0 0 20px #0099ff, 0 0 40px rgba(0,150,255,.4);
  filter: none !important;
  opacity: 0.85;
}

/* Black hole visual effect (spinning vortex) */
.blackhole-vfx {
  position: absolute;
  width: 80px; height: 80px;
  margin-left: -40px; margin-top: -40px;
  border-radius: 50%;
  background: radial-gradient(circle, #000000 30%, rgba(100,0,200,0.6) 70%, transparent 100%);
  border: 3px solid rgba(180,0,255,0.7);
  box-shadow: 0 0 30px rgba(180,0,255,0.8), inset 0 0 20px rgba(0,0,0,0.9);
  animation: bh-spin 0.6s linear infinite;
  z-index: 25; pointer-events: none;
}
@keyframes bh-spin {
  from { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(180deg) scale(1.15); }
  to   { transform: rotate(360deg) scale(1); }
}

/* ========================================================
   LIGHTNING ARC
======================================================== */
.lightning-arc {
  position: absolute; height: 4px;
  background: linear-gradient(90deg, rgba(255,255,0,0), #ffff00, #ffffff, #ffff00, rgba(255,255,0,0));
  border-radius: 2px; z-index: 25; pointer-events: none;
  box-shadow: 0 0 10px #ffff00, 0 0 20px rgba(255,255,0,.5);
  animation: lightning-flicker .15s steps(2) 2;
}
@keyframes lightning-flicker {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.3; }
}

/* ========================================================
   MINE
======================================================== */
.mine {
  position: absolute; width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; z-index: 8; pointer-events: none;
  animation: mine-pulse 0.8s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 6px rgba(255,150,0,.8));
}
.mine-triggered {
  animation: mine-blast-anim 0.5s ease-out forwards;
}
@keyframes mine-pulse {
  from { transform: scale(1);    filter: drop-shadow(0 0 5px rgba(255,150,0,.7)); }
  to   { transform: scale(1.15); filter: drop-shadow(0 0 12px rgba(255,80,0,1)); }
}
@keyframes mine-blast-anim {
  0%   { transform: scale(1); opacity: 1; }
  100% { transform: scale(4); opacity: 0; }
}

/* ========================================================
   POWER-UPS
======================================================== */
.power-up {
  position: absolute; width: 40px; height: 40px;
  border-radius: 50%; z-index: 8;
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
  animation: pu-spin 4s linear infinite, pu-glow 1s ease-in-out infinite alternate;
}
.power-up.freeze { background: radial-gradient(circle, rgba(0,200,255,.8), rgba(0,100,200,.3)); box-shadow: 0 0 22px rgba(0,200,255,.7); }
.power-up.speed  { background: radial-gradient(circle, rgba(255,220,0,.8), rgba(255,120,0,.3));  box-shadow: 0 0 22px rgba(255,200,0,.7); }
.power-up.shield { background: radial-gradient(circle, rgba(0,255,160,.8), rgba(0,180,100,.3));  box-shadow: 0 0 22px rgba(0,255,140,.7); }
.power-up.ammo   { background: radial-gradient(circle, rgba(255,90,90,.8), rgba(200,0,0,.3));    box-shadow: 0 0 22px rgba(255,50,50,.7); }

/* ========================================================
   EXPLOSIONS
======================================================== */
.explosion {
  position: absolute; width: 60px; height: 60px;
  border-radius: 50%; pointer-events: none; z-index: 20;
  animation: explode .55s ease-out forwards;
}
.big-explosion {
  position: absolute; border-radius: 50%; pointer-events: none; z-index: 20;
  background: radial-gradient(circle, rgba(255,220,0,.95), rgba(255,80,0,.7), rgba(255,0,0,0));
  animation: big-explode .7s ease-out forwards;
}

/* ========================================================
   PARTICLES & FLOAT TEXT
======================================================== */
.particle {
  position: absolute; width: 7px; height: 7px;
  border-radius: 50%; pointer-events: none;
  animation: particleFly .65s ease-out forwards; z-index: 20;
}
.float-text {
  position: absolute;
  font-family: 'Orbitron', sans-serif; font-size: 1rem; font-weight: 700;
  pointer-events: none; z-index: 30; white-space: nowrap;
  text-shadow: 0 0 8px rgba(0,0,0,.6);
  animation: floatUp 1.1s ease-out forwards;
}

/* ========================================================
   LEVEL ANNOUNCE
======================================================== */
.level-announce {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 80; background: rgba(0,0,0,.82);
  backdrop-filter: blur(5px); animation: fadeIn .3s ease;
}
.announce-inner   { text-align: center; animation: zoomIn .4s ease; }
.announce-sub     {
  font-family: 'Orbitron', sans-serif; font-size: .85rem;
  letter-spacing: 8px; color: rgba(200,150,255,.75); margin-bottom: 8px;
}
.announce-title   {
  font-family: 'Orbitron', sans-serif; font-size: 4.5rem; font-weight: 900;
  letter-spacing: 6px;
  text-shadow: 0 0 40px rgba(192,48,255,1), 0 0 90px rgba(192,48,255,.4);
}
.announce-name    {
  font-family: 'Rajdhani', sans-serif; font-size: 1.4rem; letter-spacing: 4px;
  color: #c030ff; margin-top: 10px;
}
.announce-weapon  {
  margin-top: 14px; display: inline-block;
  background: rgba(255,200,0,.12);
  border: 1px solid rgba(255,200,0,.4);
  border-radius: 20px; padding: 6px 20px;
  font-family: 'Orbitron', sans-serif; font-size: 0.85rem;
  color: gold; letter-spacing: 2px;
  box-shadow: 0 0 16px rgba(255,180,0,.3);
}
.announce-char    {
  font-family: 'Rajdhani', sans-serif; font-size: 1rem;
  color: rgba(200,255,200,.75); letter-spacing: 2px; margin-top: 8px;
}

/* ========================================================
   OVERLAY (Game Over / Win / Shop / Continue)
======================================================== */
.overlay-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 90; background: rgba(0,0,0,.84); backdrop-filter: blur(8px);
}
.result-card {
  background: rgba(10,3,24,.93); border-radius: 24px;
  padding: 40px 48px; text-align: center; max-width: 420px; width: 92%;
  animation: zoomIn .4s ease;
}
.gameover-card { border: 1px solid rgba(255,50,50,.35); box-shadow: 0 0 60px rgba(255,0,50,.22); }
.win-card      { border: 1px solid rgba(0,255,140,.35); box-shadow: 0 0 60px rgba(0,255,100,.22); }
.result-icon   { font-size: 4rem; margin-bottom: 8px; }
.result-title  {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.85rem; font-weight: 900; letter-spacing: 5px; margin-bottom: 6px;
}
.red-glow   { color: #ff4444; text-shadow: 0 0 22px rgba(255,50,50,.7); }
.green-glow { color: #00ff96; text-shadow: 0 0 22px rgba(0,255,140,.7); }
.result-msg { color: #aaa; font-size: .95rem; margin-bottom: 16px; }
.score-table { background: rgba(255,255,255,.04); border-radius: 12px; padding: 12px 18px; margin-bottom: 16px; }
.score-row {
  display: flex; justify-content: space-between; padding: 6px 0;
  font-family: 'Orbitron', sans-serif; font-size: .78rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.score-row:last-child { border-bottom: none; }
.val-purple { color: #c030ff; font-weight: 700; }
.val-gold   { color: gold;    font-weight: 700; }
.val-green  { color: #00ff96; font-weight: 700; }
.new-record {
  font-family: 'Orbitron', sans-serif; font-size: .9rem;
  color: gold; text-shadow: 0 0 16px gold; margin-bottom: 10px;
  animation: pulse .5s ease-in-out infinite alternate;
}

/* ========================================================
   SHOP SCREEN
======================================================== */
.shop-card {
  border: 1px solid rgba(255,215,0,0.35);
  box-shadow: 0 0 60px rgba(255,180,0,0.22);
  max-width: 500px;
  padding: 32px 36px;
}
.shop-header {
  text-align: center;
  margin-bottom: 20px;
}
.shop-icon {
  font-size: 3rem;
  margin-bottom: 6px;
}
.shop-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.6rem; font-weight: 900;
  letter-spacing: 4px;
  color: gold;
  text-shadow: 0 0 20px rgba(255,215,0,0.6);
  margin-bottom: 6px;
}
.shop-coins-display {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.1rem; font-weight: 700;
  color: gold;
  text-shadow: 0 0 12px rgba(255,215,0,0.7);
  margin-bottom: 4px;
}
.shop-subtitle {
  font-size: 0.82rem; color: #aaa; letter-spacing: 1px;
}
.shop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}
.shop-item {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,215,0,0.25);
  border-radius: 14px;
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}
.shop-item:hover {
  background: rgba(255,215,0,0.1);
  border-color: rgba(255,215,0,0.55);
  transform: translateY(-2px);
}
.shop-item:active { transform: scale(0.96); }
.shop-item.unaffordable {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: rgba(255,255,255,0.1);
}
.shop-item.unaffordable:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
  transform: none;
}
.shop-item-icon {
  font-size: 1.8rem;
  margin-bottom: 4px;
}
.shop-item-name {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: white;
  margin-bottom: 4px;
}
.shop-item-cost {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  color: gold;
  font-weight: 700;
  margin-bottom: 4px;
  text-shadow: 0 0 8px rgba(255,215,0,0.5);
}
.shop-item-desc {
  font-size: 0.72rem;
  color: #aaa;
  letter-spacing: 0.5px;
}
.shop-msg {
  min-height: 22px;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  color: #00ff96;
  text-align: center;
  margin-bottom: 10px;
  text-shadow: 0 0 8px rgba(0,255,140,0.4);
  letter-spacing: 1px;
}
.shop-continue-btn {
  margin-top: 6px;
  letter-spacing: 1.5px;
}

/* ========================================================
   CONTINUE SCREEN
======================================================== */
.continue-card {
  border: 1px solid rgba(255,50,50,0.4);
  box-shadow: 0 0 60px rgba(255,0,50,0.25);
  max-width: 380px;
}
.continue-heading {
  font-family: 'Orbitron', sans-serif;
  font-size: 2rem; font-weight: 900;
  letter-spacing: 4px;
  color: #ff4444;
  text-shadow: 0 0 22px rgba(255,50,50,0.7);
  margin-bottom: 10px;
}
.continue-desc {
  color: #ccc;
  font-size: 0.9rem;
  margin-bottom: 14px;
  letter-spacing: 0.5px;
}
.continue-coins-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.8rem;
  margin-bottom: 16px;
  color: #ccc;
}
.continue-timer-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}
.continue-timer {
  font-family: 'Orbitron', sans-serif;
  font-size: 3rem; font-weight: 900;
  color: #ff4444;
  text-shadow: 0 0 22px rgba(255,50,50,0.8);
  width: 70px; height: 70px;
  border-radius: 50%;
  border: 3px solid rgba(255,50,50,0.5);
  display: flex; align-items: center; justify-content: center;
  animation: pulse 0.9s ease-in-out infinite alternate;
}
.continue-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}
.btn-continue-action {
  background: linear-gradient(135deg, #cc0000, #ff4444);
  box-shadow: 0 4px 22px rgba(255,50,50,0.4);
}
.btn-continue-action:hover { box-shadow: 0 8px 32px rgba(255,50,50,0.6); }
.btn-continue-action.shake {
  animation: screenShake 0.35s ease;
}
.btn-giveup {
  display: block; width: 100%; padding: 12px;
  font-family: 'Orbitron', sans-serif; font-size: 0.85rem; font-weight: 700;
  letter-spacing: 2px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px; color: #aaa; cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.btn-giveup:hover { background: rgba(255,255,255,0.12); color: white; }
.continue-msg {
  min-height: 20px;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.72rem;
  color: #ff6666;
  text-align: center;
  letter-spacing: 1px;
}

/* ========================================================
   PAUSE OVERLAY
======================================================== */
.pause-overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 85;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.2s ease;
}
.pause-inner {
  text-align: center;
  animation: zoomIn 0.3s ease;
}
.pause-icon {
  font-size: 4rem;
  margin-bottom: 10px;
  filter: drop-shadow(0 0 16px rgba(192,48,255,0.8));
}
.pause-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 3rem; font-weight: 900;
  letter-spacing: 8px;
  color: white;
  text-shadow: 0 0 30px rgba(192,48,255,0.8), 0 0 60px rgba(192,48,255,0.4);
  margin-bottom: 12px;
}
.pause-hint {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  color: rgba(200,150,255,0.7);
  letter-spacing: 2px;
  margin-bottom: 24px;
}
.pause-resume-btn {
  max-width: 220px;
  margin: 0 auto;
  background: linear-gradient(135deg, #6000bb, #c030ff);
}

/* ========================================================
   TOUCH CONTROLS
======================================================== */
.touch-controls {
  position: fixed; bottom: 18px; left: 0; right: 0;
  display: none; justify-content: space-between; align-items: flex-end;
  padding: 0 20px; z-index: 60; pointer-events: none;
}
.touch-controls.visible { display: flex; }

.dpad { display: flex; flex-direction: column; align-items: center; gap: 3px; pointer-events: all; }
.dpad-row { display: flex; align-items: center; gap: 3px; }
.dpad-center {
  width: 44px; height: 44px; background: rgba(60,20,100,.55);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.22); font-size: 1.1rem; font-weight: 900;
}
.dpad-btn {
  width: 54px; height: 54px;
  background: rgba(50,15,90,.8); border: 2px solid rgba(140,50,255,.45);
  border-radius: 12px; color: white; font-size: 1.1rem; cursor: pointer;
  pointer-events: all; display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: background .1s, transform .1s; backdrop-filter: blur(5px);
}
.dpad-btn:active { background: rgba(140,50,255,.5); transform: scale(.9); }

.action-btns {
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: flex-end;
  pointer-events: all;
}

.mine-btn {
  width: 60px; height: 60px;
  background: rgba(80,40,0,.8); border: 2px solid rgba(255,140,0,.55);
  border-radius: 14px; color: white;
  font-family: 'Orbitron', sans-serif; font-size: 0.68rem; font-weight: 700;
  cursor: pointer; pointer-events: all;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; line-height: 1.2; text-align: center;
  -webkit-tap-highlight-color: transparent;
  transition: background .1s, transform .1s; backdrop-filter: blur(5px);
}
.mine-btn:active { background: rgba(255,120,0,.5); transform: scale(.9); }
.mine-btn small  { font-size: 0.55rem; letter-spacing: 1px; color: #ffcc88; }

.fire-btn {
  width: 78px; height: 78px;
  background: rgba(120,0,0,.8); border: 2px solid rgba(255,70,70,.55);
  border-radius: 50%; color: white;
  font-family: 'Orbitron', sans-serif; font-size: 0.72rem; font-weight: 700;
  cursor: pointer; pointer-events: all;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; line-height: 1.2; text-align: center;
  -webkit-tap-highlight-color: transparent;
  transition: background .1s, transform .1s; backdrop-filter: blur(5px);
}
.fire-btn:active { background: rgba(255,50,50,.6); transform: scale(.9); }
.fire-btn small  { font-size: 0.55rem; letter-spacing: 1px; color: #ffaaaa; }

/* ========================================================
   KEYFRAME ANIMATIONS
======================================================== */
@keyframes float       { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-14px)} }
@keyframes npc-float   { from{transform:scale(1)} to{transform:scale(1.1)} }
@keyframes ghost-pulse { 0%,100%{opacity:.88;transform:scale(1)} 50%{opacity:1;transform:scale(1.06)} }
@keyframes pu-spin     { from{transform:rotate(0deg)} to{transform:rotate(360deg)} }
@keyframes pu-glow     { from{opacity:.75} to{opacity:1} }
@keyframes blink       { 0%,100%{opacity:1} 50%{opacity:.15} }
@keyframes fadeIn      { from{opacity:0} to{opacity:1} }
@keyframes zoomIn      { from{transform:scale(.6);opacity:0} to{transform:scale(1);opacity:1} }
@keyframes pulse       { from{transform:scale(1)} to{transform:scale(1.09)} }
@keyframes floatUp     { 0%{transform:translateY(0);opacity:1} 100%{transform:translateY(-70px);opacity:0} }
@keyframes particleFly { 0%{transform:scale(1) translate(0,0);opacity:1} 100%{transform:scale(0) translate(var(--tx),var(--ty));opacity:0} }
@keyframes explode     {
  0%  {transform:scale(.5); opacity:1; box-shadow:0 0 20px 10px rgba(255,120,0,.85);}
  100%{transform:scale(4.5);opacity:0; box-shadow:0 0 60px 30px rgba(255,50,0,0);}
}
@keyframes big-explode {
  0%  {transform:scale(0);  opacity:1;}
  60% {transform:scale(1);  opacity:.9;}
  100%{transform:scale(1.4);opacity:0;}
}
@keyframes screenShake {
  0%,100%{transform:translate(0,0)} 20%{transform:translate(-6px,3px)}
  40%{transform:translate(6px,-4px)} 60%{transform:translate(-5px,-2px)} 80%{transform:translate(5px,3px)}
}
.screen-shake { animation: screenShake .3s ease; }
.shake-anim   { animation: screenShake .5s ease; }
.float-anim   { animation: float 2s ease-in-out infinite; }

/* ========================================================
   RESPONSIVE
======================================================== */
@media (max-width: 900px) {
  /* tc-drag controls are shown/hidden via JS; ammo pushed above them */
  .ammo-display { bottom: 200px; }
}
@media (max-width: 768px) {
  .start-screen { padding: 16px 12px; }
  .start-card { padding: 26px 22px; }
  .ghost-float-icon { font-size: 3.2rem; margin-bottom: 2px; }
  .game-title { font-size: 2.1rem; }
  .announce-title { font-size: 2.8rem; }
  .result-card { padding: 28px 20px; }
  .player { width: 52px; height: 52px; }
  .ghost  { width: 56px; height: 56px; }
  .ghost.boss { width: 76px !important; height: 76px !important; }
  .hud-value { font-size: 1rem; }
  .controls-grid { grid-template-columns: 1fr; }
  .ammo-display { display: none; }
  .shop-card { padding: 22px 16px; }
  .shop-grid { gap: 8px; }
}
@media (max-width: 480px) {
  .start-screen { padding: 12px 10px; }
  .start-card { padding: 22px 18px; border-radius: 18px; }
  .ghost-float-icon { font-size: 2.8rem; margin-bottom: 2px; }
  .hud { padding: 0 10px; height: 50px; }
  .sub-hud { padding: 0 10px; }
  .game-title { font-size: 1.65rem; letter-spacing: 3px; }
  .game-subtitle { font-size: 0.75rem; letter-spacing: 3px; margin-bottom: 8px; }
  .highscore-badge { font-size: 0.72rem; padding: 3px 12px; margin-bottom: 12px; }
  .start-screen input { padding: 11px 14px; font-size: 0.95rem; margin-bottom: 10px; }
  .controls-grid { gap: 6px; margin-top: 12px; }
  .announce-title { font-size: 2.1rem; }
  .dpad-btn { width: 48px; height: 48px; font-size: 1rem; }
  .fire-btn { width: 72px; height: 72px; }
  .mine-btn { width: 54px; height: 54px; }
  .char-title { display: none; }
  .coin-display { font-size: 0.62rem; padding: 2px 6px; }
}

/* ================================================================
   PORTRAIT MODE SUPPORT
================================================================ */
/* Portrait / mobile — fix HUD layout */
@media screen and (max-width: 900px) {
  .hud { height: auto; min-height: 52px; flex-wrap: wrap; gap: 4px; padding: 6px 10px; }
  .sub-hud { flex-wrap: wrap; gap: 4px; padding: 4px 10px; min-height: 32px; }
}

/* ================================================================
   LANDSCAPE WARNING OVERLAY
   Shows only when phone is in landscape + small screen (mobile)
================================================================ */
.rotate-overlay {
  display: none;          /* JS shows it on landscape */
  position: fixed; inset: 0;
  z-index: 9999;
  background: #04000f;
  flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; text-align: center; padding: 24px;
}
.rotate-overlay .rotate-icon {
  font-size: 5rem;
  animation: rotateHint 1.8s ease-in-out infinite;
}
.rotate-overlay p {
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem; letter-spacing: 2px;
  color: #c030ff; text-shadow: 0 0 16px #c030ff;
}
.rotate-overlay small {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.85rem; color: #888;
}
@keyframes rotateHint {
  0%,100% { transform: rotate(0deg) scale(1); }
  40%      { transform: rotate(90deg) scale(1.1); }
  60%      { transform: rotate(90deg) scale(1.1); }
}

/* ================================================================
   HEALTH INVENTORY BAR (below sub-hud)
================================================================ */
.health-inventory {
  position: absolute;
  top: 106px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px; align-items: center;
  z-index: 55; pointer-events: auto;
}
.inv-slot {
  display: flex; align-items: center; gap: 4px;
  background: rgba(0,0,0,0.55);
  border: 1.5px solid rgba(255,255,255,0.18);
  border-radius: 10px; padding: 4px 10px;
  font-size: 1rem; color: white; cursor: pointer;
  font-family: 'Rajdhani', sans-serif; font-weight: 700;
  transition: transform .12s, border-color .15s;
  -webkit-tap-highlight-color: transparent;
}
.inv-slot span { font-size: 0.85rem; min-width: 14px; text-align: center; }
.bandage-slot { border-color: rgba(255,150,150,0.4); }
.bandage-slot:active { transform: scale(.92); border-color: #ff9999; }
.booster-slot { border-color: rgba(0,200,255,0.4); }
.booster-slot:active { transform: scale(.92); border-color: #00ccff; }
.medkit-slot  { border-color: rgba(0,255,140,0.4); }
.medkit-slot:active  { transform: scale(.92); border-color: #00ff88; }
.inv-slot.empty { opacity: 0.38; }

/* ================================================================
   SETTINGS BUTTON
================================================================ */
.settings-btn {
  top: 64px !important;
  right: 112px !important; /* sits left of sound-btn */
}

/* ================================================================
   SETTINGS PANEL
================================================================ */
.settings-screen {
  z-index: 200;
  align-items: center; justify-content: center;
  overflow-y: auto; padding: 16px;
}
.settings-card {
  background: rgba(8, 2, 20, 0.97);
  border: 1.5px solid rgba(160, 60, 255, 0.3);
  border-radius: 20px; padding: 24px 22px;
  max-width: 420px; width: 100%;
  max-height: 88vh; overflow-y: auto;
  box-shadow: 0 0 60px rgba(140,0,255,0.2);
  backdrop-filter: blur(16px);
}
.settings-header {
  display: flex; align-items: center; justify-content: space-between;
  font-family: 'Orbitron', sans-serif; font-size: 1rem; font-weight: 700;
  color: #cc88ff; margin-bottom: 18px;
}
.settings-close-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%; width: 32px; height: 32px;
  color: white; cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.settings-close-btn:hover { background: rgba(255,255,255,0.18); }
.settings-section {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 14px; margin-bottom: 16px;
}
.settings-section-title {
  font-family: 'Orbitron', sans-serif; font-size: 0.72rem;
  letter-spacing: 2px; color: #aa66ff; margin-bottom: 10px;
  text-transform: uppercase;
}
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; gap: 10px;
}
.setting-row span { font-size: 0.88rem; color: #ccc; }
.ctrl-type-group { display: flex; gap: 6px; }
.ctrl-type-btn {
  padding: 6px 14px; border-radius: 8px; border: 1.5px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.06); color: #aaa; cursor: pointer;
  font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 0.85rem;
  transition: all .15s;
}
.ctrl-type-btn.active {
  background: linear-gradient(135deg, #5500aa, #cc00ff);
  border-color: #cc00ff; color: white;
  box-shadow: 0 0 12px rgba(200,0,255,.35);
}
.setting-slider {
  width: 120px; accent-color: #cc00ff;
  height: 6px; border-radius: 3px;
}
.setting-action-btn {
  padding: 7px 14px; border-radius: 8px; cursor: pointer;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  color: white; font-size: 0.82rem;
  font-family: 'Rajdhani', sans-serif; font-weight: 600;
  transition: background .15s;
}
.setting-action-btn:hover { background: rgba(255,255,255,0.16); }
.setting-action-btn:active { background: rgba(255,255,255,0.22); transform: scale(.97); }

/* Developer credit inside settings panel */
.settings-dev-credit {
  margin-top: 18px; padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  text-align: center;
}
.settings-dev-label {
  font-size: 0.7rem; color: rgba(255,255,255,0.35);
  letter-spacing: 1px; text-transform: uppercase;
}
.settings-dev-name {
  font-family: 'Orbitron', sans-serif; font-size: 0.88rem;
  font-weight: 700; color: #cc88ff;
  text-shadow: 0 0 12px rgba(200,100,255,0.4);
  letter-spacing: 2px;
}
.settings-dev-link {
  font-size: 0.78rem; color: rgba(180,140,255,0.7);
  text-decoration: none; letter-spacing: 1px;
  transition: color .2s;
}
.settings-dev-link:hover { color: #dd99ff; text-decoration: underline; }

/* Toggle switch */
.toggle-switch { position: relative; width: 44px; height: 24px; display: inline-block; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; border-radius: 24px;
  background: rgba(255,255,255,0.15); cursor: pointer;
  transition: background .25s;
}
.toggle-switch input:checked + .toggle-slider { background: #9900cc; }
.toggle-slider::before {
  content: ''; position: absolute;
  width: 18px; height: 18px; border-radius: 50%;
  background: white; left: 3px; top: 3px;
  transition: transform .25s;
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ======================================================
   PLAYER SKINS GRID (Settings Panel)
====================================================== */
.skin-unlock-hint {
  font-size: 0.7rem; color: rgba(200,150,255,0.6);
  margin-bottom: 10px; text-align: center; letter-spacing: 0.5px;
}
.skin-grid {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 7px; margin-top: 4px;
}
.skin-card {
  background: rgba(255,255,255,0.05);
  border: 1.5px solid rgba(140,50,255,0.3);
  border-radius: 12px; padding: 8px 4px 6px;
  text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s, transform .15s;
  touch-action: manipulation;
}
.skin-card:hover  { border-color: rgba(192,48,255,0.7); background: rgba(192,48,255,0.12); transform: translateY(-2px); }
.skin-card:active { transform: scale(.95); }
.skin-card.skin-active { border-color: #00ff88; background: rgba(0,255,100,0.1); box-shadow: 0 0 10px rgba(0,255,100,0.3); }
.skin-card.skin-locked { opacity: 0.45; cursor: default; }
.skin-emoji { font-size: 1.5rem; line-height: 1; }
.skin-name   { font-size: 0.52rem; color: rgba(255,255,255,0.7); margin-top: 3px; letter-spacing: 0.5px; font-family: 'Rajdhani', sans-serif; font-weight: 700; }
.skin-lock-label { font-size: 0.48rem; color: #ff9966; font-family: 'Orbitron', sans-serif; margin-top: 2px; }

/* Health legend */
.health-legend { font-size: 0.82rem; line-height: 1.9; color: #ccc; }
.health-legend div { padding: 2px 0; }
.legend-note { color: #888; font-size: 0.75rem; margin-top: 6px; line-height: 1.5; }
.key-chip {
  display: inline-block; background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 4px; padding: 0 5px; font-size: 0.7rem;
  font-family: 'Orbitron', sans-serif;
}

/* ================================================================
   DRAGGABLE TOUCH CONTROLS (tc-drag)
================================================================ */
/*
  tc-drag controls live INSIDE game-container (display:none at start).
  On mobile: auto-visible when game-container shows — no CSS hiding needed.
  On desktop (mouse/trackpad): hidden via media query below.
  Boss panel is always hidden by default — JS shows it on boss levels only.
*/
#tc-boss { display: none; }

/* Hide touch controls on desktop/laptop (hover + fine pointer = mouse/trackpad) */
@media (hover: hover) and (pointer: fine) {
  #tc-move, #tc-actions, #tc-health-use { display: none !important; }
}

.tc-drag {
  position: fixed;
  pointer-events: auto;
  z-index: 80;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  user-select: none;
}
/* Default positions */
#tc-move       { bottom: 22px; left: 14px; }
#tc-actions    { bottom: 22px; right: 14px; }
#tc-boss       { bottom: 200px; right: 14px; }
/* Health-use sits ABOVE the fire/mine buttons — bottom:200px keeps it clear of dpad/fire */
#tc-health-use { bottom: 200px; left: 50%; transform: translateX(-50%); }

/* Dpad direction buttons: touch-action NONE so hold-direction works instantly */
.dpad-btn { touch-action: none; }

/* All other tappable controls: manipulation = instant tap, no 300ms delay */
.icon-btn,
.fire-btn,
.mine-btn,
.health-use-btn,
.clone-touch-btn,
.portal-touch-btn,
.btn-primary,
.btn-giveup,
.inv-slot,
.settings-close-btn,
.ctrl-type-btn,
.setting-action-btn,
.shop-item,
.edit-done-btn,
.ability-key-btn {
  touch-action: manipulation;
}

/* Edit mode outline */
.tc-drag.edit-mode {
  border: 2px dashed rgba(255,220,0,0.7);
  border-radius: 14px; padding: 4px;
  background: rgba(0,0,0,0.25);
}
.drag-handle {
  text-align: center;
  font-size: 0.62rem; letter-spacing: 2px;
  color: rgba(255,220,0,0.9);
  padding: 2px 6px; cursor: grab;
  font-family: 'Orbitron', sans-serif;
}

/* Action column layout */
.action-col { display: flex; flex-direction: column; gap: 10px; align-items: center; }

/* ================================================================
   VIRTUAL JOYSTICK
================================================================ */
#joy-zone {
  width: 150px; height: 150px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
  border: 2px dashed rgba(255,255,255,0.18);
  position: relative;
  display: flex; align-items: center; justify-content: center;
  overflow: visible;
}
.joy-outer-ring {
  position: absolute; inset: 10px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1);
  pointer-events: none;
}
.joy-base {
  position: absolute;
  width: 88px; height: 88px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 2px solid rgba(255,255,255,0.28);
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  box-shadow: 0 0 20px rgba(180,100,255,0.2);
}
.joy-stick {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 35%, rgba(255,255,255,0.95), rgba(180,120,255,0.7));
  box-shadow: 0 3px 12px rgba(0,0,0,0.6), 0 0 18px rgba(180,100,255,0.4);
  transition: none;
  flex-shrink: 0;  /* don't let flex squish it */
  will-change: transform;
}

/* ================================================================
   HEALTH PICKUPS (ground items)
================================================================ */
.health-pickup {
  position: absolute; z-index: 16;
  font-size: 1.6rem; line-height: 1;
  animation: healthBob 1.1s ease-in-out infinite;
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.7));
  pointer-events: none;
  cursor: pointer;
}
.health-pickup::after {
  content: attr(data-label);
  position: absolute; bottom: -16px; left: 50%;
  transform: translateX(-50%);
  font-size: 0.55rem; color: rgba(255,255,255,0.7);
  white-space: nowrap;
  font-family: 'Rajdhani', sans-serif;
}
@keyframes healthBob {
  0%,100% { transform: translateY(0)   scale(1); }
  50%      { transform: translateY(-7px) scale(1.1); }
}
.health-drop-label {
  position: absolute; z-index: 17;
  font-family: 'Orbitron', sans-serif; font-size: 0.58rem;
  color: #00ff88; pointer-events: none;
  animation: floatUp 1.5s forwards;
}

/* ================================================================
   HEALTH USE BUTTONS (touch row)
================================================================ */
.health-use-row { display: flex; gap: 8px; align-items: center; }
.health-use-btn {
  width: 58px; height: 58px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2);
  background: rgba(0,0,0,0.55);
  font-size: 1.4rem; color: white; cursor: pointer;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  line-height: 1.1;
  -webkit-tap-highlight-color: transparent;
  transition: transform .1s, border-color .15s;
  box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}
.health-use-btn small { font-size: 0.52rem; color: rgba(255,255,255,0.7); letter-spacing: .5px; }
.bandage-btn { border-color: rgba(255,150,150,0.5); }
.bandage-btn:active { transform: scale(.88); }
.booster-btn { border-color: rgba(0,200,255,0.5); }
.booster-btn:active { transform: scale(.88); }
.medkit-btn  { border-color: rgba(0,255,140,0.5); }
.medkit-btn:active  { transform: scale(.88); }

/* ================================================================
   EDIT LAYOUT BANNER
================================================================ */
.edit-layout-banner {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255, 200, 0, 0.15);
  border-bottom: 2px solid rgba(255,220,0,0.5);
  padding: 8px 18px; z-index: 300;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.7rem; color: #ffe000;
  letter-spacing: 1px;
  backdrop-filter: blur(6px);
}
.edit-done-btn {
  padding: 6px 16px; border-radius: 8px;
  background: rgba(255,220,0,0.2);
  border: 1px solid rgba(255,220,0,0.5);
  color: #ffe000; cursor: pointer; font-size: 0.8rem;
  font-family: 'Rajdhani', sans-serif; font-weight: 700;
  transition: background .15s;
}
.edit-done-btn:hover { background: rgba(255,220,0,0.35); }
