/* =========================================================
   Mobile Controls - Shared CSS
   =========================================================
   Provides touch-friendly D-pad and action buttons for
   web games. Loaded by each game via:
     <link rel="stylesheet" href="/games/shared/mobile-controls.css">
   DOM elements are created by mobile-controls.js.
   ========================================================= */

/* --- Overlay container --- */
#mc-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  pointer-events: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* --- D-Pad (bottom-left) --- */
#mc-dpad {
  position: absolute;
  bottom: calc(30px + env(safe-area-inset-bottom, 0px));
  left: 30px;
  width: 170px;
  height: 170px;
}

/* --- Action buttons (bottom-right) --- */
#mc-actions {
  position: absolute;
  bottom: calc(30px + env(safe-area-inset-bottom, 0px));
  right: 30px;
  width: 120px;
  height: 150px;
}

/* --- Base button style --- */
.mc-btn {
  pointer-events: all;
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.7);
  font-size: 22px;
  opacity: 0.5;
  transition: opacity 0.08s, background 0.08s;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
  outline: none;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

/* --- Active / pressed state --- */
.mc-btn.mc-active {
  opacity: 0.85;
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.6);
}

/* --- D-Pad directional buttons --- */
#mc-up {
  width: 56px;
  height: 56px;
  top: 0;
  left: 57px;
}

#mc-down {
  width: 56px;
  height: 56px;
  bottom: 0;
  left: 57px;
}

#mc-left {
  width: 56px;
  height: 56px;
  top: 57px;
  left: 0;
}

#mc-right {
  width: 56px;
  height: 56px;
  top: 57px;
  right: 0;
}

/* --- Action buttons --- */
#mc-btn-a {
  width: 76px;
  height: 76px;
  bottom: 0;
  left: 22px;
  border-radius: 50%;
  font-size: 24px;
  font-weight: bold;
}

#mc-btn-b {
  width: 52px;
  height: 52px;
  top: 0;
  right: 0;
  border-radius: 50%;
  font-size: 18px;
  font-weight: bold;
}

/* --- Responsive: short screens (landscape phones) --- */
@media (max-height: 500px) {
  #mc-dpad {
    width: 140px;
    height: 140px;
    bottom: calc(15px + env(safe-area-inset-bottom, 0px));
    left: 15px;
  }

  #mc-up {
    width: 46px;
    height: 46px;
    left: 47px;
  }

  #mc-down {
    width: 46px;
    height: 46px;
    left: 47px;
  }

  #mc-left {
    width: 46px;
    height: 46px;
    top: 47px;
  }

  #mc-right {
    width: 46px;
    height: 46px;
    top: 47px;
  }

  #mc-actions {
    bottom: calc(15px + env(safe-area-inset-bottom, 0px));
    right: 15px;
  }

  #mc-btn-a {
    width: 64px;
    height: 64px;
  }

  #mc-btn-b {
    width: 44px;
    height: 44px;
  }
}

/* --- Hide on desktop with precise pointer (mouse) --- */
@media (min-width: 1024px) and (pointer: fine) {
  #mc-overlay {
    display: none !important;
  }
}
