:root {
  --ink: #535353;
  --ink-soft: #9a9a9a;
  --paper: #ffffff;
  --edge: #e6e6e6;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  overflow: hidden;
}

/* The stage takes the whole viewport - dvh so mobile browser chrome sliding
 * in and out does not crop the field - and the 16:9 screen is centred inside
 * it, letterboxed on whichever axis the viewport has to spare. */
.stage {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* The screen is the whole stage and the canvas is sized in device pixels by
 * main.js - the field grows to fit rather than being scaled to fit - so all
 * this does is centre whatever slack is left over from rounding the field to
 * whole world units. */
.screen {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
}

/* Floated over the bottom of the field rather than stacked under it, so the
 * screen gets the whole viewport. The HUD sits in the top corners, so nothing
 * on the canvas is covered. */
.hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(8px, env(safe-area-inset-bottom));
  margin: 0;
  text-align: center;
  font-size: 12px;
  line-height: 1.9;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  pointer-events: none;
}

.hint span {
  display: inline-block;
  white-space: nowrap;
  margin: 0 8px;
}

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 2px 5px;
  border: 1px solid var(--edge);
  border-bottom-width: 2px;
  border-radius: 3px;
  font: inherit;
  font-size: 11px;
  color: var(--ink);
}

/* Without JavaScript there is no game under the hint line, so it reads as the
 * page's only content rather than as an overlay. */
noscript .hint {
  position: static;
}

@media (max-width: 560px) {
  .hint {
    font-size: 11px;
  }
}
