@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  background-color: #050505;
  color: white;
  font-family: "Press Start 2P", monospace;

  display: flex;
  justify-content: center;
  align-items: center;

  overflow-x: hidden;
}

.container {
  width: 100%;
  max-width: 700px;

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  text-align: center;
  padding: 30px 20px;
}

#game-screen,
#game-over-screen {
  display: none;
}

/* START SCREEN */

.arcade-label {
  color: #ffdb38;
  font-size: 10px;
  letter-spacing: 4px;
  margin-bottom: 35px;
}

h1 {
  color: #ffdb38;
  font-size: 35px;
  line-height: 1.8;
  margin-bottom: 35px;
}

h1 span {
  display: block;
  color: white;
}

.start-characters {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-bottom: 35px;
}

.start-characters img {
  width: 55px;
  height: 55px;
  object-fit: contain;
  image-rendering: pixelated;
}

.subtitle {
  color: #ffdb38;
  font-size: 13px;
  margin-bottom: 35px;
}

button {
  background: black;
  color: #ffdb38;

  border: 3px solid #ffdb38;

  padding: 20px 30px;

  font-family: "Press Start 2P", monospace;
  font-size: 12px;

  cursor: pointer;
  transition: 0.2s;
}

button:hover {
  background: #ffdb38;
  color: black;
}

.instructions {
  color: #aaaaaa;
  font-size: 9px;
  margin-top: 35px;
}

.insert-coin {
  color: #ffdb38;
  font-size: 10px;
  margin-top: 35px;
  animation: blink 1s infinite;
}

/* GAME SCREEN */

.game-header {
  width: 400px;

  display: flex;
  justify-content: space-between;
  align-items: center;

  margin-bottom: 30px;
  padding: 0 5px;
}

.score-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;

  min-width: 100px;
}

.score-box span {
  color: white;
  font-size: 11px;
  white-space: nowrap;
}

.score-box strong {
  color: #ffdb38;
  font-size: 20px;
}

.game-title {
  color: #ffdb38;
  font-size: 12px;
}

#game-box {
  width: 400px;
  height: 400px;

  position: relative;
  overflow: hidden;

  background-color: black;

  border: 5px solid #253e9f;
  border-radius: 15px;

  box-shadow: 0 0 0 5px #101d56;
}

#game-box::before {
  content: "";

  position: absolute;
  inset: 0;

  background-image: radial-gradient(
    circle,
    #b58b1d 3px,
    transparent 4px
  );

  background-size: 35px 35px;

  opacity: 0.8;
  pointer-events: none;
}

#game-box::after {
  content: "";

  position: absolute;
  inset: 15px;

  border: 4px solid #253e9f;
  border-radius: 12px;

  pointer-events: none;
}

.player {
  position: absolute;

  background-image: url("../images/pacman.png");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;

  image-rendering: pixelated;

  z-index: 5;
}

.enemy {
  position: absolute;

  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;

  image-rendering: pixelated;

  z-index: 4;
}

.game-instructions {
  color: #aaaaaa;
  font-size: 9px;
  margin-top: 35px;
}

/* GAME OVER SCREEN */

#game-over-screen h2 {
  color: #ffdb38;
  font-size: 35px;
  margin-bottom: 40px;
}

.game-over-ghost {
  margin-bottom: 35px;
}

.game-over-ghost img {
  width: 90px;
  height: 90px;

  object-fit: contain;
  image-rendering: pixelated;
}

#game-over-screen > p {
  color: white;
  font-size: 12px;
  line-height: 2;
  margin-bottom: 30px;
}

.final-score-box {
  display: flex;
  flex-direction: column;
  gap: 20px;

  margin-bottom: 30px;
}

.final-score-box span {
  color: white;
  font-size: 12px;
}

.final-score-box strong {
  color: #ffdb38;
  font-size: 30px;
}

.best-score-text {
  color: #ffdb38 !important;
  font-size: 11px !important;
}

#restart-btn {
  margin-top: 15px;
}

/* ANIMATIONS */

@keyframes blink {
  0%, 50% {
    opacity: 1;
  }

  51%, 100% {
    opacity: 0;
  }
}

/* RESPONSIVE */

@media (max-width: 480px) {
  .container {
    padding: 20px 10px;
  }

  h1 {
    font-size: 23px;
  }

  .start-characters {
    gap: 10px;
  }

  .start-characters img {
    width: 40px;
    height: 40px;
  }

  .game-header {
    width: 300px;
  }

  .score-box {
    min-width: 0;
  }

  .score-box span {
    font-size: 8px;
  }

  .score-box strong {
    font-size: 15px;
  }

  .game-title {
    font-size: 9px;
  }

  #game-box {
    transform: scale(0.75);
    margin: -50px 0;
  }

  #game-over-screen h2 {
    font-size: 24px;
  }
}

.start-characters img:nth-child(2) {

  transform: scale(1.1);

}

.start-characters img:nth-child(3) {

  transform: scale(1.1);

}

.start-characters img:nth-child(4) {

  transform: scale(1.1);

}