@font-face {
  font-family: "zabars";
  src: url("fonts/zabars.ttf") format("truetype");
}

html,
body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
}

body {
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  font-family: "zabars", Arial, Helvetica, sans-serif;
  background-image: url("./img/5_background/desert.png");
  background-position: center;
  background-size: cover;
}

#game-container {
  position: relative;
  width: 720px;
  height: 480px;
  margin: 0 auto;
  overflow: hidden;
}

:fullscreen #game-container,
:-webkit-full-screen #game-container,
:-ms-fullscreen #game-container {
  width: 100vw;
  height: 100vh;
}

h1 {
  font-size: 64px;
  letter-spacing: 3px;
  text-shadow: 4px 4px 8px rgba(0, 0, 0, 0.5);
}

canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: black;
  display: block;
}

#playButton {
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 15px 30px;
  font-size: 48px;
  background-color: #ffa400;
  border-radius: 8px;
  font-family: "zabars", Arial, Helvetica, sans-serif;
  cursor: pointer;
  z-index: 10;
}

#playButton:hover {
  background-color: #faf1e081;
}

.controls.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

#game-container {
  position: relative;
  width: 100%;
  max-width: 720px;
  aspect-ratio: 720 / 480;
  margin: 0 auto;
  overflow: hidden;
}

.control-btn {
  background: none;
  border: none;
  height: 40px;
}

.control-btn img {
  width: 50px;
  height: 50px;
}

#winning-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

#winning-screen img {
  max-width: 90vw;
  max-height: 88vh;
}

#winning-screen .buttons-container {
  display: flex;
  justify-content: center;
  gap: 20px;
}

#winning-screen button {
  padding: 10px 20px;
  font-size: 18px;
  color: white;
  background-color: #28a745;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

#winning-screen button:hover {
  background-color: #218838;
}

#game-over-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

#game-over-screen img {
  max-width: 90vw;
  max-height: 90vh;
}

#game-over-screen .buttons-container {
  display: flex;
  justify-content: center;
  gap: 20px;
}

#game-over-screen button {
  padding: 10px 20px;
  font-size: 18px;
  color: white;
  background-color: #dc3545;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-top: -40px;
}

#game-over-screen button:hover {
  background-color: #c82333;
}

#fullscreen-btn,
#mute-btn,
#pause-btn,
#impressum-icon {
  position: absolute;
  top: 10px;
  z-index: 1000;
  background: none;
  border: none;
  cursor: pointer;
}

#fullscreen-btn {
  right: 10px;
}

#mute-btn {
  right: 60px;
}

#pause-btn {
  display: none;
  pointer-events: none;
  right: 110px;
}

#fullscreen-btn img,
#mute-btn img,
#pause-btn img,
#impressum-icon img,
#instructions-btn {
  width: 40px;
  height: 40px;
}

#pause-screen {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 10px;
  text-align: center;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 1001;
  font-size: 4vw;
  max-width: 90%;
}

#pause-screen.hidden {
  display: none;
}

#pause-screen button {
  padding: 10px 20px;
  font-size: 18px;
  color: white;
  background-color: #28a745;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 20px;
}

#pause-screen button:hover {
  background-color: #218838;
}

#restart-btn {
  background-color: #dc3545;
}

#restart-btn:hover {
  background-color: #c82333;
}

#home-btn {
  background-color: #dc3545;
}

#home-btn:hover {
  background-color: #c82333;
}

#orientation-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  font-size: 24px;
  font-weight: bold;
  font-family: "Comic Sans MS", "Comic Sans", cursive;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}

#orientation-overlay.hidden {
  display: none !important;
}

#orientation-overlay p {
  max-width: 80%;
  text-align: center;
  line-height: 1.5;
}

#how-to-play h2 {
  font-size: 24px;
  font-family: "Comic Sans MS", "Comic Sans", cursive;
  white-space: nowrap;
  color: #aeca54;
  text-shadow: -2px 4px 0px chocolate;
}

#how-to-play p {
  font-size: 20px;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  font-family: "Comic Sans MS", "Comic Sans", cursive;
}

#how-to-play span {
  font-weight: bold;
  color: #ffc91d;
  text-shadow: 1px 0 black, 0px 0px 0 black, 0px 0px 0 black, 2px 1px 0 black;
  width: 100%;
}

#impressum-container {
  max-width: 600px;
  margin: 50px auto;
  padding: 20px;
  background: #c98345;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  text-align: center;
  font-family: "Comic Sans MS", "Comic Sans", cursive;
}

#impressum-container h1 {
  font-size: 24px;
  color: #aeca54;
  text-shadow: -2px 4px 0px chocolate;
  margin-bottom: 15px;
}

#impressum-container p {
  font-size: 16px;
  line-height: 1.5;
  color: #faf1e0;
  text-shadow: -2px 4px 0px chocolate;
  margin-bottom: 10px;
}

#impressum-container button {
  display: inline-block;
  margin-top: 20px;
  padding: 10px 15px;
  background: #aeca54;
  color: white;
  text-decoration: none;
  border-radius: 5px;
  cursor: pointer;
}

#impressum-container button:hover {
  background: #0056b3;
}

#game-info h2 {
  font-size: 24px;
  font-family: "Comic Sans MS", "Comic Sans", cursive;
  white-space: nowrap;
  color: #aeca54;
  text-shadow: -2px 4px 0px chocolate;
}

#game-info p {
  font-size: 20px;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: normal;
  font-family: "Comic Sans MS", "Comic Sans", cursive;
  font-weight: bold;
  color: #ffc91d;
  text-shadow: 1px 0 black, 0px 0px 0 black, 0px 0px 0 black, 2px 1px 0 black;
}

#instructions-btn {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  background-color: #ffa400;
  cursor: pointer;
  font-family: "zabars", Arial, Helvetica, sans-serif;
  border-radius: 8px;
  transition: transform 0.2s ease;
}

#instructions-btn:hover {
  background-color: #faf1e081;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 3000;
  padding: 10px;
}

.modal-content {
  position: relative;
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  max-width: 600px;
  max-height: 80%;
  overflow-y: auto;
  background: #c98345;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #aeca54;
  border: none;
  padding: 5px 10px;
  cursor: pointer;
  border-radius: 5px;
  font-weight: bold;
  font-size: 16px;
}

.close-btn:hover {
  background-color: #faf1e081;
}

.modal.hidden {
  display: none;
}

#read-me-overlay {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  font-size: 24px;
}

#close-readme {
  background-color: #ffa400;
  padding: 5px 10px;
  cursor: pointer;
  border-radius: 5px;
  font-weight: bold;
  font-size: 16px;
}

#close-readme:hover {
  background-color: #faf1e081;
}

@media only screen and (max-width: 1024px) {
  #game-controls {
    display: none;
    justify-content: space-between;
    bottom: 10px;
    width: 95%;
    position: absolute;
    padding-left: 15px;
    z-index: 2000;
  }
}

@media only screen and (max-width: 768px) {
  .modal-content {
    max-width: 90%;
    max-height: 90%;
    padding: 15px;
  }
  .close-btn {
    font-size: 14px;
    padding: 4px 8px;
  }
}

@media only screen and (max-width: 720px) {
  #game-container {
    width: 100%;
    height: auto;
  }

  .control-btn img {
    width: 40px;
    height: 40px;
  }

  #fullscreen-btn {
    right: 10px;
    top: 5px;
  }
  #mute-btn {
    right: 55px;
    top: 5px;
  }
  #pause-btn {
    right: 100px;
    top: 5px;
  }

  #playButton {
    font-size: 20px;
    padding: 10px 20px;
  }

  #how-to-play {
    flex-wrap: wrap;
    font-size: 14px;
    gap: 15px;
  }

  #how-to-play h2 {
    font-size: 18px;
  }

  #how-to-play p {
    font-size: 16px;
  }

  #game-info {
    flex-wrap: wrap;
    font-size: 14px;
    gap: 15px;
  }

  #game-info h2 {
    font-size: 18px;
  }

  #game-info p {
    font-size: 16px;
  }

  #impressum-container {
    max-width: 90%;
    padding: 15px;
  }

  #impressum-container h1 {
    font-size: 20px;
  }

  #impressum-container p {
    font-size: 14px;
  }

  #impressum-container a {
    font-size: 14px;
    padding: 8px 12px;
  }
}

@media only screen and (max-width: 480px) {
  #impressum-container {
    max-width: 95%;
    padding: 10px;
  }

  #impressum-container h1 {
    font-size: 18px;
  }

  #impressum-container p {
    font-size: 12px;
  }

  #impressum-container a {
    font-size: 12px;
    padding: 6px 10px;
  }

  .modal-content {
    max-width: 55%;
    max-height: 95%;
    padding: 10px;
  }
  .close-btn {
    font-size: 12px;
    padding: 3px 6px;
  }
}

@media only screen and (max-height: 480px) {
  canvas {
    height: 100vh;
  }

  h1 {
    display: none;
  }

  #pause-screen {
    padding: 1em;
    font-size: 4vw;
  }

  #how-to-play {
    font-size: 12px;
    gap: 10px;
  }

  #how-to-play h2 {
    font-size: 16px;
  }

  #how-to-play p {
    font-size: 14px;
  }

  #how-to-play span {
    font-size: 12px;
  }

  #game-info {
    font-size: 12px;
    gap: 10px;
  }

  #game-info h2 {
    font-size: 14px;
  }

  #game-info p {
    font-size: 12px;
    white-space: normal;
  }
}
