/* One shared HUD; resource bars never depend on unlocked abilities or expanded details. */
#root #stage[data-mode] #hud.hud-compact{display:flex;flex-direction:column;align-items:stretch;gap:5px;width:auto;max-width:none;min-height:0;padding:7px 10px;background:linear-gradient(#0b1927dc,#0b1927a6);border:0;border-bottom:1px solid #b6d5df44;box-shadow:none;text-shadow:0 1px 2px #000;color:#eaf5ee;font:16px/1.1 VT323,monospace;cursor:default}
#root #stage[data-mode] #hud.hud-compact:not([data-hud-placed]){top:max(6px,env(safe-area-inset-top));bottom:auto;left:max(8px,env(safe-area-inset-left));right:calc(max(8px,env(safe-area-inset-right)) + 104px);translate:none;transform:none}
#root #stage[data-mode] #hud.hud-compact[hidden]{display:none}
#root #stage[data-mode] #hud.hud-compact[data-hud-placed]{width:calc(100% - 128px);max-width:calc(100% - 16px)}
#root #stage[data-mode] #hud.hud-compact .hud-top{display:grid;grid-template-columns:minmax(0,1.25fr) minmax(0,1fr) auto auto;align-items:center;gap:12px}
#root #stage[data-mode] #hud.hud-compact .hud-resource{min-width:0;color:#5ce2d3}
#root #stage[data-mode] #hud.hud-compact .hud-health{color:#ff9aa9}
#root #stage[data-mode] #hud.hud-compact .hud-resource-label{display:flex;align-items:baseline;justify-content:space-between;gap:4px;white-space:nowrap;font-size:16px}
#root #stage[data-mode] #hud.hud-compact strong{font:inherit;font-weight:normal}
#root #stage[data-mode] #hud.hud-compact .hud-resource-label strong{font-size:19px;color:#fff}
#root #stage[data-mode] #hud.hud-compact .hud-bar{height:6px;margin-top:2px;background:#050f1bcc;border:1px solid #ffffff30;overflow:hidden}
#root #stage[data-mode] #hud.hud-compact .hud-bar i{display:block;height:100%;background:currentColor;box-shadow:inset 0 2px #ffffff44}
#root #stage[data-mode] #hud.hud-compact .hud-funds .hud-bar{height:6px}
#root #stage[data-mode] #hud.hud-compact .hud-health.critical{color:var(--sb-danger);animation:hud-critical .8s ease-in-out infinite alternate}
@keyframes hud-critical{to{filter:brightness(1.7)}}
#root #stage[data-mode] #hud.hud-compact .hud-meta{display:flex;flex-direction:column;gap:3px;align-items:flex-end}
#root #stage[data-mode] #hud.hud-compact .play-wallet{font:14px/1 VT323,monospace;margin:0;gap:3px;position:relative}
#root #stage[data-mode] #hud.hud-compact .wallet-coin{width:12px;height:12px;flex-basis:12px}
#root #stage[data-mode] #hud.hud-compact .wallet-gain{position:absolute;right:0;top:100%;font-size:12px}
#root #stage[data-mode] #hud.hud-compact .run-clock{display:block;margin:0;padding:0;color:#b5c6cd;font:14px/1 VT323,monospace}
#root #stage[data-mode] #hud.hud-compact .run-clock time{font:inherit}
#root #stage[data-mode] #hud.hud-compact .hud-equipment{display:flex;gap:5px}
#root #stage[data-mode] #hud.hud-compact .hud-slot.cooling{border-color:#6a7a85;background:#07111de6}
#root #stage[data-mode] #hud.hud-compact .hud-slot.cooling :is(svg,img){opacity:.32;filter:grayscale(.8)}
#root #stage[data-mode] #hud.hud-compact .hud-mission{display:flex;align-items:center;flex-wrap:wrap;gap:4px 9px;min-width:0}
#root #stage[data-mode] #hud.hud-compact .hud-phase{font-size:13px;color:#99b9c6;white-space:nowrap}
#root #stage[data-mode] #hud.hud-compact .hud-goal{font-size:17px;color:#fff1c0;min-width:0;overflow-wrap:anywhere;flex:1 1 150px}
#root #stage[data-mode] #hud.hud-compact .hud-chips{display:flex;flex-wrap:wrap;gap:4px;align-items:center}
#root #stage[data-mode] #hud.hud-compact .hud-chip{display:inline-block;border:1px solid #adc8d533;border-radius:3px;padding:2px 5px;color:#e1f0ee;background:#05141d80;white-space:nowrap;font:15px/1 VT323,monospace}
#root #stage[data-mode] #hud.hud-compact .hud-chip.critical{color:#ff7f96;border-color:currentColor}
#root #stage[data-mode] #hud.hud-compact .hud-notices{display:flex;flex-wrap:wrap;align-items:center;gap:3px 8px}
#root #stage[data-mode] #hud.hud-compact .hud-notices:empty{display:none}
#root #stage[data-mode] #hud.hud-compact .hud-notices small{font:14px/1.1 VT323,monospace}
#root #stage[data-mode] #hud.hud-compact .history-boss-meter{flex-basis:100%;height:3px}
@media(max-height:600px),(max-width:760px){
 #root #stage[data-mode] #hud.hud-compact{padding:4px 6px;gap:3px}
 #root #stage[data-mode] #hud.hud-compact .hud-top{gap:7px}
 #root #stage[data-mode] #hud.hud-compact .hud-resource-label{font-size:13px}
 #root #stage[data-mode] #hud.hud-compact .hud-resource-label strong{font-size:16px}
 #root #stage[data-mode] #hud.hud-compact .hud-goal{font-size:15px}
 #root #stage[data-mode] #hud.hud-compact .hud-chip{font-size:13px;padding:2px 4px}
 #root #stage[data-mode] #hud.hud-compact .hud-bar{height:5px;margin-top:2px}
 #root #stage[data-mode] #hud.hud-compact .hud-funds .hud-bar{height:5px}
}
#root #stage[data-mode] #hud.hud-compact[data-reduced=true] *{animation:none!important}
@media(prefers-reduced-motion:reduce){#root #stage[data-mode] #hud.hud-compact *{animation:none!important}}
#root #stage[data-mode] #hud.hud-compact .run-clock svg{width:12px;height:12px;vertical-align:middle;margin-right:3px}
/* V1005: fixed-height strip with a bounded ability group. */
#root #stage[data-mode] #hud.hud-compact .hud-top{grid-template-columns:minmax(0,1.25fr) minmax(0,1fr) auto auto;gap:8px}
#root #stage[data-mode] #hud.hud-compact .hud-resource-label strong{position:relative}
#root #stage[data-mode] #hud.hud-compact .hud-bar{position:relative}
#root #stage[data-mode] #hud.hud-compact .hud-bar i{position:relative;z-index:1}
#root #stage[data-mode] #hud.hud-compact .hud-ghost{position:absolute;inset:0 auto 0 0;background:#d2fff4}
#root #stage[data-mode] #hud.hud-compact .hud-loss{position:absolute;right:0;top:10px;color:#fff2ba;font:16px/1 VT323,monospace;z-index:3;pointer-events:none}
#root #stage[data-mode] #hud.hud-compact .hud-gained strong{color:#98ffac;text-shadow:0 0 6px #53ff8e}
#root #stage[data-mode] #hud.hud-compact .hud-spent strong{color:#fff2ba}
#root #stage[data-mode] #hud.hud-compact .play-wallet{font-size:18px}
#root #stage[data-mode] #hud.hud-compact .run-clock{font-size:24px;color:#fff;white-space:nowrap;font-variant-numeric:tabular-nums}
#root #stage[data-mode] #hud.hud-compact .hud-clock-row{display:flex;align-items:center;gap:5px}
#root #stage[data-mode] #hud.hud-compact .hud-delta{font-size:16px;white-space:nowrap}
#root #stage[data-mode] #hud.hud-compact .hud-delta.ahead{color:#86f3ae}
#root #stage[data-mode] #hud.hud-compact .hud-delta.behind{color:#ff8798}
#root #stage[data-mode] #hud.hud-compact .hud-equipment{gap:3px;align-items:center}
#root #stage[data-mode] #hud.hud-compact .hud-consumables{display:flex;gap:5px}
#root #stage[data-mode] #hud.hud-compact .hud-consumable{display:flex;gap:2px;align-items:center;font:14px VT323,monospace;white-space:nowrap}
#root #stage[data-mode] #hud.hud-compact .hud-consumable svg{width:12px;height:12px}
#root #stage[data-mode] #hud.hud-compact .hud-consumable kbd{font:10px VT323,monospace;color:#9bb9c6}
#root #stage[data-mode] #hud.hud-compact .hud-mission{flex-wrap:nowrap}
#root #stage[data-mode] #hud.hud-compact .hud-goal{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1 1 0}
#root #stage[data-mode] #hud.hud-compact .hud-chips{flex-wrap:nowrap;max-width:45%;overflow:hidden}
#root #stage[data-mode] #hud.hud-compact .hud-notices{flex-wrap:nowrap;overflow:hidden;max-height:16px}
@media(max-width:850px){
 #root #stage[data-mode] #hud.hud-compact .hud-top{gap:4px}
 #root #stage[data-mode] #hud.hud-compact .hud-equipment{gap:2px}
 #root #stage[data-mode] #hud.hud-compact .run-clock{font-size:21px}
 #root #stage[data-mode] #hud.hud-compact .hud-delta{font-size:13px}
 #root #stage[data-mode] #hud.hud-compact .hud-resource-label{display:block;font-size:12px;overflow:hidden}
 #root #stage[data-mode] #hud.hud-compact .hud-resource-label strong{display:block;font-size:16px}
 #root #stage[data-mode] #hud.hud-compact .hud-phase{font-size:11px}
 #root #stage[data-mode] #hud.hud-compact .hud-chips{max-width:30%}
}
#root #stage[data-mode] #hud.hud-compact[data-reduced=true] .hud-loss{display:none}
@media(prefers-reduced-motion:reduce){#root #stage[data-mode] #hud.hud-compact .hud-loss{display:none}}


/* Keep labels and values inside their own grid tracks at every HUD scale. */
#root #stage[data-mode] #hud.hud-compact .hud-resource-label{display:flex;flex-direction:column;align-items:flex-start;gap:0;white-space:normal;overflow-wrap:anywhere}
#root #stage[data-mode] #hud.hud-compact .hud-resource-label>span{max-width:100%}

#root #stage[data-mode] #hud.hud-compact button[data-pix-zoom]{pointer-events:auto;padding:0;min-width:0;min-height:0;color:var(--sb-reward);touch-action:manipulation}

/* Circular abilities: only the icon and active cooldown occupy the center. */
#root #stage[data-mode] #hud.hud-compact{--hud-slot-size:44px;padding:5px 7px}
#root #stage[data-mode] #hud.hud-compact .hud-equipment{gap:8px;flex-wrap:wrap;min-width:0;padding:4px 2px 9px}
#root #stage[data-mode] #hud.hud-compact :is(.hud-slot,.hud-more){position:relative;display:block;box-sizing:border-box;flex:none;width:var(--hud-slot-size);height:var(--hud-slot-size);min-width:0;min-height:0;padding:0;border:1px solid #8be5d0;border-radius:50%;background:#16323da6;color:#fff;font:18px/1 VT323,monospace}
#root #stage[data-mode] #hud.hud-compact .hud-slot>span[class^=skill-rank]{position:absolute;inset:3px;border-radius:50%;pointer-events:none}
#root #stage[data-mode] #hud.hud-compact .hud-slot :is(svg,img){position:absolute;inset:50% auto auto 50%;translate:-50% -50%;width:24px;height:24px;padding:0;image-rendering:pixelated}
#root #stage[data-mode] #hud.hud-compact .hud-ring{position:absolute;inset:-3px;border-radius:50%;background:conic-gradient(var(--sb-reward,#ffdf76) var(--cooldown),#52647355 0);mask:radial-gradient(circle,transparent 61%,#000 65%);pointer-events:none}
#root #stage[data-mode] #hud.hud-compact .hud-count{position:absolute;inset:0;display:grid;place-items:center;font:18px/1 VT323,monospace;color:#fff;text-shadow:0 1px 3px #000,1px 0 2px #000;pointer-events:none}
#root #stage[data-mode] #hud.hud-compact .hud-badge{position:absolute;right:-4px;top:-5px;padding:1px 3px;border:1px solid #8be5d0;border-radius:6px;background:#07131c;color:#fff;font:10px/1 VT323,monospace}
#root #stage[data-mode] #hud.hud-compact .hud-badge:empty{display:none}
#root #stage[data-mode] #hud.hud-compact .hud-slot kbd{position:absolute;bottom:-8px;left:50%;translate:-50% 0;padding:1px 3px;border-radius:4px;text-align:center;font:10px/1 VT323,monospace;color:#fff;background:#07131cee;white-space:nowrap}
#root #stage[data-mode] #hud.hud-compact .hud-slot [hidden]{display:none}
#root #stage[data-mode] #hud.hud-compact .hud-resource{container-type:inline-size}
#root #stage[data-mode] #hud.hud-compact .hud-resource-name{display:block;white-space:nowrap;font-size:clamp(10px,15cqi,16px)}
#root #stage[data-mode] #hud.hud-compact .hud-meta{gap:2px}
#root #stage[data-mode] #hud.hud-compact .run-clock{font-size:21px}
#root #stage[data-mode] #hud.hud-compact .play-wallet{font-size:16px}
#root #stage[data-mode] #hud.hud-compact .hud-mission{flex-wrap:wrap}
#root #stage[data-mode] #hud.hud-compact .hud-goal{white-space:normal;overflow:visible;flex:1 1 180px}
#root #stage[data-mode] #hud.hud-compact .hud-chips{flex-wrap:wrap;max-width:none;overflow:visible}
/* Top utilities only; the lower touch controls retain their own sizing. */
#root #stage[data-mode=play] #utilities{display:grid;grid-template-columns:44px 44px;gap:5px;width:93px;right:max(6px,env(safe-area-inset-right));top:max(6px,env(safe-area-inset-top));bottom:auto}
#root #stage[data-mode=play] #utilities button{box-sizing:border-box;width:44px;height:44px;min-width:44px;min-height:44px;padding:7px;margin:0}
#root #stage[data-mode=play] #utilities button svg{width:100%;height:100%}
@media(pointer:coarse),(max-width:760px),(max-height:600px){
 #root #stage[data-mode] #hud.hud-compact{--hud-slot-size:40px}
 #root #stage[data-mode] #hud.hud-compact .hud-slot kbd{display:none}
 #root #stage[data-mode] #hud.hud-compact .hud-equipment{padding-bottom:4px}
}
@media(max-width:760px){
 #root #stage[data-mode] #hud.hud-compact .hud-top{grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto}
 #root #stage[data-mode] #hud.hud-compact .hud-equipment{grid-column:1/-1}
}
@media(max-width:420px){
 #root #stage[data-mode] #hud.hud-compact .hud-top{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
 #root #stage[data-mode] #hud.hud-compact .hud-meta{grid-column:1/-1;flex-direction:row;justify-content:space-between;flex-wrap:wrap}
}

/* Empty ability groups reserve neither a grid cell nor padding. */
#root #stage[data-mode] #hud.hud-compact .hud-equipment:empty{display:none}
#root #stage[data-mode] #hud.hud-compact .hud-top:has(>.hud-equipment:empty){grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto}
@media(max-width:420px){
 #root #stage[data-mode] #hud.hud-compact .hud-top:has(>.hud-equipment:empty){grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
}

/* Compact shared strip. Text flows together; narrow screens wrap at words, never clip labels. */
#root #stage[data-mode] #hud.hud-compact{background:linear-gradient(#0b19279c,#0b19275c);text-shadow:0 1px 2px #000,1px 0 2px #000}
#root #stage[data-mode] #hud.hud-compact .hud-top,
#root #stage[data-mode] #hud.hud-compact .hud-top:has(>.hud-equipment:empty){grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto;align-items:start;gap:4px 8px}
#root #stage[data-mode] #hud.hud-compact .hud-resource{container-type:normal}
#root #stage[data-mode] #hud.hud-compact .hud-resource-label{flex-direction:row;align-items:baseline;justify-content:flex-start;gap:4px;white-space:nowrap;overflow:visible;font-size:14px}
#root #stage[data-mode] #hud.hud-compact .hud-resource-name,
#root #stage[data-mode] #hud.hud-compact .hud-resource-label strong{display:inline;font-size:inherit}
#root #stage[data-mode] #hud.hud-compact .hud-bar,
#root #stage[data-mode] #hud.hud-compact .hud-funds .hud-bar{height:3px;margin-top:1px}
#root #stage[data-mode] #hud.hud-compact .hud-meta{flex-direction:row;align-items:baseline;flex-wrap:wrap;justify-content:flex-end;gap:3px 7px;max-width:140px}
#root #stage[data-mode] #hud.hud-compact .run-clock{font-size:16px}
#root #stage[data-mode] #hud.hud-compact .hud-clock-row{flex-wrap:wrap;justify-content:flex-end;gap:2px 4px}
#root #stage[data-mode] #hud.hud-compact .hud-delta{font-size:13px}
#root #stage[data-mode] #hud.hud-compact .hud-equipment{grid-column:1/-1;padding:2px 2px 8px}
#root #stage[data-mode] #hud.hud-compact .hud-mission{display:flex;align-items:center;gap:3px 6px}
#root #stage[data-mode] #hud.hud-compact .hud-mission-text{min-width:0;flex:1 1 auto;font-size:15px;line-height:1.1}
#root #stage[data-mode] #hud.hud-compact :is(.hud-goal,.hud-chips,.hud-mission .hud-chip){display:inline;font:inherit;white-space:normal;overflow:visible;text-overflow:clip;max-width:none;padding:0;border:0;background:none}
#root #stage[data-mode] #hud.hud-compact .hud-phase{white-space:nowrap}
#root #stage[data-mode] #hud.hud-compact .hud-mission .hud-chip::before{content:' • ';color:#99b9c6}
#root #stage[data-mode] #hud.hud-compact .hud-goal{opacity:1;transition:opacity .15s ease}
#root #stage[data-mode] #hud.hud-compact.hud-goal-fading .hud-goal{opacity:0}
#root #stage[data-mode] #hud.hud-compact.hud-goal-collapsed .hud-goal{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;opacity:0}
#root #stage[data-mode] #hud.hud-compact .hud-consumables{flex-wrap:wrap;max-width:100%}
#root #stage[data-mode] #hud.hud-compact .hud-consumables:empty{display:none}
#root #stage[data-mode] #hud.hud-compact .hud-notices{flex-wrap:wrap;overflow:visible;max-height:none}
#root #stage[data-mode] #hud.hud-compact[data-reduced=true] .hud-goal{transition:none}
@media(prefers-reduced-motion:reduce){#root #stage[data-mode] #hud.hud-compact .hud-goal{transition:none}}
@media(max-width:600px){
 #root #stage[data-mode] #hud.hud-compact .hud-top,
 #root #stage[data-mode] #hud.hud-compact .hud-top:has(>.hud-equipment:empty){grid-template-columns:minmax(0,1fr) auto}
 #root #stage[data-mode] #hud.hud-compact .hud-resource{grid-column:1}
 #root #stage[data-mode] #hud.hud-compact .hud-meta{grid-column:2;grid-row:1/3;max-width:85px;flex-direction:column;align-items:flex-end}
 #root #stage[data-mode] #hud.hud-compact .hud-resource-label{font-size:13px}
}
@media(min-width:1100px){
 #root #stage[data-mode] #hud.hud-compact .hud-top:has(>.hud-equipment:not(:empty)){grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto auto}
 #root #stage[data-mode] #hud.hud-compact .hud-equipment{grid-column:auto;padding-top:0}
}

/* A solid local backing guarantees phase-label contrast even over bright scenery. */
#root #stage[data-mode] #hud.hud-compact button.hud-phase{position:relative;display:inline-block;pointer-events:auto;cursor:pointer;touch-action:manipulation;color:#fff;background:#0b1927;border:0;border-radius:2px;padding:2px 4px;min-width:0;min-height:0;font:inherit;text-shadow:none}
/* V746: "FASE 12/24" sem bloco, só o texto seguido do tracinho (Pedro, 05/11); o contraste vem do contorno. */
#root #stage[data-mode] #hud.hud-compact button.hud-phase{background:transparent;padding:2px 0;text-shadow:1px 0 #08121c,-1px 0 #08121c,0 1px #08121c,0 -1px #08121c,1px 1px #08121c}
#root #stage[data-mode] #hud.hud-compact button.hud-phase:focus-visible{outline:2px solid #ffe16c;outline-offset:2px}
#root #stage #hud-tip{width:max-content;max-width:calc(100vw - 16px)}
#root #stage #hud-tip .hud-resource-tip{max-width:100%;white-space:normal;overflow-wrap:normal}

/* Expand only the hit target, keeping the visible mission line compact. */
#root #stage[data-mode] #hud.hud-compact button.hud-phase::before{content:"";position:absolute;left:0;right:0;top:50%;height:44px;transform:translateY(-50%);background:transparent}

/* Hospital only: the canvas owns counters and the paper owns secondary information. */
 #root #stage:has(#touch.vax-run) #hud.hud-compact[data-ward=true]{min-height:0;padding:2px 6px;gap:0;height:var(--ward-header-height,20px);box-sizing:border-box}
 #root #stage:has(#touch.vax-run) #hud[data-ward=true] :is(.hud-top,.hud-goal,.hud-chips,.hud-consumables,.hud-notices){display:none!important}
 #root #stage:has(#touch.vax-run) #hud[data-ward=true] :is(.hud-mission,.hud-mission-text){display:flex;gap:0;margin:0;padding:0;min-height:0}
 #root #stage:has(#touch.vax-run) #hud[data-ward=true] .hud-phase{font:12px/16px VT323,monospace;padding:0;margin:0;white-space:nowrap}
 #root #stage:has(#touch.vax-run):has(#hud[data-ward=true]) #shared-free[data-mode=play]{top:6px;bottom:auto;left:var(--ward-banner-left,100px);right:var(--ward-banner-right,120px);transform:none;max-width:none;width:auto;padding:1px 3px;border:0;box-shadow:none;font:12px/16px VT323,monospace;white-space:normal;overflow:visible;opacity:1}
