* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: #ddd;
  font-family: system-ui, -apple-system, sans-serif;
  /* Stop the phone from scrolling / pinch-zooming the page while playing:
     without this, a drag on the canvas is eaten by the browser and the game
     never sees the tap. */
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body { display: grid; place-items: center; }
main { width: 100%; height: 100%; display: grid; place-items: center; }

canvas {
  display: block;
  background: #000;
  image-rendering: pixelated;
  /* Fill the screen on a phone without distorting: the renderer letterboxes. */
  max-width: 100vw;
  max-height: 100vh;
  width: auto;
  height: auto;
  touch-action: none;
}

/* When the player taps FULLSCREEN the canvas owns the whole viewport. */
canvas:fullscreen,
canvas:-webkit-full-screen {
  max-width: 100vw;
  max-height: 100vh;
}
