/* web/mobile-controls.css — Contrôles tactiles ergonomiques & HUD mobile */

#mobile-controls {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 22;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* Sur les grands écrans de bureau avec souris fine, masquer les contrôles tactiles */
@media (min-width: 1025px) and (pointer: fine) and (hover: hover) {
  #mobile-controls {
    display: none !important;
  }
}

/* Zone Joystick virtuel (bas-gauche) */
.mobile-stick-zone {
  position: absolute;
  left: 20px;
  bottom: 24px;
  width: 130px;
  height: 130px;
  pointer-events: auto;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-stick-base {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(20, 28, 40, 0.45) 0%, rgba(8, 12, 18, 0.75) 100%);
  border: 2px solid rgba(255, 215, 0, 0.4);
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.6), inset 0 0 12px rgba(255, 215, 0, 0.15);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.mobile-stick-base::before {
  content: '';
  position: absolute;
  inset: 50%;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: rgba(255, 215, 0, 0.3);
}

.mobile-stick-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 50px;
  height: 50px;
  margin: -25px 0 0 -25px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff4c2 0%, #ffd700 65%, #cfa000 100%);
  border: 2px solid #ffffff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.7), 0 0 14px rgba(255, 215, 0, 0.65);
  transition: transform 0.06s ease-out;
  pointer-events: none;
}

.mobile-stick-knob.active {
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.8), 0 0 22px #ffd700;
  border-color: #fff8d6;
}

/* Zone d'orientation tactile en vue subjective (moitié droite de l'écran) */
#mobile-look-hint {
  position: absolute;
  top: 25%;
  right: 24px;
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(14, 20, 28, 0.85);
  border: 1px solid rgba(255, 215, 0, 0.6);
  color: #ffd700;
  font: 900 12px "Courier New", monospace;
  letter-spacing: 1px;
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.6);
}

#mobile-look-hint.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Viseur discret en mode subjectif */
#mobile-fp-crosshair {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  pointer-events: none;
  z-index: 10;
}

#mobile-fp-crosshair.active {
  display: block;
}

#mobile-fp-crosshair::before,
#mobile-fp-crosshair::after {
  content: '';
  position: absolute;
  background: rgba(255, 215, 0, 0.75);
  box-shadow: 0 0 4px rgba(255, 215, 0, 0.8);
}

#mobile-fp-crosshair::before {
  top: 6px;
  left: 0;
  width: 14px;
  height: 2px;
}

#mobile-fp-crosshair::after {
  top: 0;
  left: 6px;
  width: 2px;
  height: 14px;
}

/* Barre d'actions mobiles (bas-droite) */
.mobile-action-bar {
  position: absolute;
  right: 18px;
  bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: auto;
  align-items: center;
}

.mobile-btn {
  width: 52px;
  height: 52px;
  min-width: 48px;
  min-height: 48px;
  border-radius: 50%;
  border: 2px solid #ffd700;
  background: rgba(14, 20, 28, 0.88);
  color: #ffd700;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.65), 0 0 10px rgba(255, 215, 0, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}

.mobile-btn:active, .mobile-btn.pressed {
  transform: scale(0.90);
  background: #ffd700;
  color: #0c1017;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.8), 0 0 18px #ffd700;
}

.mobile-btn-icon {
  font-size: 20px;
  line-height: 1;
}

.mobile-btn-label {
  font: 900 8.5px "Courier New", monospace;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: 2px;
}

/* Bouton spécial Action contextuelle (Parler / Sauvegarder) */
#mobile-btn-action {
  display: none;
  border-color: #39ff14;
  color: #39ff14;
  box-shadow: 0 0 14px rgba(57, 255, 20, 0.45);
  animation: mobile-pulse 1.4s infinite;
}

#mobile-btn-action:active {
  background: #39ff14;
  color: #06110a;
  box-shadow: 0 0 20px #39ff14;
}

@keyframes mobile-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* Adaptations sur petits écrans */
@media (max-width: 768px) {
  /* Le radar se déplace en haut à droite avec une taille adaptée */
  #radar-wrap {
    top: 12px;
    right: 12px;
    bottom: auto !important;
    width: 105px !important;
  }
  #radar {
    width: 105px !important;
    height: 105px !important;
  }
  #radar-name {
    font-size: 9.5px !important;
    padding: 2px 6px !important;
    letter-spacing: 1px !important;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Badge joueur en haut à gauche */
  #player-badge {
    top: 12px !important;
    left: 12px !important;
    padding: 5px 12px !important;
    font-size: 11px !important;
    gap: 6px !important;
  }

  /* Menu bouton décalé pour ne pas chevaucher le badge */
  #menu-btn {
    top: 12px !important;
    left: 140px !important;
    padding: 5px 12px !important;
    font-size: 11px !important;
  }

  /* Panneau d'informations contextuelles (inspecteur) */
  #panel {
    left: 12px !important;
    top: 56px !important;
    bottom: auto !important;
    width: auto !important;
    max-width: calc(100vw - 24px) !important;
    min-width: 200px !important;
    font-size: 12px !important;
    padding: 8px 12px !important;
  }

  #toast {
    top: 64px !important;
    bottom: auto !important;
    font-size: 13px !important;
    padding: 6px 14px !important;
  }

  /* Panneau d'éclairage */
  #light {
    top: 130px !important;
    right: 12px !important;
    width: 200px !important;
  }
}
