* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body, html {
  height: 100%;
  font-family: sans-serif;
}

#game {
  position: relative;
  width: 100%;
  height: 100vh;
  background-image: url('back.jpg');
  background-size: cover;
  overflow: hidden;
  touch-action: none; 
  display: none;
}

#player {
  position: absolute;
  width: 40px;
  height: 40px;
  background: url('soldier1.svg') no-repeat center/contain;
  left: 50%;
  top: 90%;
  transform: translate(-50%, -50%);
  transition: left 0.2s linear, top 0.2s linear;
}

.mine, .star {
  position: absolute;
  width: 20px;
  height: 20px;
  text-align: center;
  font-size: 20px;
  line-height: 20px;
}

.mine {
  color: red;
  display: none;
}

.star {
  color: yellow;
}

#hud {
  position: absolute;
  top: 10px;
  left: 10px;
  color: white;
  font-size: 18px;
  display: flex;
  gap: 20px;
}

#restartBtn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 15px 30px;
  font-size: 18px;
  display: none;
  background: crimson;
  color: white;
  border: none;
  border-radius: 10px;
}
#nextLevelBtn {
  position: absolute;
  top: 60%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 15px 30px;
  font-size: 18px;
  display: none;
  background: seagreen; 
  color: white;
  border: none;
  border-radius: 10px;
}

@keyframes collected {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}

.collected {
  animation: collected 0.4s forwards;
}
#welcome-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #111;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 999;
  font-family: 'Arial', sans-serif;
}

#welcome-screen h1 {
  font-size: 4rem;
  margin: 0;
}

#welcome-screen h3 {
  margin-top: 10px;
  font-weight: normal;
  color: #ccc;
}

#welcome-screen button {
  margin-top: 40px;
  padding: 12px 24px;
  font-size: 1.5rem;
  background-color: #ff5050;
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.3s;
}

#welcome-screen button:hover {
  background-color: #ff3333;
}
canvas {
  width: 100vw;
  height: 100vh;
  display: block;
  touch-action: none; 
}

.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.popup-box {
  background: white;
  padding: 30px 40px;
  border-radius: 15px;
  text-align: center;
  max-width: 80%;
  box-shadow: 0 0 20px rgba(0,0,0,0.4);
}

.popup-box h2 {
  margin-bottom: 15px;
  font-size: 26px;
}

.popup-box p {
  font-size: 18px;
  margin-bottom: 20px;
}

#hintOkBtn {
  padding: 12px 25px;
  font-size: 18px;
  border: none;
  background-color: #4CAF50;
  color: white;
  border-radius: 10px;
  cursor: pointer;
}
#mobile-controls {
  position: absolute;
  bottom: 30px;
  left: 30px;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
}

.dpad {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.dpad button {
  width: 50px;
  height: 50px;
  margin: 5px;
  font-size: 20px;
  background-color: #444;
  color: white;
  border: 2px solid #fff;
  border-radius: 8px;
  box-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
  touch-action: none;
}

.dpad button:active {
  background-color: #666;
  transform: scale(0.95);
}

.dpad div {
  display: flex;
  justify-content: center;
  align-items: center;
}

@media (min-width: 768px) {
  #mobile-controls {
    display: none;
  }
}
