/* ============================================================================
   GAMEPLEZ COMMON MOBILE CONTROLLER MODULE (v2.0.0 - Floating Transparent Overlay)
   - Zero fixed bottom dock height: Game canvas gets 100% fullscreen
   - Left half touch: Transparent joystick + directional arrows appear at touch point
   - Right side buttons: Ultra-light ghost transparency (Option A), brightens on touch
   - Visible ONLY on Mobile / Tablet Devices or Mobile Preview Mode
   ============================================================================ */

.gp-controller-dock {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: none;
  z-index: 60;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  box-sizing: border-box;
}

body.gp-mobile-active .gp-controller-dock,
body.gp-force-mobile .gp-controller-dock,
.mobile-frame-container .gp-controller-dock {
  display: block;
}

@media (hover: none) and (pointer: coarse) {
  .gp-controller-dock {
    display: block;
  }
}

/* Left Touch Zone (captures left-half touches that aren't UI controls) */
.gp-touch-zone-left {
  position: fixed;
  left: 0;
  top: 56px;
  bottom: 0;
  width: 52%;
  pointer-events: auto;
  touch-action: none;
  z-index: 1;
}

/* Floating Transparent Joystick (Hidden until left-thumb touch) */
.gp-joystick-pad {
  position: fixed;
  left: 0;
  top: 0;
  width: 122px;
  height: 122px;
  margin-left: -61px;
  margin-top: -61px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(15, 23, 42, 0.28) 0%, rgba(30, 41, 59, 0.42) 100%);
  border: 2px solid rgba(148, 163, 184, 0.45);
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.18), inset 0 0 18px rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.86);
  transition: opacity 0.12s ease, transform 0.12s ease;
  z-index: 3;
}

.gp-joystick-pad.is-visible {
  opacity: 0.62;
  transform: scale(1);
}

.gp-joystick-pad.is-active {
  opacity: 0.78;
  border-color: rgba(56, 189, 248, 0.75);
  box-shadow: 0 0 28px rgba(56, 189, 248, 0.35), inset 0 0 18px rgba(56, 189, 248, 0.18);
}

/* Subtle transparent arrow indicators inside joystick ring */
.gp-joy-arrow {
  position: absolute;
  font-size: 11px;
  line-height: 1;
  color: rgba(226, 232, 240, 0.72);
  font-weight: 900;
  pointer-events: none;
}
.gp-joy-arrow-u { top: 8px; left: 50%; transform: translateX(-50%); }
.gp-joy-arrow-d { bottom: 8px; left: 50%; transform: translateX(-50%); }
.gp-joy-arrow-l { left: 9px; top: 50%; transform: translateY(-50%); }
.gp-joy-arrow-r { right: 9px; top: 50%; transform: translateY(-50%); }

.gp-joystick-knob {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(224, 242, 254, 0.85), rgba(56, 189, 248, 0.65));
  border: 2px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  will-change: transform;
  pointer-events: none;
}

/* Right Action Buttons (Option A: Ultra-light Ghost -> Bright on Touch) */
.gp-controller-right {
  position: fixed;
  right: 14px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: auto;
  opacity: 0.45;
  transition: opacity 0.18s ease;
  z-index: 4;
}

.gp-controller-dock.is-engaged .gp-controller-right,
.gp-controller-right:active,
.gp-controller-right:focus-within {
  opacity: 0.90;
}

.gp-btn {
  border: 1.5px solid rgba(226, 232, 240, 0.42);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.56);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: rgba(248, 250, 252, 0.92);
  font-family: inherit;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.08s ease, background 0.12s ease, border-color 0.12s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.gp-btn-wide {
  min-width: 146px;
  height: 36px;
  padding: 0 12px;
  font-size: 11px;
  letter-spacing: 0.04em;
}

.gp-btn-wide.is-toggled {
  background: rgba(14, 165, 233, 0.48);
  border-color: rgba(125, 211, 252, 0.8);
}

.gp-btn-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gp-btn-key {
  width: 56px;
  height: 54px;
  flex-direction: column;
  padding: 4px;
  border-radius: 50%;
  font-size: 9px;
}

.gp-btn-icon {
  font-size: 16px;
  line-height: 1;
}

.gp-btn.is-pressed,
.gp-btn:active {
  transform: scale(0.92);
  background: rgba(56, 189, 248, 0.52);
  border-color: rgba(255, 255, 255, 0.85);
}

@media (max-width: 480px) {
  .gp-joystick-pad { width: 112px; height: 112px; margin-left: -56px; margin-top: -56px; }
  .gp-joystick-knob { width: 44px; height: 44px; }
  .gp-btn-wide { min-width: 132px; height: 32px; font-size: 10px; }
  .gp-btn-key { width: 50px; height: 50px; font-size: 8.5px; }
}

body.gp-mobile-active #gp-save-fab,
body.gp-force-mobile #gp-save-fab {
  bottom: 124px !important;
  right: 14px !important;
}
body.gp-mobile-active #gp-save-toast,
body.gp-force-mobile #gp-save-toast {
  bottom: 168px !important;
  right: 14px !important;
}
