:root {
  color-scheme: dark;
  --background: #071018;
  --ink: #effcf9;
  --muted: #9ab6b7;
  --aqua: #7df4d5;
  --line: rgb(154 237 221 / 28%);
  --control-surface: rgb(9 29 36 / 88%);
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  margin: 0;
  background: var(--background);
  color: var(--ink);
}

.game, #gameCanvas, .game-overlay { position: absolute; inset: 0; }

.game {
  overflow: hidden;
  isolation: isolate;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#gameCanvas { display: block; width: 100%; height: 100%; }

button {
  appearance: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible { outline: 2px solid var(--aqua); outline-offset: 3px; }

.hud {
  position: absolute;
  inset: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 18px max(12px, env(safe-area-inset-left));
  background: linear-gradient(var(--background), transparent);
  pointer-events: none;
}

.telemetry { display: flex; gap: clamp(12px, 4vw, 28px); }
.telemetry > div { display: grid; gap: 2px; }
.telemetry span { color: var(--muted); font-size: 11px; line-height: 1.2; }
.telemetry strong { font: 700 clamp(13px, 4vw, 17px)/1.2 ui-monospace, monospace; font-variant-numeric: tabular-nums; }

.hud-actions { display: flex; align-items: center; gap: 6px; }

.hud-actions button, .control-button {
  border: 1px solid var(--line);
  background: var(--control-surface);
  color: var(--aqua);
  border-radius: 10px;
}

.hud-actions button { min-width: 46px; min-height: 44px; padding: 0 8px; font-size: 13px; pointer-events: auto; }
.hud-actions button:disabled { opacity: .45; cursor: default; }
.hud-actions button:active:not(:disabled), .control-button:active { background: #204549; }

.mobile-controls {
  position: absolute;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  display: flex;
  justify-content: space-between;
  gap: 24px;
  width: auto;
  max-width: 560px;
  margin-inline: auto;
  pointer-events: none;
}

.control-button {
  width: clamp(64px, 26vw, 120px);
  height: 54px;
  font-size: 30px;
  line-height: 1;
  pointer-events: auto;
  touch-action: none;
}

.game-overlay {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 18px;
  padding: 68px 18px 78px;
  background: radial-gradient(ellipse at center, rgb(7 16 24 / 22%), rgb(7 16 24 / 72%));
  text-align: center;
}

.game-overlay.hidden { display: none; }

.game-overlay h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(32px, 9vw, 62px);
  line-height: 1.05;
  text-wrap: balance;
  text-shadow: 0 0 24px rgb(125 244 213 / 24%);
}

.start-button {
  min-width: 124px;
  min-height: 48px;
  border: 0;
  border-radius: 100px;
  padding: 0 24px;
  background: var(--aqua);
  color: var(--background);
  font-size: 16px;
  font-weight: 750;
}

.start-button:active { background: #b6ffeb; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
