/* Retain the original map treatment when its one live control moves upstairs. */
#header-world-tools:empty{display:none}
#game-ui .field-actions{margin-left:auto}
@media(min-width:761px) and (min-height:601px),(min-width:1101px){
 /* Remove the old 14px empty strip above the bottom deck, without reducing its
    content height, bottom keyboard hint or safe-area clearance. */
 #game-ui{--hud-height:calc(169px + env(safe-area-inset-bottom));--hud-status-clearance:54px}
 #game-ui>footer{height:var(--hud-height);padding-top:0;padding-bottom:calc(22px + env(safe-area-inset-bottom))}
 #game-ui .field-bottom{bottom:var(--hud-height);padding-top:3px;padding-bottom:3px}
 #game-ui:has(#action-label[hidden]),#game-ui:has(#action-label:empty){--hud-status-clearance:8px}
 #game-ui .field-status-stack,
 #game-ui:has(#battle-messages:not(:empty)):not(:has(.character-story.story-cinematic:not([hidden]))):not(:has(#pause-overlay:not([hidden]))):not(:has(#journal:not([hidden]))) .field-status-stack{bottom:calc(var(--hud-height) + var(--hud-status-clearance));max-width:min(760px,calc(100% - 210px))}
 #game-ui .commandbar .wallet-tools #return{gap:6px;border-radius:0;font-size:10px;color:var(--gold)}
 #game-ui .commandbar .wallet-tools #return .return-label{display:inline;white-space:nowrap}
 #game-ui .commandbar .wallet-tools #return kbd{display:inline-block}
 /* The transient right-side messages no longer reserve an empty full-width
    band above the left buffs/loot. The full history is unchanged. */
 #game-ui #battle-messages{left:auto;width:min(480px,calc(100% - 380px))}
}
/* Boss dialogue shares the system-message centerline. Arrival/region story and
   ending cinematics retain all their separate styling and timing. */
#game-ui .character-story.story-boss-cue:not(.story-cinematic){left:50%;right:auto;transform:translateX(-50%);bottom:var(--boss-cue-bottom,calc(var(--hud-height,190px) + 12px));width:min(580px,calc(100vw - 48px));min-height:0;max-height:var(--boss-cue-max-height,calc(100dvh - 260px))}
#game-ui .story-boss-cue:not(.story-cinematic) .story-copy{min-width:0;max-height:calc(var(--boss-cue-max-height,calc(100dvh - 260px)) - 32px);overflow-y:auto;overscroll-behavior-y:contain;pointer-events:auto;scrollbar-width:thin}
#game-ui .story-boss-cue:not(.story-cinematic) #story-portrait{max-height:max(32px,calc(var(--boss-cue-max-height,160px) - 16px))}
@media(min-width:761px) and (min-height:601px),(min-width:1101px){
 #game-ui .character-story.story-boss-cue:not(.story-cinematic){width:min(580px,calc(100vw - 304px))}
}
@media(max-width:760px) and (orientation:portrait){
 #game-ui .character-story.story-boss-cue:not(.story-cinematic){width:calc(100vw - var(--safe-left,12px) - var(--safe-right,12px))}
 #game-ui .story-boss-cue:not(.story-cinematic) .story-copy{max-height:calc(var(--boss-cue-max-height,180px) - 28px)}
}
@media(orientation:landscape) and (max-height:600px) and (max-width:1100px){
 #game-ui .character-story.story-boss-cue:not(.story-cinematic){width:clamp(240px,calc(100vw - 288px),460px);max-width:calc(100vw - var(--safe-left,12px) - var(--safe-right,12px))}
 #game-ui .story-boss-cue:not(.story-cinematic) .story-copy{max-height:calc(var(--boss-cue-max-height,132px) - 22px)}
}

/* V145: the movement/attack narration is retired on both layouts. Keep its
   inert node for the existing UI updater, but reserve no visible label row. */
#game-ui .field-bottom #action-label{display:none}
@media(min-width:761px) and (min-height:601px),(min-width:1101px){
 #game-ui{--hud-status-clearance:8px}
}
/* Compact effects sit just above the character panel, alongside the controls.
   A stable left lane prevents incoming loot from lifting the entire stack.
   The right lane retains the transient feed and its full history button. */
@media(max-width:760px),(orientation:landscape) and (max-height:600px) and (max-width:1100px){
 #game-ui{--compact-status-clearance:4px;--compact-status-width:calc(50% - var(--safe-left,12px) - 8px)}
 #game-ui .field-status-stack,
 #game-ui:has(#battle-messages:not(:empty)):not(:has(.character-story.story-cinematic:not([hidden]))):not(:has(#pause-overlay:not([hidden]))):not(:has(#journal:not([hidden]))) .field-status-stack{bottom:calc(var(--hud-height) + var(--compact-status-clearance));--status-bottom-clearance:var(--compact-status-clearance);width:var(--compact-status-width);max-width:var(--compact-status-width)}
 #game-ui #battle-messages{left:auto;width:calc(50% - var(--safe-right,12px) - 8px)}
 #game-ui .field-bottom #auto-hunt{min-height:44px}
 #game-ui .quickbar{container:compact-combat-deck / inline-size}
 #game-ui .quickbar .wallet>#return{grid-column:7;grid-row:1;justify-self:end;display:flex;align-items:center;justify-content:center;width:44px;min-width:44px;height:44px;min-height:44px;margin:0;padding:4px 8px;border:1px solid #8a92746b;border-radius:0;background:#14271ee6;color:var(--gold);font-size:11px;line-height:16px;touch-action:manipulation}
 #game-ui .quickbar .wallet>#return:hover{border-color:#cebf8c;background:#354432}
 #game-ui .quickbar .wallet>#return .return-label{display:inline;white-space:nowrap}
 #game-ui .quickbar .wallet>#return kbd{display:none}
 /* The reveal may fade in, but must not translate the reward away from its
    final anchor during the first visible frames. */
 #game-ui.story-hud-reveal .field-status-stack{animation-name:compact-status-fade-v145}
 /* V147: every compact chip is one intrinsic row. A wrapping flex name
    inside fit-content still split 방어막 on the reported iPhone. Explicit
    max-content grid columns retain the whole name and reserve real end padding.
    Only unusually narrow lanes scroll; desktop chips and all anchors stay. */
 #game-ui #buff-chip{gap:4px}
 #game-ui .status-group{gap:3px}
 #game-ui .status-group-items{gap:4px;overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;scrollbar-width:thin}
 #game-ui #buff-chip .buff-status{display:inline-grid;grid-auto-flow:column;grid-auto-columns:max-content;flex:none;width:max-content;min-width:max-content;max-width:none;padding:3px 10px 3px 6px;font-size:11px;line-height:16px;gap:4px;white-space:nowrap}
 #game-ui #buff-chip .buff-status i{width:12px;font-size:13px}
 #game-ui #buff-chip .buff-status b{min-width:0;max-width:none;white-space:nowrap;word-break:normal;overflow-wrap:normal;overflow:visible}
 #game-ui #buff-chip .buff-status time{width:auto;min-width:3.5ch;margin-left:0;white-space:nowrap}
 @container compact-combat-deck (max-width:288px){
  /* Very narrow rotated decks still keep all four 44px targets distinct.
     Gold yields space before any socket or return target can overlap. */
  #game-ui .quickbar .wallet{grid-template-columns:minmax(0,1fr) 132px 44px;column-gap:4px}
  #game-ui .quickbar .wallet>b{grid-column:1;max-width:100%}
  #game-ui .quickbar .wallet .skill-preset-sockets{grid-column:2;grid-row:1;margin-left:0}
  #game-ui .quickbar .wallet>#return{grid-column:3}
 }
}
@media(orientation:landscape) and (max-height:600px) and (max-width:1100px){
 /* Keep the narrow upper part of the lane left of the target's HP card. */
 #game-ui{--compact-status-clearance:3px;--compact-status-width:calc(50% - min(102.5px,15vw) - var(--safe-left,12px) - 12px)}
}
@keyframes compact-status-fade-v145{from{opacity:0}to{opacity:1}}

/* V146: a stable upper-right voice lane for compact post-boss dialogue.
   Left-side receipts/buffs and the full bottom message/AUTO band stay separate.
   Only this non-cinematic card changes; PC, entry scenes and the ending do not. */
@media(max-width:760px),(orientation:landscape) and (max-height:600px) and (max-width:1100px){
 #game-ui .character-story.story-boss-cue:not(.story-cinematic){left:var(--boss-cue-left,auto);right:var(--safe-right,12px);top:var(--boss-cue-top,calc(52px + env(safe-area-inset-top)));bottom:auto;transform:none;translate:none;width:var(--boss-cue-width,min(360px,calc(50vw - var(--safe-right,12px))));max-width:calc(100vw - var(--safe-left,12px) - var(--safe-right,12px));min-height:0;max-height:var(--boss-cue-max-height,260px);padding:7px 8px;border-left-width:2px;align-items:flex-start;animation-name:compact-boss-fade-v146}
 #game-ui .story-boss-cue:not(.story-cinematic) #story-portrait{left:7px;top:5px;bottom:auto;width:34px;height:43px;max-height:43px;pointer-events:none}
 #game-ui .story-boss-cue:not(.story-cinematic) .story-copy{width:100%;max-height:none;overflow:visible;pointer-events:none}
 #game-ui .story-boss-cue:not(.story-cinematic) .story-heading{display:block;height:44px;min-height:44px;margin:0 0 4px;padding-left:38px;padding-right:28px;overflow:hidden}
 #game-ui .story-boss-cue:not(.story-cinematic) .story-heading strong{display:block;font-size:15px;line-height:21px;white-space:nowrap}
 #game-ui .story-boss-cue:not(.story-cinematic) .story-heading span{display:block;max-width:100%;font-size:10px;line-height:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 #game-ui .story-boss-cue:not(.story-cinematic) .story-body{max-height:calc(var(--boss-cue-max-height,260px) - 64px);overflow-y:auto;overscroll-behavior-y:contain;scrollbar-width:thin;pointer-events:auto}
 #game-ui .story-boss-cue:not(.story-cinematic) .story-copy p{font-size:14px;line-height:1.5;word-break:keep-all;overflow-wrap:anywhere}
 #game-ui .story-boss-cue:not(.story-cinematic) .story-copy p+p{margin-top:4px}
 #game-ui .story-boss-cue:not(.story-cinematic) #story-dismiss{top:0;right:0;width:44px;height:44px;min-height:44px}
 #game-ui:has(.story-boss-cue.boss-cue-cramped:not(.story-cinematic):not([hidden])) #battle-messages{visibility:hidden}
 /* At the shortest browser height, let the entire line scroll. Its content is
    never clipped away, and its 44px close target remains separate on the right. */
 #game-ui .story-boss-cue.boss-cue-tight:not(.story-cinematic) #story-portrait{display:none}
 #game-ui .story-boss-cue.boss-cue-tight:not(.story-cinematic) .story-copy{max-height:calc(var(--boss-cue-max-height,260px) - 16px);padding-right:32px;overflow-y:auto;overscroll-behavior-y:contain;scrollbar-width:thin;pointer-events:auto}
 #game-ui .story-boss-cue.boss-cue-tight:not(.story-cinematic) .story-heading{display:flex;align-items:center;gap:4px;height:18px;min-height:18px;padding:0;overflow:hidden}
 #game-ui .story-boss-cue.boss-cue-tight:not(.story-cinematic) .story-heading strong{flex:0 0 auto;font-size:13px;line-height:18px}
 #game-ui .story-boss-cue.boss-cue-tight:not(.story-cinematic) .story-heading span{min-width:0;font-size:9px;line-height:18px}
 #game-ui .story-boss-cue.boss-cue-tight:not(.story-cinematic) .story-body{max-height:none;overflow:visible}
}
@media(max-width:520px){
 #game-ui .character-story.story-boss-cue:not(.story-cinematic){top:var(--boss-cue-top,calc(91px + env(safe-area-inset-top)))}
}
@keyframes compact-boss-fade-v146{from{opacity:0}to{opacity:1}}
@media(prefers-reduced-motion:reduce){#game-ui .character-story.story-boss-cue:not(.story-cinematic){animation:none}}
