@font-face {
  font-family: Cherry;
  src: url(fonts/CherryCreamSoda-Regular.ttf);
}

h1 {
  margin-block-start: 0;
}

body {
  display: flex;
  margin: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  overflow: hidden;
  background-image: url(./img/0_page_background/desert.jpg);
  background-size: cover;
  background-position: center;
  font-family: Cherry;
  font-size: 40px;
  color: white;
  letter-spacing: 4px;
  text-shadow: 0px 10px 2px rgba(0, 0, 0, 0.7);
}

#game-screen {
  position: relative;
  width: min(720px, 100vw, calc(100vh * 1.5));
  max-height: 100vh;
  aspect-ratio: 3 / 2;
  margin: 0 auto;
}

#game-screen canvas {
  width: 100%;
  height: 100%;
  display: block;
}

#start-screen {
  position: absolute;
  inset: 0;
  z-index: 10;
}

#start-game-text {
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 11;
  text-align: center;
  font-size: 24px;
  font-family: Cherry;
  color: #ffd700;
  letter-spacing: 4px;
  text-shadow: 0px 0px 4px rgba(0, 0, 0, 0.7);
  background-color: #99440a;
  border-radius: 8px;
  transition: all 0.3s ease;
}

#start-game-text:hover {
  font-size: 28px;
  cursor: pointer;
}

#restart-game-text {
  position: absolute;
  top: 88%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 11;
  text-align: center;
  font-size: 18px;
}

#start-screen img {
  width: 100%;
  height: 100%;
}

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

#instructions-button {
  position: absolute;
  top: 92%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 11;
  text-align: center;
  font-size: 18px;
  font-family: Cherry;
  color: #ffd700;
  letter-spacing: 4px;
  text-shadow: 0px 0px 4px rgba(0, 0, 0, 0.7);
  background-color: #99440a;
  border: none;
  border-radius: 8px;
  padding: 4px 12px;
  transition: all 0.3s ease;
  cursor: pointer;
}

#instructions-button:hover {
  font-size: 20px;
}

#imprint-button {
  position: absolute;
  bottom: 4px;
  right: 8px;
  z-index: 11;
  font-size: 16px;
  font-family: Cherry;
  color: #ffd700;
  letter-spacing: 2px;
  text-shadow: none;
  background: none;
  border: none;
  opacity: 0.7;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

#imprint-button:hover {
  opacity: 1;
}

#imprint-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.85);
  overflow-y: auto;
  padding: 24px 0;
}

#imprint-overlay.hidden {
  display: none;
}

#imprint-content {
  background-color: #99440a;
  border-radius: 12px;
  padding: 24px 32px;
  color: #ffd700;
  font-family: Cherry;
  font-size: 16px;
  letter-spacing: 1px;
  max-width: 80%;
  width: 100%;
  text-shadow: none;
}

#imprint-content h2 {
  font-size: 20px;
  margin: 0 0 16px;
}

#imprint-content h3 {
  font-size: 16px;
  margin: 16px 0 6px;
}

#imprint-content p {
  margin: 0 0 10px;
  line-height: 1.6;
}

#imprint-content a {
  color: #ffd700;
}

#close-imprint-button {
  font-family: Cherry;
  font-size: 16px;
  color: #99440a;
  background-color: #ffd700;
  border: none;
  border-radius: 8px;
  padding: 4px 16px;
  margin-top: 16px;
  cursor: pointer;
  letter-spacing: 2px;
  transition: background-color 0.2s ease;
}

#close-imprint-button:hover {
  background-color: #ffdf33;
}

#instructions-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.85);
}

#instructions-overlay.hidden {
  display: none;
}

#instructions-content {
  background-color: #99440a;
  border-radius: 12px;
  padding: 24px 32px;
  text-align: center;
  color: #ffd700;
  font-family: Cherry;
  letter-spacing: 2px;
  max-width: 80%;
}

#instructions-content h2 {
  font-size: 22px;
  margin: 0 0 16px;
  text-shadow: none;
}

#instructions-content ul {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  font-size: 16px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-shadow: none;
}

.key {
  display: inline-block;
  background-color: #ffd700;
  color: #99440a;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 16px;
  margin-right: 4px;
  font-family: sans-serif;
  font-weight: bold;
  letter-spacing: 0;
}

#close-instructions-button {
  font-family: Cherry;
  font-size: 16px;
  color: #99440a;
  background-color: #ffd700;
  border: none;
  border-radius: 8px;
  padding: 4px 16px;
  cursor: pointer;
  letter-spacing: 2px;
  transition: background-color 0.2s ease;
}

#close-instructions-button:hover {
  background-color: #ffdf33;
}

#mute-button {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 15;
  font-family: Cherry;
  font-size: 16px;
  color: #ffd700;
  background-color: #99440a;
  border: none;
  border-radius: 8px;
  padding: 4px 12px;
  cursor: pointer;
  letter-spacing: 2px;
  transition: background-color 0.2s ease;
}

#mute-button:hover {
  background-color: #b85510;
}

#mute-button.hidden {
  display: none;
}

#game-over {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background-color: rgba(0, 0, 0, 0.8);
  width: 100%;
  height: 100%;
}

.end-screen-buttons {
  display: flex;
  gap: 12px;
}

.end-screen-buttons button {
  font-family: Cherry;
  font-size: 16px;
  letter-spacing: 2px;
  border: none;
  border-radius: 8px;
  padding: 6px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.end-screen-buttons button:first-child {
  color: #99440a;
  background-color: #ffd700;
}

.end-screen-buttons button:first-child:hover {
  background-color: #ffdf33;
}

.end-screen-buttons button:last-child {
  color: #ffd700;
  background-color: #99440a;
}

.end-screen-buttons button:last-child:hover {
  background-color: #b85510;
}

#you-won {
  position: absolute;
  inset: 0;
  z-index: 22;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background-color: rgba(0, 0, 0, 0.8);
  width: 100%;
  height: 100%;
}

#you-won img,
#game-over img {
  width: 50%;
  height: auto;
}

#game-over.hidden,
#you-won.hidden {
  display: none;
}

#orientation-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgb(255, 255, 255);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  color: black;
  font-family: sans-serif;
  text-shadow: 0px 0px 0px rgba(0, 0, 0, 0.7);
}

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

.overlay-content {
  text-align: center;
  max-width: 300px;
}

.overlay-content h2 {
  font-size: 24px;
  margin-bottom: 10px;
}

.overlay-content p {
  font-size: 16px;
  margin-bottom: 20px;
}

.overlay-content img {
  width: 50px;
}

#mobile-buttons {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  position: absolute;
  bottom: 8px;
  z-index: 999;
  display: none;
}

.touch-device #mobile-buttons.game-started {
  display: flex;
}

#mobile-buttons-right,
#mobile-buttons-left {
  display: flex;
  width: 100%;
  gap: 12px;
}

#mobile-buttons-right img,
#mobile-buttons-left img {
  width: 70px;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

#mobile-buttons-right {
  justify-content: flex-end;
}

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

@media only screen and (orientation: landscape) and (max-width: 1024px) {
  h1 {
    display: none;
  }

  #game-screen canvas {
    width: 100%;
    height: 100%;
  }

  #mobile-buttons {
    display: none;
  }
}
