/* Touch controls — appended dynamically by js/touch_controls.js on touch devices */

#touch-root {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 50;
  user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}
#touch-root.inactive { display: none; }

/* Virtual joystick: invisible until first touch on the left half */
#touch-stick {
  position: absolute;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(240, 200, 100, 0.10) 0%, rgba(240, 200, 100, 0.04) 60%, transparent 100%);
  border: 1px solid rgba(240, 200, 100, 0.18);
  opacity: 0; transition: opacity 0.12s;
  pointer-events: none;
}
#touch-stick.active { opacity: 1; }
#touch-knob {
  position: absolute; left: 50%; top: 50%;
  width: 38px; height: 38px; margin: -19px 0 0 -19px;
  border-radius: 50%;
  background: rgba(240, 200, 100, 0.55);
  border: 1px solid rgba(240, 200, 100, 0.8);
  box-shadow: 0 0 14px rgba(240, 180, 80, 0.45);
  transition: transform 0.04s linear;
}

/* Action row across the bottom */
#touch-actions {
  position: absolute;
  right: 14px; bottom: 18px;
  display: flex; gap: 8px;
  pointer-events: auto;
}
.touch-btn {
  width: 54px; height: 54px;
  border-radius: 50%;
  background: linear-gradient(180deg, #2a1d0f, #0f0804);
  color: #d0a878;
  font: bold 12px ui-monospace, monospace;
  letter-spacing: 1px;
  border: 1px solid rgba(240, 180, 80, 0.4);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 200, 120, 0.1);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}
.touch-btn:active {
  background: linear-gradient(180deg, #5a3a1a, #2a1d0f);
  color: #fff;
}
.touch-btn.fire {
  width: 78px; height: 78px;
  font-size: 13px;
  border-color: rgba(255, 100, 70, 0.6);
  color: #ffb090;
  box-shadow: 0 0 18px rgba(255, 80, 50, 0.35), inset 0 1px 0 rgba(255, 200, 180, 0.15);
}

@media (min-width: 900px) {
  /* On large touch screens still show, but smaller so it stays out of the way */
  .touch-btn { width: 48px; height: 48px; font-size: 11px; }
  .touch-btn.fire { width: 64px; height: 64px; }
}
