* {
  margin: 0;
  padding: 0;
}

html {
  background: #000; /* avoid gray sidebars on mobile */
}

html, body, #game-wrapper, #game-container {
  height: 100%;
  width: 100%;
}

body {
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  touch-action: none; /* prevent scroll/zoom gestures from stealing input */
}

.touch-overlay {
  position: fixed;
  inset: 0;
  z-index: 7000;
  pointer-events: none;
}

.touch-debug {
  position: absolute;
  top: 58px;
  left: 12px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font: 12px/1.2 monospace;
  pointer-events: none;
}
.touch-overlay.hidden { display:none; }

.touch-joy {
  position: absolute;
  left: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  width: 140px;
  height: 140px;
  border-radius: 999px;
  background: rgba(0,0,0,0.20);
  border: 2px solid rgba(255,255,255,0.20);
  pointer-events: auto;
  touch-action: none;
}

.touch-joy-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 74px;
  height: 74px;
  margin-left: -37px;
  margin-top: -37px;
  border-radius: 999px;
  background: rgba(0,229,255,0.18);
  border: 2px solid rgba(0,229,255,0.30);
  transform: translate(0px,0px);
}

.touch-bomb {
  position: absolute;
  right: 18px;
  bottom: calc(22px + env(safe-area-inset-bottom));
  width: 110px;
  height: 110px;
  border-radius: 999px;
  border: 2px solid rgba(0,229,255,0.28);
  background: rgba(122, 28, 255, 0.35);
  color: #fff;
  font-size: 40px;
  pointer-events: auto;
  touch-action: none;
}

#game-wrapper {
  width: 100vw;
  height: 100vh;
}

#game-container {
  /* Let Phaser manage canvas size; avoid centering that can create the "small canvas in middle" effect */
  display: block;
  width: 100vw;
  height: 100vh;
}

/* Let Phaser ScaleManager control canvas size.
   Forcing 100vw/100vh here can break input coordinates on mobile (click/touch offset). */
#game-container canvas {
  display: block;
  margin: 0 auto;
  width: auto;
  height: auto;
  max-width: 100vw;
  max-height: 100vh;
  touch-action: none;
}

/* Auth overlay (Google login + display name) */
#auth-overlay {
  position: fixed;
  top: 10px;
  right: 10px;
  left: auto;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  padding: 8px 10px;
  border-radius: 10px;
  font-family: Arial, sans-serif;
  font-size: 14px;
  max-width: 340px;
  backdrop-filter: blur(4px);
}

/* Do not block gameplay/touch except for actual controls inside */
#auth-overlay {
  pointer-events: none;
}
#auth-overlay button,
#auth-overlay input,
#auth-overlay #google-render {
  pointer-events: auto;
}

#auth-overlay.minimized {
  padding: 6px 8px;
  max-width: 220px;
}
#auth-overlay.minimized #auth-body {
  display: none;
}

#auth-overlay .auth-row {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

#auth-name {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.25);
  min-width: 170px;
}

/* HTML Menu Overlay (mobile reliable) */
.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 8000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.55);
  pointer-events: auto;
}
.menu-overlay.hidden { display: none; }

.menu-panel {
  width: min(92vw, 420px);
  background: rgba(20, 20, 25, 0.78);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 16px;
  padding: 16px;
  color: #fff;
  backdrop-filter: blur(6px);
}

.menu-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
}

.menu-btn {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(122, 28, 255, 0.55);
  color: #fff;
  font-size: 18px;
}

.menu-btn.secondary {
  background: rgba(255,255,255,0.10);
}

.menu-row {
  margin-top: 12px;
}

.map-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.map-btn {
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0, 229, 255, 0.18);
  color: #fff;
  font-size: 16px;
}

.menu-subtitle {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 8px;
}

.inline-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.chip {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.10);
  color: #fff;
  font-size: 16px;
  min-width: 56px;
}

.chip.label {
  text-align: center;
  min-width: 64px;
  background: rgba(0,0,0,0.25);
}

.chip.diff.active {
  background: rgba(0, 229, 255, 0.28);
  border-color: rgba(0, 229, 255, 0.55);
}

.hidden { display: none; }
