:root {
  --bg: #0e0f12;
  --panel: #171923;
  --text: #e6e6e6;
  --muted: #9aa0a6;
  --accent: #59f;
  --good: #37d67a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

/* header removed */

.layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 16px;
}

.layout.single {
  grid-template-columns: 1fr;
}

.panel {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

.preview-image {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid #222634;
  background: #0b0c10;
}

.game-canvas {
  width: 100%;
  height: auto;
  max-width: 800px;
  border-radius: 8px;
  border: 1px solid #222634;
  background: #0b0c10;
}

.game-wrap {
  transform-origin: top left;
}

.panel.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.instructions {
  color: var(--muted);
  font-size: 14px;
}

/* footer removed */
.layout.full {
  min-height: calc(100vh - 0px);
}

.panel.full {
  min-height: calc(100vh - 0px);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.start-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(2px);
  z-index: 10;
}

.start-overlay.hidden { display: none !important; pointer-events: none; }

.start-card {
  background: #171923;
  border: 1px solid #222634;
  border-radius: 12px;
  padding: 20px 24px;
  color: var(--text);
  text-align: center;
  max-width: 320px;
}

.btn {
  margin-top: 12px;
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.btn:active { transform: translateY(1px); }

.status { color: var(--good); }

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

/* Touch controls */
.touch-controls {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 4px;
  display: none;
  flex-direction: row; /* left actions, right dpad */
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 8px; /* bring actions closer to left edge */
  pointer-events: none; /* container ignores, buttons re-enable */
  z-index: 9;
}

.touch-controls .dpad,
.touch-controls .actions {
  pointer-events: auto;
}

.dpad {
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 6px;
}

.dpad .row {
  display: grid;
  grid-template-columns: auto auto auto;
  align-items: center;
  justify-items: center;
}

.dpad .up-row { grid-template-columns: auto auto auto; gap: 6px; }
.dpad .mid-row { grid-template-columns: auto auto auto; gap: 6px; }
.dpad .down-row { grid-template-columns: 1fr auto 1fr; }

.dpad .spacer { width: 10px; height: 10px; }

.btn-dir,
.btn-action {
  /* Larger, proportional sizes for phones */
  width: clamp(56px, 16vw, 84px);
  height: clamp(56px, 16vw, 84px);
  border-radius: 16px;
  background: rgba(23, 25, 35, 0.85);
  border: 1px solid #222634;
  color: var(--text);
  font-weight: 700;
  font-size: clamp(14px, 4vw, 20px);
  touch-action: none;
}

.btn-action.fire {
  width: clamp(80px, 24vw, 120px); /* widen */
  height: clamp(56px, 16vw, 84px);
  background: rgba(89, 153, 255, 0.9);
  color: white;
  border-color: #4a78ff;
  margin-left: 0;
}

.btn-action.reset {
  width: clamp(56px, 16vw, 84px);
  height: clamp(56px, 16vw, 84px);
  background: rgba(55, 214, 122, 0.9);
  color: #05150b;
  border-color: #2aa864;
}



/* Right-handed default: Fire/R on RIGHT, D-Pad on LEFT */
.touch-controls .actions {
  position: fixed;
  right: 8px;
  bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
  pointer-events: auto;
}

.touch-controls .dpad {
  position: fixed;
  left: 8px;
  bottom: 8px;
  pointer-events: auto;
}

@media (hover: none) and (pointer: coarse) {
  .touch-controls { display: flex; }
}

@media (max-width: 860px) {
  .touch-controls { display: flex; }
}

/* remove old nudges */


