/* ========================================
   Babayagas Arcade — Mobile Enhancement
   Auto-injected for touch device support
   ======================================== */

/* --- Responsive Canvas --- */
canvas {
  touch-action: none;
}

/* --- Prevent body scroll while playing --- */
body.mobile-playing {
  overflow: hidden;
  touch-action: manipulation;
  overscroll-behavior: none;
}

/* --- Virtual D-Pad --- */
.m-dpad {
  display: none;
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 9000;
  width: 140px;
  height: 140px;
  pointer-events: none;
}

.m-dpad-btn {
  position: absolute;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: rgba(6, 182, 212, 0.15);
  border: 1.5px solid rgba(6, 182, 212, 0.35);
  color: rgba(6, 182, 212, 0.8);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  transition: background 0.1s, border-color 0.1s;
}

.m-dpad-btn:active, .m-dpad-btn.pressed {
  background: rgba(6, 182, 212, 0.35);
  border-color: rgba(6, 182, 212, 0.6);
}

.m-dpad-btn[data-dir="up"]    { top: 0; left: 50%; transform: translateX(-50%); }
.m-dpad-btn[data-dir="down"]  { bottom: 0; left: 50%; transform: translateX(-50%); }
.m-dpad-btn[data-dir="left"]  { top: 50%; left: 0; transform: translateY(-50%); }
.m-dpad-btn[data-dir="right"] { top: 50%; right: 0; transform: translateY(-50%); }

/* --- Action Buttons --- */
.m-actions {
  display: none;
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 9000;
  pointer-events: none;
  gap: 10px;
}

.m-action-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(6, 182, 212, 0.15);
  border: 1.5px solid rgba(6, 182, 212, 0.35);
  color: rgba(6, 182, 212, 0.9);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  transition: background 0.1s, border-color 0.1s;
}

.m-action-btn:active, .m-action-btn.pressed {
  background: rgba(6, 182, 212, 0.35);
  border-color: rgba(6, 182, 212, 0.6);
}

.m-action-btn.primary {
  width: 64px;
  height: 64px;
  background: rgba(6, 182, 212, 0.2);
  border-color: rgba(6, 182, 212, 0.45);
  font-size: 0.8rem;
}

/* --- Tap Zone (for simple tap games) --- */
.m-tap-zone {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: rgba(6, 182, 212, 0.06);
  border-top: 1px solid rgba(6, 182, 212, 0.15);
  z-index: 8999;
  align-items: center;
  justify-content: center;
  color: rgba(6, 182, 212, 0.4);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* --- Show on mobile only --- */
@media (max-width: 820px), (hover: none) and (pointer: coarse) {
  .m-dpad { display: block; }
  .m-actions { display: flex; flex-direction: column; align-items: center; }
  .m-tap-zone { display: flex; }
}

/* Hide on desktop */
@media (min-width: 821px) and (hover: hover) {
  .m-dpad, .m-actions, .m-tap-zone { display: none !important; }
}

/* --- Fullscreen hint --- */
.m-fullscreen-hint {
  display: none;
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 9001;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.25);
  color: rgba(6, 182, 212, 0.7);
  font-size: 1rem;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 820px), (hover: none) and (pointer: coarse) {
  .m-fullscreen-hint { display: flex; }
}

/* --- Landscape orientation prompt --- */
.m-rotate-hint {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 99999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  color: rgba(6, 182, 212, 0.7);
  font-family: 'Space Grotesk', sans-serif;
  text-align: center;
  padding: 2rem;
}

.m-rotate-hint .rotate-icon {
  font-size: 2.5rem;
  animation: m-rotate-wiggle 2s ease-in-out infinite;
}

.m-rotate-hint p {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.5);
}

@keyframes m-rotate-wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(15deg); }
  75% { transform: rotate(-15deg); }
}

/* Only show on portrait mobile for landscape-preferred games */
@media (max-width: 820px) and (orientation: portrait) {
  body.m-prefer-landscape .m-rotate-hint { display: flex; }
}

@media (orientation: landscape) {
  .m-rotate-hint { display: none !important; }
}
