/* Ensure the body takes up the full screen with no scrollbars */
body {
  background: #222;
  margin: 0;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  font-family: sans-serif;
  /* Add these 3 lines to make it Mobile-Perfect! */
  touch-action: none; 
  user-select: none;
  -webkit-user-select: none;
}

#ui-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  pointer-events: none;
}

.menu {
  pointer-events: all;
  background: #222; /* Solid dark color to completely hide the game! */
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw; /* Forces it to fill the entire width of the screen */
  height: 100vh; /* Forces it to fill the entire height of the screen */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: white;
  z-index: 200;
  box-sizing: border-box;
}

.menu h1, .menu h2 {
  margin-top: 0;
  font-size: 6vmin;
  text-shadow: 0.3vmin 0.3vmin 0 #000;
}

/* 3D Button Style */
.play-btn, .back-btn {
  padding: 2vmin 6vmin;
  font-size: 4vmin;
  background: #88ce02;
  border: none;
  border-radius: 1.5vmin;
  cursor: pointer;
  font-weight: bold;
  box-shadow: 0 1vmin 0 #4a7500; /* 3D bottom shadow */
  transition: transform 0.1s;
  margin-top: 2vmin;
}

.play-btn:active, .back-btn:active {
  transform: translateY(1vmin); /* Pushes button down when clicked */
  box-shadow: 0 0 0 #4a7500;
}

/* The Grid from your image (7 columns like the picture, or 5 if you prefer) */
#level-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr); /* 5 columns x 4 rows = 20 levels */
  gap: 2vmin;
  padding: 2vmin;
}

/* LEVEL BUTTONS */
.lvl-btn {
  width: 14vmin;
  height: 14vmin;
  font-size: 6vmin;
  font-weight: bold;
  border-radius: 2.5vmin;
  border: none;
  cursor: pointer;
  background: linear-gradient(to bottom, #f4ffb3, #c5f04a); /* Light green/yellow gradient */
  color: #fff;
  text-shadow: -0.2vmin -0.2vmin 0 #000, 0.2vmin -0.2vmin 0 #000, -0.2vmin 0.2vmin 0 #000, 0.2vmin 0.2vmin 0 #000; /* Black outline around numbers */
  box-shadow: 0 1.5vmin 0 #153c19; /* Thick dark green 3D bottom */
  transition: transform 0.1s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.lvl-btn:active {
  transform: translateY(1.5vmin);
  box-shadow: 0 0 0 #153c19;
}

/* LOCKED LEVEL BUTTONS */
.lvl-btn.locked {
  background: linear-gradient(to bottom, #e0e0e0, #aaaaaa);
  color: #555;
  text-shadow: none; /* No outline on padlocks */
  box-shadow: 0 1.5vmin 0 #666666;
  cursor: not-allowed;
}

.lvl-btn.locked:active {
  transform: none;
  box-shadow: 0 1.5vmin 0 #666666;
}

/* STARS AT THE BOTTOM OF BUTTONS */
.stars-container {
  position: absolute;
  bottom: 0.5vmin;
  display: flex;
  gap: 0.5vmin;
}

.star {
  font-size: 3vmin;
  color: #ffcc00; /* Bright yellow */
  text-shadow: 0.2vmin 0.2vmin 0 #000; /* Black shadow behind stars */
}

/* TOP LEFT BACK BUTTONS */
.top-left-btn {
  position: absolute;
  top: 3vmin;
  left: 3vmin;
  padding: 1.5vmin 3vmin;
  font-size: 3vmin;
  font-weight: bold;
  background: #ff4d4d; /* Nice red color to indicate 'stop/back' */
  color: white;
  border: none;
  border-radius: 1.5vmin;
  cursor: pointer;
  box-shadow: 0 0.8vmin 0 #b30000; /* Dark red 3D shadow */
  pointer-events: all; /* Ensures it can be clicked even during gameplay */
  transition: transform 0.1s;
}

.top-left-btn:active {
  transform: translateY(0.8vmin);
  box-shadow: 0 0 0 #b30000;
}

/* LEVEL COMPLETE POPUP STYLES */
.popup-box {
  background: #2a4d14; /* Nice dark forest green */
  padding: 5vmin 8vmin;
  border-radius: 3vmin;
  border: 0.5vmin solid #88ce02;
  box-shadow: 0 1.5vmin 0 #153c19;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.popup-stars {
  font-size: 10vmin;
  color: #ffcc00;
  text-shadow: 0.4vmin 0.4vmin 0 #000;
  margin-bottom: 3vmin;
  letter-spacing: 1vmin;
}