/* Full-screen mobile shell; desktop gets the same viewport-sized layout. */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html {
  overscroll-behavior: none; /* only works from the root: kills pull-to-refresh */
  touch-action: manipulation; /* no double-tap or pinch zoom anywhere */
}

body {
  margin: 0;
  height: 100vh;
  height: 100dvh; /* 100vh alone hides the bottom behind the mobile address bar */
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: #050409; /* shows through wherever the canvas is unpainted */
  color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

input, textarea, [contenteditable] {
  user-select: text;
  -webkit-user-select: text;
}

#stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none; /* taps and drags feed the game, never scroll the page */
}
#game[hidden] { display: none; } /* display: block above would defeat [hidden] */

/* Overlays routed by GAME.setScreen(). */
.screen {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  padding: 2rem;
  gap: 0.75rem;
}
/* Let taps through to the canvas ONLY while the game hit-tests them:
   GAME.syncInput publishes data-input="canvas" when a pointer hook is defined.
   The engine mounts the canvas on frame one for every game, so keying on the
   canvas alone would make even a DOM game's own elements click-through (DOM
   instead of canvas only when a request explicitly demands it).
   #game is the first child of #stage and the screens are its siblings, so ~
   selects exactly the overlays over it. */
#game:not([hidden])[data-input="canvas"] ~ .screen,
#game:not([hidden])[data-input="canvas"] ~ .screen * { pointer-events: none; }
#game:not([hidden])[data-input="canvas"] ~ .screen :is(button, a, input, [data-action]) { pointer-events: auto; }
.screen[hidden] { display: none; } /* display: grid above would defeat [hidden] */

button {
  font: inherit;
  font-size: 1.15rem;
  min-height: 48px;
  padding: 0.7rem 2.4rem;
  border: 0;
  border-radius: 999px;
  background: #7c6cff;
  color: #fff;
  cursor: pointer;
  justify-self: center;
}
/* `scale`, never `transform`: a transform here would override a game's own
   centering transform mid-press — measured: bench/ttt/HAIKU-PLANNING-FRICTION.md. */
button:active { scale: 0.96; }

h1 { margin: 0 0 1rem; font-size: 2.4rem; }
#resume-note { margin: 0; color: #8f8ba8; font-size: 0.95rem; }
