/* --- 1. GLOBAL RESET & FONTS --- */
html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%; /* Critical for background images */
  background-color: #000000; /* Black fallback */
  font-family: "adso", sans-serif;
  overflow: hidden; /* No scrollbars */
  perspective: 5000px; 
  overflow: hidden; /* Prevents scrollbars when scene tilts */
  background: #000;
}

:root {
  --primary-color: #34ff0b;
  --secondary-color: #0d5c63;
  --font-heading-size: clamp(24px, 3vw, 36px);
}

/* --- 2. BACKGROUND LAYERS (The Fix) --- */
/* Order: Ground (1) -> Boots (2) -> Texture (10) -> UI (99) */

#bg-ground {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("images/ground.png");
  background-size: cover;
  background-position: center;
  mix-blend-mode: overlay;
  pointer-events: none;
  z-index: 3; /* Bottom Layer */
}

#bg-boots {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("images/boots.jpeg");
  background-size: cover;
  background-position: center;
  z-index: 2; /* Middle Layer */
}

#bg-texture {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("images/texture.png");
  background-size: cover;
  background-position: center;
  mix-blend-mode: darken;
  opacity: 0.7;
  pointer-events: none;
  z-index: 10; /* Top Texture Layer */
}

#color {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url(images/greenoverlay.png);
  background-size: cover;
  background-position: center;
  mix-blend-mode: overlay;
  opacity: 0.6;
  pointer-events: none;
  z-index: 10; /* Just above ground */
}
/* --- 3. UI LAYOUT --- */
.title {
  position: absolute;
  bottom: 20vh;
  right: 5vw;
  color: white;
  font-family: adso, sans-serif;
  font-size: clamp(1.5rem, 5vw, var(--font-heading-size, 3rem));
  text-align: right;
  text-shadow: 0 0 5px rgba(65, 254, 93, 0.7);
  z-index: 99; /* Above all backgrounds */
  pointer-events: none;
}

h1,
h2,
h3 {
  margin: 0 0 20px 0;
  padding: 0;
}

.button-container {
  position: absolute;
  top: 75%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  gap: clamp(20px, 5vw, 80px);
  justify-content: center;
  align-items: center;
  z-index: 100; /* Highest Priority (Clickable) */
}

/* --- 4. BUTTON STYLES (Sci-Fi) --- */
button {
  position: relative;
  background: rgba(11, 12, 16, 0.8);
  color: var(--primary-color);
  font-family: "input-mono-compressed", monospace;
  font-size: clamp(10px, 3vw, 26px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  padding: 15px 40px;
  border: 1px solid var(--secondary-color);
  outline: none;
  cursor: pointer;
  clip-path: polygon(
    15px 0,
    100% 0,
    100% calc(100% - 15px),
    calc(100% - 15px) 100%,
    0 100%,
    0 15px
  );
  transition: all 0.2s ease-in-out;
  overflow: hidden;
}

/* Scanline Effect */
button::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 2px,
    rgba(255, 255, 255, 0.05) 3px
  );
  z-index: -1;
}

/* Corner Accents */
button::after {
  content: "";
  position: absolute;
  bottom: 0;
  right: 0;
  width: 8px;
  height: 8px;
  background-color: var(--primary-color);
  clip-path: polygon(100% 0, 0 100%, 100% 100%);
}

/* Button Colors */
#join {
  --primary-color: #34ff0b; /* Neon Cyan */
  --secondary-color: #0d5c63;
  box-shadow: 0 0 10px rgba(77, 238, 234, 0.1);
}

#leave {
  --primary-color: #ff2929; /* Alert Orange */
  --secondary-color: #701e1e;
  box-shadow: 0 0 10px rgba(255, 76, 41, 0.1);
}

/* Hover States */
button:hover {
  background: var(--primary-color);
  color: #0b0c10;
  box-shadow: 0 0 25px var(--primary-color);
}
button:hover::after {
  background-color: #0b0c10;
}
button:active {
  transform: scale(0.98);
}

/* --- 5. ANIMATIONS --- */
@keyframes glitch-shake {
  0% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(-5px, 5px);
  }
  50% {
    transform: translate(5px, -5px);
  }
  75% {
    transform: translate(-5px, -5px);
  }
  100% {
    transform: translate(0, 0);
  }
}

.crashing-body {
  animation: glitch-shake 0.7s infinite;
}

/* --- 6. ERROR POPUP --- */
.error-popup {
  position: fixed;
  background: #000;
  border: 2px solid #ff4c29;
  color: #ff4c29;
  font-family: "Courier New", monospace;
  font-weight: bold;
  padding: 10px 20px;
  box-shadow: 10px 10px 0px rgba(255, 76, 41, 0.5);
  z-index: 999;
  text-transform: uppercase;
  font-size: 14px;
  width: 200px;
}
.error-header {
  background: #b12121;
  color: #474747;
  padding: 2px 5px;
  margin-bottom: 5px;
  font-size: 10px;
  display: flex;
  justify-content: space-between;
}

/* RPG Text Box Container */
#instruction-box {
  position: fixed;
  bottom: 30px; /* Distance from bottom */
  left: 50%;
  transform: translateX(-50%); /* Centers it perfectly */

  width: 80%;
  max-width: 800px;
  height: auto;
  min-height: 80px;

  background-color: rgba(
    10,
    10,
    15,
    0.9
  ); /* Dark semi-transparent background */

  padding: 20px;
  box-sizing: border-box;

  font-family: "Courier New", monospace; /* Typewriter feel */
  font-size: 18px;
  color: #c0c0c0; /* Light grey text */

  z-index: 1000; /* Ensures it sits on top of the canvas */

  border: 2px solid #ff3300; /* Change from Green to HOSTILE RED */
  box-shadow: 0 0 15px rgba(255, 51, 0, 0.3); /* Red Glow */
  color: #a0a0a0;
}

/* The "Speaker" Label (e.g., SYSTEM:) */
#speaker-name {
  display: block;
  font-weight: bold;
  color: #ff3300; /* Red Speaker Name */
  font-weight: 800;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* The Blinking Cursor Effect */
.blinking-cursor {
  animation: blink 1s step-end infinite;
  color: #ff3300;
  font-weight: bold;
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

/* --- 7. SHOOTING GAME LAYERS --- */

.bg-shooting {
  position: relative;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  transform-style: preserve-3d;
  transition: transform 0.1s ease-out; /* Smooths the movement */

  /* Ensure the background image covers the tilt edges */
  transform: scale(1.2);
}

/* 2. Style the Fake Cursor */
#aim-cursor {
  position: absolute;
  width: 150px; 
  height: 150px;
  background-image: url("images/cross.png");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: none; /* CRITICAL: This lets clicks pass through to the deer! */
  z-index: 9999; /* Must be above everything (overlays are ~25) */
  /* Center the crosshair on the mouse coordinates */
  transform: translate(-50%, -50%);
  transition:
    top 0.05s linear,
    left 0.05s linear;
}

#shoot-deers {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%; /* Changed to % to fit parent scaling */
  background-image: url("images/bg-shooting.png");
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  z-index: 10; /* Base Layer */
}

#shoot-overlay2 {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("images/overlay 2.png");
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  mix-blend-mode: overlay;
  opacity: 0.5;
  pointer-events: none;
  z-index: 20;
}

#shoot-overlay1 {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  scale: 2;
  background-image: url("images/overlay 1.png");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  mix-blend-mode: difference;
  opacity: 0.9;
  pointer-events: none;
  z-index: 25;
}
.bullet-hole {
  position: absolute;
  /* Remove any background colors or borders you had previously */
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;

  /* Center the emoji */
  display: flex;
  justify-content: center;
  align-items: center;

  /* Ensure mouse clicks go through the flowers */
  pointer-events: none;

  /* Ensure the emoji looks flat on the surface */
  line-height: 1;
  z-index: 999; /* Above the background */
}
/* The Moving Target */
.silhouette-target {
  position: absolute;
  /* Remove top: 0 and left: 0 so we can position them individually */

  /* FIX: Changed from 100vh/vw to a realistic size for a target */
  width: 400px;
  height: 400px;
  bottom: 0;
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;

  /* FIX: Z-index should be LOWER than overlays (20/25) but HIGHER than background (10) */
  z-index: 12;

  cursor:
    url("images/cross.png") 16 16,
    auto;
}

/* Position each deer in a different spot */
#deer1 {
  left: 5%;
  bottom: 30%;
  height: 55%; /* Adjust height relative to container */
  z-index: 100;
  background-image: url("images/deer1.png");
}
#deer2 {
  /* 1. POSITIONING */
  right: 5%;
  bottom: 0%;

  /* 2. SIZING (Critical Fix) */
  /* Remove the 400px limit by overriding it here */
  width: 50vw; /* Make it wide enough (half the screen) so the height controls the size */
  height: 50%; /* This is your desired height */

  /* 3. CLICKABLE AREA */
  z-index: 105; /* Top layer */
  pointer-events: auto; /* Correct syntax! (was 'visible') */

  /* 4. IMAGE */
  background-image: url("images/deer2.png");
  background-position: bottom right; /* Align it to the corner */
  background-size: contain; /* Now it can grow up to 50% height because width isn't choking it */

}

#deer3 {
  bottom: 10%;
  left: 50%;
  transform: translateX(-45%); /* Center the element */
  height: 85%; /* Bottom Center */
  z-index: 103;
  background-image: url("images/deer3.png");
}
#deer4 {
  bottom: 20%;
  right: 25%;
  height: 60%; /* Adjust height relative to container */
  z-index: 101;
  background-image: url("images/deer4.png");
}
#deer5 {
  bottom: 5%;
  left: 15%;
  height: 70%; /* Adjust height relative to container */
  z-index: 102;
  background-image: url("images/deer5.png");
}
#deer6 {
  bottom: 15%;
  right: 10%;
  height: 50%; /* Adjust height relative to container */
  z-index: 104;
  background-image: url("images/deer6.png");
}
/* Animation triggers ONLY when they die */
.silhouette-dead {
  opacity: 0;
  transition: all 0.5s ease-out forwards;
  pointer-events: none;
}

#tunnel-vision {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 900; /* High z-index, but below the custom cursor */
  pointer-events: none;

  /* Default position center screen */
  --x: 50%;
  --y: 50%;

  /* The Spotlight Effect */
  background: radial-gradient(
    circle 150px at var(--x) var(--y),
    transparent 0%,
    rgba(0, 0, 0, 0.4) 30%,
    rgba(0, 0, 0, 0.95) 100%
  );

  transition: background 0.05s linear;
}
#intel-panel {
  position: fixed;
  top: 10vh;
  right: 10%;
  width: 300px;
  max-height: 80vh; /* Stop it from going off-screen */
  background: rgba(0, 20, 0, 0.8); /* Dark military green tint */
  border: 2px solid #3a5c2a;
  color: #a3cfa3; /* Light green terminal text color */
  font-family:
    "input-mono-compressed", monospace; /* Monospace font for data look */
  padding: 15px;
  z-index: 1000; /* Below tunnel vision, above background */
  overflow-y: auto; /* Scroll if too many tags */
  box-shadow: -5px 5px 15px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.intel-header {
  border-bottom: 2px solid #3a5c2a;
  margin-bottom: 10px;
  padding-bottom: 5px;
}

.intel-header h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 1px;
}

#intel-counter {
  font-weight: bold;
  color: #e74c3c; /* Red hue for the kill count */
}

#dogtag-list {
  list-style-type: none;
  padding: 0;
  margin: 0;
}

/* Styles for individual collected tags */
.dogtag-entry {
  background: rgba(255, 255, 255, 0.05);
  margin-bottom: 8px;
  padding: 8px;
  border-left: 4px solid #555; /* Looks like a metal tag edge */
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  animation: flickerIn 0.3s ease-out; /* Small entry animation */
}

.dogtag-entry .rank {
  color: #ccc;
  font-weight: bold;
}
.dogtag-entry .name {
  color: #fff;
}
.dogtag-entry .id {
  color: #777;
  font-size: 0.9em;
}

/* Simple entry animation */
@keyframes flickerIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Custom scrollbar for the panel to match the theme */
#intel-panel::-webkit-scrollbar {
  width: 8px;
}
#intel-panel::-webkit-scrollbar-track {
  background: #0f1a0f;
}
#intel-panel::-webkit-scrollbar-thumb {
  background: #3a5c2a;
}

.dust-particle {
  position: absolute;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  pointer-events: none;
  z-index: 50;
}

/* --- AMBUSH SCANNER STYLES --- */
#p5-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999; 
  background: black;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Utility to toggle visibility */
.hidden {
  display: none !important;
  pointer-events: none;
}

/* Ensure these stay on top of the scanner */
#tunnel-vision {
  z-index: 900;
}
#intel-panel {
  z-index: 950;
}
#aim-cursor {
  z-index: 1000;
}

/* --- WIN SCREEN STYLES --- */
#win-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 10, 0, 0.95);
  z-index: 5000; /* Highest priority */
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 1s ease-in;
  pointer-events: none;
}

#win-screen.active {
  opacity: 1;
  pointer-events: auto;
}

.win-content {
  text-align: center;
  font-family: "Courier New", monospace;
  color: #00ff00; /* Hacker Green */
  padding: 40px;

  max-width: 600px;
  width: 80%;
  transition: opacity 1s ease-in;
}

.win-content h1 {
  font-size: 40px;
  margin: 0 0 20px 0;
  letter-spacing: 5px;
  text-shadow: 0 0 10px #1e771e;
}

.stats-box p {
  font-size: 18px;
  margin: 10px 0;
  letter-spacing: 2px;
}

.stats-box hr {
  border-color: #004400;
  margin: 20px 0;
}

/* Blinking Animation for the Title */
.blink-text {
  animation: blinker 2s linear infinite;
}

@keyframes blinker {
  50% {
    opacity: 0;
  }
}

/* Loading Bar Animation */
.loader-bar {
  width: 100%;
  height: 10px;
  background: #003300;
  margin-top: 20px;
  border: 1px solid #1e771e;
}

.loader-progress {
  width: 0%;
  height: 100%;
  background: #1e771e;
  transition: width 7s linear; /* Takes 10 seconds to fill */
}
