/* 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; /* the canvas clears to THIS live (game.js reads it), so background edits show in the game */
  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 — but ONLY while a canvas is actually
   mounted (#game is hidden until a game asks for a drawing context). Without
   this guard the rule is a trap for a DOM game: a board built from divs inside
   a screen inherits pointer-events:none and silently stops responding, which
   surfaces only as taps landing on whatever is underneath. With no canvas
   there is nothing to let taps through TO, so a DOM game's own elements stay
   tappable by default. #game is the first child of #stage and the screens are
   its siblings, so ~ selects exactly the overlays sitting over the canvas. */
#game:not([hidden]) ~ .screen,
#game:not([hidden]) ~ .screen * { pointer-events: none; }
#game:not([hidden]) ~ .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;
}
button:active { transform: scale(0.96); }

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