/* ────────────────────────────────────────────────────────────────
   2026-07-23 — Mobile touch controls for games (M Runner, Grid
   Defender, RPEQ Drop). Hidden on desktop, visible on touch devices
   and narrow viewports. Buttons overlay the game-frame at fixed
   positions with translucent green chrome to match the site.
   ──────────────────────────────────────────────────────────────── */

.touch-controls {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  display: none;
}

/* Only surface on touch-capable devices OR narrow viewports.
   `hover: none` catches phones + iPad without keyboard, and the
   width breakpoint catches Chromium's mobile emulator. */
@media (hover: none), (max-width: 720px) {
  .touch-controls { display: block; }
}

.touch-btn {
  position: absolute;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(11,13,15,.72);
  backdrop-filter: blur(8px);
  border: 1.5px solid rgba(57,255,136,.5);
  color: #39FF88;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(57,255,136,.6);
  border-radius: 50%;
  width: 68px;
  height: 68px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform .1s ease, background .1s ease, box-shadow .1s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,.4), 0 0 0 1px rgba(57,255,136,.15);
}
.touch-btn:active {
  transform: scale(0.92);
  background: rgba(57,255,136,.22);
  box-shadow: 0 2px 10px rgba(0,0,0,.5), 0 0 20px rgba(57,255,136,.5);
}
.touch-btn.primary {
  background: rgba(57,255,136,.15);
  border-color: rgba(57,255,136,.85);
  color: #F7F7F5;
}
.touch-btn.wide {
  border-radius: 34px;
  width: 96px;
  height: 60px;
  font-size: 13px;
}
.touch-btn.pill {
  border-radius: 34px;
  width: auto;
  min-width: 80px;
  height: 44px;
  padding: 0 18px;
  font-size: 12px;
}

/* Positional presets — games place buttons via one of these classes */
.touch-btn.bl { bottom: 16px; left: 16px; }        /* bottom-left */
.touch-btn.br { bottom: 16px; right: 16px; }       /* bottom-right */
.touch-btn.bc { bottom: 16px; left: 50%; transform: translateX(-50%); }
.touch-btn.br2 { bottom: 100px; right: 16px; }     /* stacked above br */
.touch-btn.tr { top: 60px; right: 16px; }          /* below HUD */
.touch-btn.tl { top: 60px; left: 16px; }

/* At true narrow widths, shrink slightly to preserve gameplay area */
@media (max-width: 400px) {
  .touch-btn { width: 58px; height: 58px; font-size: 12px; }
  .touch-btn.wide { width: 84px; height: 52px; }
}
