/* Manette Xbox (player/gamepad.js, ui/pad-glyphs.js). body.pad : la manette a la main (dernier appareil utilisé) ;
   body.pad-ui : une fenêtre est ouverte (navigation au pad) ; body.pad-phone : le téléphone. */

/* Clavier ou manette : chaque aide montre les commandes de l'appareil en main */
body:not(.pad) .pad-only { display: none; }
body.pad .kb-only { display: none; }

/* Boutons de la manette */
.xb {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  min-width: 20px; height: 20px; padding: 0 5px; margin-right: 3px;
  font: 700 10px/1 'Orbitron', sans-serif; font-style: normal; letter-spacing: 0.02em; color: var(--text);
  background: rgba(8, 14, 34, 0.9); border: 1px solid rgba(223, 246, 255, 0.4); border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  vertical-align: middle;
}
.xb + .xb { margin-left: -1px; }
.xb-face { width: 20px; padding: 0; font-size: 11px; }
.xb-a { color: #7ee36f; border-color: rgba(126, 227, 111, 0.75); }
.xb-b { color: #ff6b6b; border-color: rgba(255, 107, 107, 0.75); }
.xb-x { color: #5cb0ff; border-color: rgba(92, 176, 255, 0.8); }
.xb-y { color: #ffd23f; border-color: rgba(255, 210, 63, 0.75); }
.xb-bumper { border-radius: 7px 7px 4px 4px; min-width: 26px; }
.xb-trigger { border-radius: 9px 9px 4px 4px; min-width: 24px; height: 22px; }
.xb-stick { border-radius: 50%; width: 22px; height: 22px; padding: 0; font-size: 8.5px; box-shadow: inset 0 0 0 2px rgba(8, 14, 34, 0.9), inset 0 0 0 3px rgba(223, 246, 255, 0.25); }
.xb svg { width: 14px; height: 14px; display: block; }
.xb-dpad { width: 24px; height: 22px; padding: 0; border-radius: 6px; }
.xb-dpad svg { width: 19px; height: 19px; }
.xb-cross { fill: rgba(223, 246, 255, 0.45); }
.xb-arm { fill: var(--cyan); }
.xb-sys { width: 20px; padding: 0; }
.xb-sys svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Invite d'interaction (« X Parler à… ») et téléphone rangé (« Y ») */
.prompt .xb { width: 26px; height: 26px; font-size: 14px; margin-right: 0; }
.phone-key.xb { position: absolute; left: -6px; bottom: -6px; width: 20px; min-width: 0; height: 20px; margin: 0; }
body.touch .phone-key.xb { display: none; }

/* Bouton choisi à la manette : bien visible sur tous les fonds */
body.pad :is(button, a, input, select, textarea, summary, [tabindex], [role="button"], [role="switch"], [role="tab"]):focus,
body.pad .pad-focus {
  outline: 2px solid var(--cyan); outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(56, 232, 255, 0.22), 0 0 18px rgba(56, 232, 255, 0.55);
}
body.pad input[type="range"]:is(:focus, .pad-focus) { outline-offset: 6px; }

/* Plus de « clique pour reprendre la caméra » : le stick droit la tient */
body.pad .resume { display: none; }

/* Fenêtre ouverte : rappel des commandes au pad, en bas de l'écran (la barre du jeu laisse la place) */
.pad-hint {
  position: fixed; left: 50%; bottom: 10px; z-index: 50; transform: translateX(-50%);
  display: none; flex-wrap: wrap; justify-content: center; gap: 5px 14px;
  width: max-content; max-width: calc(100vw - 32px); padding: 6px 16px;
  font-size: 13px; line-height: 1.4; color: var(--muted);
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: 10px;
  pointer-events: none;
}
body.pad.pad-ui .pad-hint { display: flex; }
body.pad.pad-ui .help { visibility: hidden; }
.pad-hint-phone { display: none; }
body.pad-phone .pad-hint-phone { display: inline-flex; }
body.phone-open .pad-hint { left: calc((100vw - 376px) / 2); max-width: calc(100vw - 408px); }
/* Studio d'avatar : ses outils sont en bas à gauche, son panneau à droite ; le rappel passe sous la carte du joueur */
body.editing .pad-hint { top: 74px; bottom: auto; left: 16px; transform: none; max-width: min(440px, calc(100vw - 32px)); }
@media (max-width: 720px) {
  .pad-hint { display: none !important; }
}
/* Les fenêtres remontent au-dessus du rappel */
@media (min-width: 721px) {
  body.pad.pad-ui .panel { padding-bottom: 52px; }
  body.pad.pad-ui .panel-inner { max-height: min(880px, calc(100vh - 68px)); }
  body.pad.pad-ui .gm { height: min(740px, calc(100vh - 68px)); }
}

/* Onglet Touches et Contrôles du menu Paramètres */
.key-keys .xb { margin-right: 0; }
.keys-title { margin: 26px 0 10px; font: 700 13px 'Orbitron'; letter-spacing: 0.16em; text-transform: uppercase; color: var(--cyan); }
.pad-status { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.pad-status .muted { font-size: 13px; }
.pad-status b { color: #7dff5a; }
.pad-status.off b { color: var(--muted); }
