#hud{
 --combat-width:clamp(262px,27vw,352px);
 --combat-toggle-h:calc(60px + env(safe-area-inset-bottom,0px))
}
#hud #combat{
 --out:#78f1d8;--in:#ff9b8b;--muted:#b0c4d4;
 --height:calc(100% - max(120px,18vh));
 position:absolute;top:50%;right:max(16px,env(safe-area-inset-right,0px));transform:translateY(-50%);
 width:var(--combat-width);max-width:calc(100% - 20px);max-height:var(--height);
 z-index:12;display:flex;flex-direction:column;pointer-events:auto;touch-action:pan-y;
 text-shadow:none;color:#f1f8ff;text-align:left;white-space:normal;
 font:550 14px/1.28 system-ui,sans-serif;font-variant-numeric:tabular-nums
}
#hud #combat[hidden],body:is(.podium-live,.replay-live) #hud #combat{display:none}
#combat .cr-out{color:var(--out)}
#combat .cr-in,.cr-fatal{color:var(--in)}
.cr-panel{
 display:flex;flex-direction:column;min-height:0;overflow:hidden;
 border:1px solid #adc4d053;border-radius:6px;background:#0a1b2ce3;
 box-shadow:0 15px 42px #01142866
}
.cr-head,.cr-rival,.cr-compact,.cr-fatal,.cr-meta{display:flex;align-items:center;gap:7px}
.cr-head{
 flex:none;min-height:68px;gap:13px;border-bottom:1px solid #ff998c45;
 background:linear-gradient(120deg,transparent 68%,#ff9b8b10 68% 73%,transparent 73%),
 linear-gradient(110deg,#263548,#55333f)
}
.cr-portrait{
 flex:none;background:url('./portraits.webp');background-size:300% 100%;
 background-position:calc(var(--hero,0) * 50%) 0
}
.cr-head>i{flex:none;width:68px;height:68px;align-self:center;border-right:2px solid #ff9b8b9c}
.cr-cause{display:grid;place-items:center;color:var(--in)}
.cr-symbol{width:18px;height:18px;flex:none;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.cr-cause .cr-symbol{width:32px;height:32px;stroke-width:1.5}
.cr-head>div,.cr-rival>div,.cr-compact strong{min-width:0}
.cr-head>div{flex:1;padding:5px 8px 5px 0}
.cr-head small,.cr-labels,.cr-compact span{
 font-size:11px;font-weight:820;text-transform:uppercase;letter-spacing:.05em
}
.cr-head small{color:#ffbdb4}
.cr-head strong{display:block;font-size:19px;letter-spacing:-.02em}
.cr-head span{font-size:12px;color:#e6d9df}
.cr-head strong,.cr-rival strong{overflow-wrap:anywhere;unicode-bidi:plaintext}
.cr-compact strong{
 white-space:nowrap;overflow:hidden;text-overflow:ellipsis;unicode-bidi:plaintext
}
.cr-labels,.cr-pair{
 display:grid;grid-template-columns:minmax(44px,1fr) minmax(0,2.62fr) minmax(44px,1fr);
 align-items:center;text-align:center;gap:4px
}
.cr-labels{padding:9px 12px;flex:none;background:#0b1d2fab}
.cr-labels>span{color:#e5eff9}
.cr-labels b:first-child,.cr-pair b:first-child{text-align:left}
.cr-labels b:last-child,.cr-pair b:last-child{text-align:right}
.cr-list{
 flex:auto;min-height:0;overflow:auto;touch-action:pan-y;overscroll-behavior:contain;
 margin:0;padding:0;list-style:none;scrollbar-width:thin;scrollbar-color:#6999ac #122d40
}
.cr-list:focus-visible{outline:2px solid var(--out);outline-offset:-2px}
.cr-list>li{border-top:1px solid #a5cbdf35}
.cr-pair{
 min-height:39px;padding:5px 12px;background:linear-gradient(100deg,#154149b8,#193045ab 49%,#492e40a8)
}
.cr-list>.fatal .cr-pair{box-shadow:inset -3px 0 var(--in);background:linear-gradient(100deg,#185058,#21354a 48%,#5b303e)}
.cr-pair>b{font-size:21px;letter-spacing:-.032em;font-weight:830}
.cr-rival{min-width:0;justify-content:center;text-align:left}
.cr-rival .cr-portrait{width:33px;height:33px;border-radius:5px;box-shadow:0 0 0 1px #abc5de3d}
.cr-rival strong{display:block;font-size:14px;line-height:1.2}
.cr-fatal{gap:3px;font-size:11px;font-weight:760}
.cr-fatal .cr-symbol{width:13px;height:13px}
.cr-meta{gap:5px;flex-wrap:wrap}
.cr-gun{font-size:11px;color:#cedeea}
.cr-gun svg{width:44px;height:16px;display:block;fill:currentColor}
.cr-zones{
 display:grid;grid-template-columns:minmax(0,1fr) 31px 49px 31px minmax(0,1fr);
 column-gap:4px;grid-auto-rows:minmax(22px,auto);align-items:center;padding:6px 12px 8px
}
.cr-figure{grid-row:1/4;height:66px;width:100%;fill:#405871}
.cr-figure.cr-out{grid-column:2}
.cr-figure.cr-in{grid-column:4}
.cr-figure .hit{fill:currentColor}
.cr-location{grid-column:3;text-align:center;font-size:12px;color:#cfdeea}
.cr-location.cr-wide{grid-column:2/5}
.cr-value{display:flex;align-items:baseline;gap:0 5px;flex-wrap:wrap}
.cr-value.cr-out{grid-column:1}
.cr-value.cr-in{grid-column:5;flex-direction:row-reverse}
.cr-value small{font-size:11px;color:var(--muted)}
.cr-value span,.cr-empty{color:#99b0c4}
.cr-empty{text-align:center;padding:14px}
.cr-help{
 flex:none;text-align:center;border-top:1px solid #a4d7f029;padding:6px 8px 7px;
 color:var(--muted);font-size:11px;line-height:1.35
}
#hud #combat button{display:none}
@media(max-width:1050px),(max-height:620px){
 .cr-head{min-height:56px;gap:8px}
 .cr-head>i{height:56px;width:56px}
 .cr-head strong{font-size:16px}
 .cr-head small,.cr-labels{font-size:10px}
 .cr-head span{font-size:11px}
 .cr-labels,.cr-pair{padding:5px 9px}
 .cr-pair{min-height:34px}
 .cr-pair>b{font-size:17px}
 .cr-rival strong{font-size:12px}
 .cr-rival{gap:5px}
 .cr-rival .cr-portrait{width:26px;height:26px}
 .cr-fatal{font-size:10px}
 .cr-fatal .cr-symbol{display:none}
 .cr-gun svg{width:33px;height:13px}
 .cr-zones{grid-template-columns:minmax(0,1fr) 26px 42px 26px minmax(0,1fr);grid-auto-rows:minmax(19px,auto);gap:0 2px;padding:4px 9px}
 .cr-figure{height:56px}
 .cr-value{font-size:13px;gap:0 3px}
 .cr-location,.cr-help{font-size:11px}
}
@media(max-width:950px){
 #hud #combat{
  --height:calc(100% - 100px);
  width:clamp(236px,36vw,286px);right:max(8px,env(safe-area-inset-right,0px))
 }
 /* When the two panels cannot fit side by side, reserve a single
    touch target under the scoreboard. Tapping it opens the full rail. */
 #hud #report:not([hidden])~#combat:not(.cr-expanded){
  top:auto;bottom:calc(8px + env(safe-area-inset-bottom,0px));transform:none;width:min(314px,94%)
 }
 #hud #report:not([hidden])~#combat:not(.cr-expanded) .cr-panel{display:none}
 #hud #report:not([hidden])~#combat:not(.cr-expanded) .cr-compact{
  display:flex;align-items:center;gap:10px;min-width:0;height:44px;flex:none;padding:6px 12px;
  border-radius:8px;border:1px solid #7793aa;background:linear-gradient(110deg,#153449,#483042);
  color:#fff;box-shadow:0 4px 12px #0613234d
 }
 .cr-compact strong{flex:1;text-align:right}
 .cr-compact b{font-size:18px}
 #hud #report:not([hidden])~#combat.cr-expanded{
  top:50%;transform:translateY(-50%);bottom:auto;max-height:calc(100% - 24px);
  width:min(94%,342px)
 }
 #hud #report:not([hidden])~#combat.cr-expanded .cr-panel{
  box-shadow:0 0 0 100vmax #05152880,0 15px 32px #0008;background:#0a1b2c
 }
 #hud #report:not([hidden])~#combat.cr-expanded .cr-back{
  display:grid;place-items:center;width:44px;height:44px;flex:none;
  box-shadow:none;margin-right:6px;background:#19263a96
 }
}
@media(max-width:540px) and (orientation:portrait){
 /* Keep the spectator controls and the centre of the scene clear. */
 #hud #combat{
  width:min(270px,85%);top:auto;transform:none;
  bottom:calc(5% + 52px);max-height:clamp(220px,calc(47% - 45px),390px)
 }
}
@media(max-height:450px){
 #hud #combat{--height:calc(100% - 82px)}
 .cr-head{min-height:46px}
 .cr-head>i{width:46px;height:46px}
 .cr-head>div{line-height:1.11;padding-block:3px}
 .cr-help{padding:3px 6px;font-size:10px}
}
