* {
  box-sizing: border-box;
}
html {
  margin: 0px;
  max-height: 100px;
}
body {
  font-family: Arial, sans-serif;
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: #202124;
}

.main-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
  margin: 0;
  padding: 4px;
}
.game-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.game-container {
  display: grid;
  grid-template-columns: repeat(7, 60px);
  grid-template-rows: repeat(7, 60px);
  gap: 2px;
}

.game-container div {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background-color: blanchedalmond;
  border: 1px solid #ccc;
}
img.bomb-image,
img.player-image {
  mix-blend-mode: hard-light;
}
img.player-image {
  display: flex;
  border-radius: 50%;
  width: 60px;
  height: 60px;
}

img.bomb-image {
  display: none;
  width: 50px;
  height: 50px;
}

img.bomb-image.blinking,
img.player-image.blinking {
  display: inline-block;
  width: 350px;
  height: 350px;
  animation: grow 2s infinite, blink 2s infinite;
}

.player-image {
  background-color: cadetblue;
}

img.game-image-lose {
  height: 400px;
}

.game-image-lose,
.game-image-win {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.game-image-lose img,
.game-image-win img {
  max-width: 50%;
  max-height: 50vh;
}

h2 {
  font-size: 2rem;
  font-family: "Press Start 2P";
  text-align: center;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 4px; /* Add some letter spacing for a more spread-out look */
  text-shadow: 2px 2px 3px rgba(0, 0, 0, 0.5);
}

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

@keyframes grow {
  0% {
    width: 60px;
    height: 60px;
  }
  50% {
    width: 300px;
    height: 300px;
  }
  100% {
    width: 60px;
    height: 60px;
  }
}

p {
  font-family: "Press Start 2P";
  font-size: 0.6rem;
  text-align: center;
  color: #ffffff;
  margin: 8px 5px;
  padding: 4px;
}

.help-bubble {
  position: absolute;
  bottom: 520px;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  visibility: hidden;
  max-width: 300px;
  padding: 10px;
  border-radius: 10px;
  background-color: #fff;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
  transition: opacity 0.8s ease-in-out, visibility 0s linear 0.5s;
}

.help-bubble::before {
  content: "";
  position: absolute;
  bottom: -10px; /* Adjust this value to bring the triangle into view */
  left: 50%;
  transform: translateX(-50%);
  border-width: 10px;
  border-style: solid;
  border-color: transparent transparent #fff transparent;
}
.help-bubble.show {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s ease-in-out, visibility 0s linear;
}

.help-button {
  text-align: center;
  margin: 0;
  padding: 3px;
  margin-bottom: 3px;
}

button#instructionsButton {
  align-items: center;
  appearance: none;
  background-image: radial-gradient(100% 100% at 100% 0, #5adaff 0, #5468ff 100%);
  border: 0;
  border-radius: 6px;
  box-shadow: rgba(45, 35, 66, 0.4) 0 2px 4px, rgba(45, 35, 66, 0.3) 0 7px 13px -3px, rgba(58, 65, 111, 0.5) 0 -3px 0 inset;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-family: "Press Start 2P", cursive;
  height: 32px;
  justify-content: center;
  line-height: 1;
  list-style: none;
  overflow: hidden;
  padding: 16px;
  position: relative;
  text-align: left;
  text-decoration: none;
  transition: box-shadow 0.15s, transform 0.15s;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  white-space: nowrap;
  will-change: box-shadow, transform;
  font-size: 0.7rem;
}

button#instructionsButton:focus {
  box-shadow: #3c4fe0 0 0 0 1.5px inset, rgba(45, 35, 66, 0.4) 0 2px 4px, rgba(45, 35, 66, 0.3) 0 7px 13px -3px, #3c4fe0 0 -3px 0 inset;
}

button#instructionsButton:hover {
  box-shadow: rgba(45, 35, 66, 0.4) 0 4px 8px, rgba(45, 35, 66, 0.3) 0 7px 13px -3px, #3c4fe0 0 -3px 0 inset;
  transform: translateY(-2px);
}

button#instructionsButton:active {
  box-shadow: #3c4fe0 0 3px 7px inset;
  transform: translateY(2px);
}

.game-container div.visited {
  background-color: #838383;
  pointer-events: none;
}

.instructions-para {
  color: #202124;
}

.mobile-movevement {
  display: flex;
  flex-wrap: wrap;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 10px;
}

.mobile-movevement button {
  font-family: "Press Start 2P", cursive;
  font-size: 14px;
  padding: 8px;
  background-color: #3498db;
  color: #fff;
  border: none;
  cursor: pointer;
  border-radius: 5px;
  margin: 4px;
  outline: none;
  transition: background-color 0.3s;
  display: flex;
  max-width: 130px;
  align-items: center;
  justify-content: center;
}

.mobile-movevement button::before {
  content: "";
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 5px;
}

.mobile-movevement #upButton::before {
  content: "↑";
}

.mobile-movevement #downButton::before {
  content: "↓";
}

.mobile-movevement #leftButton::before {
  content: "←";
  font-size: 25px;
}

.mobile-movevement #rightButton::before {
  content: "→";
  font-size: 25px;
}

.counter-move h2 {
  font-family: "Press Start 2P", cursive;
  color: #3498db;
  text-align: center;
}

.left-right,
.upper-button,
.down-button {
  display: flex;
  height: 40px;
}

footer {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
  margin: 0;
  margin-top: auto;
  text-align: center;
  width: 100%;
}

.winCount,
.lossCount {
  font-size: 0.8rem;
  font-family: "Press Start 2P";
  color: #3498db;
}

.restart-button {
  font-family: "Press Start 2P";
  padding: 10px;
  width: 120px;
  height: 50px;
  border: none;
  margin-top: 10px;
  outline: none;
  color: #3498db;
  background-color: #fff;
  cursor: pointer;
  position: relative;
  z-index: 0;
  border-radius: 10px;
  transition: background-color 0.7s, transform 0.5s;
}

.restart-button:hover {
  background-color: #3498db;
  box-shadow: #202124;
  color: #fff;
}

.restart-button:active {
  transform: scale(0.75);
}

div.win-message {
  position: absolute;
  text-align: center;
  font-family: "Press Start 2P";
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.3rem;
  font-weight: bold;
  color: #3498db;
  animation: zoomIn 4s ease;
  width: 0;
  height: 0;
  border-radius: 50px;
  overflow: hidden;
}

div.win-message::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.8);
  z-index: -1;
}

div.lose-message {
  position: absolute;
  text-align: center;
  font-family: "Press Start 2P";
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.7rem;
  font-weight: bold;
  color: #3498db;
  animation: zoomInLose 4s ease;
  width: 0;
  height: 0;
  border-radius: 50px;
  overflow: hidden;
}

div.lose-message::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.8);
  z-index: -1;
}

@keyframes zoomIn {
  0% {
    width: 0;
    height: 0;
    opacity: 0;
  }
  90% {
    opacity: 1;
    width: 400px;
    height: 120px;
  }
  100% {
    width: 400px;
    height: 120px;
    opacity: 1;
  }
}

@keyframes zoomInLose {
  0% {
    width: 0;
    height: 0;
    opacity: 0;
  }
  90% {
    opacity: 1;
    width: 230px;
    max-width: 100%;
    height: 120px;
  }
  100% {
    width: 230px;
    max-width: 100%;
    height: 120px;
    opacity: 1;
  }
}

.swal2-popup {
  width: 300px; /* Set the width as needed */
  margin: 0 auto; /* Center horizontally */
  max-height: 100vh; /* Ensure the popup doesn't exceed viewport height */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: #202124;
}

.swal2-title {
  font-size: 1.3rem;
  color: #3498db;
}

button.swal2-confirm.swal2-styled {
  background-color: white;
  color: #3498db;
  text-align: center;
  font-family: "Press Start 2P";
}

.swal2-close {
  color: #3498db;
  font-size: 1.5rem;
}

@media only screen and (max-width: 600px) {
  body {
    margin: 0;
    font-size: 14px;
    padding: 5px;
    max-height: 100%;
    min-height: 70%;
  }

  h2 {
    font-size: 1.5rem;
  }

  .game-container {
    display: grid;
    grid-template-columns: repeat(7, 40px);
    grid-template-rows: repeat(7, 40px);
    gap: 1px;
  }

  .game-container div {
    max-width: 70%;
    max-height: 70%;
  }

  img.player-image {
    width: 8vw;
    height: 8vw;
  }
  .mobile-movevement button {
    font-size: 10px;
    padding: 7px;
    margin: 3px;
    background-color: #3498db;
    color: #fff;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    outline: none;
    transition: background-color 0.3s;
    display: flex;
    max-width: 110px;
    align-items: center;
    justify-content: center;
  }
  .game-image-lose,
  .game-image-win {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    width: 100%;
  }

  img.game-image-lose,
  img.game-image-win {
    min-width: 270px;
    height: auto;
    max-height: 300px;
    padding: 5px;
  }

  .help-bubble {
    bottom: 520px;
  }
  .instructions-para {
    font-size: 0.4rem;
  }
  Button#instructionsButton {
    font-size: 0.5rem;
    padding: 10px;
    margin-bottom: 10px;
  }
  #upButton,
  #leftButton,
  #rightButton,
  #downButton {
    touch-action: manipulation;
  }

  @keyframes zoomIn {
    0% {
      width: 0;
      height: 0;
      opacity: 0;
    }
    90% {
      opacity: 1;
      width: 94%;
      max-width: 100%;
      height: 120px;
    }
    100% {
      width: 94%;
      max-width: 100%;
      height: 120px;
      opacity: 1;
    }
  }

  @keyframes zoomInLose {
    0% {
      width: 0;
      height: 0;
      opacity: 0;
    }
    90% {
      opacity: 1;
      width: 60%;
      max-width: 100%;
      height: 120px;
    }
    100% {
      width: 60%;
      max-width: 100%;
      height: 120px;
      opacity: 1;
    }
  }

  .swal2-popup {
    width: 300px;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
    background-color: #202124;
  }

  .swal2-title {
    font-size: 1.3rem;
    color: #3498db;
  }
  button.swal2-confirm.swal2-styled {
    background-color: white;
    color: #3498db;
    text-align: center;
    font-family: "Press Start 2P";
  }
}
