/*
 * The production client's page: one full-screen game surface (Milestone 21). The world canvas and the cache-authored
 * shell canvas fill the viewport; nothing scrolls. HTML is only the host bridge: the login bridge before the game, the
 * hidden keyboard input, the landscape gate and the unsupported-guide screen.
 */
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #000;
  color: #eee;
  font: 14px/1.35 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.vm-root {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
}
.vm-root canvas {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
}
.vm-world {
  z-index: 0;
}
.vm-actors {
  z-index: 1;
  pointer-events: none;
}
/* Milestone 23: the head-up layer (split PMs, the system-update countdown, XP drops) over the world, under the shell. */
.vm-hud {
  z-index: 1;
  pointer-events: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
/* Cache sprites and legacy widget rasters stay crisp: nearest-neighbour when the canvas is composited. */
.vm-shell {
  z-index: 2;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
}
/*
 * Milestone 22 touch presentation: the action sheet and the transient feedback are small canvases over the shell (their
 * position and size are set inline); they never take input — the shell canvas's gesture controller owns every touch.
 */
.vm-sheet,
.vm-press,
.vm-tip {
  pointer-events: none;
  image-rendering: pixelated;
}
.vm-sheet[hidden],
.vm-press[hidden],
.vm-tip[hidden] {
  display: none;
}
.vm-rotate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: #000;
  color: #ffff00;
  font-size: 18px;
}
.vm-rotate[hidden] {
  display: none;
}
.vm-boot,
.vm-login,
.vm-refused {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: #000;
}
.vm-boot[hidden],
.vm-login[hidden],
.vm-refused[hidden] {
  display: none;
}
.vm-login form {
  display: grid;
  gap: 10px;
  width: min(360px, 90vw);
}
.vm-login input,
.vm-login button {
  min-height: 44px;
  padding: 8px 12px;
  font-size: 16px;
  border-radius: 4px;
  border: 1px solid #5d5447;
  background: #14110d;
  color: #fff;
}
.vm-login button {
  background: #3e3529;
  cursor: pointer;
}
.vm-login .vm-status {
  min-height: 1.4em;
  color: #c8b58c;
}
.vm-refused pre {
  max-width: 90vw;
  white-space: pre-wrap;
  font-size: 12px;
  color: #ff9f9f;
}
.vm-login .vm-alpha {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  font-size: 13px;
  color: #8f846f;
}
.vm-login .vm-alpha button.vm-link {
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: #c8b58c;
  text-decoration: underline;
}
.vm-login .vm-alpha input {
  min-height: 0;
  width: 20px;
  height: 20px;
  vertical-align: middle;
}
.vm-diag-open {
  position: fixed;
  z-index: 40;
  right: max(4px, env(safe-area-inset-right));
  bottom: max(4px, env(safe-area-inset-bottom));
  min-width: 44px;
  min-height: 44px;
  font-size: 11px;
  opacity: 0.55;
  border: 1px solid #5d5447;
  border-radius: 4px;
  background: #14110d;
  color: #c8b58c;
}
.vm-diag {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  background: rgba(0, 0, 0, 0.85);
}
.vm-diag[hidden] {
  display: none;
}
.vm-diag-box {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
  color: #ddd;
}
.vm-diag-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.vm-diag-bar button {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #5d5447;
  border-radius: 4px;
  background: #3e3529;
  color: #fff;
  font-size: 14px;
}
.vm-diag-status {
  color: #c8b58c;
  font-size: 13px;
}
.vm-diag pre {
  flex: 1;
  min-height: 0;
  overflow: auto;
  margin: 8px 0 0;
  font-size: 11px;
  white-space: pre-wrap;
  user-select: text;
  -webkit-user-select: text;
}
