@font-face {
  font-family: "Nunito";
  src: url("assets/fonts/Nunito.woff2") format("woff2");
  font-weight: 200 1000;
  font-display: block;
}

@font-face {
  font-family: "PressStart";
  src: url("assets/fonts/PressStart2P.woff2") format("woff2");
  font-display: block;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #1a0a08;
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#stage {
  position: fixed;
  inset: 0 0 46px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#screen {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
  background: #000;
}

/* On-screen controls: only shown on touch devices. */
#touch { display: none; }

body.touch #stage {
  align-items: flex-start;
  padding-top: env(safe-area-inset-top);
}

body.touch #touch {
  display: block;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42vh;
  pointer-events: none;
}

#touch button {
  pointer-events: auto;
  position: absolute;
  border: 2px solid rgba(232, 184, 74, 0.55);
  background: rgba(20, 12, 24, 0.38);
  color: rgba(243, 234, 216, 0.9);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  font: 14px "PressStart", monospace;
  border-radius: 10px;
  padding: 0;
}

#touch button.down-state { background: rgba(232, 184, 74, 0.55); color: #140d0a; }

.dpad {
  position: absolute;
  left: max(16px, env(safe-area-inset-left));
  bottom: calc(50px + env(safe-area-inset-bottom));
  width: 156px;
  height: 156px;
}

.dpad button { width: 52px; height: 52px; }
.dpad .up { left: 52px; top: 0; }
.dpad .down { left: 52px; top: 104px; }
.dpad .left { left: 0; top: 52px; }
.dpad .right { left: 104px; top: 52px; }

.ab {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(62px + env(safe-area-inset-bottom));
  width: 150px;
  height: 120px;
}

.ab button { width: 64px; height: 64px; border-radius: 50%; }
.ab .a { right: 0; top: 0; background: rgba(192, 40, 45, 0.42); }
.ab .b { left: 0; top: 48px; }

#touch .menu {
  left: 50%;
  transform: translateX(-50%);
  top: 10px;
  width: 92px;
  height: 34px;
  font-size: 10px;
}


#stage { inset: 0; }
.ab .y { right: 18px; top: -50px; width: 52px; height: 52px; background: rgba(255, 138, 216, 0.35); }
#touch button { font-size: 11px; }
@media (orientation: landscape) {
  body.touch #stage { align-items: center; padding-top: 0; }
  body.touch #touch { top: 0; height: auto; }
  body.touch .dpad { bottom: calc(14px + env(safe-area-inset-bottom)); left: max(10px, env(safe-area-inset-left)); transform: scale(0.85); transform-origin: bottom left; }
  body.touch .ab { bottom: calc(18px + env(safe-area-inset-bottom)); right: max(10px, env(safe-area-inset-right)); transform: scale(0.85); transform-origin: bottom right; }
  /* top-left corner (beside the picture on wide phones), not centred over the HUD and the logo */
  body.touch #touch .menu { top: calc(8px + env(safe-area-inset-top)); left: max(6px, env(safe-area-inset-left)); transform: none; width: 60px; bottom: auto; opacity: 0.8; }
}
body.embedded.touch #touch { display: none; }
