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

@font-face {
  font-family: "Silkscreen";
  src: url("./assets/fonts/silkscreen-bold.ttf") format("truetype");
  font-weight: 700;
}

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

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 16px;
  background-color: #0b1310;
  color: #eee;
  font-family: "Silkscreen", monospace;
}

.backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background-color: #accce8;
  background-image:
    url("./assets/images/forest/background/trees.png"),
    url("./assets/images/forest/background/mountains.png");
  background-size: cover;
  background-position: center bottom;
  image-rendering: pixelated;
  opacity: 0.4;
}

main {
  width: min(968px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.game main {
  width: min(968px, 100%, calc((100dvh - 158px) * 16 / 9));
}

h1 {
  font-size: 48px;
  font-weight: 700;
  color: #ffa600;
  text-shadow: 4px 4px 0 #191a0c;
}

canvas {
  width: min(100%, calc(100dvh * 16 / 9));
  height: auto;
  background-color: #000;
  image-rendering: pixelated;
}

.stage {
  width: 100%;
  display: flex;
  border: 4px solid #191a0c;
}

.stage:fullscreen {
  align-items: center;
  border: none;
  background-color: #000;
}

.screen {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
}

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 16px;
  font-size: 16px;
  color: #c2ab5d;
  text-shadow: 2px 2px 0 #191a0c;
  text-align: center;
}

footer a {
  color: #ffc500;
}

.legal {
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-size: 16px;
  line-height: 24px;
  text-align: center;
  text-shadow: 2px 2px 0 #191a0c;
}

.touch-controls,
.touch-talk,
.rotate-hint {
  display: none;
}

.touch-group {
  position: relative;
  height: 100%;
  display: flex;
  gap: 16px;
  pointer-events: auto;
}

.touch-button {
  position: relative;
  height: 100%;
  aspect-ratio: 1;
  border: none;
  background: none;
  touch-action: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.touch-button img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  pointer-events: none;
}

.touch-menu {
  position: absolute;
  top: 8%;
  right: 8px;
  height: 7.5%;
  cursor: pointer;
}

@media (pointer: coarse) {
  .screen {
    touch-action: none;
  }

  .touch-controls,
  .touch-menu {
    height: 10.5%;
  }

  .touch-controls {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 0.5%;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
  }

  .touch-talk {
    display: block;
    position: absolute;
    right: 0;
    bottom: calc(100% + 16px);
  }

  .overlay .touch-controls {
    visibility: hidden;
  }
}

@media (pointer: coarse) and (orientation: landscape) {
  .game {
    padding: 0;
    overflow: hidden;
  }

  .game main {
    width: 100%;
  }

  .game h1,
  .game footer {
    display: none;
  }

  .stage {
    border: none;
  }
}

@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  canvas {
    width: min(calc(100% - 116px), calc(100dvh * 16 / 9));
  }

  .touch-controls,
  .touch-menu {
    height: min(16%, 50px);
  }
}

@media (pointer: coarse) and (orientation: portrait) {
  .game .stage {
    display: none;
  }

  .rotate-hint {
    display: block;
    font-size: 24px;
    line-height: 32px;
    text-align: center;
    text-shadow: 2px 2px 0 #191a0c;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 32px;
  }
}
