/*-------------------------------------------Background & Layout---------------------------------------------*/
html {
  scroll-behavior: smooth;
}

html, body {
  background-color: #0c4e9c !important;
  margin: 0;
  padding: 0;
  color: #fff;
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Titles */
.section-title {
  color: #ffffff !important;
  text-align: center;
  text-transform: uppercase;
  font-weight: 800;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
  margin-bottom: 10px;
}

.section-subtitle {
  color: #ffcc00 !important;
  text-align: center;
  font-size: 1.1rem;
  margin-bottom: 25px;
  font-weight: 600;
}

/*-------------------------------------------Hero Section---------------------------------------------*/
section.position-relative {
  display: flex;
  justify-content: center;
  align-items: center;
}
#bg {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}
.redirect-btn { top: 75%; }
.redirect-btn img { width:70%; animation: pulse 1s infinite linear; }

/*-------------------------------------------Mini-Game Section---------------------------------------------*/
#game-section {
    display: flex;
    justify-content: center;
    padding-bottom: 50px;
}

#game-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    aspect-ratio: 4 / 3;
    background: url('../image/game/background.jpg') center/cover no-repeat, #2e7d32;
    border: 4px solid #fff;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    overflow: hidden;
    margin: 0 auto;
}

#goalkeeper {
    position: absolute;
    bottom: 30%;
    left: 50%;
    width: 160px;
    height: 200px;
    transform: translateX(-50%);
    transition: all 0.4s ease-out;
    z-index: 2;
    background: url('../image/game/goalkeeper.png') center/contain no-repeat;
}

#ball {
    position: absolute;
    bottom: 10%;
    left: 50%;
    width: 70px;
    height: 70px;
    transform: translateX(-50%);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 3;
    background: url('../image/game/ball.png') center/contain no-repeat;
    border-radius: 50%;
}

.target-grid {
    position: absolute;
    top: 15%;
    left: 5%;
    right: 5%;
    height: 50%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    z-index: 4;
}

.target { cursor: pointer; }

/* Game Popup Buttons */
/* --- Fixed Popup Image & Button Scaling --- */

#game-popup {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9); /* Darker background for better button contrast */
    z-index: 10;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px; /* Prevents edge touching on mobile */
}

#game-popup img {
    width: 80%; /* Shrinks the image to fit the container */
    max-width: 280px;
    height: auto;
    margin-bottom: 15px;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 80%; /* Responsive width */
    max-width: 220px;
    margin-top: 0px; 
}

.btn {
    padding: 12px 15px; /* Slightly smaller padding for better fit */
    font-size: 14px; /* Optimized font size for mobile visibility */
    font-weight: 800;
    border-radius: 30px;
    text-transform: uppercase;
    width: 100%;
    border: 2px solid #ffffff !important;
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
    opacity: 1 !important;
}

/* Ensure the status bar doesn't overlap the popup */
.game-status-bar {
    position: absolute;
            top: 15px;
            left:30%;
            width: 100%;
            text-align: center;
            color: white;
            font-weight: bold;
            font-size: 20px;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    z-index: 1; 
}

/*-------------------------------------------Video Section---------------------------------------------*/
#video-section { display: flex; justify-content: center; }
.video-frame {
  width: min(90vw, 420px);
  aspect-ratio: 9 / 16;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  margin: 0 auto;
}
.video-el { width: 100%; height: 100%; object-fit: cover; display: block; }

/*-------------------------------------------Animations---------------------------------------------*/
@keyframes pulse { 0%, 100% { transform: scale(0.9); } 50% { transform: scale(1.1); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
/* --- Desktop Height Adjustment --- */
@media (min-width: 992px) {
  section.position-relative {
    height: 100vh; /* Force section to match screen height */
    width: auto;
    overflow: hidden;
    display: flex;
    justify-content: center;
  }

  #bg {
    height: 100%; /* Make image match the section height */
    width: auto;   /* Let width scale naturally to avoid stretching */
    max-width: none; 
    object-fit: contain;
  }
  
  /* Adjust titles and buttons for desktop height */
  .main-title {
    top: 15%; 
  }
  
  .redirect-btn {
    top: 80%; /* Moves the button slightly lower to fit the taller view */
  }
}

/* --- Mobile View (Keeps existing logic) --- */
@media (max-width: 991px) {
  #bg {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
  }
}