* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ── Page shell ──────────────────────────────────────────────────────────── */

html, body {
  width: 100%;
  height: 100%;
  background: #0d0d1a;
  overflow: hidden;
  /* Prevent pull-to-refresh and accidental scroll on iOS/Android */
  overscroll-behavior: none;
  touch-action: none;
}

/* ── Game container ──────────────────────────────────────────────────────── */

#game-container {
  width: 100%;
  height: 100%;           /* Phaser Scale.FIT fills this */
  touch-action: none;     /* Hand pointer events to Phaser */
}

canvas {
  display: block;
}

/* ── Touch controls ──────────────────────────────────────────────────────── */

#touch-controls {
  /* Hidden by default on devices that have a precise pointer (mouse/trackpad) */
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 130px;
  justify-content: space-between;
  align-items: flex-end;
  padding: 10px 18px 14px;
  /* Let non-button touches fall through to the canvas */
  pointer-events: none;
  z-index: 100;
  /* Subtle gradient so controls don't fully obscure the game */
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.45));
}

/* Show only on touch/coarse-pointer screens (phones, tablets) */
@media (hover: none) and (pointer: coarse) {
  #touch-controls { display: flex; }
  /* Shrink game area so it sits above the controls */
  #game-container { height: calc(100% - 130px); }
}

/* Two clusters — left (move) and right (jump/duck) */
.tc-side {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  pointer-events: auto;    /* Re-enable pointer events on the buttons */
}

/* Stack jump/duck vertically on the right */
#tc-action {
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* Individual buttons */
.tc-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 26px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;

  /* Prevent text selection and callout menus on long-press */
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;

  /* Hand all touch events here, not the browser */
  touch-action: none;

  /* Smooth press feedback */
  transition: background 80ms, border-color 80ms, transform 80ms;
}

.tc-btn:active,
.tc-btn.pressed {
  background: rgba(255, 255, 255, 0.32);
  border-color: rgba(255, 255, 255, 0.75);
  transform: scale(0.93);
}
