/* Combat rails use the canvas viewport; lobby components retain their own layout. */
body.in-party{--rail:min(23vw,280px);--edge:12px}
#hud #localVitals{position:absolute;left:var(--edge);top:12px;width:var(--rail);height:86px;padding:0 6px 0 72px;border:0;border-radius:0;box-shadow:none;background:none;transform:none;isolation:isolate;text-shadow:0 1px 2px #0a1520}
#localVitals .portrait-medallion{position:absolute;left:0;top:4px;width:68px;height:68px;border:3px ridge #c6aa71;border-radius:50%;overflow:hidden;background:#1a3649;box-shadow:0 2px 4px #121b21}
#localPortrait{width:100%;height:100%;object-fit:contain;image-rendering:pixelated}
#localVitals #localName{padding:5px 8px 3px;background:url('assets/ui/Ribbon_Blue_3Slides.png') center/100% 100%;color:#fff2cd}
#localVitals #localLevel{position:absolute;left:16px;top:65px;background:#142c37;border:1px solid #b5a173;padding:0 5px;border-radius:5px}
#localVitals .coop-life{background:#182a30 url('assets/ui/BigBar_Base.png') center/100% 100%;border:2px ridge #ad966b;border-radius:4px}
#localVitals #localHp{background:#7fbca3 url('assets/ui/BigBar_Fill.png') left center/100% 100%}
#hud #localVitals:is(.zhaoyun-hud,.artemis-hud)::before{inset:0;width:100%;height:100%;background-size:100% 100%}
#hud #localVitals:is(.zhaoyun-hud,.artemis-hud) .portrait-medallion{left:0;top:0;width:70px;height:70px;border:none;background:none;box-shadow:none}
#hud #localVitals:is(.zhaoyun-hud,.artemis-hud) #localName{background:none}
#localVitals:is(.zhaoyun-low-health,.artemis-low-health) .coop-life{outline:2px solid #ed886f}
body.in-party #playerBuffs{left:var(--edge);top:101px;width:var(--rail);max-width:var(--rail);max-height:50px;overflow:auto}
body.in-party #partyState{left:var(--edge);top:157px!important;width:var(--rail);transform:none}
body.in-party #hud #bossPanel.boss-frame,body.in-party #hud #forestTwinsHud,body.in-party #hud #quarryAutomataHUD{left:50%;top:42px;width:min(44vw,500px);transform:translateX(-50%)}
#hud #bossTrack{position:absolute;left:50%;top:8px;transform:translateX(-50%);display:flex;gap:4px}
#bossTrack span{display:grid;place-items:center;width:21px;height:21px;border:1px solid #7f755a;border-radius:50%;background:#122832;color:#b9c5be;font:bold 11px system-ui}
#bossTrack .current{border-color:#eed38b;color:#fff3be}#bossTrack .cleared{color:#8ce1bc}
#hud .coop-clock{left:calc(50% + 72px);top:6px;right:auto;transform:none;font-size:10px}
#hud #bossArrival,#hud #victoryFlash{position:absolute;inset:0;pointer-events:none;z-index:8}
#hud #bossArrival[hidden],#hud #victoryFlash[hidden],#hud .arrival-skip{display:none}
#hud #quarryResource{position:absolute;left:24%;right:8%;top:1%;font-size:clamp(10px,1vw,13px);color:#f4d996;text-shadow:0 1px 2px black;pointer-events:none}
body.in-party .coop-dock{bottom:10px;gap:5px}
.coop-dock .skill,.coop-dock .coop-resources button{background:#16374c url('assets/ui/Button_Blue.png') center/100% 100%;border:1px solid #b7a87c;border-radius:4px}
.coop-dock .skill{width:clamp(40px,4vw,54px);height:clamp(40px,4vw,54px)}
#mageCoopUltimate[hidden]{display:none}#mageCoopUltimate:not([hidden]){position:relative;inset:auto;transform:none;padding:3px}
#mageCoopUltimate b:not([hidden]){display:grid;place-items:center;position:absolute;inset:0;background:conic-gradient(#0a1929c9 var(--cooldown-angle),transparent 0);color:white;border-radius:50%}
body.in-party #upgrade{bottom:88px;width:min(450px,48vw);right:12px}
#upgrade .coop-choice{border:2px solid var(--quality);border-image:none;background:linear-gradient(160deg,color-mix(in srgb,var(--quality) 22%,#182a35),#10222e 76%);box-shadow:inset 0 3px var(--quality);color:#f3eddf;text-shadow:none}
#upgrade .coop-choice>strong,#upgrade .coop-choice>small{color:var(--quality);text-shadow:none}
#upgrade .coop-choice>small{background:#11212b;border-bottom:1px solid var(--quality);padding:1px 4px}
#upgrade .coop-choice>p{color:#e2e8e2}#upgrade .coop-choice>span{background:#172d38;color:var(--quality);border:1px solid var(--quality)}
body.in-party #marshPartyObjective{right:10px;top:198px;width:min(19vw,200px);max-height:120px;overflow:auto}
body.in-party #quarryCampaignHUD .qc-map{left:auto;right:10px;top:60px;width:min(19vw,190px)}
@media(max-height:650px){body.in-party #upgrade{bottom:83px}body.in-party #marshPartyObjective{top:174px}}
body.in-party #marshPartyObjective{top:242px}
@media(max-height:650px){body.in-party #marshPartyObjective{top:239px;max-height:91px}}
body.in-party #upgrade.coop-choice-overlay{bottom:118px}
#upgrade .coop-choice-heading h2,#upgrade .coop-choice-heading p{line-height:1.2}
#upgrade .coop-choice>p{min-height:0;line-height:1.25}
#upgrade .coop-choice>span{padding:3px 5px;line-height:1.1}
@media(max-height:650px){body.in-party #upgrade.coop-choice-overlay{bottom:96px;right:calc(var(--rail) + 8px);width:min(44vw,410px)}}
body.in-party #hud.reef-defense-hud #bossPanel.boss-frame{width:min(44vw,500px)}

#hud .coop-dock .skill.unlearned b{inset:auto 0 0;height:auto;background:#12202bcc;font:9px/1.3 system-ui}
#hud .coop-dock .ultimate-slot>span{position:absolute;left:2px;top:1px;z-index:2}
#hud #quarryResource{white-space:nowrap;line-height:1.2}

/* Keep the timer and portrait together, as on the solo battlefield. */
body.in-party #hud .coop-clock{left:calc(var(--edge) + 38px);right:auto;top:2px;width:106px;height:30px;padding:4px 12px}
#hud .coop-clock>strong{font-size:14px;line-height:20px}
#hud .coop-clock>span{position:absolute;left:100%;top:6px;white-space:nowrap;color:#fff4d6;text-shadow:0 1px 3px #142b34}
body.in-party #hud #localVitals{top:34px}
body.in-party #playerBuffs{top:124px}
body.in-party #partyState{top:180px!important;width:min(var(--rail),192px);gap:3px}
body.in-party #partyState .coop-teammate{height:58px;padding:4px 6px 4px 39px}
body.in-party #partyState .coop-teammate>img{width:32px;height:32px;border-width:3px}
body.in-party #partyState .coop-party-life{left:39px;bottom:3px;height:4px}

/* Solo upgrade art, with the non-blocking party controls. */
#upgrade[data-choice="upgrade"] .coop-choice{position:relative;isolation:isolate;background:#eee1c0;padding:6px;box-shadow:0 2px 4px #08152088}
#upgrade[data-choice="upgrade"] .coop-choice::before{content:"";position:absolute;inset:0;z-index:-1;border:6px solid transparent;border-image:url('assets/ui/Carved_Regular.png') 12 fill /6px stretch;pointer-events:none}
#upgrade[data-choice="upgrade"] .skill-learn::before{filter:hue-rotate(155deg) saturate(.85) brightness(1.04)}
#upgrade[data-choice="upgrade"] .skill-enhance.quality-0::before{filter:grayscale(.9) brightness(1.12)}
#upgrade[data-choice="upgrade"] .skill-enhance.quality-1::before{filter:hue-rotate(65deg) saturate(.9) brightness(1.04)}
#upgrade[data-choice="upgrade"] .skill-enhance.quality-2::before{filter:hue-rotate(155deg) saturate(.85) brightness(1.04)}
#upgrade[data-choice="upgrade"] .skill-enhance.quality-3::before{filter:hue-rotate(235deg) saturate(.9) brightness(1.02)}
#upgrade[data-choice="upgrade"] .skill-enhance.quality-4::before{filter:sepia(.16) saturate(1.55) brightness(1.03)}

#upgrade[data-choice="upgrade"] .coop-choice>strong{color:#30271e}
#upgrade[data-choice="upgrade"] .coop-choice>p{color:#352e25}
#upgrade[data-choice="upgrade"] .coop-choice>small{border-left:3px solid var(--quality);border-radius:2px}
#upgrade[data-choice="upgrade"] .coop-choice>img{width:30px;height:30px;object-fit:contain;image-rendering:pixelated}
