/* Dedicated Mobile & Portrait Touch HUD (Pillar 3): activates only under html[data-mobile="1"] (<900px viewport).
   Uses tokens only (T-HUD-51) and never sets overflow auto/scroll (T-HUD-02). */
#mobile-hud { display: none; position: fixed; inset: 0; pointer-events: none; z-index: 32; font: 13px/1.25 "Roboto Condensed", system-ui, sans-serif; color: var(--fg); }
#mobile-hud * { box-sizing: border-box; }
[data-mobile="1"] #mobile-hud { display: block; }
[data-mobile="1"] #hud, [data-mobile="1"] #p1-controls, [data-mobile="1"] #coach-card, [data-mobile="1"] #size-banner { display: none !important; }
[data-mobile="1"] #title-launcher section,
[data-mobile="1"] #skirmish-picker,
[data-mobile="1"] #settings-modal,
[data-mobile="1"] #p1-report,
[data-mobile="1"] #leaderboard-modal section {
  width: calc(92vw / var(--stage-k, 1)) !important;
  max-width: calc(92vw / var(--stage-k, 1)) !important;
  padding: 16px !important;
}
[data-mobile="1"] #campaign-overlay { padding: 12px !important; }
[data-mobile="1"] #p1-menu-pop { left: 50% !important; right: auto !important; transform: translateX(-50%) !important; top: calc(58px / var(--stage-k, 1)) !important; width: calc(88vw / var(--stage-k, 1)) !important; z-index: 60 !important; }
[data-mobile="1"] #replay-bar { top: calc(56px / var(--stage-k, 1)) !important; max-width: calc(96vw / var(--stage-k, 1)) !important; flex-wrap: wrap; justify-content: center; }

/* Mobile top bar */
.m-top { position: fixed; left: 0; right: 0; top: 0; height: 50px; padding: 0 8px; display: flex; align-items: center; justify-content: space-between; gap: 6px; background: var(--panel); border-bottom: 1px solid var(--line); pointer-events: auto; }
.m-stats { display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; min-width: 0; }
.m-pill { display: flex; flex-direction: column; line-height: 1.1; }
.m-pill small { font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }
.m-pill b { font-size: 13px; color: var(--fg); white-space: nowrap; }
.m-pill b.req { color: var(--zone); }
.m-pill b.ok { color: var(--live); }
.m-pill b.warn { color: var(--overload); }
.m-top-btns { display: flex; align-items: center; gap: 4px; flex: none; }
.m-btn { min-height: 36px; min-width: 36px; padding: 0 9px; background: var(--raise); color: var(--fg); border: 1px solid var(--line); border-radius: 4px; font: 700 12px/1 inherit; text-transform: uppercase; cursor: pointer; }
.m-btn.primary { background: var(--active); border-color: var(--sel); }
.m-btn.active { background: var(--active); border-color: var(--sel); color: var(--sel); }
.m-btn.danger { border-color: var(--cut); color: var(--cut); }

/* Right-side compact map controls */
.m-side { position: fixed; right: 8px; top: 58px; display: flex; flex-direction: column; gap: 6px; pointer-events: auto; }
.m-side .m-btn { width: 40px; height: 38px; padding: 0; font-size: 14px; }

/* Collapsible Objectives / Assets drawer */
.m-drawer { position: fixed; left: 8px; top: 58px; right: 56px; max-width: 320px; background: var(--panel-solid); border: 1px solid var(--sel); border-radius: 6px; padding: 10px 12px; pointer-events: auto; }
.m-drawer[hidden] { display: none; }
.m-drawer h3 { margin: 0 0 6px; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--sel); }
.m-drawer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.m-drawer li { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }

/* Armed placement banner */
.m-arm-banner { position: fixed; left: 8px; right: 8px; bottom: 158px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; background: var(--panel-solid); border: 1px solid var(--sel); border-radius: 6px; pointer-events: auto; }
.m-arm-banner[hidden] { display: none; }

/* Selected unit/building quick strip */
.m-sel { position: fixed; left: 8px; right: 8px; bottom: 158px; display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 8px 10px; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 6px; pointer-events: auto; }
.m-sel[hidden] { display: none; }
.m-sel-meta { min-width: 0; flex: 1; }
.m-sel-meta b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-sel-meta small { display: block; font-size: 11px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-sel-acts { display: flex; gap: 4px; flex: none; }

/* Mobile bottom dock */
.m-dock { position: fixed; left: 0; right: 0; bottom: 0; background: var(--panel); border-top: 1px solid var(--line); padding: 6px 8px 8px; pointer-events: auto; }
.m-tabs { display: flex; align-items: center; justify-content: space-between; gap: 3px; margin-bottom: 6px; }
.m-tab-row { display: flex; gap: 3px; min-width: 0; }
.m-tab { min-height: 30px; padding: 0 7px; background: var(--tile); color: var(--dim); border: 1px solid var(--line); border-radius: 4px; font: 700 10px/1 inherit; letter-spacing: 0.04em; cursor: pointer; white-space: nowrap; }
.m-tab[aria-selected="true"] { background: var(--active); border-color: var(--sel); color: var(--fg); }
.m-pager { display: flex; align-items: center; gap: 3px; font-size: 10px; color: var(--dim); flex: none; }
.m-pager[hidden] { display: none; }
.m-pager .m-btn { min-height: 28px; min-width: 24px; padding: 0 5px; font-size: 11px; }
.m-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.m-tile { position: relative; height: 96px; padding: 6px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; text-align: center; background: var(--tile); border: 1px solid var(--line); border-radius: 5px; color: var(--fg); cursor: pointer; }
.m-tile.armed { background: var(--active); border-color: var(--sel); }
.m-tile[aria-disabled="true"] { opacity: 0.45; }
.m-tile img { width: 32px; height: 32px; object-fit: contain; pointer-events: none; }
.m-tile .m-nm { font-size: 11px; line-height: 1.1; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.m-tile .m-cost { font-size: 11px; font-style: normal; color: var(--zone); font-weight: 700; }
.m-tile .m-cost.free { color: var(--live); }
