/* Independent field groups (ui-hud.js): the Main menu button, the minimap, the quest tracker frame, the left action
   stack (chat, fullscreen) and the field chat feed, plus the compact HUD for phones / small windows
   (body.hud-compact). Restyled 2026-10-09 (direction A "Field Terminal", Proposed): plates come from base.css
   (::before, --c1/--c2 cuts, --bd line, --fill, --deco), colours and type from css/ui-tokens.css. Geometry unchanged
   except where a touch target had to reach 44 px. The tracker's content is styled by css/guide.css. */
body {
  --hud-edge: 24px;
  --map-width: 202px;
  --map-height: 232px;
}
body.hud-compact {
  --hud-edge: 10px;
  --map-width: 138px;
  --map-height: 152px;
}
body.hud-map-collapsed {
  --map-width: 44px;
  --map-height: 44px;
}

/* ------------------------------------------------------------------------------------------------- group buttons */
.hud-group-toggle {
  --c1: 8px;
  --c2: 8px;
  width: 44px;
  height: 44px;
  padding: 3px 2px 2px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1px;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--text);
}
.hud-group-toggle .icon {
  width: 21px;
  height: 21px;
  color: var(--accent);
}
.hud-group-toggle > span {
  font: 600 12px/1.1 var(--f-head);
  white-space: nowrap;
}
#hudToggle {
  position: absolute;
  right: calc(var(--hud-edge) + var(--sr) + var(--map-width) + 8px);
  top: calc(var(--hud-edge) + var(--st));
  z-index: 3;
}
/* the Main menu button is the HUD's door to every window: amber line, larger on wide screens */
#hudToggle {
  --bd: rgba(255, 178, 30, 0.6);
  --deco: linear-gradient(var(--accent), var(--accent)) 8px 0 / 18px 2px no-repeat;
}
body:not(.hud-compact) #hudToggle {
  width: 52px;
  height: 52px;
}
body:not(.hud-compact) #hudToggle .icon {
  width: 24px;
  height: 24px;
}

/* ------------------------------------------------------------------------------------------------- minimap */
body #tr,
body.touch #tr,
body.hud-compact #tr {
  top: calc(var(--hud-edge) + var(--st));
  right: calc(var(--hud-edge) + var(--sr));
  width: var(--map-width);
  gap: 0;
}
body #tr .map-heading {
  height: 44px;
  padding: 0 0 0 12px;
  gap: 0;
}
body #tr .map-heading > span {
  flex: 1;
  font-size: 11px;
}
body #tr .map-heading button {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}
body #tr #mm {
  width: 100%;
  height: 158px;
}
body #tr .north {
  top: 48px;
}
body #tr #zoneTag {
  min-height: 30px;
  padding: 6px 10px 6px 12px;
  font-size: 13px;
  line-height: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* The target takes the former map-heading space, leaving the field centre clear. */
body #tf,
body.touch #tf,
body:not(.touch) #tf {
  top: calc(var(--hud-edge) + var(--st));
  left: 50%;
  transform: translateX(-50%);
}
body.hud-compact #tr .map-heading {
  padding: 0;
  justify-content: flex-end;
}
body.hud-compact #tr .map-heading > span {
  display: none;
}
body.hud-compact #tr #mm {
  height: 80px;
}
body.hud-compact #tr #zoneTag {
  height: 26px;
  min-height: 26px;
  padding: 4px 6px 4px 9px;
  font-size: 12px;
  line-height: 18px;
}
#mapToggle {
  margin-left: auto;
}

/* ------------------------------------------------------------------------------------------------- Salvage Core */
/* Live salvage reserves follow the player's health, not the minimap. */
body #core {
  position: absolute;
  left: calc(24px + var(--sl));
  top: calc(160px + var(--st));
  width: 302px;
  min-height: 68px;
  padding: 9px 12px 9px 11px;
  gap: 10px;
}
body #core .core-icon .icon {
  width: 28px;
  height: 28px;
}
body #coreNote {
  display: block;
  font-size: 13px;
  line-height: 1.35;
}
/* compact: the accepted thin meter (value + bar, 24 px). It stays under the 44 px touch size on purpose: a taller
   strip pushes the left stack into the chat feed on short phones (Proposed; see the HUD report). */
body.hud-compact #core {
  --c1: 6px;
  --c2: 6px;
  --deco: linear-gradient(var(--accent), var(--accent)) 0 6px / 2px calc(100% - 12px) no-repeat;
  left: calc(10px + var(--sl));
  top: calc(62px + var(--st));
  width: clamp(155px, 24vw, 205px);
  height: 24px;
  min-height: 24px;
  padding: 3px 8px 3px 9px;
}
body.hud-compact #core .core-icon,
body.hud-compact #core .top > span,
body.hud-compact #coreNote {
  display: none;
}
body.hud-compact #core .core-content {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 8px;
}
body.hud-compact #core .top b {
  font-size: 12px;
}
body.hud-compact #coreBar {
  flex: 1;
  height: 4px;
}

/* ------------------------------------------------------------------------------------------------- quest tracker frame */
#questTracker {
  position: absolute;
  right: calc(var(--hud-edge) + var(--sr));
  top: calc(var(--hud-edge) + var(--st) + var(--map-height) + 8px);
  width: 224px;   /* narrower so the tracker covers less of the field (user, 2026-10-10; was 270 px) */
}
#questToggle {
  margin-left: auto;
}
#questPanel {
  --c1: 12px;
  --c2: 12px;
  --deco: linear-gradient(var(--accent), var(--accent)) 12px 0 / 44px 2px no-repeat;
  display: flex;
  flex-direction: column;
}
#questPanel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 12px;
  height: 44px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(255, 178, 30, 0.1), transparent 70%);
}
#questPanel > header > div {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
#questPanel > header .icon {
  width: 20px;
  height: 20px;
  color: var(--accent);
  flex-shrink: 0;
}
#questPanel h2 {
  margin: 0;
  font: 700 15px/1.2 var(--f-head);
  color: var(--text);
  white-space: nowrap;
}
#questCollapse {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  background: none;
  color: var(--dim);
}
#questCollapse .icon {
  width: 18px;
  height: 18px;
}
#questList {
  max-height: 192px;
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: none;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
#questList::-webkit-scrollbar {
  display: none;
}
/* narrower on small screens so the open tracker covers less of the field (user, 2026-10-10; was 244 px) */
body.hud-compact #questTracker {
  width: 204px;
}
body.hud-compact #questTracker[data-open="true"] {
  top: calc(10px + var(--st));
  z-index: 4;
}
body.hud-compact #questPanel {
  --fill: linear-gradient(180deg, rgba(232, 237, 230, 0.04), transparent 40%), rgba(12, 18, 20, 0.95);
  max-height: calc(100dvh - 26px - var(--st) - var(--sb));
}

/* ------------------------------------------------------------------------------------------------- field chat feed */
/* Read all channels at a glance. Row controls resize only this feed (2–8).
   The full left pane has a separate channel filter and composer. */
body #commsDock {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(108px + var(--sb));   /* 6 px above the combat dock (2026-10-10; was 148) */
  width: min(560px, calc(100vw - 48px));
}
body #commsDock #chatMini {
  position: static;
  inset: auto;
  transform: none;
  width: 100%;
  padding: 3px 10px 5px;
  display: block;
}
body #commsDock .chat-mini-heading {
  height: 30px;
  margin-bottom: 2px;
  justify-content: space-between;
  gap: 4px;
}
#chatMiniOpen {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  height: 32px;
  padding: 0 6px 0 0;
  border: 0;
  background: none;
  color: var(--text);
}
#chatMiniOpen .icon {
  width: 17px;
  height: 17px;
  color: var(--accent);
}
#chatMiniOpen b {
  white-space: nowrap;
  font: 600 13px/1 var(--f-head);
}
.chat-row-controls {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 2px;
}
.chat-row-controls button {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 0;
  background: rgba(9, 14, 15, 0.6);
  color: var(--text);
  font: 600 18px/1 var(--f-num);
  -webkit-clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);
  clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);
}
.chat-row-controls button.is-pressed {
  border-color: var(--accent);
  color: var(--accent);
}
.chat-row-controls button:disabled {
  opacity: 0.3;
}
#chatRowCount {
  width: 22px;
  text-align: center;
  font: 700 12px/1 var(--f-num);
  color: var(--dim);
}
body #commsDock #chatMiniLines {
  width: 100%;
  display: grid;
  gap: 0;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  color: inherit;
}
body #commsDock .chat-mini-line {
  display: block;
  font-size: 13px;
  line-height: 21px;
  height: 21px;
}
.chat-mini-line.mention {
  background: linear-gradient(90deg, rgba(255, 178, 30, 0.12), transparent 80%);
}

/* ------------------------------------------------------------------------------------------------- left action stack */
#commsActions {
  position: absolute;
  left: calc(24px + var(--sl));
  top: calc(var(--core-bottom, 228px) + 8px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
body #commsActions #chatLauncher {
  --c1: 8px;
  --c2: 8px;
  display: flex;
  position: relative;
  inset: auto;
  transform: none;
  height: 44px;
  min-height: 44px;
  padding: 5px 12px 5px 11px;
  margin: 0;
}
body #commsActions #chatLauncher {
  flex-shrink: 0;
  gap: 8px;
}
body #commsActions #chatLauncher > span {
  font: 600 14px/1.1 var(--f-head);
}
body #commsActions #chatLauncher kbd {
  margin-left: 2px;
}
body #commsActions #chatLauncher small {
  display: none;
}
body #commsActions #bFullscreen {
  --c1: 8px;
  --c2: 8px;
  position: relative;
  inset: auto;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 9px;
  margin: 0;
  display: grid;
  place-items: center;
  color: var(--text);
}
body #commsActions #bFullscreen .icon {
  width: 22px;
  height: 22px;
}
body #commsActions #bFullscreen[aria-pressed="true"] {
  --bd: var(--accent-dim);
  color: var(--accent);
}
body.hud-compact #commsDock {
  width: min(440px, calc(100vw - 24px));
  bottom: calc(205px + var(--sb));
}
/* small mouse windows: the EXP edge line sits at the very bottom, so the dock and the feed close up on it (2026-10-10) */
body.hud-compact:not(.touch) #act {
  bottom: calc(10px + var(--sb));
}
body.hud-compact:not(.touch) #commsDock {
  bottom: calc(96px + var(--sb));
}
@media (max-width: 700px) {
  /* the mouse dock wraps into two rows here (interface.css), about 151 px tall */
  body.hud-compact:not(.touch) #commsDock {
    bottom: calc(167px + var(--sb));
  }
}
body.hud-compact #commsDock #chatMini {
  padding: 2px 8px 5px;
}
body.hud-compact #commsDock .chat-mini-line {
  font-size: 12px;
  height: 18px;
  line-height: 18px;
}
body.hud-compact #commsDock .chat-mini-line b {
  font-size: 12px;
}
body.hud-compact #commsActions {
  left: calc(10px + var(--sl));
}
body.hud-compact #commsActions #chatLauncher {
  width: 44px;
  height: 44px;
  padding: 9px;
  display: grid;
  place-items: center;
}
body.hud-compact #commsActions #chatLauncher > span,
body.hud-compact #commsActions #chatLauncher kbd {
  display: none;
}
body.hud-compact #commsActions #chatUnread {
  position: absolute;
  right: -4px;
  top: -3px;
}
body.hud-compact #chatMiniOpen .chat-mock {
  display: none;
}
/* touch: the feed controls reach 44 px */
body.touch #commsDock .chat-mini-heading {
  height: 44px;
}
body.touch #chatMiniOpen {
  height: 44px;
  min-width: 44px;
}
body.touch .chat-row-controls button {
  width: 44px;
  height: 44px;
  border-color: transparent;
  background: radial-gradient(circle, rgba(9, 14, 15, 0.7) 0 13px, transparent 14px);
  -webkit-clip-path: none;
  clip-path: none;
}
/* Centre the capped feed in the free corridor, including on wide tablets. */
body.touch.hud-compact #commsDock {
  left: calc((100% + var(--sl) - var(--sr) - 122px) / 2);   /* centred between stick and the two-ring pad (2026-10-10; was 136) */
  right: auto;
  transform: translateX(-50%);
  width: min(460px, calc(100vw - 392px - var(--sl) - var(--sr)));
  max-width: none;
  bottom: calc(12px + var(--sb));
}
body #svc {
  bottom: calc(100dvh - var(--comms-top, 65vh) + 8px);
}

/* ------------------------------------------------------------------------------------------------- compact chrome */
/* Compact chrome preserves the live health bars and combat touch targets. */
body.hud-compact #pf {
  --c1: 9px;
  --c2: 9px;
  --deco: linear-gradient(var(--accent), var(--accent)) 9px 0 / 40px 2px no-repeat;
  left: calc(10px + var(--sl));
  top: calc(10px + var(--st));
  width: clamp(155px, 24vw, 205px);
  padding: 5px 8px 5px 5px;
  grid-template-columns: 31px minmax(0, 1fr);
  gap: 7px;
}
body.hud-compact .pilot-portrait {
  width: 31px;
  height: 34px;
}
body.hud-compact .pilot-portrait #pLv {
  font-size: 11px;
  line-height: 14px;
}
body.hud-compact .pilot-info {
  padding-top: 0;
}
body.hud-compact #pf .top {
  margin-bottom: 3px;
  line-height: 16px;
}
body.hud-compact #pf .name {
  font-size: 14px;
}
body.hud-compact #hpBar {
  height: 14px;
}
body.hud-compact #hpBar .num {
  font-size: 11px;
}
body.hud-compact #pf .row,
body.hud-compact .class-name,
body.hud-compact #tags,
body.hud-compact #keys,
body.hud-compact #touchHint,
body.hud-compact #portraitHint,
body.hud-compact #labels {
  display: none;
}
/* touch: the whole pilot plate is the "open Equipment" target (44 px+); the portrait stays a small inset picture */
body.touch .pilot-portrait {
  position: absolute;
  inset: 0;
  width: auto !important;
  height: auto !important;
  z-index: 0;
  overflow: visible;
  background: none;
  -webkit-clip-path: none;
  clip-path: none;
}
body.touch .pilot-portrait::before {
  content: "";
  position: absolute;
  left: var(--pp-x, 7px);
  top: var(--pp-y, 7px);
  width: var(--pp-w, 45px);
  height: var(--pp-h, 51px);
  background: radial-gradient(circle at 50% 32%, #2e3f44, #0b1112 78%);
  -webkit-clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
}
body.touch .pilot-portrait::after {
  inset: auto;
  left: var(--pp-x, 7px);
  top: var(--pp-y, 7px);
  width: var(--pp-w, 45px);
  height: var(--pp-h, 51px);
  background:
    linear-gradient(135deg, transparent 4.4px, var(--line-strong) 0 5.6px, transparent 0),
    linear-gradient(315deg, transparent 4.4px, var(--accent-dim) 0 5.6px, transparent 0);
}
body.touch .pilot-portrait img {
  left: calc(var(--pp-x, 7px) - var(--pp-w, 45px) * 0.15);
  top: calc(var(--pp-y, 7px) - var(--pp-h, 51px) * 0.04);
  width: calc(var(--pp-w, 45px) * 1.3);
  height: calc(var(--pp-h, 51px) * 1.3);
  -webkit-clip-path: inset(calc(var(--pp-h, 51px) * 0.04) calc(var(--pp-w, 45px) * 0.15) calc(var(--pp-h, 51px) * 0.26) calc(var(--pp-w, 45px) * 0.15));
  clip-path: inset(calc(var(--pp-h, 51px) * 0.04) calc(var(--pp-w, 45px) * 0.15) calc(var(--pp-h, 51px) * 0.26) calc(var(--pp-w, 45px) * 0.15));
}
body.touch .pilot-portrait #pLv {
  left: var(--pp-x, 7px);
  right: auto;
  top: calc(var(--pp-y, 7px) + var(--pp-h, 51px) - 15px);
  bottom: auto;
  width: var(--pp-w, 45px);
  line-height: 15px;
  font-size: 11px;
}
body.touch .pilot-portrait.is-pressed::after {
  box-shadow: inset 0 0 0 1px var(--accent);
}
body.touch .pilot-info {
  position: relative;
  z-index: 1;
  grid-column: 2;
  grid-row: 1;
  pointer-events: none;
}
body.touch #pf {
  --pp-x: 7px;
  --pp-y: 7px;
  --pp-w: 45px;
  --pp-h: 51px;
}
body.touch.hud-compact #pf {
  min-height: 44px;
}
body.hud-compact #pf {
  --pp-x: 5px;
  --pp-y: 5px;
  --pp-w: 31px;
  --pp-h: 34px;
}
/* Keep live level progress as a quiet edge line on small screens. */
body.hud-compact #expTrack {
  display: flex;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  gap: 0;
  pointer-events: none;
}
body.hud-compact #expTrack > span {
  display: none;
}
body.hud-compact #expBar {
  height: 3px;
  border: 0;
  border-radius: 0;
}
body.hud-compact #expBar::after {
  display: none;
}
body.hud-compact #tf {
  top: calc(10px + var(--st));
  left: 50%;
  width: clamp(150px, 24vw, 205px);
  transform: translateX(-50%);
  padding: 6px 10px 7px;
  gap: 5px;
}
body.hud-compact #tf .target-eyebrow,
body.hud-compact #tf .sub,
body.hud-compact #tf #tNote {
  display: none;
}
body.hud-compact #tName {
  font-size: 14px;
  line-height: 18px;
}
body.hud-compact #tLv {
  font-size: 12px;
}
body.hud-compact #tBar {
  height: 6px;
}
body:not(.touch) #toasts,
body.touch #toasts,
body.hud-compact #toasts {
  top: calc(var(--core-bottom, 228px) + 110px);
  pointer-events: none;
}
body.touch #toasts {
  top: calc(var(--core-bottom, 228px) + 160px);
}
body.hud-compact #toasts {
  left: calc(10px + var(--sl));
  width: min(240px, 30vw);
}
body.hud-compact .toast {
  padding: 5px 9px 5px 11px;
  font-size: 13px;
  line-height: 1.3;
}
body.hud-compact .toast:nth-last-child(n + 3) {
  display: none;
}
body.hud-compact #banner {
  top: 23%;
  padding: 8px 40px 10px;
}
body.hud-compact #banner b {
  font-size: clamp(22px, 4vw, 32px);
}
body.hud-compact #banner small {
  font-size: 13px;
}
body.hud-compact #svc {
  max-width: min(280px, calc(100vw - 24px));
  padding: 5px 12px 5px 16px;
  min-height: 44px;
}
body.hud-compact #svc b {
  font-size: 14px;
}
body.hud-compact #svc span {
  display: none;
}
body.hud-compact #previewMode {
  left: 50%;
}
body.touch.hud-compact #act {
  width: 270px !important;
  height: 202px !important;
  bottom: calc(16px + var(--sb));
  right: calc(12px + var(--sr));
  transform: scale(0.9);
  transform-origin: right bottom;
}
body.touch.hud-compact #bKit {
  left: 17px !important;
  top: 142px !important;
}
body.touch.hud-compact #bDash {
  left: 18px !important;
  top: 87px !important;
}
body.touch.hud-compact .auto-controls {
  left: 0;
  right: auto;
  top: 31px;
  height: 49px;
  gap: 3px;
}
body.touch.hud-compact #bAuto {
  width: 54px;
  min-width: 0;
  height: 49px;
  padding: 5px 4px 4px;
  flex-direction: column;
  font-size: 12px;
  gap: 2px;
}
body.touch.hud-compact #bAuto .icon {
  width: 20px;
  height: 20px;
}
body.touch.hud-compact #autoSettings {
  width: 49px;
}
/* landscape compact: AUTO sits where Rest used to be, so Rest goes on top of the utility column */
@media (orientation: landscape) {
  body.touch.hud-compact #bRest {
    left: 4px !important;
    top: -22px !important;
  }
  /* the "unlocks in the tutorial" note goes beside AUTO, not over Rest or the quest tracker */
  body.touch #bAuto:is(.locked, .is-locked, [data-locked="true"]) :is(.lock-note, small) {
    right: calc(100% + 6px);
    bottom: auto;
    top: 50%;
    transform: translateY(-50%);
  }
}
body.touch.hud-compact #stick {
  width: 100px;
  height: 100px;
  left: calc(70px + var(--sl));
  bottom: calc(28px + var(--sb));
  opacity: 0.55;
}
body.touch.hud-compact #stick.active {
  opacity: 0.95;
}
body.touch.hud-compact #knob {
  left: 28px;
  top: 28px;
}
/* landscape compact: toasts sit beside the left action stack, clear of the stick and the chat feed */
@media (orientation: landscape) {
  body.hud-compact #toasts,
  body.touch.hud-compact #toasts {
    top: calc(var(--core-bottom, 106px) + 8px);
    left: calc(64px + var(--sl));
    width: min(260px, 32vw);
  }
}
@media (max-height: 360px) and (orientation: landscape) {
  /* Leave the new left-stack button clear of the default movement stick. */
  body.touch.hud-compact #stick {
    left: calc(110px + var(--sl));
  }
  body.touch.hud-compact #commsDock {
    left: calc((100% + var(--sl) - var(--sr) - 82px) / 2);
    width: min(460px, calc(100vw - 432px - var(--sl) - var(--sr)));
  }
}
@media (max-width: 600px) and (orientation: portrait) {
  body.hud-compact {
    --map-width: 108px;
    --map-height: 114px;
    --portrait-target-width: clamp(100px, 26vw, 145px);
    /* Reserve the centre for the target, with a gap beside the player's frame. */
    --portrait-player-width: min(174px, calc((100vw - var(--sl) - var(--sr) - var(--portrait-target-width)) / 2 - 18px));
  }
  body.hud-compact.hud-map-collapsed {
    --map-width: 44px;
    --map-height: 44px;
  }
  body.hud-compact #tr #mm {
    height: 44px;
  }
  body.hud-compact #tr #zoneTag {
    height: 24px;
    min-height: 24px;
    padding-block: 3px;
    font-size: 11px;
  }
  body.hud-compact #hudToggle {
    top: calc(var(--hud-edge) + var(--st) + var(--map-height) + 8px);
    right: calc(var(--hud-edge) + var(--sr));
  }
  body.hud-compact #questTracker[data-open="false"] {
    top: calc(var(--hud-edge) + var(--st) + var(--map-height) + 60px);
    right: calc(var(--hud-edge) + var(--sr));
    width: 44px;
  }
  body.hud-compact #pf,
  body.hud-compact #core {
    width: var(--portrait-player-width);
  }
  body.hud-compact #tf {
    left: calc((100% + var(--sl) - var(--sr)) / 2);
    top: calc(10px + var(--st));
    width: var(--portrait-target-width);
    transform: translateX(-50%);
    padding: 5px 7px 6px;
    gap: 4px;
  }
  body.hud-compact #tf .top {
    gap: 4px;
  }
  body.hud-compact #tName {
    font-size: 12px;
    line-height: 16px;
    min-width: 0;
  }
  body.hud-compact #tLv {
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  body.hud-compact #tBar {
    height: 5px;
  }
  body.hud-compact #toasts {
    width: 168px;
  }
  body.hud-compact #commsDock,
  body.touch.hud-compact #commsDock {
    left: calc(12px + var(--sl));
    right: calc(12px + var(--sr));
    width: auto;
    max-width: none;
    transform: none;
    bottom: calc(227px + var(--sb));   /* 6 px above the two-ring touch pad (2026-10-10; was 205) */
  }
  body.hud-compact #questTracker[data-open="true"] {
    width: min(224px, calc(100vw - 24px));
    right: calc(12px + var(--sr));
  }
  body.hud-compact #questPanel {
    max-height: max(112px, calc(var(--comms-top, 60vh) - 22px - var(--st)));
  }
}
@media (orientation: portrait) {
  /* Rest sits left of AUTO, between the feed and the movement stick (it is back in the pad since 2026-10-09) */
  body.touch.hud-compact #bRest {
    left: -54px !important;
    top: 26px !important;
  }
  body.hud-compact #previewMode {
    top: auto;
    bottom: calc(6px + var(--sb));
    left: calc(12px + var(--sl));
    transform: none;
  }
}
@media (max-width: 520px) and (orientation: portrait) {
  /* Only the narrow portrait case needs smaller player/map chrome. */
  body.hud-compact {
    --map-width: clamp(90px, 20vw, 100px);
    --map-height: calc(var(--map-width) + 12px);
  }
  body.hud-compact.hud-map-collapsed {
    --map-width: 44px;
    --map-height: 44px;
  }
  body.hud-compact #pf {
    --pp-x: 4px;
    --pp-y: 4px;
    --pp-w: 26px;
    --pp-h: 34px;
    grid-template-columns: 26px minmax(0, 1fr);
    padding: 4px 6px 4px 4px;
    gap: 5px;
  }
  body.hud-compact .pilot-portrait {
    width: 26px;
    height: 34px;
  }
  body.hud-compact .pilot-portrait #pLv {
    font-size: 11px;
    line-height: 13px;
    letter-spacing: -0.04em;
  }
  body.hud-compact #pf .top {
    line-height: 16px;
  }
  body.hud-compact #pf .name {
    font-size: 13px;
    letter-spacing: 0.01em;
  }
  body.hud-compact #hpBar {
    height: 14px;
  }
  /* the stack keeps the accepted narrow-portrait meter (22 px) right under the 44 px pilot plate */
  body.hud-compact #core {
    top: calc(56px + var(--st));
    height: 22px;
    min-height: 22px;
    padding-block: 2px;
  }
}
@media (max-width: 400px) and (orientation: portrait) {
  body.hud-compact #tName {
    font-size: 11px;
  }
}
@media (max-width: 600px) and (max-height: 620px) and (orientation: portrait) {
  /* short phones: eight feed rows must still clear the left stack */
  body.hud-compact #commsDock .chat-mini-heading {
    margin-bottom: 0;
  }
  body.hud-compact #commsDock .chat-mini-line {
    font-size: 11px;
    height: 16px;
    line-height: 16px;
  }
  /* A taller feed leaves the right-hand quest button usable on short phones. */
  body.hud-compact #commsDock:has(#chatMini[data-rows="6"], #chatMini[data-rows="7"], #chatMini[data-rows="8"]) {
    right: calc(64px + var(--sr));
  }
}
@media (max-width: 360px) and (orientation: portrait) {
  body.touch.hud-compact #act {
    right: var(--sr);
  }
  body.touch.hud-compact #stick {
    left: calc(48px + var(--sl));
    bottom: calc(32px + var(--sb));
    width: 80px;
    height: 80px;
  }
  body.touch.hud-compact #knob {
    left: 18px;
    top: 18px;
  }
}

@media (max-height: 450px) and (orientation: landscape) {
  body.hud-compact {
    --map-height: 124px;
  }
  body.hud-compact.hud-map-collapsed {
    --map-height: 44px;
  }
  body.hud-compact #tr #mm {
    height: 52px;
  }
  body.hud-compact #questTracker[data-open="false"] {
    top: calc(62px + var(--st));
    right: calc(var(--hud-edge) + var(--sr) + var(--map-width) + 8px);
    width: 44px;
  }
}

/* On compact maps the controls float over the map instead of consuming its area. */
body.hud-compact #tr .map-heading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1;
  background: linear-gradient(rgba(9, 14, 15, 0.8), rgba(9, 14, 15, 0));
}
body.hud-compact #tr #mm {
  height: calc(var(--map-height) - 28px);
}
@media (max-width: 600px) and (orientation: portrait) {
  body.hud-compact #tr #mm {
    height: calc(var(--map-height) - 26px);
  }
}

/* ------------------------------------------------------------------------------------------------- touch pad: two rings */
/* User request 2026-10-10 (phone layout, every touch size, landscape and portrait):
   - skills 1-4 on an inner ring round Attack, 8:30 to 12 o'clock, 36° apart, 100 px from Attack's centre;
   - skill 5 and the shoulder skill on an outer half ring, 159 px out, at about 10 and 11 o'clock;
   - AUTO (now the size of a skill socket), Boost and Repair in one column on the left, AUTO on top;
   - no auto-settings button on touch (Main menu → Auto, or tap the Salvage Core);
   - Rest moves to the left stack under the fullscreen icon (js/ui-hud.js moves the element).
   Positions are in pad pixels before the per-size scale; every pair of tap circles is at least 7 px apart and no two
   socket boxes overlap. `html body.touch #act` outranks the older per-size position rules above and in
   interface.css, which stay only for the pad's own placement and scale. */
html body.touch #act#act {
  width: 258px !important;
  height: 227px !important;
}
html body.touch #act #bSkill0 { left: 91.9px !important; top: 175.8px !important; }
html body.touch #act #bSkill1 { left: 91.9px !important; top: 114px !important; }
html body.touch #act #bSkill2 { left: 128.2px !important; top: 64px !important; }
html body.touch #act #bSkill3 { left: 187px !important; top: 44.9px !important; }
html body.touch #act #bSkill4 { left: 61.7px !important; top: 47px !important; }
html body.touch #act #bShoulder { left: 117.3px !important; top: 2px !important; }
html body.touch #act #bAttack { left: 171px !important; top: 128.9px !important; }
html body.touch #act #bKit { left: 2px !important; top: 166.9px !important; }
html body.touch #act #bDash { left: 2px !important; top: 109.9px !important; }
html body.touch #act .auto-controls {
  position: absolute;
  left: 2px !important;
  right: auto !important;
  top: 52.9px !important;
  width: 49px;
  height: 49px;
  gap: 0;
  padding: 0;
}
html body.touch #act #autoSettings {
  display: none !important;
}
/* AUTO as a round socket: the plate is clipped to a circle and the box itself is round, so taps follow the shape */
html body.touch #act #bAuto {
  --c1: 0px;
  --c2: 0px;
  width: 49px;
  min-width: 0;
  height: 49px;
  padding: 0;
  border-radius: 50%;
  flex-direction: column;
  gap: 1px;
  font-size: 10px;
  letter-spacing: 0.06em;
}
html body.touch #act #bAuto::before {
  -webkit-clip-path: circle(50%);
  clip-path: circle(50%);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--bd), inset 0 0 0 4px rgba(4, 8, 9, 0.55);
}
html body.touch #act #bAuto .icon {
  width: 20px;
  height: 20px;
}
html body.touch #act #bAuto kbd {
  display: none;
}
html body.touch #act #bAuto:is(.locked, .is-locked, [data-locked="true"])::after {
  right: 6px;
  top: 6px;
  width: 11px;
  height: 11px;
}
/* Rest in the left stack: the fullscreen icon's 44 px plate, icon only (the name stays in its label) */
html body.touch #commsActions #bRest {
  --c1: 8px;
  --c2: 8px;
  --plate: none;
  position: relative !important;
  inset: auto !important;
  left: auto !important;
  top: auto !important;
  width: 44px !important;
  height: 44px !important;
  min-height: 44px;
  padding: 0;
  margin: 0;
  display: grid;
  place-items: center;
  border-radius: 0 !important;
  background: none;
  box-shadow: none;
  color: var(--text);
  isolation: isolate;
}
html body.touch #commsActions #bRest::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  -webkit-clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  border-radius: 0;
  -webkit-mask: none;
  mask: none;
  background: var(--fill, var(--hud-fill));
  box-shadow: inset 0 0 0 1px var(--bd, var(--hud-bd));
}
html body.touch #commsActions #bRest .action-icon {
  position: static;
  margin: 0;
  width: 26px;
  height: 26px;
}
html body.touch #commsActions #bRest .action-icon > .icon {
  width: 22px;
  height: 22px;
}
html body.touch #commsActions #bRest :is(.l, .k, .t) {
  display: none;
}
html body.touch #commsActions #bRest.on {
  --bd: var(--accent);
  color: var(--accent);
}
/* very short landscape phones (568 × 320): the two-ring pad's top would reach the minimap, so the pad sits lower and
   the map name rides on the map's bottom edge instead of under it (2026-10-10) */
@media (max-height: 360px) and (orientation: landscape) {
  html body.touch.hud-compact #act#act {
    bottom: calc(6px + var(--sb));
  }
  body.touch.hud-compact #tr #zoneTag {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    background: linear-gradient(90deg, rgba(9, 14, 15, 0.86), rgba(9, 14, 15, 0.55) 75%);
  }
}
