/* ---------- HUD ----------
   Corners carry the information (status top-start, dope top-end, weapon bottom-end), the
   middle stays clear for the scope picture. Physical layout is LTR whatever the language;
   #hud.mirror (left-handed touch layout) flips it through the logical insets below. */
#hud {
  --g-s: var(--gutter-l); --g-e: var(--gutter-r);
  --top: calc(16px + var(--safe-t)); --bot: calc(16px + var(--safe-b));
  --fire: 88px; --btn: 58px; --sm: 46px; --tool: 44px;
  --status-w: 210px; --dope-w: 200px; --drawer-w: 192px; --comp-w: min(300px, 40vw);
  --col: calc(var(--top) + 74px);                 /* top of the touch column under the status corner */
  --stick-r: clamp(54px, 14vh, 72px);
  position: fixed; inset: 0; pointer-events: none; direction: ltr;
  font-family: var(--f-data); color: var(--hud);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 0 10px rgba(0, 0, 0, 0.5);
}
#hud.mirror { direction: rtl; --g-s: var(--gutter-r); --g-e: var(--gutter-l); }
#hud .sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
#hud svg.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.hud-objective, .hud-hint, .hud-log div, .hud-msg, .shotcard, .computer, .st-word, .stance-ro span, .dope-grid span, .wind-txt .lab { unicode-bidi: plaintext; }
.hud-status b, .dope-grid b, .wind-txt b, .hud-weapon b, .steady b, .wind-path bdi { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }

/* status corner: stealth, objective, health, stamina, stance */
.hud-status { position: absolute; top: var(--top); inset-inline-start: var(--g-s); display: grid; gap: 6px; justify-items: start; max-width: min(320px, 36vw); }
.stealth { display: flex; align-items: center; gap: 7px; font: 600 12px var(--f-body); letter-spacing: 0.03em; padding: 2px 9px 2px 6px; margin-inline-start: -6px; border-radius: 12px; }
.stealth .ic { width: 20px !important; height: 20px !important; }
.st-bar { display: block; width: 58px; height: 4px; background: rgba(0, 0, 0, 0.45); border: 1px solid rgba(242, 239, 227, 0.3); }
.st-bar b { display: block; height: 100%; background: currentColor; transform-origin: left center; transform: scaleX(0); }
#hud.mirror .st-bar b { transform-origin: right center; }
.stealth[data-state="hidden"] { color: var(--hud-dim); }
.stealth[data-state="suspicious"] { color: var(--amber); }
.stealth[data-state="suspicious"] .ic { animation: stPulse 1.1s ease-in-out infinite alternate; }
.stealth[data-state="spotted"] { color: #fff7ee; background: var(--alert); text-shadow: none; box-shadow: 0 0 14px rgba(255, 70, 40, 0.6); }
.stealth[data-state="spotted"] .st-bar { border-color: rgba(255, 255, 255, 0.6); background: rgba(0, 0, 0, 0.25); }
@keyframes stPulse { from { opacity: 0.45; } to { opacity: 1; } }
.hud-edge { position: absolute; inset: 0; opacity: 0; transition: opacity 0.7s; will-change: opacity; }
.hud-edge[data-state="suspicious"] { opacity: 1; box-shadow: inset 0 0 60px rgba(242, 179, 61, 0.26); }
.hud-edge[data-state="spotted"] { opacity: 1; box-shadow: inset 0 0 80px 6px rgba(255, 60, 30, 0.42); animation: edgeIn 0.42s ease-in-out 4 alternate; }
@keyframes edgeIn { from { opacity: 1; } to { opacity: 0.35; } }
.hud-objective { font: 500 14px var(--f-body); line-height: 1.45; }
.hud-objective > div { unicode-bidi: plaintext; }
.hud-objective b { font-family: var(--f-data); color: var(--amber); margin-inline-start: 0.4em; }
.vitals { display: flex; gap: 12px; align-items: center; }
.vitals:not(:has(> :not([hidden]))) { display: none; }
.vbar { display: flex; align-items: center; gap: 5px; }
.vbar .ic { width: 13px !important; height: 13px !important; }
.vbar i { display: block; width: 76px; height: 5px; background: rgba(0, 0, 0, 0.5); border: 1px solid rgba(242, 239, 227, 0.35); }
.vbar b { display: block; height: 100%; width: 100%; transform-origin: left center; }
#hud.mirror .vbar b { transform-origin: right center; }
.vb-health { color: #9ed48a; } .vb-health b { background: #9ed48a; }
.vb-health.hurt, .vb-health.hurt b { color: var(--alert); background: var(--alert); }
.vb-health.hurt { background: none; }
.vb-stamina { color: var(--amber); } .vb-stamina b { background: var(--amber); } .vb-stamina b.low { background: var(--alert); }
.stance-ro { display: flex; align-items: center; gap: 6px; font: 500 12px var(--f-body); color: var(--hud-dim); }
.stance-ro .ic { width: 20px !important; height: 20px !important; color: var(--hud); }

/* dope corner: wind meter and the instrument strip */
.hud-dope { position: absolute; top: var(--top); inset-inline-end: var(--g-e); display: grid; gap: 6px; justify-items: end; }
.wind-row { display: flex; align-items: center; gap: 9px; }
.wind-dial { position: relative; width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid rgba(242, 239, 227, 0.55); background: rgba(0, 0, 0, 0.28); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); }
.wind-dial::before { content: ""; position: absolute; left: 50%; top: -1px; width: 2px; height: 5px; margin-left: -1px; background: var(--hud); }
.wind-dial i { position: absolute; inset: 0; transition: transform 0.4s ease-out; }
.wind-dial i::before { content: ""; position: absolute; left: 50%; top: 9px; bottom: 6px; width: 2px; margin-left: -1px; background: var(--amber); }
.wind-dial i::after { content: ""; position: absolute; left: 50%; top: 4px; margin-left: -4.5px; border-left: 4.5px solid transparent; border-right: 4.5px solid transparent; border-bottom: 7px solid var(--amber); }
.wind-dial.calm i { opacity: 0.25; }
.wind-txt { display: grid; justify-items: end; line-height: 1.15; }
.wind-txt .lab { font: 500 10.5px var(--f-body); color: var(--hud-dim); letter-spacing: 0.04em; }
.wind-txt b { font-size: 20px; font-weight: 600; color: var(--amber); }
.wind-path { display: grid; justify-items: end; font-size: 12px; color: var(--hud); }
.wind-env { font-size: 11.5px; color: var(--hud-dim); direction: ltr; }
.dope-grid { display: grid; grid-template-columns: repeat(4, auto); gap: 0 14px; padding-top: 5px; border-top: 1px solid rgba(242, 239, 227, 0.28); }
.dope-grid .ro { display: grid; justify-items: start; line-height: 1.2; }
.dope-grid span { font: 500 10.5px var(--f-body); color: var(--hud-dim); letter-spacing: 0.04em; }
.dope-grid b { font-size: 17px; font-weight: 600; white-space: nowrap; }

/* weapon (keyboard and mouse layout) */
.hud-weapon { position: absolute; bottom: var(--bot); inset-inline-end: var(--g-e); display: grid; justify-items: end; line-height: 1.1; }
#ro-rifle { font: 600 12px var(--f-data); color: var(--hud-dim); letter-spacing: 0.08em; }
#ro-ammo { font-size: 30px; font-weight: 600; color: var(--amber); }

/* messages: hint, log, transient notices */
.hud-stack { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--bot) + 34px); width: min(620px, calc(100% - 560px)); min-width: 300px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.hud-hint {
  background: rgba(12, 15, 12, 0.74); border-bottom: 3px solid var(--amber); padding: 7px 14px; max-width: 100%;
  font: 500 14.5px var(--f-body); line-height: 1.5; text-shadow: none; text-align: center;
}
#hud.card-on .hud-hint { display: none; }
.hud-log { display: grid; gap: 4px; justify-items: center; }
.hud-log div { background: rgba(12, 15, 12, 0.6); padding: 3px 12px; font: 500 14px var(--f-body); text-shadow: none; animation: logIn 0.18s ease-out; text-align: center; }
.hud-log div.good { color: #bfe8a8; }
.hud-log div.bad { color: #ffb4a2; }
.hud-log div.alert { color: #1a0c08; background: var(--alert); font-weight: 600; }
.hud-log div.out { opacity: 0; transition: opacity 0.6s; }
@keyframes logIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.hud-msg { background: rgba(12, 15, 12, 0.7); padding: 6px 16px; font: 500 15px var(--f-body); text-shadow: none; }
.steady { position: absolute; left: 50%; transform: translateX(-50%); bottom: var(--bot); display: flex; align-items: center; gap: 7px; padding: 3px 10px; border-radius: 12px; background: rgba(12, 15, 12, 0.42); font: 500 11px var(--f-body); color: var(--hud-dim); }
.steady i { display: block; width: 78px; height: 5px; background: rgba(0, 0, 0, 0.5); border: 1px solid rgba(242, 239, 227, 0.35); }
.steady i b { display: block; height: 100%; background: var(--hud); transform-origin: left center; }
.steady i b.low { background: var(--alert); }
.steady .ic { width: 12px !important; height: 12px !important; color: var(--alert); }
.steady > b { font-size: 13px; color: var(--hud); min-width: 3ch; }

.markers { position: absolute; inset: 0; overflow: hidden; }
.mk { position: absolute; left: 0; top: 0; display: grid; justify-items: center; font: 600 11px var(--f-data); color: var(--amber); white-space: nowrap; will-change: transform; }
.mk::after { content: ""; width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 7px solid var(--amber); filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.9)); }
.hipdot { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: rgba(242, 239, 227, 0.85); box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.5), 0 0 0 9px rgba(242, 239, 227, 0.08); }
.threat { position: absolute; left: 0; top: 0; width: 0; height: 0; will-change: transform; }
.threat::before { content: ""; position: absolute; left: -11px; top: -22px; border-left: 11px solid transparent; border-right: 11px solid transparent; border-top: 18px solid var(--alert); filter: drop-shadow(0 0 6px rgba(255, 60, 30, 0.9)); animation: threatPulse 0.45s ease-in-out infinite alternate; }
@keyframes threatPulse { from { opacity: 0.45; } to { opacity: 1; } }

/* shot analysis card and ballistic computer: printed field cards */
.shotcard {
  position: absolute; inset-inline-start: var(--g-s); bottom: var(--bot); width: min(260px, 44vw);
  padding: 10px 12px; text-shadow: none; font: 400 12.5px var(--f-data); animation: logIn 0.2s ease-out;
}
.shotcard h4, .computer h4 { margin: 0 0 6px; font: 700 15px var(--f-display); border-bottom: 1.5px solid var(--ink); padding-bottom: 4px; display: flex; justify-content: space-between; gap: 8px; }
.computer h4 span:last-child, .shotcard h4 span:last-child { font: 600 11px var(--f-data); align-self: center; white-space: nowrap; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.computer h4 span:first-child { white-space: nowrap; }
.shotcard .res { font: 600 13px var(--f-body); margin-bottom: 6px; }
.shotcard .res.miss { color: var(--pencil); }
.kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 10px; }
.kv span { font-family: var(--f-body); color: var(--ink-2); font-size: 12px; }
.kv b { font-weight: 600; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; text-align: end; }

.computer {
  position: absolute; inset-inline-end: var(--g-e); top: calc(var(--top) + 118px); width: min(300px, 62vw); max-height: calc(100% - 118px - 120px - var(--safe-t) - var(--safe-b)); overflow-y: auto;
  padding: 10px 12px; text-shadow: none; font: 400 12.5px var(--f-data); pointer-events: auto; overscroll-behavior: contain;
}
.computer .sol { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.computer .sol div { border: 1.5px solid var(--ink); padding: 4px 8px; min-width: 0; }
.computer .sol span { display: block; font: 500 11px var(--f-body); color: var(--ink-2); }
.computer .sol b { font-size: 21px; font-weight: 600; direction: ltr; unicode-bidi: isolate; display: block; white-space: nowrap; }
.computer .sol small { font-size: 11px; color: var(--ink-2); direction: ltr; unicode-bidi: isolate; display: block; }
.computer .hintline { font: 400 11px var(--f-body); color: var(--ink-2); margin-top: 8px; line-height: 1.45; }
.computer .keyhints { display: grid; grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); gap: 2px 6px; margin-top: 8px; font: 400 11px var(--f-body); color: var(--ink-2); align-items: baseline; }
.computer .keyhints kbd { font: 600 11px var(--f-data); color: var(--ink); direction: ltr; white-space: nowrap; }
.computer .msg { font: 500 13px var(--f-body); color: var(--pencil); margin: 8px 0; line-height: 1.45; }
.computer .btn { min-height: 38px; padding: 4px 10px; font-size: 13px; flex: 1 1 auto; }
.computer .btn.close { flex: 0 0 44px; padding: 0; font-family: var(--f-data); }
.computer .btn-row { margin: 0 0 8px; gap: 6px; flex-wrap: nowrap; }
.computer .step { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 4px; min-height: 34px; }
.computer .step > span:first-child { font: 500 12px var(--f-body); color: var(--ink-2); }
.computer .step .ctl { display: flex; align-items: center; gap: 6px; direction: ltr; }
.computer .step b { direction: ltr; unicode-bidi: isolate; min-width: 7ch; text-align: center; }
.computer .step button { width: 34px; height: 34px; border: 1.5px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer; font: 600 16px var(--f-data); border-radius: 2px; touch-action: manipulation; }
.computer .step button:active { background: var(--ink); color: var(--paper); }
table.card { width: 100%; border-collapse: collapse; margin-top: 8px; direction: ltr; font-variant-numeric: tabular-nums; }
table.card th { font: 500 10.5px var(--f-body); color: var(--ink-2); text-align: right; padding: 2px 4px; border-bottom: 1.5px solid var(--ink); }
table.card td { text-align: right; padding: 1.5px 4px; border-bottom: 1px solid var(--rule); }
table.card tr.near td { background: rgba(179, 49, 29, 0.16); font-weight: 600; }
table.card tr.sub td { color: var(--ink-2); }

.camhud { position: absolute; left: 50%; bottom: calc(26px + var(--safe-b)); transform: translateX(-50%); display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; direction: ltr; width: min(760px, calc(100% - 32px)); }
.camhud div { display: grid; justify-items: center; }
.camhud span { font: 500 10.5px var(--f-body); color: var(--hud-dim); letter-spacing: 0.1em; }
.camhud b { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.camhud .skip { flex-basis: 100%; text-align: center; font: 400 12px var(--f-body); color: var(--hud-dim); }
#hud.cam-on .hud-status, #hud.cam-on .hud-dope, #hud.cam-on .hud-stack, #hud.cam-on .hud-weapon, #hud.cam-on .steady { visibility: hidden; }

/* ---------- touch controls ---------- */
.touch { position: absolute; inset: 0; pointer-events: none; text-shadow: none; }
.tb {
  position: absolute; pointer-events: auto; touch-action: none; cursor: pointer; -webkit-touch-callout: none;
  width: var(--btn); height: var(--btn); border-radius: 50%; padding: 0;
  border: 1.5px solid rgba(242, 239, 227, 0.5); background: rgba(14, 18, 14, 0.44); color: var(--hud);
  display: grid; place-items: center; align-content: center; gap: 1px;
  font: 600 10.5px var(--f-body); line-height: 1.1; letter-spacing: 0.02em;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22); transition: background 0.1s, border-color 0.1s, transform 0.08s;
}
.tb svg.ic { width: 22px; height: 22px; }
.tb.down { background: rgba(242, 179, 61, 0.42); border-color: var(--amber); transform: scale(0.96); }
.tb span { white-space: nowrap; }

/* right thumb: trigger cluster */
.tb-fire {
  width: var(--fire); height: var(--fire); inset-inline-end: var(--g-e); bottom: var(--bot);
  border: 2px solid rgba(255, 98, 71, 0.85); background: radial-gradient(circle at 50% 40%, rgba(196, 58, 34, 0.55), rgba(120, 30, 16, 0.5));
  font: 700 15px var(--f-display); letter-spacing: 0.04em;
}
.tb-fire::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; border: 1px solid rgba(255, 220, 200, 0.28); }
.tb-fire::after {
  content: ""; position: absolute; inset: -7px; border-radius: 50%; opacity: 0; transition: opacity 0.15s;
  background: conic-gradient(var(--amber) calc(var(--air, 1) * 360deg), rgba(242, 239, 227, 0.14) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px));
}
.tb-fire.holding::after { opacity: 1; }
.tb-fire.down { background: radial-gradient(circle at 50% 40%, rgba(242, 179, 61, 0.6), rgba(150, 50, 20, 0.55)); border-color: var(--amber); transform: scale(0.97); }
.tb-fire.cancel { background: rgba(40, 40, 40, 0.5); border-color: var(--hud-dim); color: var(--hud-dim); text-decoration: line-through; }
.tb-scope { inset-inline-end: calc(var(--g-e) + var(--fire) + 14px); bottom: calc(var(--bot) + 2px); }
#hud.is-scoped .tb-scope { background: rgba(242, 239, 227, 0.2); border-color: var(--hud); }
.tb-smart { inset-inline-end: calc(var(--g-e) + var(--fire) + 14px); bottom: calc(var(--bot) + var(--btn) + 16px); display: none; border-color: var(--amber); color: var(--amber); background: rgba(40, 30, 10, 0.42); }
#hud.is-scoped:not(.is-sidearm) .tb-smart { display: grid; }
.tb-reload { width: var(--sm); height: var(--sm); inset-inline-end: calc(var(--g-e) + var(--fire) + var(--btn) + 26px); bottom: calc(var(--bot) + 8px); display: none; font-size: 9.5px; }
.tb-reload svg.ic { width: 18px; height: 18px; }
#hud.can-reload .tb-reload { display: grid; }
#hud.mag-empty .tb-reload { border-color: var(--amber); color: var(--amber); animation: stPulse 0.7s ease-in-out infinite alternate; }

/* zoom slider (scoped only): top = most magnification */
.tb-zoom {
  position: absolute; pointer-events: auto; touch-action: none; width: 44px;
  inset-inline-end: calc(var(--g-e) + (var(--fire) - 44px) / 2);
  top: max(calc(var(--top) + 72px), calc(100% - var(--bot) - var(--fire) - 14px - 300px)); bottom: calc(var(--bot) + var(--fire) + 14px);
  display: none; flex-direction: column; align-items: center; gap: 4px;
}
#hud.is-scoped:not(.no-zoom) .tb-zoom { display: flex; }
.zb { width: 44px; height: 36px; flex: none; border-radius: 15px; border: 1.5px solid rgba(242, 239, 227, 0.45); background: rgba(14, 18, 14, 0.36); color: var(--hud); font: 600 17px var(--f-data); padding: 0; touch-action: none; cursor: pointer; }
.zb.down { background: rgba(242, 179, 61, 0.42); }
.zoom-track { position: relative; flex: 1; width: 44px; min-height: 40px; touch-action: none; cursor: ns-resize; }
.zoom-track::before { content: ""; position: absolute; left: 50%; top: 4px; bottom: 4px; width: 4px; margin-left: -2px; border-radius: 2px; background: rgba(242, 239, 227, 0.35); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35); }
.zoom-knob { position: absolute; left: 2px; right: 2px; height: 26px; top: calc((1 - var(--f, 0)) * (100% - 26px)); border-radius: 13px; display: grid; place-items: center; background: rgba(14, 18, 14, 0.78); border: 1.5px solid var(--amber); color: var(--amber); font: 600 10.5px var(--f-data); direction: ltr; }
.tb-zoom.down .zoom-knob { background: rgba(242, 179, 61, 0.35); color: var(--hud); }

/* top-end corner: pause */
.tb-pause { width: 44px; height: 44px; inset-inline-end: var(--g-e); top: var(--top); }
.tb-pause svg.ic { width: 18px; height: 18px; stroke-width: 2.4; }

/* left thumb: tools drawer, stance, weapon */
.tb-tools { width: var(--tool); height: var(--tool); inset-inline-start: var(--g-s); top: var(--col); }
.tb-tools.on { background: rgba(242, 239, 227, 0.22); border-color: var(--hud); }
.tb-stance { inset-inline-start: var(--g-s); top: calc(var(--col) + var(--tool) + 10px); }
.tb-stance svg.ic { width: 28px; height: 28px; stroke-width: 2; }
.tb-stance span { font-size: 9.5px; }
.tb-weapon {
  width: auto; min-width: 108px; height: 46px; border-radius: 23px; padding: 0 12px;
  inset-inline-start: calc(var(--g-s) + var(--btn) + 10px); top: calc(var(--col) + var(--tool) + 10px + (var(--btn) - 46px) / 2);
  grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: 8px; justify-items: start;
}
.tb-weapon .w-name { grid-area: 1 / 1; font: 600 10px var(--f-data); letter-spacing: 0.06em; color: var(--hud-dim); direction: ltr; max-width: 92px; overflow: hidden; text-overflow: ellipsis; }
.tb-weapon .w-ammo { grid-area: 2 / 1; font: 600 15px var(--f-data); color: var(--amber); direction: ltr; font-variant-numeric: tabular-nums; }
.tb-weapon svg.ic { grid-area: 1 / 2 / 3 / 3; width: 18px; height: 18px; color: var(--hud-dim); }
.touch.drawer-open .tb-weapon { visibility: hidden; }

.drawer {
  position: absolute; pointer-events: auto; touch-action: none; inset-inline-start: calc(var(--g-s) + var(--btn) + 8px); top: var(--col);
  padding: 8px; display: grid; gap: 8px; justify-items: center;
  background: rgba(12, 15, 12, 0.8); border: 1px solid rgba(242, 239, 227, 0.22); border-radius: 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}
.turret-pad { display: grid; grid-template-columns: repeat(3, 40px); grid-template-rows: repeat(3, 40px); gap: 4px; direction: ltr; }
.tp, .dg { border: 1.5px solid rgba(242, 239, 227, 0.4); background: rgba(242, 239, 227, 0.06); color: var(--hud); border-radius: 9px; padding: 0; cursor: pointer; touch-action: none; font: 600 14px var(--f-data); }
.tp.down, .dg.down { background: rgba(242, 179, 61, 0.42); border-color: var(--amber); }
.t-up { grid-area: 1 / 2; } .t-left { grid-area: 2 / 1; } .t-zero { grid-area: 2 / 2; font: 600 11px var(--f-body); } .t-right { grid-area: 2 / 3; } .t-down { grid-area: 3 / 2; }
.drawer-grid { display: grid; grid-template-columns: repeat(3, 54px); gap: 5px; }
.dg { height: 44px; display: grid; place-items: center; align-content: center; gap: 2px; font: 600 9.5px var(--f-body); }
.dg svg.ic { width: 18px; height: 18px; }

/* floating movement stick */
.stick-ghost { position: absolute; inset-inline-start: calc(var(--g-s) + 36px); bottom: calc(var(--bot) + 22px); width: calc(var(--stick-r) * 2); height: calc(var(--stick-r) * 2); border-radius: 50%; border: 1.5px dashed rgba(242, 239, 227, 0.2); display: grid; place-items: center; }
.stick-ghost i { width: 40px; height: 40px; border-radius: 50%; background: rgba(242, 239, 227, 0.1); }
#hud.stick-known .stick-ghost { display: none; }
.stick { position: absolute; left: 0; top: 0; width: 0; height: 0; will-change: transform; }
.stick::before { content: ""; position: absolute; left: calc(var(--stick-r) * -1); top: calc(var(--stick-r) * -1); width: calc(var(--stick-r) * 2); height: calc(var(--stick-r) * 2); border-radius: 50%; border: 2px solid rgba(242, 239, 227, 0.4); background: rgba(14, 18, 14, 0.22); box-sizing: border-box; }
.stick-knob { position: absolute; left: -23px; top: -23px; width: 46px; height: 46px; border-radius: 50%; background: rgba(242, 239, 227, 0.42); border: 1.5px solid rgba(242, 239, 227, 0.75); will-change: transform; }
.stick.sprint::before { border-color: var(--amber); box-shadow: 0 0 16px rgba(242, 179, 61, 0.45); }
.stick.sprint .stick-knob { background: rgba(242, 179, 61, 0.6); border-color: var(--amber); }

/* keyboard and mouse: a little larger, there is room */
#hud:not(.has-touch) .stealth { font-size: 13.5px; }
#hud:not(.has-touch) .hud-objective { font-size: 15.5px; }
#hud:not(.has-touch) .stance-ro { font-size: 13px; color: var(--hud); }
#hud:not(.has-touch) .vbar i { width: 96px; height: 6px; }
#hud:not(.has-touch) .dope-grid span { font-size: 11.5px; }
#hud:not(.has-touch) .dope-grid b { font-size: 19px; }
#hud:not(.has-touch) .wind-txt b { font-size: 22px; }
#hud:not(.has-touch) .wind-dial { width: 36px; height: 36px; }

/* phone layout of the information */
#hud.has-touch .hud-status { max-width: var(--status-w); gap: 4px; }
#hud.has-touch .hud-objective { font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 0 10px; line-height: 1.35; }
#hud.has-touch .stance-ro, #hud.has-touch .hud-weapon, #hud.has-touch .wind-env { display: none; }
#hud.has-touch .vbar i { width: 54px; }
#hud.has-touch .hud-dope { inset-inline-end: calc(var(--g-e) + 106px); gap: 4px; max-width: var(--dope-w); }
#hud.has-touch .wind-dial { width: 28px; height: 28px; }
#hud.has-touch .wind-txt b { font-size: 16px; }
#hud.has-touch .wind-txt .lab { display: none; }
#hud.has-touch .wind-path { font-size: 11px; }
#hud.has-touch .dope-grid { gap: 0 9px; padding-top: 3px; }
#hud.has-touch .dope-grid span { font-size: 9.5px; }
#hud.has-touch .dope-grid b { font-size: 13.5px; }
#hud.has-touch .hud-stack {
  top: var(--top); bottom: auto; left: auto; transform: none; width: auto; min-width: 0; gap: 4px;
  inset-inline-start: calc(var(--g-s) + var(--status-w) + 12px); inset-inline-end: calc(var(--g-e) + 106px + var(--dope-w) + 16px);
}
#hud.has-touch .steady { gap: 6px; padding: 2px 8px; font-size: 10px; }
#hud.has-touch .steady i { width: 60px; }
/* the stack never grows past the middle of the picture: the oldest log lines give way first */
#hud.has-touch .hud-stack { max-height: 58%; overflow: hidden; }
#hud.has-touch .hud-stack > * { flex: none; }
#hud.has-touch .hud-stack > .hud-log { flex: 0 1 auto; min-height: 0; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
#hud.has-touch .hud-hint { font-size: 12.5px; line-height: 1.45; padding: 5px 10px; border-bottom-width: 2px; }
#hud.has-touch .hud-log div { font-size: 12.5px; padding: 2px 9px; }
#hud.has-touch .hud-msg { font-size: 13px; padding: 4px 12px; }
#hud.has-touch .shotcard { position: static; width: 100%; padding: 5px 9px; font-size: 11px; }
#hud.has-touch .shotcard h4 { display: none; }
#hud.has-touch .shotcard .res { margin-bottom: 2px; font-size: 12px; }
#hud.has-touch .shotcard .kv { display: flex; flex-wrap: wrap; gap: 0 5px; }
#hud.has-touch .shotcard .kv span { font-size: 11px; }
#hud.has-touch .shotcard .kv b { margin-inline-end: 7px; }
#hud.has-touch .computer {
  inset-inline-start: var(--g-s); inset-inline-end: auto; top: var(--top); max-height: calc(100% - var(--top) - var(--bot));
  width: var(--comp-w); padding: 8px 10px; z-index: 2;
}
#hud.has-touch .computer h4 span:last-child { display: none; }
#hud.has-touch .computer .sol { margin: 6px 0; }
#hud.has-touch .computer .sol b { font-size: 18px; }
/* side panels push the top message stack and the breath meter out of their way */
#hud.has-touch.drawer-open .hud-stack { inset-inline-start: calc(var(--g-s) + var(--btn) + 8px + var(--drawer-w) + 12px); }
#hud.has-touch.comp-open .hud-stack { inset-inline-start: calc(var(--g-s) + var(--comp-w) + 12px); }
#hud.has-touch.comp-open .steady { left: auto; transform: none; inset-inline-start: calc(var(--g-s) + var(--comp-w) + 12px); }
#hud.has-touch.comp-open .hud-status, #hud.comp-open .tb-tools, #hud.comp-open .tb-stance, #hud.comp-open .tb-weapon, #hud.comp-open .stick-ghost, #hud.comp-open .drawer { visibility: hidden; }
#hud.has-touch .camhud { top: var(--top); bottom: auto; gap: 2px 16px; width: calc(100% - 2 * (var(--g-e) + 50px)); }
#hud.has-touch .camhud b { font-size: 17px; }
#hud.cam-on .touch > :not(.tb-fire):not(.stick) { visibility: hidden; }

/* portrait phones: ask for landscape instead of a broken layout */
.rotate-hint { display: none; position: fixed; inset: 0; z-index: 30; pointer-events: auto; place-items: center; align-content: center; gap: 16px; padding: 24px; background: rgba(8, 11, 8, 0.93); text-align: center; text-shadow: none; }
.rotate-hint svg.ic { width: 72px !important; height: 72px !important; stroke-width: 1.4; color: var(--amber); animation: rotPhone 2.6s ease-in-out infinite; }
.rotate-hint p { margin: 0; font: 600 18px var(--f-display); color: var(--hud); max-width: 22ch; unicode-bidi: plaintext; }
@keyframes rotPhone { 0%, 30% { transform: rotate(0); } 55%, 85% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }
@media (orientation: portrait) {
  #hud.has-touch .rotate-hint { display: grid; }
  #hud.has-touch > :not(.rotate-hint) { visibility: hidden; }
}

/* short phones */
@media (max-height: 370px) {
  #hud { --fire: 82px; --btn: 54px; --sm: 44px; }
}
/* tablets */
@media (min-width: 1000px) and (min-height: 640px) {
  #hud.has-touch { --fire: 104px; --btn: 68px; --sm: 54px; --tool: 52px; --status-w: 280px; --dope-w: 260px; --col: calc(var(--top) + 96px); --g-s: calc(var(--gutter-l) + 8px); --g-e: calc(var(--gutter-r) + 8px); }
  #hud.has-touch.mirror { --g-s: calc(var(--gutter-r) + 8px); --g-e: calc(var(--gutter-l) + 8px); }
  #hud.has-touch .tb { font-size: 12px; }
  #hud.has-touch .tb svg.ic { width: 26px; height: 26px; }
  #hud.has-touch .tb-fire { font-size: 18px; }
  #hud.has-touch .hud-objective { font-size: 14px; }
  #hud.has-touch .dope-grid b { font-size: 16px; }
  #hud.has-touch .wind-txt b { font-size: 19px; }
  #hud.has-touch .hud-hint { font-size: 14px; }
  #hud.has-touch .tb-zoom { width: 52px; inset-inline-end: calc(var(--g-e) + (var(--fire) - 52px) / 2); }
  #hud.has-touch .zoom-track { width: 52px; }
  #hud.has-touch .zb { width: 48px; height: 36px; }
  .turret-pad { grid-template-columns: repeat(3, 48px); grid-template-rows: repeat(3, 48px); }
  .drawer-grid { grid-template-columns: repeat(3, 64px); }
  .dg { height: 52px; font-size: 11px; }
  #hud.has-touch { --comp-w: min(340px, 34vw); --drawer-w: 222px; }
  /* the left column sits just above the thumb instead of under the status corner */
  #hud.has-touch .tb-stance { top: auto; bottom: calc(var(--bot) + 2 * var(--stick-r) + 64px); }
  #hud.has-touch .tb-weapon { top: auto; bottom: calc(var(--bot) + 2 * var(--stick-r) + 64px + (var(--btn) - 46px) / 2); }
  #hud.has-touch .tb-tools { top: auto; bottom: calc(var(--bot) + 2 * var(--stick-r) + 64px + var(--btn) + 12px); }
  #hud.has-touch .drawer { top: auto; bottom: calc(var(--bot) + 2 * var(--stick-r) + 64px); }
  #hud.has-touch .hud-status { gap: 7px; }
  #hud.has-touch .stealth { font-size: 14px; }
  #hud.has-touch .vbar i { width: 80px; height: 6px; }
}
@media (max-width: 720px) and (pointer: fine) {
  .hud-objective { font-size: 12.5px; }
  .dope-grid b { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  .hud-log div, .shotcard, .hud-edge, .stealth .ic, .rotate-hint svg.ic, #hud.mag-empty .tb-reload { animation: none !important; }
}

/* shot card: one quiet line; a tap opens the breakdown */
.shotcard { pointer-events: auto; cursor: pointer; }
.shotcard:not(.open) { width: auto !important; padding: 3px 10px !important; background: rgba(12, 15, 12, 0.6); color: var(--hud); border: 0; box-shadow: none; }
.shotcard:not(.open) .sc-full { display: none; }
.shotcard.open .sc-brief { display: none; }
.sc-brief { all: unset; display: flex; gap: 10px; align-items: baseline; font: 500 12px var(--f-data); direction: ltr; white-space: nowrap; cursor: pointer; }
.sc-brief b { font-weight: 600; color: var(--amber, #f0b23a); }
.sc-brief i { font: 500 11px var(--f-body); font-style: normal; opacity: 0.7; text-decoration: underline; }
#hud.has-touch .shotcard.open { position: static; width: 100%; }

/* full screen: the familiar corner brackets, beside pause */
.tb-full { width: 44px; height: 44px; inset-inline-end: calc(var(--g-e) + 52px); top: var(--top); }
.tb-full svg.ic { width: 18px; height: 18px; stroke-width: 2.4; }
.fs-btn { position: fixed; top: max(10px, env(safe-area-inset-top)); inset-inline-end: max(10px, env(safe-area-inset-right)); z-index: 60; width: 44px; height: 44px; display: grid; place-items: center;
  border: 1.5px solid rgba(255, 255, 255, 0.55); border-radius: 8px; background: rgba(12, 15, 12, 0.55); color: #fff; cursor: pointer; padding: 0; }
.fs-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.fs-btn[hidden] { display: none; }
.fs-toast { position: fixed; left: 50%; transform: translateX(-50%); top: max(62px, calc(env(safe-area-inset-top) + 56px)); z-index: 70; max-width: min(460px, 88vw); padding: 9px 14px; border-radius: 8px;
  background: rgba(12, 15, 12, 0.9); color: #fff; font: 500 14px var(--f-body); text-align: center; line-height: 1.5; }

/* install-as-app button, beside full screen on the menus */
.pwa-btn { inset-inline-end: calc(max(10px, env(safe-area-inset-right)) + 52px); }

/* message lines: small and brief; a tap pins one, a second tap dismisses it */
.hud-log div { font-size: 12.5px; padding: 2px 10px; pointer-events: auto; cursor: pointer; background: rgba(12, 15, 12, 0.5); }
#hud.has-touch .hud-log div { font-size: 11.5px; padding: 2px 8px; }
.hud-log div.pin { background: rgba(12, 15, 12, 0.85); outline: 1px solid rgba(240, 178, 58, 0.7); }
.sc-brief { font-size: 11px; gap: 8px; }
.shotcard:not(.open) { padding: 2px 8px !important; }
.shotcard.open { outline: 1px solid rgba(240, 178, 58, 0.7); }
