/* Reset the whole page to prevent hidden margins */
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    overflow: hidden; /* Stops the whole page from scrolling */
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;

}

header {
    height: 80px; /* Fixed height for your logo area */
    width: 100%;
    background-color: white;
    display: flex;
    align-items: center;
    padding: 0 20px;
    box-sizing: border-box; /* Ensures padding doesn't add to the 80px */
}

#bg-image {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover; /* This makes it act like 'background-size: cover' */
    z-index: -1;       /* Places it behind all other elements */
    transition: filter 0.6s ease; /* Smooth blur transition */
    filter: blur(2px);
}

#game-container {
    position: relative;
    width: 100%;
    /* This tells the game to be EXACTLY the screen height minus the header */
    height: calc(100vh - 80px); 
    
    background-image: url('/assets/background.jpg');
   
    background-size: cover;
    background-position: center;
    overflow: hidden; /* Keeps the hand/ring inside the "half" */
}

#hand {
    top: -20px;
    width: 200px; 
    height: 400px;
    background-color: transparent; /* Changed from thistle to transparent */
    position: relative;
  
    /* This ensures the tilt looks smooth */
    animation: moveHand 3s ease-in-out infinite alternate; 
   
    transform-origin: top center; 
    z-index: 5;
}

#hand-img {
    width: 170%;       /* Makes image as wide as the div */
    height: 100%;      /* Makes image as tall as the div */
    transform: translate(-60px, 0); /* Centers the image within the div */
    /* This ensures the image doesn't look "squashed" or "stretched" */
    
    
    display: block;    /* Removes extra whitespace at the bottom */
}
#hitbox {
    position: absolute;
    /* ADJUST THESE VALUES TO LINE UP WITH THE FINGER */
    top: 250px;        /* Distance from top of hand image */
    left: 120px;       /* Distance from left of hand image */
    width:40px;      /* Width of the finger area */
    height: 50px;     /* Length of the finger area */
    z-index: 10;

    pointer-events: none; /* The ring should pass "through" it for the logic to work */
}
@keyframes moveHand {
  0% { 
    left: 0%; 
    transform: rotate(-10deg); /* Tilt left at start */
  }
  100% { 
    left: 90%; 
    transform: rotate(10deg); /* Tilt right at end */
  }
}

#ring {
    position: absolute;
    bottom: 20px;
    left: 50%;
    /* This centering trick is important for large objects */
    transform: translateX(-50%); 
   
    /* Set the size of the container */
    width: 100px;
    height: 100px;
    
    transition: bottom 5s ease-out;
}

#ring-img {
    width: 100%;  /* Fills the 200px container */
    height: 100%; /* Fills the 200px container */
    object-fit: contain; /* Prevents the image from stretching */
}

.launched {
  bottom: 300vh !important; /* Send it past the top of the screen */
}

/* Position the text to the right of the 200px ring */
.instructions {
    position: absolute;
    /* Adjust these to place the box exactly where you want it */
    bottom: 50px;       /* Distance from the bottom of the game area */
    right: 20%;        /* Distance from the right edge of the screen */
    
    width: 280px;
    padding: 20px;
    background-color: rgba(255, 182, 193, 0.9); /* Your 80% pink */
    border-radius: 15px;
    font-family: sans-serif;
    color: #333;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    z-index: 10;        /* Ensures it stays on top of the background */
}

.instructions p {
    margin: 5px 0;
}

.instructions em {
    font-size: 0.9em;
    color: #666;
}



header {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    padding: 0;
}

.container.header-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    height: 72px;
}

.logo img {
    height: 2vw;
}

nav .nav-links {
    list-style: none;
    display: flex;
    gap: 32px;
    margin: 0;
    padding: 0;
}

nav .nav-links li a {
    text-decoration: none;
    color: #ed96bf;
    font-weight: 500;
    font-size: 1.1rem;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

nav .nav-links li a.active,
nav .nav-links li a:hover {
    background: #ed96bf;
    color: #fff;
}


/* Triggers on screens smaller than tablet size */
@media (max-width: 768px) {
    
    /* 1. Allow header to grow vertically */
    .container.header-flex {
        flex-direction: column; /* Stack items vertically */
        height: auto;           /* Remove fixed height */
        padding: 16px;          /* Add breathing room */
        gap: 20px;              /* Space between logo and links */
    }

    /* 2. Fix the microscopic logo issue */
    .logo img {
        height: 40px;           /* Fixed height for mobile */
        width: auto;            /* Maintain aspect ratio */
    }

    /* 3. Stack the links */
    nav .nav-links {
        gap: 10px;              /* Reduce gap between links */
        width: 100%;            /* Full width for alignment */
        justify-content: center; /* Center links visually */
        flex-wrap: wrap;        /* Allow wrapping if many links */
    }

    /* 4. Make links easier to tap */
    nav .nav-links li a {
        display: block;         /* Better hit area */
        text-align: center;
        padding: 10px 16px;     /* Larger touch target */
    }

    
}

.no-transition {
    transition: none !important;
}


#status-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    
    /* This MUST be higher than anything else in the game */
    z-index: 9999; 
    
    /* Ensure the box itself allows clicking */
    pointer-events: auto !important; 
    
    background-color: rgba(255, 182, 193, 0.9);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
}

/* Helper class to hide/show the box */
.hidden {
    display: none;
    opacity: 0;
}

/* Class to stop the hand wherever it is */
.stop-animation {
    animation-play-state: paused !important;
}

/* Style for the reset button */
#reset-btn {
    margin-top: 15px;
    padding: 10px 25px;
    background-color: #fff;
    border: 2px solid #ffb6c1;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    color: #333;
    display: block;
    margin-left: auto;
    margin-right: auto;
    cursor: pointer;
    pointer-events: auto !important; /* Forces the button to be clickable */
    position: relative;
    z-index: 10000;
}

#reset-btn:hover {
    background-color: #ffb6c1;
    color: white;
}



/* --- RESPONSIVE FIXES --- */

@media (max-width: 768px) {
    /* 1. Fix the Header stacking */
    header {
        height: auto; /* Allow header to grow if content stacks */
        padding: 10px;
    }

    .container.header-flex {
        flex-direction: column; /* Stack logo and nav vertically */
        height: auto;
        gap: 10px;
        padding: 0 10px;
    }

    .logo img {
        height: 30px; /* Shrink logo for mobile */
    }

    nav .nav-links {
        gap: 15px;
        justify-content: center;
    }

    nav .nav-links li a {
        font-size: 0.9rem;
        padding: 6px 10px;
    }

    /* 2. Fix Game Area scaling */
    #game-container {
        /* Ensure the game area fills the remaining space properly */
        height: calc(100vh - 120px); 
    }

    /* 3. Fix the Ring being cut off */
    #ring {
        width: 15vw; /* Scale ring width by viewport */
        height: 15vw;
        max-width: 70px;
        bottom: 50px; /* Lift it higher so it's not behind browser UI or cut off */
    }

    /* 4. Fix the Hand size */
    #hand {
        width: 30vw;
        height: 60vw;
        max-width: 250px;
        top: -20;
    }

    @keyframes moveHand {
        0% { left: -50%; transform: rotate(-10deg); }
        100% { left: calc(150% - 60vw); transform: rotate(10deg); }
    }

    #hand-img {
       /* Makes image as tall as the div */
    transform: translate(-40px, 0); /* Centers the image within the div */
    /* This ensures the image doesn't look "squashed" or "stretched" */
    
    
    display: block;    /* Removes extra whitespace at the bottom */
}

    /* 5. Center the Instructions */
    .instructions {
        right: 5%;
        left: 5%;
        width: 90%;
        bottom: 200px;
        padding: 10px;
        text-align: center;
        font-size: 0.9rem;
    }

    #hitbox {
    position: absolute;
    /* ADJUST THESE VALUES TO LINE UP WITH THE FINGER */
    top: 150px;        /* Distance from top of hand image */
    left: 70px;       /* Distance from left of hand image */
    width:30px;      /* Width of the finger area */
    height: 30px;     /* Length of the finger area */
    z-index: 10;
   
    pointer-events: none; /* The ring should pass "through" it for the logic to work */
}
}



#teaser-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* Dim the background */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20000; /* Higher than everything else */
    transition: opacity 1s ease;
}

.teaser-content {
    background-color: white;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    width: 80%;
    border: 4px solid #ed96bf;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

.teaser-content p {
    color: #333;
    font-size: 1.1rem;
    line-height: 1.5;
    margin: 10px 0;
}

/* Class to fade the popup out */
.fade-out {
    opacity: 0;
    pointer-events: none;
}