@font-face {
  font-family: "Rye";
  src: url("./assets/font/Rye/Rye-Regular.ttf");
  font-weight: 400;
  font-style: normal;
}

body {
  box-sizing: border-box;
  display: flex;
  margin: 0;
  flex-direction: column;
  align-items: center;
  font-family: "Rye", serif;
  /* background: linear-gradient(to bottom, #87ceeb, #c8a97e); */
  background-image: url("./assets/img/screens/Background.png");
  background-repeat: no-repeat;

  background-size: cover;
  min-height: 100vh;
}

body:has(dialog[open]) {
  overflow: hidden;
}

body:has(canvas:focus) {
  overflow: hidden;
}

h1 {
  margin-top: 160px;
  font-size: 48px;
  letter-spacing: 2px;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  font-family: "Rye";
  border: none;
  background-color: transparent;
  align-items: center;
  display: flex;
  /* flex-direction: row; */
  flex-direction: row-reverse;
  font-size: 18px;
  gap: 4px;
}

button:hover {
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
}

#modiBar {
  position: absolute;
  top: 5px;
  right: 10px;
  z-index: 2;
  display: flex;
  flex-direction: row;
  margin-bottom: 8px;
  justify-content: space-evenly;
}

#muteIcon {
  filter: brightness(0);
}

canvas {
  background-color: black;
  box-shadow: o 8px 32px rgba(245, 214, 214, 0.6);
  border-radius: 8px;
}
canvas:focus {
  outline: none;
}

#fullscreen {
  position: relative;
}

#screen-game-over,
#screen-you-win {
  position: absolute;
  top: 0;
  left: 0;
  width: 720px;
  height: 480px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.5);
}

#start-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 720px;
  height: 480px;
  border-radius: 8px;
}

section {
  width: 720px;
}

.key {
  display: inline-block;
  border: 2px solid rgb(0, 0, 0);
  border-radius: 4px;
  padding: 2px 8px;
  min-width: 30px;
  text-align: center;
}

.controls {
  display: flex;
  gap: 100px;
  align-content: center;
  justify-content: center;
  align-items: center;
}

.controls-group h3 {
  margin-bottom: 8px;
  font-size: 24px;
}

.controls-group ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

footer {
  width: 100%;
  display: flex;
  margin-top: auto;
  padding: 20px 0;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.1);
  flex-direction: column;
}

footer a {
  text-decoration: none;
  color: black;
}

footer a:hover {
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
}

footer nav {
  display: flex;
  gap: 20px;
  align-items: center;
}

dialog {
  border: none;
  border-radius: 12px;
  padding: 24px;
  max-width: 600px;
  width: 90%;
  margin: auto;
  background-color: rgba(245, 230, 200, 0.97);
  font-family: "Rye", serif;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

dialog h2 {
  font-size: 22px;
  margin-bottom: 12px;
  text-align: center;
}

dialog h3 {
  font-size: 18px;
  margin-top: 12px;
  margin-bottom: 4px;
}

dialog p {
  font-size: 16px;
  line-height: 1.6;
}

.dialog-content {
  display: flex;
  flex-direction: column;
}

.dialog-content button {
  align-self: flex-end;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

#startButton,
#restartButton {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
}

#startButton img {
  width: 80px;
  height: 80px;
  filter: brightness(0) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
  transition: transform 0.2s;
}

#startButton img:hover,
#restartButton img:hover {
  transform: scale(1.1);
}

#restartButton img {
  width: 60px;
  height: 60px;
}

#restartButton {
  display: none;
  color: white;
  font-size: 24px;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  left: 60%;
}

#restartButton img {
  filter: brightness(0) invert(1) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
  transition: transform 0.2s;
}

#homeButton {
  display: none;
  position: absolute;
  top: 50%;
  left: 38%;
  transform: translate(-50%, -50%);
  z-index: 3;
  color: white;
  font-size: 24px;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

#homeButton img {
  width: 60px;
  height: 60px;
  filter: brightness(0) invert(1) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
  transition: transform 0.2s;
}
#lottie-rotate {
  width: 200px;
  height: 200px;
}

#rotate-overlay {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  color: white;
  font-size: 24px;
}

#touch-controls-left,
#touch-controls-right {
  display: none;
}

@media (orientation: landscape) and (pointer: coarse) {
  section,
  footer {
    display: none;
  }

  #touch-controls {
    display: contents;
  }

  #touch-controls-left {
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: fixed;
    bottom: 80px;
    left: 10px;
    z-index: 10;
  }

  #touch-controls-right {
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: fixed;
    bottom: 80px;
    right: 10px;
    z-index: 10;
  }

  #touch-controls-left button,
  #touch-controls-right button {
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    padding: 20px 35px;
    color: white;
    font-size: 28px;
    font-family: "Rye";
    border: 2px solid rgba(255, 255, 255, 0.3);
    width: 140px;
    justify-content: center;
  }
}

@media (orientation: portrait) and (pointer: coarse) {
  #rotate-overlay {
    display: flex;
  }
}

@media (max-width: 1100px) {
  #touch-controls-left button,
  #touch-controls-right button {
    width: 120px;
  }

  dialog p {
    line-height: 1.3;
  }
}

@media (orientation: landscape) and (pointer: coarse) and (max-height: 500px) {
  h1 {
    display: none;
  }

  body {
    overflow: hidden;
  }

  #fullscreen {
    width: 100vw;
    height: 100vh;
  }

  canvas {
    width: 100vw;
    height: 100vh;
  }

  #screen-game-over,
  #screen-you-win,
  #start-screen {
    width: 100vw;
    height: 100vh;
  }

  #touch-controls-left,
  #touch-controls-right {
    bottom: 10px;
     flex-direction: row;
  }
}

@media (orientation: portrait) and (pointer: coarse) and (max-width: 500px) {
  h1 {
    font-size: 28px;
    margin-top: 20px;
    text-align: center;
    width: 100%;
  }

  section {
    width: 100%;
  }


#fullscreen {
  width: 100%;
}

#screen-game-over,
#screen-you-win,
#start-screen {
  width: 100%;
  height: auto;
  aspect-ratio: 720 / 480;
}

canvas {
  width: 100%;
  aspect-ratio: 720 / 480;
}

.controls {
  flex-direction: column;
  gap: 20px;
}

footer {
  font-size: 14px;
}
}