/* PINK WARS — règle mobile RLH, 22 octobre 2026.
   Main droite = caméra par glissement sur le canvas. Aucun second joystick.
   Milieu = visée maintenue ; saut immédiatement au-dessus ; tir à droite.
   Clavier, manettes et XR ne sont pas concernés. */
@media (pointer:coarse) {
  body.playing .game-hud .touch-controls {
    position: fixed; inset: 0; display: block;
    pointer-events: none; z-index: 6; touch-action: none;
  }
  body.playing .game-hud #look-stick { display: none !important; }
  body.playing .game-hud #move-stick {
    position: absolute; left: max(12px, env(safe-area-inset-left));
    bottom: max(16px, env(safe-area-inset-bottom));
    width: 116px; min-width: 0; height: 116px; gap: 0;
    pointer-events: auto; touch-action: none; z-index: 3;
  }
  body.playing .game-hud #move-stick .control-label { display: none; }
  body.playing .game-hud #move-stick .joystick-ring {
    width: 116px; height: 116px; position: relative;
    background: rgba(4,17,27,.47); border-color: rgba(141,211,235,.44);
  }
  body.playing .game-hud #move-stick .joystick-knob {
    width: 48px; height: 48px; left: 34px; top: 34px;
  }
  body.playing .game-hud .fire-area {
    position: fixed; inset: 0; display: block;
    width: 100%; transform: none; pointer-events: none;
    min-width: 0; margin: 0; padding: 0; bottom: 0;
  }
  body.playing .game-hud .fire-row {
    position: absolute; inset: 0; display: block;
    pointer-events: none; margin: 0; padding: 0;
  }
  body.playing .game-hud .fire-row button { pointer-events: auto; touch-action: none; }
  body.playing .game-hud #aim-button,
  body.playing .game-hud #jump-button {
    position: absolute; left: 50%; right: auto;
    transform: translateX(-50%); display: grid; place-items: center;
    margin: 0; width: 56px; height: 56px; border-radius: 50%;
    background: rgba(7,29,43,.82); border: 1px solid #8dcff0;
    color: #e0f6ff; box-shadow: 0 0 18px #04152490;
    z-index: 4;
  }
  body.playing .game-hud #aim-button {
    bottom: max(21px, calc(env(safe-area-inset-bottom) + 8px));
  }
  body.playing .game-hud #jump-button {
    bottom: max(91px, calc(env(safe-area-inset-bottom) + 78px));
  }
  body.playing .game-hud #fire-button {
    position: absolute; display: grid; place-items: center;
    right: max(12px, env(safe-area-inset-right)); left: auto; top: auto;
    bottom: max(22px, calc(env(safe-area-inset-bottom) + 7px));
    width: 78px; height: 78px; border-radius: 50%;
    background: rgba(175,38,92,.6); border: 1px solid #ff9abf;
    z-index: 4;
  }
  body.playing .game-hud #reload-button {
    position: absolute; left: calc(50% - 88px); right: auto; top: auto;
    bottom: max(25px, calc(env(safe-area-inset-bottom) + 10px));
    width: 49px; height: 49px; z-index: 3;
  }
  body.playing .game-hud #crouch-button {
    position: absolute; left: calc(50% - 86px); right: auto; top: auto;
    bottom: max(92px, calc(env(safe-area-inset-bottom) + 80px));
    width: 45px; height: 45px; z-index: 3;
  }
  body.playing .game-hud #arsenal-button {
    position: absolute; right: max(27px, calc(env(safe-area-inset-right) + 14px));
    left: auto; top: auto;
    bottom: max(112px, calc(env(safe-area-inset-bottom) + 96px));
    width: 50px; height: 50px; z-index: 3;
  }
  body.playing .game-hud .fire-area > .control-label,
  body.playing .game-hud .fire-area > .charge-track {
    display: none !important;
  }
  body.playing .game-hud .weapon-tag {
    position: absolute; left: auto; right: max(9px, env(safe-area-inset-right));
    top: auto; bottom: max(175px, calc(env(safe-area-inset-bottom) + 159px));
    transform: none; margin: 0; z-index: 3;
    pointer-events: auto;
  }
  body.playing .game-hud .weapon-tag button { pointer-events: auto; }
  /* Les zones non occupées par les contrôles laissent passer les gestes au canvas. */
}
@media (pointer:coarse) and (max-width:390px) {
  body.playing .game-hud #move-stick { width: 101px; height: 101px; }
  body.playing .game-hud #move-stick .joystick-ring { width: 101px; height: 101px; }
  body.playing .game-hud #move-stick .joystick-knob { left: 26.5px; top: 26.5px; }
  body.playing .game-hud #reload-button { left: calc(50% - 72px); }
  body.playing .game-hud #crouch-button { left: calc(50% - 72px); }
}

/* Universal mobile contract for Mission 02 (identical positioning to M01).
   Left movement, right half drag camera, center ADS, jump above, fire right. */
@media (pointer:coarse) {
  #m02-touch-controls {position:fixed;inset:0;z-index:5;display:block;pointer-events:none;touch-action:none}
  #m02-touch-controls #m02-move {position:fixed;left:max(12px,env(safe-area-inset-left));bottom:max(16px,env(safe-area-inset-bottom));pointer-events:auto;touch-action:none}
  #m02-touch-controls #m02-move .m02-stick-ring {width:112px;height:112px;border-radius:50%;background:#0717229c;border:1px solid #79cde7aa}
  #m02-touch-controls #m02-move small {display:none}
  #m02-touch-controls #m02-look {display:none!important}
  #m02-touch-controls .m02-actions {position:fixed;inset:0;display:block;width:100%;max-width:none;min-width:0;margin:0;padding:0;pointer-events:none;touch-action:none;transform:none}
  #m02-touch-controls .m02-actions button {
    position:fixed;display:grid;place-items:center;pointer-events:auto;touch-action:none;
    min-width:0;width:48px;height:48px;min-height:0;padding:0;border-radius:50%;
    border:1px solid #88cde2aa;background:#071e2dd9;color:#d6f2f9;
    font:800 10px system-ui;z-index:5
  }
  #m02-touch-controls .m02-actions button[data-m02="aim"] {
    left:50%;right:auto;top:auto;bottom:max(21px,calc(env(safe-area-inset-bottom) + 8px));
    width:56px;height:56px;transform:translateX(-50%);border-color:#8dcff0
  }
  #m02-touch-controls .m02-actions button[data-m02="jump"] {
    left:50%;right:auto;top:auto;bottom:max(91px,calc(env(safe-area-inset-bottom) + 78px));
    width:56px;height:56px;transform:translateX(-50%);border-color:#8dcff0
  }
  #m02-touch-controls .m02-actions button[data-m02="fire"] {
    right:max(12px,env(safe-area-inset-right));left:auto;top:auto;
    bottom:max(22px,calc(env(safe-area-inset-bottom) + 7px));
    width:78px;height:78px;border-color:#ff9abf;background:rgba(175,38,92,.7);font-size:15px
  }
  #m02-touch-controls .m02-actions button[data-m02="interact"] {
    right:max(24px,calc(env(safe-area-inset-right) + 13px));left:auto;top:auto;
    bottom:max(111px,calc(env(safe-area-inset-bottom) + 97px));width:56px;height:56px
  }
  #m02-touch-controls .m02-actions button[data-m02="next"] {
    right:max(90px,calc(env(safe-area-inset-right) + 83px));left:auto;top:auto;
    bottom:max(21px,calc(env(safe-area-inset-bottom) + 8px));width:46px;height:46px
  }
  #m02-touch-controls .m02-actions button[data-m02="reload"] {
    left:calc(50% - 88px);right:auto;top:auto;
    bottom:max(25px,calc(env(safe-area-inset-bottom) + 10px));width:49px;height:49px
  }
  #m02-touch-controls .m02-actions button[data-m02="crouch"] {
    left:calc(50% - 86px);right:auto;top:auto;
    bottom:max(92px,calc(env(safe-area-inset-bottom) + 80px));width:46px;height:46px;font-size:9px
  }
  #m02-touch-controls .m02-actions button[data-m02="view"] {
    right:max(92px,calc(env(safe-area-inset-right) + 80px));left:auto;top:auto;
    bottom:max(111px,calc(env(safe-area-inset-bottom) + 97px));width:46px;height:46px
  }
  #m02-touch-controls .m02-actions button[data-m02="pause"] {
    right:max(12px,env(safe-area-inset-right));left:auto;top:max(62px,calc(env(safe-area-inset-top) + 48px));
    bottom:auto;width:40px;height:40px
  }
  #bottom {bottom:max(166px,calc(env(safe-area-inset-bottom) + 148px))}
}
@media(pointer:coarse) and (max-width:390px) {
  #m02-touch-controls #m02-move .m02-stick-ring {width:100px;height:100px}
  #m02-touch-controls .m02-actions button[data-m02="reload"],
  #m02-touch-controls .m02-actions button[data-m02="crouch"] {left:calc(50% - 72px)}
}

/* Quiet gameplay: instructions live in the menu/help, not across the playfield.
   Never hide health, ammo, objective compass, hit indicators or actual controls. */
body.playing #game-tip{display:none!important}
@media(pointer:coarse){
 body.playing .game-hud .control-label{display:none!important}
 body.playing .game-hud #game-view-label{display:none!important}
 body.playing .game-hud .wave-hud small{display:none!important}
}
