html, body {
  margin: 0;
  padding: 0;
  background: #000;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

#tank {
  display: block;
  width: 100vw;
  height: 100vh;
  background: #000;
  touch-action: none;
}

/* Dynamic viewport units: on mobile browsers 100vh includes the area
   behind the URL bar, so a 100vh canvas is taller than the visible window
   and the bottom ~90 px strip (seashell/feed/speed) renders off-screen.
   100dvh tracks the actually visible height instead. The JS client size
   (app.js) uses visualViewport for the same height, keeping CSS px and the
   canvas backing store in sync. */
@supports (height: 100dvh) {
  html, body {
    height: 100dvh;
  }
  #tank {
    width: 100dvw;
    height: 100dvh;
  }
}

/* Custom tank cursor (spec/08-input.md §8): input.js toggles the
   `custom-cursor` class on #tank while hovering a speed-button box and
   removes it otherwise (arrow default); toggle only on identity change.
   Hotspot 13,9 decoded from the MOPYPLAY cursor resource
   (site/assets/cursor.png, 32x32). Tank-canvas scope only. */
#tank.custom-cursor {
  cursor: url("assets/cursor.png") 13 9, auto;
}

/* Settings panel (spec/13): 1 du = 2 CSS px; controls sit at double the
   section 3 rects inside a 508x252 body under the caption. */
#mopy-config {
  font: 16px system-ui, sans-serif;
  padding: 0;
  border: 2px outset #fff;
  background: #c0c0c0;
  color: #000;
}

#mopy-config .cfg-title {
  padding: 2px 6px;
  background: #000080;
  color: #fff;
  font-weight: bold;
}

#mopy-config .cfg-body {
  position: relative;
  width: 508px;
  height: 252px;
}

#mopy-config .cfg-check,
#mopy-config .cfg-btn,
#mopy-config .cfg-group {
  position: absolute;
  margin: 0;
  box-sizing: border-box;
}

#mopy-config .cfg-check {
  /* Single-line like the original Win16 checkbox: text is drawn past the
     control rect when wider (no wrap, no clip). The du-pinned rects in
     settings.js stay EXACT per spec/13 §3; at 16px system-ui the
     "Show Thermometer" label is wider than its 79du box on some platforms
     and must not wrap onto (and clip over) the next row. */
  overflow: visible;
  white-space: nowrap;
}

#mopy-config .cfg-check input {
  margin-right: 4px;
}

#mopy-config .verbatim {
  white-space: pre;
}

#boot-error {
  position: fixed;
  left: calc(1em + env(safe-area-inset-left));
  top: calc(1em + env(safe-area-inset-top));
  color: #fff;
  font: 14px monospace;
  white-space: pre-wrap;
}

/* Soft-keyboard target for the touch name box (input.js): a canvas cannot
   summon the mobile keyboard, so a tap on the name label focuses this
   hidden field instead. Off-screen and pointer-transparent so it never
   intercepts canvas taps; focus() still opens the keyboard. 16px keeps
   iOS from zooming on focus. */
#mopy-name {
  position: fixed;
  left: 0;
  top: 0;
  width: 4px;
  height: 4px;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  font-size: 16px;
  pointer-events: none;
}

/* PWA fullscreen polish (installable, display:fullscreen): the tank canvas
   itself stays edge-to-edge; only DOM UI chrome is inset so notches and
   gesture bars never cover it. There are no fixed headers/footers in this
   app (tank controls are canvas-drawn); the settings dialog and boot error
   are the only DOM chrome besides the debug-only panel (debug.js carries
   its own touch/selection rules inline). */
#mopy-config {
  max-width: calc(100vw - env(safe-area-inset-left) - env(safe-area-inset-right));
  max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
}

#mopy-config button,
#mopy-config input {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

#mopy-config,
#mopy-config .cfg-title {
  user-select: none;
  -webkit-user-select: none;
}

#mopy-config input {
  user-select: auto;
  -webkit-user-select: auto;
}
