html,
body {
  margin: 0;
  height: 100%;
  background: #000;
  overflow: hidden;
  overscroll-behavior: none;
}
body {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: 100dvh;
  /* clear of the notch and the home bar (viewport-fit=cover hands us the whole screen) */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  /* a game, not a page: no scrolling, zooming, selecting or long-press menus */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
#stage {
  position: relative;
  width: 640px;
  height: 360px;
}
#stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
#ui {
  pointer-events: none;
}
#stage canvas[hidden] {
  display: none;
}
/* the touch controls: over everything, out into the margins; fingers are read
   from the window, so the layer itself never gets in the way of a click */
#touch {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  image-rendering: pixelated;
  z-index: 2;
}
/* held upright on a phone: it only goes one way */
#rotate {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 3;
  background: #04060a;
  color: #e8eef4;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  font: bold 18px/1.3 ui-monospace, Menlo, monospace;
  letter-spacing: 0.12em;
  text-align: center;
}
#rotate .phone {
  width: 46px;
  height: 80px;
  border: 4px solid #ffd060;
  border-radius: 9px;
  animation: turn 2.4s ease-in-out infinite;
}
@keyframes turn {
  0%,
  25% {
    transform: rotate(0);
  }
  55%,
  100% {
    transform: rotate(-90deg);
  }
}
@media (orientation: portrait) and (pointer: coarse) {
  #rotate {
    display: flex;
  }
}
@media (prefers-reduced-motion: reduce) {
  #rotate .phone {
    animation: none;
    transform: rotate(-90deg);
  }
}
