/* SPACE_EMPIRE_SN071_MOBILE_PILOT_ASSIST
   Mobile-only ergonomic layer. PC/fine-pointer layout is unchanged. */

body.mobile071-enabled .fh-mobile071-state {
  display: none;
}

@media (max-width: 860px), (pointer: coarse) {
  body.touch.mobile071-enabled .fh-status {
    width: min(188px, 48vw);
    padding: 6px 7px 7px;
    background: linear-gradient(180deg, rgba(3, 10, 18, .78), rgba(3, 10, 18, .42));
    backdrop-filter: blur(7px);
  }
  body.touch.mobile071-enabled .fh-status .fh-career {
    display: none;
  }
  body.touch.mobile071-enabled .fh-ship {
    margin-bottom: 3px;
  }
  body.touch.mobile071-enabled .fh-ship b {
    font-size: 11px;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  body.touch.mobile071-enabled .fh-rank {
    font-size: 8px;
    padding: 2px 5px;
  }
  body.touch.mobile071-enabled .fh-bar {
    grid-template-columns: 45px minmax(46px, 1fr) 34px;
    gap: 4px;
    min-height: 14px;
  }
  body.touch.mobile071-enabled .fh-bar span,
  body.touch.mobile071-enabled .fh-bar em {
    font-size: 8px;
  }
  body.touch.mobile071-enabled .fh-xp {
    margin-top: 3px;
  }

  /* The old telemetry strip obscured the ship on narrow screens. Critical
     information remains in shield/hull bars, target HUD, radar and actions. */
  body.touch.mobile071-enabled .fh-science040 {
    display: none !important;
  }

  body.touch.mobile071-enabled .fh-sector {
    display: none;
  }

  body.touch.mobile071-enabled .fh-flight {
    top: calc(112px + var(--safe-t));
    left: calc(8px + var(--safe-l));
    padding: 0;
    pointer-events: auto;
  }
  body.touch.mobile071-enabled .fh-speed {
    position: relative;
    min-width: 112px;
    padding: 6px 8px 18px;
    border: 1px solid rgba(95, 212, 255, .22);
    border-radius: 12px;
    background: rgba(3, 10, 18, .55);
    backdrop-filter: blur(7px);
    touch-action: manipulation;
  }
  body.touch.mobile071-enabled .fh-speed b {
    font-size: 20px;
  }
  body.touch.mobile071-enabled .fh-mobile071-speed {
    position: absolute;
    left: 8px;
    bottom: 3px;
    font: 800 8px/1 system-ui, sans-serif;
    letter-spacing: .11em;
    color: rgba(190, 220, 236, .62);
  }
  body.touch.mobile071-enabled .fh-mobile071-speed.active {
    color: #7dffb3;
    text-shadow: 0 0 10px rgba(125, 255, 179, .55);
  }

  body.touch.mobile071-enabled .fh-mobile071-state {
    display: block;
    position: absolute;
    z-index: 14;
    right: calc(10px + var(--safe-r));
    top: calc(116px + var(--safe-t));
    padding: 5px 9px;
    border: 1px solid rgba(125, 255, 179, .24);
    border-radius: 999px;
    background: rgba(4, 20, 18, .62);
    color: rgba(190, 245, 219, .82);
    font: 800 8px/1 system-ui, sans-serif;
    letter-spacing: .12em;
    pointer-events: none;
    backdrop-filter: blur(7px);
  }
  body.touch.mobile071-enabled .fh-mobile071-state.auto {
    color: #fff1b6;
    border-color: rgba(242, 197, 114, .48);
    background: rgba(46, 29, 8, .66);
  }

  body.touch.mobile071-enabled .fh-radar {
    top: calc(150px + var(--safe-t));
    width: 92px;
    height: 92px;
  }

  body.touch.mobile071-enabled .fh-target {
    top: calc(150px + var(--safe-t));
    width: min(156px, 42vw);
  }

  /* Existing prompt becomes the single smart mobile action button. */
  body.touch.mobile071-enabled .fh-prompt {
    bottom: calc(238px + var(--safe-b));
    right: calc(10px + var(--safe-r));
    left: auto;
    transform: none;
    max-width: min(230px, 62vw);
    z-index: 18;
  }
  body.touch.mobile071-enabled .fh-prompt button {
    min-height: 50px;
    width: 100%;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 14px;
    clip-path: none;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .28);
    backdrop-filter: blur(9px);
  }
  body.touch.mobile071-enabled .fh-prompt button span {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Keep manual fire dominant. Automation never fires weapons. */
  body.touch.mobile071-enabled .fh-touch {
    right: calc(8px + var(--safe-r));
    bottom: calc(8px + var(--safe-b));
    width: 220px;
    height: 220px;
  }
  body.touch.mobile071-enabled .fh-touch .t-fire {
    width: 104px;
    height: 104px;
    font-size: 38px;
  }
  body.touch.mobile071-enabled .fh-touch .t-mine {
    width: 76px;
    height: 76px;
    right: 112px;
    bottom: 4px;
  }
  body.touch.mobile071-enabled .fh-touch .t-boost {
    width: 66px;
    height: 66px;
    right: 18px;
    bottom: 116px;
  }
  body.touch.mobile071-enabled .fh-touch .t-target {
    width: 58px;
    height: 58px;
    right: 110px;
    bottom: 104px;
  }

  /* Voice remains available but no longer covers the mobile flight controls. */
  body.touch.mobile071-enabled .fh-voice036 {
    top: calc(250px + var(--safe-t));
    right: calc(8px + var(--safe-r));
    bottom: auto;
    left: auto;
    transform: none;
    max-width: none;
    padding: 3px;
    gap: 4px;
    border-radius: 999px;
    background: rgba(3, 10, 18, .46);
  }
  body.touch.mobile071-enabled .fh-voice036 button {
    width: 38px;
    height: 38px;
    justify-content: center;
    padding: 0;
    border-radius: 50%;
    font-size: 14px;
  }
  body.touch.mobile071-enabled .fh-voice036 button b,
  body.touch.mobile071-enabled .fh-voice036 button kbd,
  body.touch.mobile071-enabled .fh-voice036 small {
    display: none !important;
  }

  body.touch.mobile071-enabled .fh-toast {
    bottom: calc(360px + var(--safe-b));
    max-width: 80vw;
  }

  body.touch.mobile071-enabled .fh-autopilot {
    bottom: calc(300px + var(--safe-b));
    max-width: 64vw;
  }

  body.touch.mobile071-enabled .fh-stick-base {
    width: 148px;
    height: 148px;
    margin: -74px 0 0 -74px;
  }
  body.touch.mobile071-enabled .fh-stick {
    width: 64px;
    height: 64px;
    margin: -32px 0 0 -32px;
  }
}

@media (max-width: 860px) and (orientation: landscape),
       (pointer: coarse) and (orientation: landscape) and (max-height: 520px) {
  body.touch.mobile071-enabled .fh-status {
    width: min(174px, 33vw);
  }
  body.touch.mobile071-enabled .fh-flight {
    top: auto;
    bottom: calc(8px + var(--safe-b));
  }
  body.touch.mobile071-enabled .fh-mobile071-state {
    top: calc(8px + var(--safe-t));
    right: calc(112px + var(--safe-r));
  }
  body.touch.mobile071-enabled .fh-voice036 {
    top: calc(58px + var(--safe-t));
    right: calc(8px + var(--safe-r));
  }
  body.touch.mobile071-enabled .fh-prompt {
    bottom: calc(118px + var(--safe-b));
    right: calc(220px + var(--safe-r));
  }
  body.touch.mobile071-enabled .fh-autopilot {
    bottom: calc(72px + var(--safe-b));
  }
  body.touch.mobile071-enabled .fh-toast {
    bottom: calc(78px + var(--safe-b));
  }
}

@media (min-width: 861px) and (pointer: fine) {
  .fh-mobile071-state,
  .fh-mobile071-speed {
    display: none !important;
  }
}
