.hud-disposition, .hud-entete, .hud-milieu, .hud-bas { display:contents; }
.hud-disposition:has(.radar-card.expanded, .profile-dock:not(.replie)) { z-index:40; }
@media (max-width:1100px), (max-height:800px) {
  .hud-disposition { position:fixed; z-index:19; inset:8px; display:grid; grid-template-rows:auto minmax(48px,1fr) auto auto; gap:8px; pointer-events:none; min-height:0; }
  .hud-entete { display:flex; flex-wrap:wrap; align-items:flex-start; gap:6px; min-width:0; }
  .hud-entete > :is(.profile-dock,.cam-tools,.radar-card,.boussole-cadre)[data-hud-placement=defaut],
  .hud-entete > .combat-hud[data-hud-placement=defaut],
  .hud-milieu > .panneau-commandes[data-hud-placement=defaut],
  .hud-bas > #sorts-flottants[data-hud-placement=defaut],
  .hud-disposition > .interaction-hud { position:relative; inset:auto!important; transform:none!important; margin:0; }
  .hud-entete > :is(.profile-dock,.cam-tools,.radar-card), .hud-entete > .combat-hud, .hud-milieu > .panneau-commandes, .hud-bas > #sorts-flottants { pointer-events:auto; }
  .hud-entete .profile-dock { width:auto; max-width:100%; flex-wrap:wrap; align-self:flex-start; }
  .hud-entete .profile-dock:not(.replie) { position:fixed; inset:8px!important; width:auto; height:max-content; background:#071822fa; padding:8px; z-index:45; }
  .hud-entete .cam-tools { display:flex; flex-wrap:wrap; max-width:100%; gap:4px; }
  .hud-entete .cam-tools button { min-width:32px; min-height:32px; }
  .hud-entete .cam-tools #hub-view-mode { width:32px; min-width:32px; padding:0; font-size:0; gap:0; }
  .hud-entete .cam-tools #hub-view-mode svg { width:20px; }
  .hud-entete .radar-card:not(.expanded) { margin-left:auto; width:140px; flex-shrink:0; }
  .hud-entete .radar-card:not(.expanded) .radar-head b { display:none; }
  .hud-entete .radar-card:not(.expanded) .radar-head { padding:4px; }
  .hud-entete .radar-card:not(.expanded) .radar-head button { margin:0; min-width:24px; height:28px; padding:3px; }
  .hud-entete .radar-card:not(.expanded) #atlas-open { font-size:0!important; padding:3px!important; width:24px!important; }
  .hud-entete .radar-card:not(.expanded) #atlas-open::before { content:'⌖'; font:700 18px/1 sans-serif; }
  .hud-entete .radar-card:not(.expanded) #hub-radar { display:none; }
  .hud-entete .radar-card.expanded { position:fixed; inset:8px!important; width:auto; max-height:calc(100dvh - 16px); overflow:auto; z-index:45; }
  .hud-entete .boussole { width:28px; height:28px; flex-shrink:0; }
  .hud-entete .combat-hud[data-hud-placement=defaut] { width:100%; max-width:350px; box-sizing:border-box; display:grid; grid-template-columns:1fr 1fr; gap:2px 8px; padding:4px 6px; }
  .hud-entete .combat-hud[data-hud-placement=defaut] > div:first-child { grid-column:1; grid-row:1; }
  .hud-entete .combat-hud[data-hud-placement=defaut] .health-track { grid-column:1; grid-row:2; margin:0; }
  .hud-entete .combat-hud[data-hud-placement=defaut] .jetpack-fuel-hud { grid-column:2; grid-row:1 / span 2; margin:0; }
  .hud-entete .combat-hud[data-hud-placement=defaut] .jetpack-fuel-hud > div:first-child { font-size:8px; white-space:nowrap; letter-spacing:0; }
  .hud-entete .combat-hud[data-hud-placement=defaut] > small { grid-column:1; margin:0; }
  .hud-entete .combat-hud[data-hud-placement=defaut] .wallet { grid-column:2; grid-row:3; margin:0; }
  .hud-entete .combat-hud[data-hud-placement=defaut] .wallet > span { padding:1px 3px; grid-template-columns:9px auto; }
  .hud-milieu { display:flex; min-height:0; align-items:flex-start; }
  .hud-milieu > .panneau-commandes[data-hud-placement=defaut] { width:238px; max-height:100%; box-sizing:border-box; }
  .hud-milieu .commandes-contenu { min-height:0; max-height:none; }
  .hud-milieu .commandes-entete { box-sizing:border-box; min-height:44px; }
  .hud-bas { display:flex; justify-content:center; }
  .hud-disposition > .interaction-hud { width:100%!important; max-width:100%; max-height:var(--contexte-max,40dvh); overflow:auto; overscroll-behavior:contain; align-self:end; align-items:center; pointer-events:auto; scrollbar-width:thin; }
  .hud-disposition > .interaction-hud:not(:has(.interaction-prompt:not([hidden]), .flight-hud:not([hidden]))) { display:none; }
  .hud-disposition > .interaction-hud > .interaction-prompt { flex-shrink:0; min-height:44px; }
  .hud-disposition > .interaction-hud > .flight-hud { flex-shrink:0; }
}
@media (max-height:480px) and (orientation:landscape) {
  .hud-entete .combat-hud[data-hud-placement=defaut] { flex:1; min-width:180px; width:auto; }
  .hud-disposition > .interaction-hud { flex-direction:row; align-items:flex-start; }
  .hud-disposition > .interaction-hud > .interaction-prompt { flex:0 1 32%; }
  .hud-disposition > .interaction-hud > .flight-hud { flex:1 1 68%; }
  .hud-bas > #sorts-flottants[data-hud-placement=defaut] { padding:3px 6px 4px; }
  .hud-bas > #sorts-flottants[data-hud-placement=defaut] header { min-height:24px; padding-bottom:3px; }
  .hud-bas > #sorts-flottants[data-hud-placement=defaut] .spell-bar { --case:34px; }
}
/* Le tactile conserve les vraies commandes et leurs gestes maintenus. */
.mode-tactile .hud-disposition { position:fixed; inset:8px; z-index:19; display:grid; grid-template-rows:auto minmax(0,1fr) auto auto; gap:8px; pointer-events:none; }
.mode-tactile .hud-entete { display:flex; flex-wrap:wrap; align-items:flex-start; gap:6px; }
.mode-tactile .hud-entete .cam-tools { position:relative; inset:auto; transform:none; display:flex; gap:4px; flex-wrap:wrap; max-width:100%; pointer-events:auto; }
.mode-tactile .hud-entete .cam-tools button, .mode-tactile .hud-entete .cam-tools #hub-view-mode { width:44px; min-width:44px; height:44px; padding:0; font-size:0; }
.mode-tactile .hud-entete .cam-tools #hub-view-mode svg { width:20px; }
.mode-tactile .hud-entete .radar-card:not(.expanded) { position:relative; inset:auto; margin-left:auto; width:224px; pointer-events:auto; }
.mode-tactile .hud-entete .radar-card:not(.expanded) #hub-radar { display:none; }
.mode-tactile .hud-entete .radar-head { padding:0; flex-wrap:nowrap; align-items:center; }
.mode-tactile .hud-entete .radar-head b { display:none; }
.mode-tactile .hud-entete .radar-actions { width:100%; }
.mode-tactile .hud-entete .radar-head button { margin:0; padding:0; }
.mode-tactile .hud-entete .radar-card:not(.expanded) #atlas-open { font-size:0!important; padding:0!important; width:44px!important; }
.mode-tactile .hud-entete .radar-card:not(.expanded) #atlas-open::before { content:'⌖'; font:700 22px/1 sans-serif; }
.mode-tactile .hud-entete .boussole { position:relative; inset:auto; width:28px; height:28px; }
.mode-tactile .hud-entete .combat-hud[data-hud-placement=defaut] { position:relative; inset:auto!important; transform:none!important; width:100%; box-sizing:border-box; padding:4px 6px; display:grid; grid-template-columns:1fr 1fr; gap:2px 8px; pointer-events:auto; }
.mode-tactile .hud-entete .combat-hud > div:first-child { grid-column:1; grid-row:1; }
.mode-tactile .hud-entete .combat-hud .health-track { grid-column:1; grid-row:2; margin:0; }
.mode-tactile .hud-entete .combat-hud .jetpack-fuel-hud { grid-column:2; grid-row:1 / span 2; margin:0; }
.mode-tactile .hud-entete .combat-hud > small { grid-column:1; margin:0; }
.mode-tactile .hud-entete .combat-hud .wallet { grid-column:2; grid-row:3; margin:0; }
.mode-tactile .hud-entete .combat-hud .wallet > span { padding:1px 3px; }
.mode-tactile .hud-milieu { display:block; min-height:0; }
.mode-tactile .hud-bas { display:block; height:calc(var(--mobile-bas) + var(--tactile-stick) + var(--tactile-case) + 38px); }
.mode-tactile .hud-disposition > .interaction-hud { position:relative; inset:auto; transform:none; width:100%!important; max-width:100%; max-height:var(--contexte-max,35dvh); overflow:auto; overscroll-behavior:contain; pointer-events:auto; scrollbar-width:thin; }
.mode-tactile .tactile-actions { display:grid; grid-template-columns:repeat(4,var(--tactile-case)); grid-template-rows:repeat(2,var(--tactile-case)); gap:4px; width:max-content; height:max-content; }
.mode-tactile .tactile-actions button, .mode-tactile .tactile-actions [data-action=attack] { position:relative; inset:auto; width:var(--tactile-case); height:var(--tactile-case); }
.mode-tactile .tactile-outils { top:auto; bottom:calc(var(--mobile-bas) + var(--tactile-stick) + 30px); left:auto; right:12px; }
.mode-tactile .tactile-conseil { display:none; }
@media (max-height:480px) and (orientation:landscape) {
  .mode-tactile .hud-entete .combat-hud[data-hud-placement=defaut] { flex:1; width:auto; min-width:180px; }
  .mode-tactile .hud-bas { height:calc(var(--mobile-bas) + var(--tactile-stick) + 16px); }
  .mode-tactile .tactile-communs { flex-direction:column; left:calc(var(--tactile-stick) + 32px); bottom:var(--mobile-bas); gap:4px; }
  .mode-tactile .tactile-outils { left:calc(var(--tactile-stick) + var(--tactile-case) + 44px); right:auto; bottom:var(--mobile-bas); }
}

/* Les poignées restent accessibles sans recouvrir les boutons du panneau. */
.hud-reglable { box-sizing:border-box; padding-top:32px; }
.hud-reglable > .hud-commandes { top:4px; right:4px; opacity:1; pointer-events:auto; }
.hud-reglable > .hud-commandes button { width:22px; min-width:22px; height:22px; min-height:22px; padding:0; display:grid; grid-template:none; place-items:center; border:1px solid #42606a; border-radius:4px; background:#142f3a; color:#b9dfe7; touch-action:none; }
.hud-reglable > .hud-commandes button[hidden] { display:none; }
.hud-reglable > .hud-commandes svg { width:10px; height:10px; fill:currentColor; }
.hud-reglable > .hud-commandes button.hud-verrou[aria-pressed=true] { color:#ffb89e; border-color:#ff9670; }
.hud-reglable > .hud-commandes button:focus-visible { outline:2px solid #78edec; outline-offset:2px; }
.hud-reglable[data-hud-placement=personnalise] { margin:0!important; }
.hud-entete .profile-dock.hud-reglable { min-width:60px; }
.hud-disposition .hud-entete .combat-hud.hud-reglable { padding-top:32px; }
.hud-entete .profile-dock.hud-reglable:not(.replie) { padding-top:32px; }
.hud-entete .radar-card.hud-reglable:not(.expanded) { width:calc(210px * var(--echelle-hud,1)); max-width:calc(100vw - 16px); min-width:140px; }
.hud-entete .radar-card.expanded[data-hud-placement=personnalise] { width:min(720px,calc(100vw - 16px)); }
.hud-entete .radar-card[data-hud-placement=personnalise] { transition:opacity .22s,background .22s; }
.boussole-cadre { position:fixed; right:16px; top:130px; width:58px; padding-top:28px; pointer-events:none; }
.hud-entete .boussole-cadre > .boussole { position:relative; inset:auto; margin:0; width:56px; height:56px; transform:none; }
.interaction-cadre { position:relative; width:100%; max-width:calc(100vw - 16px); pointer-events:none; }
.interaction-cadre[data-hud-placement=personnalise] { width:min(340px,calc(100vw - 16px)); }
.interaction-cadre:not(:has(> .interaction-prompt:not([hidden]))) { display:none; }
.interaction-cadre > .interaction-prompt { position:static; inset:auto; transform:none; width:100%; min-height:44px; max-width:100%; pointer-events:auto; margin:0; }
.interaction-hud { transform:none; }
.interaction-hud > .flight-hud.hud-reglable { padding-top:32px; clip-path:none; border-radius:8px; width:calc(320px * var(--echelle-hud,1)); max-width:calc(100vw - 16px); max-height:calc(100dvh - 120px); overflow:auto; overflow-x:hidden; overscroll-behavior:contain; scrollbar-width:thin; pointer-events:auto; }
.flight-hud.hud-reglable > strong { font-size:calc(10px * var(--echelle-hud,1)); }
.flight-hud.hud-reglable .flight-readout { flex-wrap:wrap; justify-content:center; gap:calc(16px * var(--echelle-hud,1)); }
.flight-hud.hud-reglable .flight-readout b { font-size:calc(15px * var(--echelle-hud,1)); }
.interaction-hud > .flight-hud[data-hud-placement=defaut] { width:100%; flex:none; }
.interaction-hud:not(:has(.interaction-prompt:not([hidden]), .flight-hud:not([hidden]))) { display:none; }

/* Le centre reste libre au défaut ; un choix personnel peut aller partout. */
html:not(.mode-tactile) .hud-disposition > .interaction-hud { position:fixed; inset:auto 12px 12px auto!important; width:min(340px,29vw)!important; max-width:calc(100vw - 24px); max-height:calc(100dvh - 170px); overflow:visible; align-items:stretch; flex-direction:column; gap:8px; pointer-events:none; }
html:not(.mode-tactile) .hud-bas { justify-content:flex-start; }
html:not(.mode-tactile) #sorts-flottants[data-hud-placement=defaut] { left:12px; bottom:12px; transform:none; }
html:not(.mode-tactile) .combat-hud[data-hud-placement=defaut] { left:16px; transform:none; }
html:not(.mode-tactile) .panneau-commandes[data-hud-placement=defaut] { left:16px; right:auto; max-height:calc(100dvh - 290px); }
html:not(.mode-tactile) .panneau-commandes[data-hud-placement=defaut] .commandes-contenu { max-height:100%; }
@media (min-width:1101px) and (min-height:801px) {
  html:not(.mode-tactile) .cam-tools[data-hud-placement=defaut] { top:16px; right:244px; bottom:auto; max-width:calc(100vw - 580px); flex-wrap:wrap; }
}
@media (pointer:coarse) {
  .hud-reglable { padding-top:42px; }
  .hud-entete .profile-dock.hud-reglable, .boussole-cadre { min-width:74px; }
  .interaction-hud > .flight-hud.hud-reglable { padding-top:42px; }
  .hud-reglable > .hud-commandes button { width:32px; height:32px; min-width:32px; min-height:32px; }
}
