/* ══════════════════════════════════════════════════════
   MOBILE CONTROLS  —  shared PixelUI d-pad + action FAB
   ══════════════════════════════════════════════════════
   Themable via CSS custom properties:
     --mc-btn-bg        Button background        (default: rgba(20,20,20,0.85))
     --mc-btn-border    Button border colour      (default: rgba(255,255,100,0.25))
     --mc-btn-active    Active press background   (default: rgba(60,60,0,0.9))
     --mc-icon-color    Icon primary colour       (default: #ff6)
     --mc-icon-dim      Icon secondary colour     (default: #aa4)
   ══════════════════════════════════════════════════════ */

/* ── D-Pad container ── */
.mc-dpad {
  display: none;
  position: fixed;
  bottom: 16px; right: 16px;
  z-index: 50;
}
.mc-dpad-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.mc-dpad-row { display: flex; gap: 2px; }

/* ── D-Pad buttons ── */
.mc-dpad-btn {
  width: 50px; height: 50px;
  background: var(--mc-btn-bg, rgba(20,20,20,0.85));
  border: 2px solid var(--mc-btn-border, rgba(255,255,100,0.25));
  border-radius: 0;
  color: var(--mc-icon-color, #ff6);
  font-size: 18px;
  font-family: inherit;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  image-rendering: pixelated;
  padding: 0;
  line-height: 1;
  outline: none;
}
.mc-dpad-btn:active,
.mc-dpad-btn.mc-pressed {
  background: var(--mc-btn-active, rgba(60,60,0,0.9));
  border-color: rgba(255,255,100,0.6);
}
.mc-dpad-diag {
  width: 38px !important; height: 38px !important;
  opacity: 0.5;
}
.mc-dpad-diag:active,
.mc-dpad-diag.mc-pressed {
  opacity: 0.9;
}
.mc-dpad-center {
  width: 50px; height: 50px;
  background: var(--mc-btn-bg, rgba(20,20,20,0.85));
  border: 2px solid var(--mc-btn-border, rgba(255,255,100,0.25));
  border-radius: 0;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  image-rendering: pixelated;
  padding: 0;
  outline: none;
}
.mc-dpad-center:active,
.mc-dpad-center.mc-pressed {
  background: var(--mc-btn-active, rgba(60,60,0,0.9));
  border-color: rgba(255,255,100,0.6);
}

/* ── FAB (Floating Action Buttons) ── */
.mc-fab {
  display: none;
  position: fixed;
  bottom: 16px; left: 16px;
  z-index: 50;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.mc-fab-toggle {
  width: 56px !important; height: 56px !important;
  background: rgba(20,16,4,0.96) !important;
  border: 2px solid rgba(255,210,0,0.55) !important;
  border-radius: 0 !important;
  box-shadow: 0 2px 14px rgba(0,0,0,0.7);
  flex-shrink: 0;
  z-index: 2;
  transition: transform 0.18s;
  image-rendering: pixelated;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  padding: 0;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.mc-fab-toggle.mc-open { transform: rotate(45deg); }

.mc-fab-grid {
  display: grid;
  grid-template-columns: repeat(3, 50px);
  gap: 8px;
  opacity: 0;
  transform: scale(0.4) translateY(20px);
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  transform-origin: left bottom;
}
.mc-fab-grid.mc-open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}
.mc-fab-btn {
  width: 50px; height: 50px;
  background: rgba(16,14,6,0.93);
  border: 2px solid rgba(255,255,100,0.2);
  border-radius: 0;
  color: var(--mc-icon-color, #ff6);
  font-size: 20px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  flex-shrink: 0;
  image-rendering: pixelated;
  padding: 0;
  outline: none;
}
.mc-fab-btn:active { filter: brightness(1.4); }

.mc-fab-bottom-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.mc-fab-quick {
  display: flex;
  gap: 8px;
}

/* ── Mobile media query: show controls ── */
@media (max-width: 768px), (pointer: coarse) {
  .mc-dpad { display: flex; }
  .mc-fab  { display: flex; }
}
