/* Malware Defender — OVERDRIVE EDITION [V3.1 FINAL] */
:root {
  --bg: #050102;
  --accent: #ff003c;
  --accent-glow: rgba(255, 0, 60, 0.7);
  --heal: #00ffaa;
  --panel: rgba(10, 0, 3, 0.9);
  --border: rgba(255, 0, 60, 0.4);
  --font-header: 'Orbitron', sans-serif;
  --font-body: 'Inter', sans-serif;
}

* { 
  box-sizing: border-box; 
  user-select: none; 
  -webkit-tap-highlight-color: transparent; 
  outline: none;
}

html, body {
  height: 100%; margin: 0; padding: 0;
  background-color: var(--bg);
  color: #fff;
  font-family: var(--font-body);
  overflow: hidden;
  touch-action: none; /* Prevents browser pull-to-refresh */
}

/* CYBER GRID & SCANLINES */
body::before {
  content: "";
  position: absolute;
  inset: 0;
  background: 
    linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
    linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
  z-index: 5;
  background-size: 100% 4px, 4px 100%;
  pointer-events: none;
}

#game {
  display: block;
  width: 100vw;
  height: 100vh;
  background: #000;
}

/* FULLSCREEN BUTTON FIX */
.fs-btn {
  position: fixed;
  top: 15px; 
  right: 15px;
  z-index: 2000; /* Stays above everything */
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 10px;
  padding: 8px 12px;
  font-family: var(--font-header);
  cursor: pointer;
  pointer-events: auto;
  border-radius: 4px;
  transition: 0.2s;
}

.fs-btn:active {
  transform: scale(0.9);
  background: var(--accent);
  color: #000;
}

/* HUD ELEMENTS */
.hud-top {
  position: fixed;
  top: 0; left: 0; right: 0;
  padding: env(safe-area-inset-top, 15px) 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 20;
  pointer-events: none;
}

.stat-group { flex: 1; }
.stat-group.center { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.stat-group.right { text-align: right; }

.label {
  font-family: var(--font-header);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent);
  text-shadow: 0 0 5px var(--accent-glow);
  margin-bottom: 4px;
}

.hp-bar-container {
  width: 150px;
  height: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
  backdrop-filter: blur(5px);
}

.hp-bar-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #ff4d79);
  box-shadow: 0 0 15px var(--accent-glow);
  transition: width 0.2s cubic-bezier(0, 0, 0, 1);
}

.badge {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 4px;
  font-family: var(--font-header);
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 1px;
  pointer-events: auto;
}

.timer {
  font-family: var(--font-header);
  font-size: 20px;
  font-weight: 900;
  color: #fff;
}

/* VIRTUAL JOYSTICKS */
.joystick {
  position: absolute;
  width: 110px;
  height: 110px;
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid var(--border);
  border-radius: 50%;
  z-index: 30;
  pointer-events: auto;
  touch-action: none;
}

#joystick-left { left: 40px; bottom: 50px; }
#joystick-right { right: 40px; bottom: 50px; }

.joy-label {
  position: absolute;
  top: -28px;
  width: 100%;
  text-align: center;
  font-family: var(--font-header);
  font-size: 10px;
  color: var(--accent);
  opacity: 0.6;
}

.stick {
  position: absolute;
  width: 44px;
  height: 44px;
  top: 31px;
  left: 31px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 25px var(--accent-glow);
  opacity: 0.9;
}

/* OVERLAYS */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 50;
  backdrop-filter: blur(15px);
  text-align: center;
  padding: 20px;
}

.glitch {
  font-family: var(--font-header);
  font-size: 4rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: -2px;
  position: relative;
  text-shadow: 0.05em 0 0 var(--accent), -0.05em -0.025em 0 #00ffaa;
  animation: glitch-anim 0.4s infinite;
}

.btn-main {
  margin-top: 40px;
  padding: 18px 50px;
  background: transparent;
  border: 3px solid var(--accent);
  color: var(--accent);
  font-family: var(--font-header);
  font-weight: 900;
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 4px;
  cursor: pointer;
  transition: 0.2s;
  pointer-events: auto;
}

.btn-main:active {
  background: var(--accent);
  color: #000;
  transform: scale(0.92);
}

@keyframes glitch-anim {
  0% { transform: translate(0); }
  20% { transform: translate(-3px, 3px); }
  40% { transform: translate(-3px, -3px); }
  60% { transform: translate(3px, 3px); }
  80% { transform: translate(3px, -3px); }
  100% { transform: translate(0); }
}

@media (max-width: 600px) {
  .glitch { font-size: 2.5rem; }
  #joystick-left { left: 20px; bottom: 40px; }
  #joystick-right { right: 20px; bottom: 40px; }
  .joystick { width: 95px; height: 95px; }
  .stick { width: 38px; height: 38px; top: 26px; left: 26px; }
}
