/* Runtime naval tokens remain canonical; this component changes HUD placement only. */
#resourceHud{--rail-width:192px;--resource-glass:rgba(4,18,31,.30);--resource-edge:rgba(231,240,247,.5);position:fixed;inset:0;z-index:850;pointer-events:none;font-family:Cairo,Tahoma,sans-serif;color:var(--ink,#E7F0F7)}
#resourceHud[hidden],#resourceRailBalances[hidden]{display:none!important}
#resourceHud button{font-family:inherit;cursor:pointer;color:inherit;touch-action:manipulation}
#resourceHud button:focus-visible{outline:2px solid #FFD58A;outline-offset:3px}
#resourceHud button:hover{border-color:var(--blue,#3E7BB6);background:#16354b}
.commander-profile{position:absolute;top:max(8px,env(safe-area-inset-top));left:max(12px,env(safe-area-inset-left));display:grid;grid-template-columns:42px minmax(0,1fr);grid-template-rows:auto auto;gap:0 10px;align-items:center;min-height:54px;width:230px;padding:6px 10px;text-align:right;background:var(--panel,#0B2236);border:1px solid #47708b;border-radius:var(--radius,12px);box-shadow:0 3px 12px #0005;pointer-events:auto}
.commander-profile img{grid-row:1/3;object-fit:cover;border-radius:8px;border:1px solid #60839a}
.commander-profile-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:700}
.commander-profile-level{font-size:12px;color:var(--ink-dim,#93A9BC);font-variant-numeric:tabular-nums}
.commander-profile-level{position:relative;display:flex;align-items:center;direction:ltr;height:26px;padding-left:22px;min-width:0}
.commander-level-badge{position:absolute;left:-3px;top:-1px;z-index:2;display:grid;place-items:center;width:32px;height:30px;font-size:17px;font-weight:900;color:#fff;text-shadow:0 2px 1px #123442,-1px 0 #123442,1px 0 #123442;isolation:isolate;filter:drop-shadow(0 1px 1px #0009)}
.commander-level-badge::before{content:"";position:absolute;inset:0;z-index:-1;clip-path:polygon(50% 0,65% 12%,84% 9%,89% 29%,100% 45%,90% 64%,90% 84%,67% 88%,50% 100%,33% 88%,10% 84%,10% 64%,0 45%,11% 29%,16% 9%,35% 12%);background:linear-gradient(#8de4ed,#42a8c4 48%,#1b627d);border:2px solid #b2eef5}
.commander-xp-track{position:relative;display:block;width:100%;height:19px;overflow:hidden;border:2px solid #1d3441;border-radius:5px;background:rgba(2,18,28,.68);box-shadow:inset 0 1px 3px #0009,0 1px 0 #c7edf344;box-sizing:border-box;color:#fff}
.commander-xp-fill{position:absolute;inset:0 auto 0 0;width:0;background:linear-gradient(#82dfeb,#35b2c7 55%,#248fa9);box-shadow:inset 0 1px #dbfcff99,1px 0 #cefbff99;transition:width .35s ease}
.commander-xp-value{position:absolute;inset:0;display:flex;align-items:center;padding-left:12px;font-size:11px;font-weight:900;line-height:15px;text-shadow:0 1px 2px #00131e,-1px 0 1px #00131e,1px 0 1px #00131e;white-space:nowrap}
@media(prefers-reduced-motion:reduce){.commander-xp-fill{transition:none}}
.resource-rail{position:absolute;top:max(8px,env(safe-area-inset-top));right:max(8px,env(safe-area-inset-right));width:var(--rail-width);box-sizing:border-box;background:transparent;border:0;border-radius:0;box-shadow:none;pointer-events:none}
#resourceRailToggle{display:block;margin-right:0;margin-left:auto;width:96px;min-height:44px;border:1px solid var(--resource-edge);border-radius:6px;background:var(--resource-glass);font-size:11px;font-weight:700;text-align:center;padding:4px 8px;pointer-events:auto;text-shadow:0 1px 2px #000,1px 0 2px #000,-1px 0 2px #000}
#resourceRailBalances{display:grid;gap:5px;padding-top:3px}
.resource-rail-row{position:relative;isolation:isolate;display:grid;grid-template-columns:30px minmax(0,1fr);grid-template-rows:12px 22px;gap:0 6px;align-items:center;min-height:34px;padding:0 4px;box-sizing:border-box;pointer-events:none;text-shadow:0 1px 2px #000,1px 0 2px #000,-1px 0 2px #000,0 -1px 2px #000}
.resource-rail-row::before{content:"";position:absolute;z-index:-1;inset:12px 0 0;border:1px solid var(--resource-edge);border-radius:5px;background:var(--resource-glass);pointer-events:none}
.resource-rail-icon{grid-row:1/3;text-align:center;font-size:26px;line-height:1;filter:drop-shadow(0 1px 2px #0008)}
.resource-rail-label{font-size:10px;font-weight:700;line-height:12px;color:var(--ink,#E7F0F7)}
.resource-rail-row strong{font-size:16px;font-weight:800;line-height:22px;font-variant-numeric:tabular-nums;text-align:right;white-space:nowrap;letter-spacing:-.15px}
[data-hud-resource=gold] strong{color:#FFD58A}[data-hud-resource=gems] strong{color:#91DEF3}
.resource-rail-collapsed .resource-rail{width:100px}
body.resource-hud-active #topbar,body.resource-hud-active #topbar2{display:none!important}
body.resource-hud-active:not(.fleet-room) #screen-port{padding-top:74px!important;box-sizing:border-box}
body.resource-hud-active:not(.fleet-room) #portBody{padding-right:212px!important;box-sizing:border-box}
body.resource-rail-collapsed:not(.fleet-room) #portBody{padding-right:16px!important}
/* Keep harbor actions in the top band between the profile and resource disclosure. */
body.resource-hud-active #frScene>.fr-command-shell{top:0!important;bottom:auto!important;left:max(252px,calc(env(safe-area-inset-left) + 252px))!important;right:max(212px,calc(env(safe-area-inset-right) + 212px))!important;height:58px!important;width:auto!important;max-width:none;transform:none!important;display:flex;flex-direction:row;align-items:center;gap:8px;padding:4px 8px;box-sizing:border-box;overflow-x:auto;overflow-y:hidden;background:#091827;pointer-events:auto;scrollbar-width:thin}
body.resource-hud-active.resource-rail-collapsed #frScene>.fr-command-shell{right:max(120px,calc(env(safe-area-inset-right) + 120px))!important}
body.resource-hud-active #frScene .fr-hud.fr-command-bar{display:flex;flex:0 0 auto;gap:6px!important;align-items:center;width:auto!important;max-width:none;padding:0!important;border:0;background:none;box-shadow:none;backdrop-filter:none}
body.resource-hud-active #frScene .fr-command-identity{display:none}
body.resource-hud-active #frScene .fr-command-status{display:flex;flex-wrap:nowrap;gap:4px}
body.resource-hud-active #frScene .fr-command-status>span:not(.fr-hud-btn){display:none}
body.resource-hud-active #frScene .fr-hud-btn,body.resource-hud-active #frScene .fr-command-shell>.fr-dock button{min-height:44px;flex-shrink:0;white-space:nowrap}
body.resource-hud-active #frScene .fr-command-shell>.fr-dock{display:flex;flex:0 0 auto;align-self:center;gap:4px}
body.resource-hud-active #frScene .fr-command-shell>.fr-dock button{width:auto;max-width:none;padding:3px 8px}
body.resource-hud-active #frScene>.fr-toolbar-toggle{top:58px!important;bottom:auto;border-radius:0 0 10px 10px;border-top:0;border-bottom:1px solid #60839a}
body.resource-hud-active #frScene.fr-toolbar-collapsed>.fr-toolbar-toggle{top:0!important;bottom:auto}
body.resource-hud-active #frScene>.fr-map-viewport{top:58px!important;bottom:0;right:0}
body.resource-hud-active.resource-rail-collapsed #frScene>.fr-map-viewport{right:0}
body.resource-hud-active #frScene.fr-toolbar-collapsed>.fr-map-viewport{top:0!important;bottom:0}
body.resource-hud-active #frScene .fr-view-controls{bottom:8px;left:10px;right:auto;transform:none;max-width:calc(100% - 72px)}
body.resource-hud-active #frScene.fr-toolbar-collapsed .fr-view-controls{bottom:8px}
body.resource-hud-active #frScene>.fr-map-viewport>.fr-stage{width:100%!important;top:50%}
body:has(.modal-overlay:not(.hidden)) #resourceHud{visibility:hidden}
@media(max-height:500px),(max-width:700px){
 #resourceHud{--rail-width:156px}
 body.resource-hud-active #frScene>.fr-command-shell{left:max(218px,calc(env(safe-area-inset-left) + 218px))!important;right:max(172px,calc(env(safe-area-inset-right) + 172px))!important}
 body.resource-hud-active.resource-rail-collapsed #frScene>.fr-command-shell{right:max(116px,calc(env(safe-area-inset-right) + 116px))!important}
 .commander-profile{width:204px;min-height:50px;grid-template-columns:36px minmax(0,1fr);padding:4px 8px;gap:0 8px;left:max(6px,env(safe-area-inset-left));top:4px}
 .commander-profile img{width:36px;height:36px}.commander-profile-name{font-size:12px}.commander-profile-level{font-size:11px}
 .resource-rail{top:4px;right:max(4px,env(safe-area-inset-right))}
 #resourceRailBalances{gap:4px;padding-top:1px}
 .resource-rail-row{min-height:30px;padding:0 3px;grid-template-columns:24px minmax(0,1fr);grid-template-rows:10px 20px;gap:0 4px}
 .resource-rail-row::before{top:10px}
 .resource-rail-icon{font-size:23px}.resource-rail-label{font-size:9px;line-height:10px}.resource-rail-row strong{font-size:13px;line-height:20px}
 body.resource-hud-active #frScene>.fr-map-viewport{right:0}
 body.resource-hud-active:not(.fleet-room) #screen-port{padding-top:60px!important}
 body.resource-hud-active:not(.fleet-room) #portBody{padding-right:170px!important}
 body.resource-hud-active.resource-rail-collapsed:not(.fleet-room) #portBody{padding-right:8px!important}
}
@media(max-height:340px){
 #resourceRailBalances{gap:2px}
 .resource-rail-row{min-height:26px;grid-template-rows:9px 17px}
 .resource-rail-row::before{top:9px}.resource-rail-row strong{font-size:12px;line-height:17px}.resource-rail-label{font-size:8px;line-height:9px}
}
