/* .47 measured HUD layout. Optional panels share a scrolling rail rather than stacking. */
#hud-right-rail{position:fixed;top:18px;right:20px;bottom:138px;width:208px;display:flex;flex-direction:column;gap:9px;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#688b82 #13231d;pointer-events:auto;z-index:24;padding:0 0 4px;box-sizing:border-box}
#hud-right-rail:focus-visible{outline:2px solid #e2ce96;outline-offset:2px}
#hud #hud-right-rail>*{position:relative!important;inset:auto!important;transform:none!important;flex:0 0 auto;width:100%!important;max-width:100%!important;min-width:0;max-height:none!important;margin:0;box-sizing:border-box;overflow-wrap:anywhere}
#hud #hud-right-rail>[hidden]{display:none!important}
#hud-right-rail #flight-hud{padding:9px;font-size:11px}
#hud-right-rail #flight-hud h3{font-size:14px}
#hud-right-rail .flight-telemetry{flex-wrap:wrap}
#hud-right-rail .party-mini{grid-template-columns:minmax(40px,1fr) 45px 62px 23px;gap:3px;font-size:10px}
#hud-right-rail .party-dock{padding:8px}
.comms-collapse{background:#203d36;border:1px solid #60877c;color:#e0efdf;border-radius:3px;min-width:28px;height:26px;font-size:16px;padding:0 5px;cursor:pointer}
.comms-collapse[hidden]{display:none!important}
@media(max-width:1000px), (max-height:650px){#hud-right-rail{width:166px}.map-panel .map-legend{display:none}}
@media(max-width:700px){
 #hud-right-rail{right:12px;top:12px;bottom:224px;width:154px}
 #hud .target-panel{top:92px}
 #hud .player-status{width:calc(100vw - 172px);max-width:210px;padding:10px 9px;gap:7px}
 #hud .player-status .status-avatar{width:25px;min-width:25px;font-size:21px}
 #tool-status{left:12px;right:auto;bottom:278px;width:calc(100vw - 188px);max-width:194px;padding:8px;box-sizing:border-box;overflow-wrap:anywhere}
 #active-tool-name{font-size:11px}
 #tool-status>div{font-size:9px}
 .comms-log.comms-compact:not(.comms-expanded){left:12px!important;top:auto!important;bottom:238px!important;width:calc(100vw - 188px)!important;max-width:194px;height:34px!important}
 .comms-compact .comms-grip{gap:4px}.comms-compact .comms-grip small,.comms-compact .comms-reset,.comms-compact .comms-resize{display:none}
 #toast{left:12px;top:178px;bottom:auto;transform:none;max-width:calc(100vw - 188px);padding:7px;box-sizing:border-box;font-size:10px}
 #approach-status{left:12px;top:230px;bottom:auto;transform:none;width:calc(100vw - 188px);padding:7px;box-sizing:border-box;font-size:10px}
 #approach-status button{margin-left:0}
}
@media(max-height:500px) and (min-width:701px){
 .comms-log.comms-compact:not(.comms-expanded){left:20px!important;top:110px!important;width:225px!important;height:34px!important}
 .comms-compact .comms-grip small,.comms-compact .comms-reset,.comms-compact .comms-resize{display:none}
 #hud-right-rail{bottom:136px}
 #toast{left:50%;top:108px;bottom:auto;max-width:calc(100vw - 520px);font-size:10px;padding:6px;box-sizing:border-box}
 #approach-status{left:50%;bottom:132px;max-width:calc(100vw - 540px);font-size:10px;padding:6px}
}
.comms-compact:not(.comms-expanded)>:not(.comms-head){display:none!important}
/* Opening compact chat is an explicit focused panel, never a pile of competing controls. */
body.comms-expanded #hud>:not(.comms-log),body.comms-expanded #tool-status,body.comms-expanded #control-status,body.comms-expanded #save-status,body.comms-expanded #toast,body.comms-expanded #approach-status,body.comms-expanded #combat-world-overlay{visibility:hidden!important;pointer-events:none!important}
.comms-log.comms-expanded{position:fixed!important;left:12px!important;top:50%!important;transform:translateY(-50%);width:calc(100vw - 24px)!important;height:min(340px,calc(100dvh - 32px))!important;max-width:none;z-index:80}
body.comms-expanded .comms-log{visibility:visible!important;pointer-events:auto!important}
#player-context-menu{max-height:calc(100dvh - 16px);overflow-y:auto;box-sizing:border-box}
@media(max-width:1000px), (max-height:650px){
 #hud-right-rail .party-mini{display:grid;grid-template-columns:minmax(0,1fr) 23px;gap:2px}
 #hud-right-rail .party-mini>span{grid-column:1;grid-row:1}
 #hud-right-rail .party-vitals{grid-column:1;grid-row:2}
 #hud-right-rail .party-mini>small{grid-column:1;grid-row:3}
 #hud-right-rail .party-mini>button{grid-column:2;grid-row:1 / 4}
}
#hud-right-rail #finder-hud .finder-supplies{flex-wrap:wrap;gap:4px}
#hud-right-rail .finder-body{padding:8px;min-width:0}
#hud-right-rail #finder-channels{flex-wrap:wrap}
#hud-right-rail button{max-width:100%;white-space:normal}
#player-context-menu strong{overflow-wrap:anywhere}

/* Notices share a bounded stack; overlapping notification types remain scrollable. */
#hud-notice-stack{position:fixed;left:50%;transform:translateX(-50%);bottom:228px;width:300px;max-height:170px;display:flex;flex-direction:column;gap:6px;overflow:auto;scrollbar-width:thin;z-index:30;pointer-events:none}
#hud #hud-notice-stack>*{position:relative!important;inset:auto!important;transform:none!important;width:100%!important;max-width:100%!important;flex:0 0 auto;margin:0;box-sizing:border-box;overflow-wrap:anywhere;pointer-events:auto}
#hud #hud-notice-stack>[hidden]{display:none!important}
#hud-right-rail #planet-location{display:block;white-space:normal;text-align:left;padding:6px;font-size:10px}
@media(max-width:700px){#hud-notice-stack{left:12px;top:178px;bottom:auto;transform:none;width:calc(100vw - 188px);max-height:calc(100dvh - 550px)}#hud #hud-notice-stack>*{font-size:10px;padding:7px}}
@media(max-height:500px) and (min-width:701px){#hud-notice-stack{top:112px;bottom:210px;width:calc(100vw - 550px);max-height:none}#hud #hud-notice-stack>*{font-size:10px;padding:6px}}
@media(min-width:701px) and (max-width:1100px){#hud-notice-stack{left:350px;transform:none;width:calc(100vw - 550px);max-width:300px}}

/* Full server/build status must not run into the target panel. */
@media(min-width:701px) and (max-width:1100px){#hud #runtime{max-width:calc(50vw - 210px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}}
@media(max-width:700px){#hud #runtime{max-width:calc(100vw - 198px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}}
