/* SWV-038 compact / expanded HUD. Highest layer overrides historical fixed offsets. */
.hud038{--message-height:156px;--side-width:min(290px,38vw);--message-width:min(480px,calc(100vw - 120px));--hud-gap:10px;--hud-top:env(safe-area-inset-top,0px);--hud-bottom:env(safe-area-inset-bottom,0px);--hud-left:max(10px,env(safe-area-inset-left,0px));--hud-right:max(10px,env(safe-area-inset-right,0px))}
.hud038.messagesCollapsed{--message-height:44px}.hud038.inventoryDockOpen{--message-width:min(480px,calc(100vw - var(--side-width) - 30px))}
.hud038 button,.hud038 #world canvas,.hud038 #actionDock{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}.hud038 button{touch-action:manipulation}.hud038 #interact{touch-action:none}
.hud038 #playerIdentity{left:var(--hud-left)!important;top:calc(var(--hud-top) + 10px)!important;width:220px!important;max-width:calc(100vw - 155px)!important;height:60px!important;padding:4px 8px 4px 4px!important;gap:8px!important;border-radius:12px!important}
.hud038 #playerIdentity .identityPortrait{width:48px!important;height:48px!important;flex-basis:48px!important}.hud038 .identityText small,.hud038 .identityText span{display:none}.hud038 #playerName{font-size:22px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hud038 #playerControls{position:fixed;top:calc(var(--hud-top) + 78px);left:var(--hud-left);display:flex;gap:7px;z-index:32}
.hud038 #playerControls #menuToggle,.hud038 #playerControls #coinBalance{position:static!important;inset:auto!important;height:44px!important;min-width:66px!important;width:auto!important;max-width:120px!important;display:flex;align-items:center;justify-content:center;gap:5px;padding:5px 10px!important}
.hud038 #playerControls #menuToggle svg{width:23px;height:23px}.hud038 #menuToggle span{display:inline!important}.hud038 #coinBalance svg{width:26px;height:26px}
.hud038 #gameHUD{left:var(--hud-left)!important;right:auto!important;top:calc(var(--hud-top) + 130px)!important;bottom:auto!important;z-index:50!important;max-width:220px}.hud038 #settingsPanel{left:var(--hud-left)!important;top:calc(var(--hud-top) + 130px)!important;bottom:calc(var(--message-height) + 90px + var(--hud-bottom))!important;max-height:calc(100dvh - var(--message-height) - 230px)!important;width:min(290px,calc(100vw - 24px))!important;z-index:60!important}
.hud038 #navigationHUD{top:calc(var(--hud-top) + 10px)!important;right:var(--hud-right)!important;width:128px!important}.hud038 #minimap{width:128px!important;height:128px!important;aspect-ratio:1}.hud038 .mapControls{display:grid;grid-template-columns:1fr 1fr;gap:5px}.hud038 .mapControls button{min-height:44px}.hud038 #destinationHint{max-width:128px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hud038 #notice,.hud038 #journeyHint,.hud038 #instructions,.hud038 #cloudStatus,.hud038 #saveStatus,.hud038 #testSaveNotice{display:none!important}
.hud038 #messageWindow{position:fixed;z-index:34;left:var(--hud-left);bottom:calc(var(--hud-bottom) + 10px);width:var(--message-width);height:var(--message-height);box-sizing:border-box;padding:5px;border:2px solid #bd9a51;border-radius:12px;background:linear-gradient(130deg,#173e2fed,#12241ef2);box-shadow:inset 0 0 0 2px #382b18,0 3px 12px #0006;color:#f1e6c8;font:14px/1.4 system-ui;pointer-events:auto;display:flex;flex-direction:column}
.hud038 #messageWindow nav{display:flex;gap:4px;flex:none}.hud038 #messageWindow nav button{min-height:34px;min-width:58px;padding:3px 10px;border-radius:6px;font-size:13px}.hud038 #messageWindow nav button[aria-pressed=true]{background:linear-gradient(#4b782d,#244c25);border-color:#d3b66e;color:#fff2bc}.hud038 #collapseMessages{margin-left:auto;min-width:38px!important;font-size:20px!important}
.hud038 #messageLog{list-style:none;margin:5px 2px 0;padding:0 5px;overflow:auto;overscroll-behavior:contain;min-height:0;flex:1;user-select:text}.hud038 #messageLog li{display:flex;gap:8px;padding:2px 0;overflow-wrap:anywhere}.hud038 #messageLog li>span{color:#d5bd68;flex:none;width:17px}.hud038 #messageLog li[data-kind=system]{color:#c5d5ce}.hud038 #messageWindow.collapsed #messageLog{display:none}
.hud038 #actionDock{position:fixed!important;left:var(--hud-left)!important;right:auto!important;top:auto!important;bottom:calc(var(--hud-bottom) + var(--message-height) + 20px)!important;width:var(--message-width)!important;transform:none!important;z-index:35!important;display:grid;grid-template-columns:minmax(0,1fr) 60px;grid-template-rows:auto auto;column-gap:7px;align-items:center;pointer-events:auto}
.hud038 #actionDock[hidden]{display:none!important}.hud038 #actionDock #interact{position:static!important;inset:auto!important;grid-column:1;grid-row:1;width:100%!important;min-height:44px!important;border-radius:20px 20px 0 0;padding:7px 10px;font-weight:700;font-size:16px;letter-spacing:.4px;background:linear-gradient(#24553b,#102e23);border:2px solid #be9d55;border-bottom:0;transform:none!important}.hud038 #interact:disabled{opacity:1;color:#d7d2ba}
.hud038 #actionDock #activity{position:static!important;inset:auto!important;grid-column:1;grid-row:2;width:auto!important;max-width:none!important;transform:none!important;margin:0!important;padding:0 12px 9px!important;background:#102e23!important;border:2px solid #be9d55!important;border-top:0!important;border-radius:0 0 20px 20px!important;font:11px/1.25 system-ui;text-align:center;min-height:22px;box-sizing:border-box}.hud038 #activityText{display:block}.hud038 #chopProgress{display:block;width:100%;height:9px;margin:5px 0 0;accent-color:#8fc448}
.hud038 #actionDock #cancelWork{position:static!important;inset:auto!important;grid-column:2;grid-row:1/3;transform:none!important;min-width:58px!important;width:58px!important;min-height:65px!important;background:linear-gradient(#793c28,#311c18);border:2px solid #c7a35e;border-radius:14px;padding:3px;display:flex;flex-direction:column;align-items:center;justify-content:center}.hud038 #cancelWork span{font-size:30px;line-height:30px}.hud038 #cancelWork small{font-size:11px}.hud038 #cancelWork[hidden]{display:none!important}
.hud038 #travelHUD{left:var(--hud-left)!important;top:auto!important;bottom:calc(var(--hud-bottom) + var(--message-height) + 20px)!important;right:auto!important;max-width:var(--message-width)!important;width:var(--message-width);box-sizing:border-box;transform:none!important;font-size:12px;display:flex;justify-content:space-between;align-items:center;gap:6px}.hud038 #travelHUD[hidden],.hud038.activityBusy #travelHUD{display:none!important}
.hud038 #inventoryRestore{position:fixed!important;left:auto!important;right:var(--hud-right)!important;top:auto!important;bottom:calc(var(--hud-bottom) + 10px)!important;width:84px!important;height:88px!important;min-width:0!important;padding:8px!important;display:flex;flex-direction:column;justify-content:center;align-items:center;border:2px solid #bc9857!important;border-radius:16px!important;background:linear-gradient(#3b3923,#172c20)!important;z-index:36!important}.hud038 #inventoryRestore svg{width:49px;height:49px;filter:drop-shadow(0 2px 2px #0008)}.hud038 #inventoryRestore .packCount{font:bold 12px system-ui;color:#fff0b8}.hud038 #inventoryRestore[hidden]{display:none!important}
.hud038 #inventoryPanel.inventory28:not(.bankView){position:fixed!important;left:auto!important;right:var(--hud-right)!important;top:calc(var(--hud-top) + 218px)!important;bottom:calc(var(--hud-bottom) + 10px)!important;width:var(--side-width)!important;max-width:var(--side-width)!important;height:auto!important;max-height:none!important;transform:none!important;display:flex!important;flex-direction:column!important;box-sizing:border-box;z-index:38!important;overflow:hidden!important}.hud038 #inventoryPanel[hidden]{display:none!important}
.hud038 #inventoryPanel.inventory28:not(.bankView) .i28Head{display:flex;flex:none;min-height:32px;padding:4px 7px}.hud038 .i28Head .i28Crest,.hud038 .i28Head small{display:none}.hud038 .i28Head h2{font:15px Georgia}.hud038 #inventoryPanel.inventory28:not(.bankView) .i28Nav{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;grid-template-rows:auto!important;flex:none;padding:5px!important;gap:4px!important;min-height:46px!important}.hud038 .i28Nav button{min-width:0;min-height:42px!important;padding:3px!important}.hud038 .i28Nav button span{font-size:9px}.hud038 .i28Nav svg{width:22px!important;height:22px!important}
.hud038 #inventoryPanel.inventory28:not(.bankView) .i28Content{flex:1!important;min-height:0!important;max-height:none!important;height:auto!important;overflow:auto!important;padding:5px!important}.hud038 #inventoryPanel.inventory28:not(.bankView) .i28BagGrid{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:4px!important}.hud038 #inventoryPanel.inventory28:not(.bankView) .i28Cell{height:clamp(42px,7dvh,67px)!important;min-height:42px!important}.hud038 #inventoryPanel.inventory28:not(.bankView) .i28Details{position:static!important;width:auto!important;max-height:none!important}.hud038 .i28Status{font-size:10px}.hud038 .i28SectionTitle{display:none}
@media(orientation:portrait){.hud038{--side-width:min(245px,44vw);--message-height:142px}.hud038 #navigationHUD{width:110px!important}.hud038 #minimap{width:110px!important;height:110px!important}.hud038 #playerIdentity{width:210px!important;max-width:calc(100vw - 138px)!important;height:56px!important}.hud038 #playerName{font-size:19px}.hud038 #playerControls{top:calc(var(--hud-top) + 74px)}.hud038 #inventoryPanel.inventory28:not(.bankView){top:calc(var(--hud-top) + 197px)!important}.hud038.inventoryDockOpen #messageWindow nav button{min-width:0;padding:3px 6px;font-size:11px}.hud038.inventoryDockOpen #actionDock{grid-template-columns:minmax(0,1fr) 45px}.hud038.inventoryDockOpen #cancelWork{width:45px!important;min-width:45px!important}.hud038.inventoryDockOpen #actionDock #interact{font-size:12px}.hud038.inventoryDockOpen #messageWindow{font-size:12px}}
@media(orientation:landscape) and (max-height:550px){.hud038{--message-height:96px;--side-width:240px;--message-width:min(410px,calc(100vw - 120px))}.hud038.inventoryDockOpen{--message-width:min(410px,calc(100vw - 270px))}.hud038 #navigationHUD{width:88px!important}.hud038 #minimap{width:88px!important;height:88px!important}.hud038 .mapControls button{min-height:38px!important}.hud038 #inventoryPanel.inventory28:not(.bankView){top:calc(var(--hud-top) + 154px)!important}.hud038 #playerIdentity{height:52px!important;width:195px!important}.hud038 #playerIdentity .identityPortrait{width:40px!important;height:40px!important;flex-basis:40px!important}.hud038 #playerControls{top:calc(var(--hud-top) + 68px)}.hud038 #gameHUD,.hud038 #settingsPanel{top:calc(var(--hud-top) + 118px)!important}.hud038 #settingsPanel{bottom:calc(var(--hud-bottom) + 10px)!important;max-height:calc(100dvh - 130px)!important}.hud038 #messageWindow{font-size:12px}.hud038 #actionDock #activity{padding-bottom:5px!important}.hud038 #actionDock #interact{min-height:38px!important;font-size:14px}.hud038 #messageWindow nav button{min-height:28px;font-size:11px}.hud038 #inventoryRestore{height:74px!important;width:76px!important}}
.hud038 #inventoryPanel.inventory28[hidden]:not(.bankView){display:none!important}
.hud038 #playerIdentity .identityText small,.hud038 #playerIdentity .identityText span{display:none!important}

.hud038 #inventoryPanel.inventory28:not(.bankView) .i28Nav button span{display:none!important}
.hud038 #inventoryPanel.inventory28:not(.bankView) .i28Nav svg{width:27px!important;height:27px!important}
@media(orientation:portrait){.hud038{--side-width:min(245px,max(188px,46vw))}.hud038.inventoryDockOpen #messageWindow nav button{padding:3px 2px!important;font-size:10px!important}.hud038.inventoryDockOpen #collapseMessages{min-width:27px!important;flex:none}.hud038.inventoryDockOpen #messageWindow nav button[data-filter]{flex:1;min-width:0!important}}
.hud038 #actionDock #interact{max-width:none!important;min-width:0!important;box-sizing:border-box!important}

/* SWV-038 R2 — owner places messages at upper left; icon controls below minimap. */
.hud038{--navigation-width:144px;--message-width:min(480px,calc(100vw - var(--navigation-width) - 30px))}
.hud038.inventoryDockOpen{--message-width:min(480px,calc(100vw - var(--navigation-width) - 30px))}
.hud038 #messageWindow{top:calc(var(--hud-top) + 10px)!important;bottom:auto!important}
.hud038 #playerControls{top:calc(var(--hud-top) + var(--message-height) + 20px)!important}
.hud038 #navigationHUD{width:var(--navigation-width)!important;display:flex;flex-direction:column;align-items:flex-end}
.hud038 .mapControls{width:var(--navigation-width);display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px}
.hud038 #navigationHUD #menuToggle,.hud038 #navigationHUD #mapToggle,.hud038 #navigationHUD #runToggle{position:static!important;inset:auto!important;transform:none!important;display:flex!important;align-items:center;justify-content:center;width:100%!important;min-width:0!important;min-height:44px!important;height:44px!important;padding:5px!important;box-sizing:border-box}
.hud038 .mapControls svg{width:29px!important;height:29px!important;flex:none}.hud038 .mapControls button span{display:none!important}
.hud038 #gameHUD{left:auto!important;right:var(--hud-right)!important;top:calc(var(--hud-top) + 218px)!important;bottom:auto!important}
.hud038 #settingsPanel{top:calc(var(--hud-top) + var(--message-height) + 74px)!important;bottom:calc(var(--hud-bottom) + 10px)!important;max-height:calc(100dvh - var(--message-height) - var(--hud-top) - var(--hud-bottom) - 84px)!important}
.hud038 #messageWindow nav button[data-filter]{flex:1;min-width:0!important;padding:3px 5px!important}.hud038 #collapseMessages{min-width:30px!important}
.hud038 #actionDock,.hud038 #travelHUD{max-width:min(480px,calc(100vw - var(--side-width) - 30px))!important;bottom:calc(var(--hud-bottom) + 15px)!important}
.hud038:not(.inventoryDockOpen) #actionDock,.hud038:not(.inventoryDockOpen) #travelHUD{max-width:min(480px,calc(100vw - 120px))!important}
@media(orientation:portrait){.hud038{--message-height:142px;--message-width:calc(100vw - var(--navigation-width) - 30px)}.hud038.inventoryDockOpen{--message-width:calc(100vw - var(--navigation-width) - 30px)}.hud038 #messageWindow{font-size:12px}.hud038 #messageWindow nav button{font-size:11px!important}.hud038 #gameHUD{top:calc(var(--hud-top) + 200px)!important}}
@media(orientation:landscape) and (max-height:550px){.hud038{--message-height:96px}.hud038 #gameHUD{top:calc(var(--hud-top) + 160px)!important}.hud038 #settingsPanel{max-height:calc(100dvh - var(--message-height) - 84px)!important}}

.hud038.messagesCollapsed{--message-height:48px}

.hud038 #actionDock[data-fishing=true] #activity[hidden],
.hud038 #actionDock[data-fishing=true] #interact[hidden]{display:none!important}
.hud038 #actionDock[data-fishing=true]{pointer-events:none}
.hud038 #actionDock[data-fishing=true] #cancelWork{pointer-events:auto}
