/*
 * 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;
}
/* Action-combat telegraphs (boss attack areas) on the ground, under the actor overlays. */
.vm-telegraphs {
  z-index: 1;
  pointer-events: none;
}
/* The action pad (Controls → Joystick): stick and action buttons over the world, under the shell; input via the shell. */
.vm-pad {
  z-index: 1;
  pointer-events: none;
}
/* Closed-alpha fix 2: the region-transition cover (black, "Loading...") over the world, its overlays and the HUD. */
.vm-cover {
  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;
}
/* docs/enhanced-renderer/pass-1.1.md: the live Enhanced / Classic toggle, beside the diagnostics button. */
.vm-gfx-toggle {
  position: fixed;
  z-index: 40;
  right: calc(max(4px, env(safe-area-inset-right)) + 52px);
  bottom: max(4px, env(safe-area-inset-bottom));
  min-width: 72px;
  min-height: 44px;
  font-size: 11px;
  opacity: 0.7;
  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;
}
/*
 * docs/desktop-shell: the classic desktop presentation (`?layout=desktop`). The fixed 765 × 503 frame is placed by the
 * view (inline left / top / size): the world at the frame's (4, 4), the frame canvas over it with every pointer event.
 * The legacy art is drawn nearest-neighbour; the page around the frame stays black.
 */
.vd-frame {
  z-index: 2;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: default;
}
.vd-pixel {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
/*
 * docs/enhanced-renderer/pass-2.md: the client settings (every player). The gear is placed by the client (inline left /
 * top / size); the panel is a small centred card over a dim backdrop, safe-area aware, every control ≥ 44 px tall.
 */
.vm-settings-open {
  position: fixed;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  border: 1px solid #5d5447;
  border-radius: 50%;
  background: rgba(20, 17, 13, 0.72);
  color: #c8b58c;
  opacity: 0.85;
}
.vm-settings-open[hidden] {
  display: none;
}
.vm-settings {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  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.55);
}
.vm-settings[hidden] {
  display: none;
}
.vm-settings-box {
  width: min(360px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 10px 14px 14px;
  border: 1px solid #5d5447;
  border-radius: 6px;
  background: #1d1913;
  color: #e8dcc0;
}
.vm-settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.vm-settings-head h2 {
  margin: 0;
  font-size: 16px;
  color: #ff981f;
}
.vm-settings-close {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: #c8b58c;
  font-size: 18px;
}
.vm-settings-section h3 {
  margin: 6px 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: #c8b58c;
}
.vm-settings-choice {
  display: flex;
  gap: 6px;
}
.vm-settings-choice button {
  flex: 1;
  min-height: 44px;
  border: 1px solid #5d5447;
  border-radius: 4px;
  background: #2a241c;
  color: #e8dcc0;
  font-size: 14px;
}
.vm-settings-choice button[aria-pressed='true'] {
  background: #5a4a30;
  border-color: #ff981f;
  color: #fff;
}
.vm-settings-note {
  margin: 8px 0 0;
  font-size: 12px;
  color: #a89d86;
}
/* docs/enhanced-renderer/pass-5.md: Advanced graphics → Shadows (an Enhanced-only option). */
.vm-settings-label {
  margin: 0 0 6px;
  font-size: 12px;
  color: #e8dcc0;
}
/* docs/enhanced-renderer/pass-6.md: Advanced graphics holds two rows (Shadows, Dynamic lights). */
.vm-settings-row + .vm-settings-row {
  margin-top: 12px;
}
