@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

body {
  font-family: 'Press Start 2P', cursive;
  background-color: #111827;
  overflow: hidden;
  touch-action: manipulation;
  margin: 0;
  padding: 0;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('../assets/bgbody.png');
  background-size: cover;
  background-position: center;
  opacity: 0.1;
  z-index: -1;
  pointer-events: none;
}

.score-display, .high-score-display {
  position: absolute;
  color: white;
  font-size: 1vw;
  z-index: 10;
}

.score-display {
  top: 2vh;
  right: 5vw;
}

.high-score-display {
  top: 2vh;
  left: 5vw;
  color: #facc15;
}

.game-container {
  position: relative;
  width: 95vw;
  height: 45vh;
  max-width: 900px;
  max-height: 400px;
  margin: 0 auto;
  margin-top: 5vh;
  overflow: hidden;
  background-color: #1f2937;
  border: 1vw solid #4b5563;
  box-shadow: 0 0 3vw rgba(59, 130, 246, 0.5);
  background-image: url('../assets/bg.png');
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center center;
}

.popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.popup-content {
  background: #1f2937;
  padding: 4vh 6vw;
  border-radius: 12px;
  text-align: center;
  color: white;
  font-family: 'Press Start 2P', cursive;
  font-size: 3.5vw;
  max-width: 90vw;
}

.popup-content button {
  margin-top: 4vh;
  padding: 2.5vh 5vw;
  cursor: pointer;
  font-family: inherit;
  font-size: 3vw;
  border: none;
  border-radius: 8px;
  background-color: #3b82f6;
  color: white;
  transition: background-color 0.3s ease;
}

.popup-content button:hover {
  background-color: #2563eb;
}

.hidden {
  display: none;
}

#block {
  position: absolute;
  bottom: -1vh;
  left: 100%;
  width: 10vw;
  max-width: 100px;
  height: 10vw;
  max-height: 80px;
  background-image: url('../assets/blok.png');
  background-size: contain;
  background-repeat: no-repeat;
  animation: block 1.5s infinite linear;
  z-index: 2;
}

#block2 {
  position: absolute;
  bottom: -1vh;
  left: 130%;
  width: 10vw;
  max-width: 100px;
  height: 10vw;
  max-height: 80px;
  background-image: url('../assets/ShortBrankas.jpg');
  background-size: contain;
  background-repeat: no-repeat;
  animation: block 2s infinite linear;
  z-index: 2;
}

#character {
  position: absolute;
  bottom: 2vh;
  left: 10vw;
  width: 6vw;
  max-width: 48px;
  height: 6vw;
  max-height: 48px;
  background-image: url('https://media1.giphy.com/media/v1.Y2lkPTc5MGI3NjExZzc3MXpoZXYwaDNjNWNicGU4bzF2dXF5bmk1cjMycmd0cjFtZXU1NCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9cw/DjWtHm9jCMNZpDdLPi/giphy.gif');
  background-size: contain;
  background-repeat: no-repeat;
  transform: scale(2.5);
  image-rendering: pixelated;
  z-index: 3;
}

.jump {
  animation: jump 0.3s ease-out;
}

@keyframes block {
  0% {
    left: 100%;
  }
  100% {
    left: -10vw;
  }
}

@keyframes jump {
  0% {
    bottom: 4vh;
  }
  50% {
    bottom: 17vh;
  }
  100% {
    bottom: 4vh;
  }
}

/* MOBILE BREAKPOINTS */

@media (max-width: 600px) {
    
  .popup-content {
    font-size: 4vw;
  }

  .popup-content button {
    font-size: 3.5vw;
    padding: 2vh 6vw;
  }

  .game-container {
    margin-top: 2vh;
    height: 45vh;
  }

  #character {
    width: 10vw;
    height: 10vw;
    bottom: 4vh; /* dikurangi agar tidak terlalu tinggi */
  }

  #block {
    width: 18vw;
    height: 18vw;
    bottom: 0; /* naik agar tidak tenggelam */
    max-width: none;
    max-height: none;
  }



  .score-display,
  .high-score-display {
    font-size: 4vw;
  }

  .jump {
    animation: jump 0.2s ease-out; /* dari 0.45s naik ke 0.55s */
  }
  @keyframes jump {
    0% { bottom: 5vh; }
    50% { bottom: 22vh; }
    100% { bottom: 5vh; }
  }
}

@media (max-width: 400px) {
  .popup-content {
    font-size: 4.5vw;
  }

  .popup-content button {
    font-size: 4.2vw;
  }

  .game-container {
    margin-top: 1vh;
    height: 48vh;
  }

  #character {
    width: 12vw;
    height: 12vw;
    bottom: 5vh;
  }

  #block {
    width: 18vw;
    height: 18vw;
    bottom: 0;
  }


  .score-display,
  .high-score-display {
    font-size: 4.8vw;
  }

  .jump {
    animation: jump 0.2s ease-out;
  }
  @keyframes jump {
    0% { bottom: 5vh; }
    50% { bottom: 20vh; }  /* lompat lebih tinggi */
    100% { bottom: 5vh; }
  }
}
