:root {
    --color-bg: #0b0a0a;
    --color-dark-red: #1a0000;
    --color-primary-red: #8b0000;
    --color-accent-red: #b51e1e;
    --color-text: #f5f3f3;
    --transition-speed: 0.4s;
    --max-content-width: 1200px;
    --mobile-nav-height: 60px;
    --desktop-nav-height: 80px;
}

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

html, body {
    height: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    overflow-x: hidden;
    min-height: 100vh;
}

#app-container {
    position: relative;
    width: 100%;
    min-height: 100vh;
}

/* Typography */
h1, h2, p {
    color: var(--color-text);
}

h1 {
    font-size: clamp(2rem, 8vw, 4.5rem);
    letter-spacing: 0.1em;
    text-shadow: 0 0 5px rgba(0,0,0,0.5);
}

h2 {
    font-size: clamp(1.2rem, 4vw, 2rem);
    margin-bottom: 10px;
}

p {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
}

/* Buttons */
.btn {
    padding: 1rem 2rem;
    font-size: clamp(1rem, 3vw, 1.25rem);
    font-weight: 500;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    transition: background-color var(--transition-speed), transform 0.1s ease;
    text-transform: uppercase;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: var(--color-primary-red);
    color: var(--color-text);
    border: 1px solid var(--color-accent-red);
}

.btn-primary:hover {
    background-color: var(--color-accent-red);
}

.btn-large {
    padding: 1.5rem 3rem;
    margin-top: 20px;
    font-size: clamp(1.2rem, 4vw, 1.5rem);
}

/* Navbar */
#navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--mobile-nav-height);
    background-color: var(--color-dark-red);
    z-index: 1000;
    border-bottom: 1px solid rgba(245, 243, 243, 0.1);
}

.container {
    max-width: var(--max-content-width);
    margin: 0 auto;
    padding: 0 15px;
    height: 100%;
}

.nav-content {
    display: flex;
    justify-content: space-between; /* Keep space-between for hamburger/links separation on mobile */
    align-items: center;
    position: relative; /* For absolute positioning of hamburger on mobile */
}

.logo-area .logo {
    /* REMOVED: height: 40px; width: auto; */
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 15px;
    align-items: center;
}

.nav-links a {
    color: var(--color-text);
    text-decoration: none;
    font-weight: 500;
    padding: 5px 10px;
    transition: color var(--transition-speed);
}

.nav-links a:hover {
    color: var(--color-accent-red);
}

/* Style button like a link (overrides .btn, .btn-primary) */
.nav-links li button {
    background: none;
    border: none;
    color: var(--color-text);
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.3s ease, opacity 0.3s ease;
    text-transform: none; /* Inherit casing */
    box-shadow: none; /* Remove button shadow */
    padding: 5px 10px; /* Match link padding */
    font-size: clamp(1rem, 2.5vw, 1.25rem); /* Maintain font size */
}

.nav-links li button:hover {
    background: none;
    color: var(--color-accent-red);
}

.nav-links li button.copied {
    color: var(--color-accent-red); 
    opacity: 0.8;
}

/* Mobile Navigation adjustments */
.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    position: absolute;
    left: 15px; /* Position to the left edge */
}

.hamburger span {
    width: 100%;
    height: 3px;
    background: var(--color-text);
    border-radius: 10px;
    transition: all 0.3s linear;
}

/* Hide desktop links by default on mobile */
.nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: var(--mobile-nav-height);
    right: 0;
    width: 100%;
    background-color: var(--color-dark-red);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.5);
    padding: 20px 0;
    transition: max-height var(--transition-speed) ease-in-out;
    overflow: hidden;
}

.nav-links li {
    width: 100%;
    text-align: center;
    margin: 10px 0;
}

.nav-links li button {
    width: auto;
    /* Ensure mobile button padding/style is link-like */
}

.nav-links.open {
    display: flex;
}

/* Hero Section */
.screen {
    position: relative;
    width: 100%;
    height: 100vh;
    padding-top: var(--mobile-nav-height); /* Offset for fixed navbar */
    opacity: 0;
    transition: opacity 1s ease-in-out;
    display: none;
}

.screen.active {
    opacity: 1;
    display: flex;
    flex-direction: column;
}

#hero-section {
    background: url('assets/ui/hero-bg.jpg') no-repeat center center/cover;
    justify-content: center;
    align-items: center;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
}

.hero-content {
    position: relative;
    z-index: 5;
    text-align: center;
    padding: 20px;
}

.hero-logo {
    max-width: 150px;
    margin-bottom: 20px;
}

/* Game Scene Layout */
#game-scene {
    background-color: var(--color-bg);
    padding-top: 0; /* Reset screen padding, handled by .scene */
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

/* === GAME SCENE FIXED LAYOUT === */
.scene {
  position: relative;
  width: 100%;
  min-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: visible;          /* prevent splash cropping */
  margin: 0 auto;
  padding: 120px 0 80px;      /* space for navbar & footer */
  z-index: 1;
  /* Optional Extra Mobile Safety */
  padding-top: calc(120px + env(safe-area-inset-top));
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
  max-width: 900px;
}

.layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    pointer-events: none;
}

/* Z-index layers */
.layer.bg {
    z-index: 1;
    background-image: url('assets/ui/bg-layer.png');
    /* Background always full viewport */
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.layer.frame {
    z-index: 10;
    background-image: url('assets/ui/frame-overlay.png');
    background-size: 100% 100%;
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.content-wrapper {
    position: relative;
    z-index: 5;
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(26, 0, 0, 0.4);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 20px;
    padding: 40px 20px;
    box-shadow: 0 4px 25px rgba(0,0,0,0.3);
    gap: 10px;
}

/* HUD */
#game-hud {
    display: flex;
    justify-content: space-around;
    width: 100%;
    max-width: 400px;
    background-color: rgba(11, 10, 10, 0.7); /* semi-transparent black */
    border: 1px solid rgba(245, 243, 243, 0.1);
    border-radius: 5px;
    padding: 8px;
    margin-top: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.hud-item {
    text-align: center;
    font-size: clamp(0.8rem, 2vw, 1rem);
    line-height: 1.2;
}

.hud-item span:first-child {
    display: block;
    font-weight: 400;
    color: var(--color-primary-red);
    text-transform: uppercase;
}
.hud-item span:last-child {
    display: block;
    font-weight: 700;
    font-size: clamp(1rem, 3vw, 1.5rem);
}

/* Progress Bar */
#progress-container {
    width: 100%;
    text-align: center;
    margin: 10px 0;
}

.progress-bar-bg {
    width: 100%;
    height: 15px;
    background-color: var(--color-dark-red);
    border: 1px solid var(--color-primary-red);
    border-radius: 7px;
    overflow: hidden;
    margin-top: 5px;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background-color: var(--color-accent-red);
    transition: width 0.3s ease-out;
}

.progress-monsters {
    display: flex;
    justify-content: space-around;
    width: 100%;
    margin-top: 5px;
}

.monster-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--color-dark-red);
    border: 1px solid var(--color-primary-red);
    opacity: 0.5;
    transition: background-color 0.5s, opacity 0.5s;
}

.monster-dot.defeated {
    background-color: var(--color-accent-red);
    opacity: 1;
}

/* Monster Display */
#monster-display-area {
    position: relative;
    width: 95%; /* Make it wider within the content wrapper */
    aspect-ratio: 1 / 1;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0; /* Increased margin */
    z-index: 6;
    /* Card Styling */
    background: #100000;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.45);
    border: none;
}

.monster-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    transition: transform 0.2s ease-out;
}

/* NEW ABSOLUTELY POSITIONED GUN */
#sprayGun {
  position: absolute;
  bottom: 4vh;
  right: 22vw;
  width: clamp(150px, 35vw, 75px);
  height: auto;
  transform: rotate(-2deg);
  cursor: wait; /* Default wait state */
  z-index: 12;
  transition: transform 0.15s ease;
  pointer-events: auto; /* Ensure interactivity */
}
#sprayGun:active {
  transform: scale(0.95) rotate(-1deg);
}

/* Cursor override once assets are loaded */
body.ready #sprayGun {
    cursor: pointer;
}


/* Animations and Effects */

/* Screen Shake Effect */
.shake {
    animation: screen-shake 0.1s ease-in-out 2;
}
@keyframes screen-shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    25% { transform: translate(-1px, -2px) rotate(-0.5deg); }
    50% { transform: translate(-3px, 0px) rotate(0.5deg); }
    75% { transform: translate(2px, -1px) rotate(-0.5deg); }
    100% { transform: translate(1px, 1px) rotate(0deg); }
}

/* Floating Score Text */
.floating-score {
    position: absolute;
    color: var(--color-accent-red);
    font-weight: 700;
    font-size: 2.5rem;
    pointer-events: none;
    opacity: 1;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    animation: float-up 1s ease-out forwards;
}

@keyframes float-up {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-150px) scale(0.7); opacity: 0; }
}

/* Splash Effect */
.splash-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70%; /* Relative to arena */
    aspect-ratio: 1 / 1;
    pointer-events: none;
    opacity: 50%;
    z-index: 8;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    animation: splash-fade 0.5s ease-out;
}

@keyframes splash-fade {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(0.5); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.5); }
}


/* Spray Burst Animation */
.spray-burst {
  position: fixed;
  width: 160px;
  height: 160px;
  pointer-events: none;
  opacity: 0.9;
  transform-origin: left center;
  z-index: 20;
  transition: transform 0.5s ease-out, opacity 0.5s ease-out;
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.1));
}


/* NEW MUZZLE FLASH STYLES */
.flash {
  position: fixed;
  width: 100px;
  height: 100px;
  transform: translate(-50%, -50%);
  opacity: 0.8;
  filter: blur(2px);
  animation: flashAnim 0.2s ease-out forwards;
  z-index: 21;
}

@keyframes flashAnim {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.6); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.3); }
}


/* Modal (Victory Popup) */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    transition: opacity var(--transition-speed);
}

.modal.visible {
    display: flex;
}

.modal-content {
    background-color: var(--color-bg);
    padding: 40px 30px;
    border: 3px solid var(--color-primary-red);
    border-radius: 10px;
    text-align: center;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 0 20px rgba(139, 0, 0, 0.5);
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

.modal.visible .modal-content {
    opacity: 1;
    transform: scale(1);
}

#victory-title {
    color: var(--color-accent-red);
    margin-bottom: 20px;
}

.modal-content p {
    margin: 10px 0;
}

/* Media Queries for Desktop */
@media (min-width: 768px) {
    #navbar {
        height: var(--desktop-nav-height);
    }

    .screen {
        padding-top: var(--desktop-nav-height);
    }
    
    .nav-content {
        justify-content: center; /* Center everything on desktop */
    }

    .logo-area .logo {
        /* REMOVED */
    }

    .hamburger {
        display: none;
    }

    .nav-links {
        position: static;
        flex-direction: row;
        width: auto; 
        box-shadow: none;
        padding: 0;
        display: flex !important; /* Override mobile display toggle */
        justify-content: space-around; /* Evenly space links */
        gap: 40px; /* Increased gap for desktop spacing */
    }

    .hero-logo {
        max-width: 250px;
    }

    .content-wrapper {
        padding: 40px 20px; /* Use consistent padding */
    }
}