/* Moon Lander — page chrome around the canvas.
   The canvas paints the playfield in the game's own skin (see game.js); everything here
   is the frame, the HUD mirror for screen readers, the overlay and the buttons. Page
   colours come from the branding tokens so the frame follows site light/dark while the
   PLAYFIELD follows the game skin — a player can want a light page and a green screen. */

#ml-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

#ml-stage {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
}

#ml-canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  background: #05070b;
  /* A thrust drag must never become a page scroll — the single most common
     mobile-canvas bug. */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
}

html[data-ml-skin="retro"] #ml-canvas {
  border-radius: 4px;
  /* Generic handheld bezel — no maker's shape, badge or button layout. */
  box-shadow: 0 0 0 8px #1d2a12, 0 0 0 11px #2c3d1c, 0 8px 22px rgba(0, 0, 0, 0.35);
  image-rendering: pixelated;
}

/* Screen-reader mirror of the canvas HUD. */
#ml-hud {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

#ml-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px;
  text-align: center;
  background: rgba(5, 7, 11, 0.72);
  border-radius: 10px;
  color: #e6edf3;
}
/* An id selector beats the UA's [hidden]{display:none} — brick-breaker shipped that bug. */
#ml-overlay[hidden] { display: none; }
#ml-overlay h2 { margin: 0; font-size: 1.35rem; letter-spacing: 0.04em; }
#ml-overlay p { margin: 0; max-width: 34ch; color: #c5cbd6; font-size: 0.95rem; }
#ml-overlay button {
  margin-top: 6px;
  padding: 10px 22px;
  border: 0;
  border-radius: 8px;
  background: var(--primary, #4ea8ff);
  color: #05070b;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}
#ml-overlay .ml-secondary {
  background: transparent;
  color: #7ad3ff;
  border: 1px solid #4ea8ff;
}

#ml-modes, #ml-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
#ml-modes button, #ml-controls button {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border, #2a313d);
  background: var(--surface, #12161f);
  color: var(--text, #e6edf3);
  font-size: 0.9rem;
  cursor: pointer;
}
#ml-modes button[aria-pressed="true"] {
  background: var(--primary, #4ea8ff);
  color: #05070b;
  border-color: var(--primary, #4ea8ff);
}
#ml-mode-note {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted, #8d96a5);
  text-align: center;
}
#ml-streak { font-size: 0.85rem; color: var(--text-muted, #8d96a5); align-self: center; }

/* Touch pads: left half tilts left, right half tilts right, hold anywhere thrusts.
   Drawn as hint text only; the canvas takes the pointer events. */
#ml-touch-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted, #8d96a5);
  text-align: center;
}

@media (max-width: 600px) {
  #ml-wrap { gap: 8px; }
  #ml-overlay h2 { font-size: 1.15rem; }
  #ml-modes button, #ml-controls button { padding: 8px 10px; font-size: 0.85rem; }
}

/* Flight pad — the app's three controls. Big, thumb-sized, no accidental text selection,
   no long-press menu, and the canvas above still burns on hold. */
/* Inside #ml-stage, pinned to the bottom of the playfield, so on a phone the controls
   are on screen WITH the rocket. Below the canvas they scrolled off — the first public
   build shipped that way and the game read as "left/right does not work". */
#ml-pad {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 10px;
  z-index: 2;
}
#ml-pad button {
  height: 60px;
  opacity: 0.92;
  border-radius: 14px;
  border: 1px solid var(--border, #2a313d);
  background: var(--surface, #12161f);
  color: var(--text, #e6edf3);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  cursor: pointer;
}
#ml-pad #ml-burn {
  background: var(--primary, #4ea8ff);
  color: #05070b;
  border-color: var(--primary, #4ea8ff);
}
#ml-pad button:active { filter: brightness(1.25); transform: scale(0.98); }
html[data-ml-skin="retro"] #ml-pad button { border-radius: 6px; }
