/* Independent Interface foundation; no legacy selector overrides. */
.ri-menu,.ri-window{--ri-bg:#18232e;--ri-border:#79684b;--ri-text:#eee3ca;--ri-accent:#d5b374;--ri-gap:4px;color:var(--ri-text);font:13px system-ui,sans-serif;box-sizing:border-box}
.ri-menu{position:absolute;z-index:8;right:max(4px,env(safe-area-inset-right,0px));bottom:max(4px,env(safe-area-inset-bottom,0px));display:flex;align-items:end;gap:var(--ri-gap);pointer-events:auto}
.ri-menu[hidden],.ri-menu [hidden]{display:none!important}
.ri-menu-strip{display:grid;grid-template-columns:repeat(10,30px);gap:3px;padding:3px;border:1px solid var(--ri-border);border-radius:5px;background:#111b24ef}
.ri-menu-icon,.ri-menu-trigger{position:relative;display:grid;place-items:center;width:30px;height:30px;margin:0;padding:3px;border:1px solid #59616b;border-radius:3px;background:linear-gradient(#354350,#17212a);color:var(--ri-text);cursor:pointer}
.ri-menu-icon svg{width:21px;height:21px;fill:var(--ri-icon);shape-rendering:crispEdges;filter:drop-shadow(1px 1px #080c10)}
.ri-menu-icon:hover,.ri-menu-trigger:hover{border-color:var(--ri-accent);background:#425060}
.ri-menu-icon:focus-visible,.ri-menu-trigger:focus-visible{outline:2px solid var(--ri-accent);outline-offset:2px}
.ri-menu-icon:disabled{opacity:.38;cursor:default}
.ri-menu [data-notice=true]::after{content:"";position:absolute;right:2px;top:2px;width:7px;height:7px;border-radius:50%;background:#ffd070;border:1px solid #39270c}
.ri-menu[data-mode=collapsed] .ri-menu-strip{position:absolute;bottom:calc(100% + 5px);right:0;grid-template-columns:repeat(5,44px);box-shadow:0 4px 18px #0009}
.ri-menu[data-mode=collapsed] .ri-menu-icon,.ri-menu-trigger{width:44px;height:44px}
.ri-window{position:absolute;display:grid;grid-template-rows:auto minmax(0,1fr);min-width:0;min-height:0;overflow:hidden;border:1px solid var(--ri-border);border-radius:6px;background:var(--ri-bg);box-shadow:0 8px 30px #0008}
.ri-window[hidden]{display:none}
.ri-window>header{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 12px;background:#273542;border-bottom:1px solid var(--ri-border)}
.ri-window-body{min-height:0;min-width:0;overflow:auto;overscroll-behavior:contain;padding:12px}
@media(any-pointer:coarse){.ri-menu-strip{grid-template-columns:repeat(10,44px)}.ri-menu-icon{width:44px;height:44px}}

/* Chat indicator is an overlay; new traffic cannot change the log's dimensions. */
.ri-chat-feed{position:relative;min-width:0}.ri-chat-feed #realm-chat{overflow-anchor:none}.ri-chat-feed .ri-chat-new{position:absolute;right:9px;bottom:8px;z-index:2;margin:0;padding:5px 9px;min-height:28px;border:1px solid #a7905d;background:#293849;color:#fff0ce;border-radius:4px;font-size:12px;box-shadow:0 2px 7px #0008}.ri-chat-feed .ri-chat-new[hidden]{display:none!important}

/* Desktop preview adapter: preserve existing DOM, commands and fallback. */
.realm-stage.ri-desktop.realm-ui2 .realm-hud-bottom{position:absolute;inset:auto auto 0 var(--ri-x);width:var(--ri-action);max-width:none;transform:none;display:grid;grid-template-columns:minmax(0,1fr);gap:2px;padding:0;z-index:5;background:none}
.realm-stage.ri-desktop.realm-ui2 .realm-hud-bottom #realm-spells{grid-row:2}
.realm-stage.ri-desktop.realm-ui2 .realm-hud-bottom #realm-supplies{grid-row:1}
.realm-stage.ri-desktop.realm-ui2 .realm-hud-bottom .realm-ui-xp{grid-row:3;height:8px;border-radius:0}
.realm-stage.ri-desktop.realm-ui2 .realm-hud-bottom .realm-ui-xp span{font-size:7px}
.realm-stage.ri-desktop.realm-ui2 .realm-hud-bottom :is(.realm-ui-tools,.realm-ui-micro){display:none}
.realm-stage.ri-desktop[data-ri-legacy=open].realm-ui2 .realm-hud-bottom :is(.realm-ui-tools,.realm-ui-micro){display:flex!important;position:absolute;left:0;right:0;bottom:calc(100% + 10px);padding:6px;background:#182630f5;border:1px solid #9b8662;border-radius:5px;z-index:22}
.realm-stage.ri-desktop[data-ri-legacy=open].realm-ui2 .realm-hud-bottom .realm-ui-micro{bottom:calc(100% + 70px)}
.realm-stage.ri-desktop .ri-menu{bottom:0;right:0}
.ri-legacy-toggle{position:absolute;right:4px;bottom:39px;z-index:9;min-width:30px;min-height:26px;padding:2px 6px;background:#20303a;color:#e9d9b5;border:1px solid #8c7857;border-radius:4px}
.ri-legacy-toggle[hidden]{display:none!important}
.realm-stage.ri-desktop .realm-desktop-interact{bottom:39px;right:43px;min-height:26px;min-width:74px;padding:3px 7px}
.realm-stage.ri-desktop .realm-hud-left{width:230px;top:4px;left:4px;max-height:none;overflow:visible;align-content:start}
.realm-stage.ri-desktop .realm-hud-right{width:184px;top:4px;right:4px;max-height:calc(100% - 95px);overflow:auto;display:flex;flex-direction:column;align-items:stretch}
.realm-stage.ri-desktop .realm-hud-right .realm-minimap-box{order:-3;width:184px;max-width:184px;flex:0 0 auto;box-sizing:border-box}
.realm-stage.ri-desktop .realm-hud-right #realm-zone{order:-2}
.realm-stage.ri-desktop .realm-hud-right #realm-climate{order:-1}
.realm-stage.ri-desktop .realm-hud-right #realm-minimap:not([hidden]){width:174px;height:174px;aspect-ratio:1;box-sizing:border-box;image-rendering:pixelated;cursor:default}
.ri-mini-tools{display:flex;justify-content:center;gap:4px;margin-top:3px}
.ri-mini-tools[hidden],.ri-mini-name[hidden]{display:none!important}
.ri-mini-tools button{min-width:32px;min-height:24px;padding:2px 5px}
.ri-mini-name{display:block;height:14px;line-height:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.realm-stage.ri-desktop .realm-hud-left #realm-party-frames:not([hidden]){width:100%;max-width:none;max-height:none;overflow:visible;scale:1;position:relative}
.realm-stage.ri-desktop #realm-party-frames .realm-party-body{grid-template-columns:minmax(0,1fr);max-height:none;overflow:visible}
.realm-stage.ri-desktop #realm-party-frames .realm-unit-frame{min-height:42px}
.realm-stage.ri-desktop.realm-ui2:not(.realm-compact) #realm-chat-drawer[data-pinned=true]{left:0;bottom:0;width:var(--ri-chat);max-width:var(--ri-chat);height:170px;max-height:170px;overflow:hidden;padding:4px;box-sizing:border-box;transform:none;translate:none}
.realm-stage.ri-desktop #realm-chat-drawer[data-pinned=true] #realm-chat{height:88px;min-height:88px;max-height:88px;resize:none}
.realm-stage.ri-desktop #realm-chat-drawer[data-pinned=true] .realm-chat-tabs{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:thin}
.realm-stage.realm-cinematic :is(.ri-menu,.ri-legacy-toggle){visibility:hidden!important;pointer-events:none!important}

/* Fixed internal chat geometry, independent casts, and compact assist access. */
.realm-stage.ri-desktop.realm-ui2 #realm-chat-drawer[data-pinned=true]:not([hidden]){display:grid;grid-template-rows:auto minmax(0,1fr);height:190px;max-height:190px}
.realm-stage.ri-desktop #realm-chat-drawer[data-pinned=true] .realm-bottom{min-height:0;display:flex;flex-direction:column}
.realm-stage.ri-desktop #realm-chat-drawer[data-pinned=true] .realm-bottom section:last-child{display:grid;grid-template-rows:auto minmax(0,1fr) auto;flex:1;min-height:0;padding:0}
.realm-stage.ri-desktop #realm-chat-drawer[data-pinned=true] .ri-chat-feed{min-height:0;overflow:hidden}
.realm-stage.ri-desktop #realm-chat-drawer[data-pinned=true] #realm-chat{height:100%;min-height:0;max-height:none;box-sizing:border-box}
.realm-stage.ri-desktop #realm-chat-drawer[data-pinned=true] #realm-chat-form{display:flex;gap:3px;align-items:center}
.realm-stage.ri-desktop #realm-chat-drawer[data-pinned=true] #realm-chat-input{min-width:0;flex:1;width:0}
.realm-stage.ri-desktop #realm-chat-drawer[data-pinned=true] #realm-chat-form select{min-height:26px;max-width:68px}
.realm-stage.ri-desktop .realm-hud-left .realm-ui-cast:not([hidden]),.ri-player-cast:not([hidden]){position:absolute;display:grid;gap:2px;width:220px;padding:5px;background:#192731ef;border:1px solid #9e8659;border-radius:4px;color:#f3e8d0;z-index:6;box-sizing:border-box;text-align:center;pointer-events:none}
.realm-stage.ri-desktop .realm-hud-left .realm-ui-cast:not([hidden]){position:fixed;position:absolute;left:calc((100cqw - 220px)/2 - 4px);top:72px}
.ri-player-cast:not([hidden]){left:calc(var(--ri-x) + (var(--ri-action) - 220px)/2);bottom:130px}
.ri-player-cast progress{width:100%;height:8px;accent-color:#74b8e0}
.ri-player-cast[hidden],.ri-auto-toggle{display:none!important}
.realm-stage.ri-desktop .ri-auto-toggle{display:grid!important;place-items:center;position:absolute;right:125px;bottom:39px;z-index:9;min-height:26px;min-width:30px;padding:2px 6px;background:#20303a;color:#bfe4a1;border:1px solid #8c7857;border-radius:4px}
.realm-stage.realm-cinematic :is(.ri-player-cast,.ri-auto-toggle){visibility:hidden!important;pointer-events:none!important}

/* A stable shared section rail above the existing authoritative route content. */
.ri-section-tabs[hidden]{display:none!important}
.ri-section-tabs{display:flex;flex-wrap:wrap;gap:4px;padding:7px 0;border-bottom:1px solid #786c53;margin-bottom:5px}
.ri-section-tabs button{font:600 12px system-ui,sans-serif;min-height:30px;padding:5px 9px;margin:0;border:1px solid #5c6c73;background:#23333e;color:#dddfd8;border-radius:4px}
.ri-section-tabs button[aria-pressed=true]{color:#f7e9c4;background:#435849;border-color:#bca16a}
.ri-section-tabs button:focus-visible{outline:2px solid #e0c791;outline-offset:2px}

/* Fixed window frame, legacy live content, internal scrolling. Geometry is owned by
   the Interface manager only while the desktop preview is active. */
.realm-stage.ri-desktop.realm-ui2 :is(.realm-ui-window,#realm-side-drawer,#realm-settings-drawer):not([hidden]){
 position:absolute;inset:var(--ri-window-y,8px) auto auto var(--ri-window-x,8px);width:var(--ri-window-width,640px);height:var(--ri-window-height,500px);
 min-width:0;min-height:0;max-width:none;max-height:none;box-sizing:border-box;translate:none;transform:none;resize:none;
 background:#182630;border:1px solid #8e7955;border-radius:6px;box-shadow:0 8px 32px #0009;padding:0;overflow:auto;overscroll-behavior:contain
}
.realm-stage.ri-desktop.realm-ui2 :is(.realm-ui-window,#realm-side-drawer,#realm-settings-drawer)>header{
 position:sticky;top:0;display:flex;align-items:center;justify-content:space-between;min-height:38px;box-sizing:border-box;padding:7px 12px;margin:0;z-index:3;background:linear-gradient(#35434b,#24313b);border-bottom:1px solid #8e7955;color:#f0e0be
}
.realm-stage.ri-desktop.realm-ui2 .realm-ui-window:not([hidden]){display:grid;grid-template-rows:auto minmax(0,1fr);overflow:hidden}
.realm-stage.ri-desktop.realm-ui2 .realm-ui-window-body{min-height:0;min-width:0;overflow:auto;padding:12px;overscroll-behavior:contain}
.realm-stage.ri-desktop.realm-ui2 #realm-side-drawer .ri-section-tabs:not([hidden]){position:sticky;top:38px;z-index:2;background:#182630;padding:7px 10px;margin:0}
.realm-stage.ri-desktop.realm-ui2 #realm-side-drawer #realm-side{padding:4px 12px;min-width:0}
.realm-stage.ri-desktop.realm-ui2 #realm-settings-drawer:not([hidden]){display:flex;flex-direction:column;overflow:hidden}
.realm-stage.ri-desktop.realm-ui2 #realm-settings-drawer .realm-settings-main{min-height:0;overflow:auto}

/* Measured touch controls and opt-in mobile Interface panels. */
.realm-stage.realm-ui2.realm-compact .realm-map-viewport #realm-touch-controls #realm-touch-interact{width:min(var(--realm-pad-cluster),max(80px,calc(var(--realm-pad-interact,44px)*2)))!important;transform:translateX(var(--realm-pad-interact-x,0px));margin-top:var(--realm-pad-interact-y,0px)}
.realm-stage.realm-ui2.realm-compact .realm-touch-spells button{touch-action:none}
.realm-stage.ri-touch.realm-ui2 :is(.realm-ui-window,#realm-side-drawer,#realm-settings-drawer):not([hidden]){position:absolute;inset:var(--ri-window-y,4px) auto auto var(--ri-window-x,4px);width:var(--ri-window-width,calc(100% - 8px));height:var(--ri-window-height,calc(100% - 8px));max-width:none;max-height:none;min-width:0;min-height:0;box-sizing:border-box;transform:none;translate:none;resize:none;overflow:auto;background:#182630;z-index:12;padding:0}
.realm-stage.ri-touch.realm-ui2 .realm-ui-window:not([hidden]){display:grid;grid-template-rows:auto minmax(0,1fr);overflow:hidden}
.realm-stage.ri-touch.realm-ui2 .realm-ui-window-body{overflow:auto;min-height:0;padding:10px}
.realm-stage.ri-touch.realm-ui2 #realm-settings-drawer:not([hidden]){display:flex;flex-direction:column;overflow:hidden}
.realm-stage.ri-touch.realm-ui2 :is(.realm-ui-window,#realm-side-drawer,#realm-settings-drawer)>header{position:sticky;top:0;z-index:3;min-height:44px;padding:5px 10px;background:#263743;margin:0;box-sizing:border-box}
.realm-stage.ri-touch .ri-section-tabs:not([hidden]){position:sticky;top:44px;z-index:2;background:#182630;flex-wrap:nowrap;overflow-x:auto;padding:5px;scrollbar-width:thin}
.realm-stage.ri-touch .ri-section-tabs button{flex:0 0 auto;min-height:44px}
.realm-stage.ri-touch .ri-menu{bottom:2px;right:2px;z-index:9}
.realm-stage.ri-touch .ri-menu-strip{grid-template-columns:repeat(10,44px)}
.realm-stage.ri-touch .ri-menu-icon{width:44px;height:44px}
.realm-stage.ri-touch .ri-menu[data-mode=collapsed] .ri-menu-strip,.realm-stage.ri-touch[data-touch-presentation^=phone] .ri-menu[data-mode=expanded] .ri-menu-strip{grid-template-columns:repeat(5,44px)}
.realm-stage.ri-touch:has(.realm-drawer:not([hidden]):not([data-pinned=true])) .ri-menu{visibility:hidden;pointer-events:none}
.realm-stage.ri-touch.realm-ui2.realm-compact .realm-hud-left #realm-party-frames:not([hidden]){display:block!important;position:absolute;top:78px;left:0;right:auto;width:min(195px,48cqw);max-width:none;max-height:none;overflow:visible;scale:1;z-index:3}
.realm-stage.ri-touch.realm-ui2.realm-compact #realm-party-frames .realm-party-body{display:grid;grid-template-columns:minmax(0,1fr);max-height:none;overflow:visible}
.realm-stage.ri-touch.realm-ui2.realm-compact #realm-party-frames .realm-unit-frame{min-height:38px}
.realm-stage.ri-touch[data-touch-presentation=phoneLandscape].realm-ui2.realm-compact .realm-hud-left #realm-party-frames:not([hidden]){width:min(330px,48cqw)}
.realm-stage.ri-touch[data-touch-presentation=phoneLandscape].realm-ui2.realm-compact #realm-party-frames .realm-party-body{grid-template-columns:repeat(2,minmax(0,1fr))}
.realm-stage.ri-touch #realm-party-frames :is(.realm-party-header,.realm-party-quick-orders){grid-column:1/-1}
.realm-stage.ri-touch .realm-mobile-nav{margin-right:48px}

/* Permanent bottom strip is reserved by layout, not by transient menu expansion. */
.realm-stage.ri-touch.realm-ui2.realm-compact .realm-hud-bottom{bottom:calc(var(--ri-touch-reserve,50px) + 2px)}
.realm-stage.ri-touch.realm-ui2.realm-compact .realm-mobile-nav{bottom:calc(var(--ri-touch-reserve,50px) + 65px);margin-right:0}
.realm-stage.ri-touch[data-touch-landscape=false].realm-ui2.realm-compact .realm-mobile-nav{bottom:calc(var(--ri-touch-reserve,50px) + 57px)}
.realm-stage.ri-touch[data-touch-presentation=phoneLandscape] .ri-menu[data-mode=expanded] .ri-menu-strip{grid-template-columns:repeat(10,44px)}
@container (max-width:499px){.realm-stage.ri-touch[data-touch-presentation=phoneLandscape] .ri-menu[data-mode=expanded] .ri-menu-strip{grid-template-columns:repeat(5,44px)}}
.realm-stage.ri-touch.realm-ui2.realm-compact .realm-hud-left #realm-party-frames:not([hidden]):not(.realm-ui-suppressed),.realm-stage.ri-touch.realm-ui2.realm-compact[data-details=open] .realm-hud-left #realm-party-frames:not([hidden]):not(.realm-ui-suppressed){max-height:none;overflow:visible;scale:1}
.realm-stage.ri-touch.realm-ui2.realm-compact[data-details=open] #realm-party-frames .realm-party-body{max-height:none;overflow:visible}
.realm-stage.ri-touch.realm-ui2.realm-compact .realm-hud-right .realm-minimap-box{width:132px;max-width:132px;flex:0 0 auto;box-sizing:border-box}
.realm-stage.ri-touch.realm-ui2.realm-compact .realm-hud-right #realm-minimap:not([hidden]){width:124px;height:124px;aspect-ratio:1;box-sizing:border-box;image-rendering:pixelated;cursor:default}
.realm-stage.ri-touch .ri-mini-tools button{min-width:36px;min-height:36px}

/* Editor 2.0: user transforms are isolated from legacy positioning and profiles. */
.ri-user-widget{translate:var(--ri-user-x,0px) var(--ri-user-y,0px)!important;scale:var(--ri-user-scale,1)!important;opacity:var(--ri-user-opacity,1)!important;transform-origin:top left!important}
.ri-user-hidden{visibility:hidden!important;pointer-events:none!important}
.realm-stage .ri-editor-overlay{position:absolute;inset:0;z-index:80;background:#0a142026;pointer-events:auto;touch-action:none}
.ri-editor-overlay[hidden]{display:none!important}
.ri-editor-frame{position:absolute!important;margin:0!important;padding:2px 4px!important;min-width:0!important;min-height:0!important;box-sizing:border-box;border:1px dashed #9cc1ce!important;border-radius:3px!important;background:#24435348!important;color:#eef4e7!important;overflow:hidden;text-align:left;white-space:nowrap;text-overflow:ellipsis;font:600 10px system-ui!important;touch-action:none;cursor:move}
.ri-editor-frame[data-selected=true]{border:2px solid #ffe2a0!important;background:#886d354f!important;z-index:2;box-shadow:0 0 0 1px #131d25}
.ri-editor-frame[data-placeholder=true]{border-style:dotted!important;background:#6a536b65!important}
.ri-editor-panel{position:absolute;z-index:4;top:8px;right:8px;width:min(260px,46%);max-height:calc(100% - 16px);overflow:auto;overscroll-behavior:contain;touch-action:pan-y;padding:9px;background:#182630f5;border:1px solid #a28b61;border-radius:6px;color:#eee2c8;box-sizing:border-box;display:grid;gap:7px}
.ri-editor-panel header,.ri-editor-actions{display:flex;gap:5px;align-items:center;justify-content:space-between;flex-wrap:wrap}
.ri-editor-panel button,.ri-editor-panel select{min-height:32px;max-width:100%;font-size:12px}
.ri-editor-controls{display:grid;gap:8px;min-width:0}
.ri-editor-controls label{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:4px;font-size:12px}
.ri-editor-controls input[type=range]{width:100%;min-width:0;touch-action:pan-y}
.realm-stage.ri-touch .ri-editor-panel{top:auto;bottom:6px;right:6px;width:min(320px,80%);max-height:44%}
.realm-stage.ri-touch .ri-editor-panel :is(button,select){min-height:40px}

.ri-editor-guide-x,.ri-editor-guide-y{position:absolute;pointer-events:none;background:#e8c784a0;z-index:1}
.ri-editor-guide-x{top:0;bottom:0;width:1px}
.ri-editor-guide-y{left:0;right:0;height:1px}
.ri-editor-guide-x[hidden],.ri-editor-guide-y[hidden],.ri-editor-recover[hidden]{display:none!important}
.realm-stage .ri-editor-recover{position:absolute;right:4px;bottom:4px;min-width:44px;min-height:36px;z-index:15;padding:4px;background:#283a44;color:#ffe4a5;border:1px solid #a68e60;border-radius:4px}
.realm-stage.realm-cinematic .ri-editor-recover{visibility:hidden;pointer-events:none}

/* Context windows retain original action listeners, close paths and stacking levels.
   Fixed outer geometry; one scroll container and a persistent window header. */
.realm-stage:is(.ri-desktop,.ri-touch).realm-ui2 :is(.realm-dialogue,#realm-fishing,.realm-merchant-overlay,.realm-player-inspect,.realm-loot-window):not([hidden]){
 position:absolute;inset:50% auto auto 50%;transform:translate(-50%,-50%);translate:none;
 width:min(var(--ri-context-width,640px),calc(100% - 16px));height:min(var(--ri-context-height,500px),calc(100% - 16px));
 max-width:none;max-height:none;min-width:0;min-height:0;margin:0;padding:0 12px 12px;box-sizing:border-box;
 overflow:auto;overscroll-behavior:contain;resize:none;background:#182630;color:#f0e0be;
 border:1px solid #8e7955;border-radius:6px;box-shadow:0 8px 32px #0009;
}
.realm-stage:is(.ri-desktop,.ri-touch).realm-ui2 .realm-merchant-overlay{--ri-context-width:900px;--ri-context-height:650px}
.realm-stage:is(.ri-desktop,.ri-touch).realm-ui2 :is(.realm-player-inspect,.realm-loot-window,#realm-fishing){--ri-context-width:460px;--ri-context-height:500px}
.realm-stage:is(.ri-desktop,.ri-touch).realm-ui2 :is(.realm-dialogue,#realm-fishing,.realm-merchant-overlay,.realm-player-inspect,.realm-loot-window)>header{
 position:sticky;top:0;z-index:3;display:flex;align-items:center;justify-content:space-between;gap:8px;
 min-height:42px;margin:0 -12px 10px;padding:6px 12px;box-sizing:border-box;background:linear-gradient(#35434b,#24313b);border-bottom:1px solid #8e7955;
}
.realm-stage.ri-touch.realm-ui2 :is(.realm-dialogue,#realm-fishing,.realm-merchant-overlay,.realm-player-inspect,.realm-loot-window):not([hidden]){
 width:calc(100% - 8px);height:calc(100% - 8px);padding:0 10px 10px;
}
.realm-stage.ri-touch.realm-ui2 :is(.realm-dialogue,#realm-fishing,.realm-merchant-overlay,.realm-player-inspect,.realm-loot-window)>header{min-height:48px;margin:0 -10px 10px;padding:4px 10px}
.realm-stage.ri-touch.realm-ui2 :is(.realm-dialogue,#realm-fishing,.realm-merchant-overlay,.realm-player-inspect,.realm-loot-window) button{min-height:44px}
.realm-stage.ri-touch.realm-ui2 .realm-merchant-panels{display:grid;grid-template-columns:minmax(0,1fr)}
.realm-stage.ri-touch.realm-ui2 .realm-merchant-overlay :is(input,select){font-size:16px;min-height:44px;max-width:100%}
.ri-collections{min-width:0}
.ri-collections .realm-item{margin:8px 0}
.ri-collections select{max-width:100%;min-width:0}
.ri-collections .realm-context-row{min-width:0}
.ri-collections .realm-achievement progress{width:100%}

/* Bounded service drawers, original transaction handlers. */
.realm-stage:is(.ri-desktop,.ri-touch).realm-ui2 .realm-bank{display:grid;gap:8px}
.realm-stage:is(.ri-desktop,.ri-touch).realm-ui2 .ri-transfer-panel{display:grid;gap:6px;padding:10px;border:1px solid #8e795566;border-radius:5px;background:#22343f;min-width:0}
.realm-stage:is(.ri-desktop,.ri-touch).realm-ui2 .ri-transfer-panel :is(input,select){width:100%;max-width:100%;min-width:0;box-sizing:border-box}
.realm-stage.ri-desktop.realm-ui2 .realm-bank{grid-template-columns:repeat(2,minmax(0,1fr))}
.realm-stage.ri-desktop.realm-ui2 .realm-bank>:not(.ri-transfer-panel){grid-column:1/-1}
.realm-stage.ri-touch.realm-ui2 .ri-transfer-panel :is(input,select,button){min-height:44px}
.realm-stage:is(.ri-desktop,.ri-touch).realm-ui2 #realm-side-drawer :is([data-section=market-listings],[data-section=market-sell],[data-section=market-history],[data-section=market],[data-section=trade]){min-width:0;overflow-wrap:anywhere}
.realm-stage:is(.ri-desktop,.ri-touch).realm-ui2 #realm-side-drawer :is([data-section=market-listings],[data-section=market-sell],[data-section=market-history],[data-section=market],[data-section=trade]) :is(input,select){max-width:100%;min-width:0;box-sizing:border-box}

/* Encounter stack: only live children occupy space. */
.realm-stage:is(.ri-desktop,.ri-touch).realm-ui2 .ri-encounter-stack:not([hidden]){position:absolute;left:50%;top:8px;transform:translateX(-50%);width:min(420px,38%);display:grid;gap:3px;z-index:7;pointer-events:none}
.ri-encounter-stack[hidden],.ri-encounter-stack:not(:has(>:not([hidden]))){display:none!important}
.realm-stage:is(.ri-desktop,.ri-touch).realm-ui2 .ri-encounter-stack>.realm-world-boss-hud{position:static;inset:auto;transform:none;width:100%;box-sizing:border-box;padding:5px 8px}
.realm-stage:is(.ri-desktop,.ri-touch).realm-ui2 .ri-encounter-stack>.realm-ui-cast:not([hidden]){position:static;inset:auto;transform:none;width:100%;box-sizing:border-box;text-align:center;pointer-events:none}
.ri-encounter-stack>.realm-ui-cast[data-interruptible=true] progress{accent-color:#e5bd6e}
.ri-encounter-stack>.realm-ui-cast[data-interruptible=false] progress{accent-color:#a5a9b8}
.realm-stage.ri-touch.realm-ui2 .ri-encounter-stack:not([hidden]){top:76px;width:min(36%,300px)}
.realm-stage.ri-touch.realm-ui2 .ri-encounter-stack>.realm-world-boss-hud{padding:3px 5px}
.realm-stage.ri-touch.realm-ui2 .ri-player-cast:not([hidden]){left:50%;transform:translateX(-50%);bottom:calc(var(--realm-dock-height,80px) + 8px);width:min(220px,40%);font-size:11px}
.realm-stage.realm-cinematic .ri-encounter-stack{visibility:hidden!important}
.ri-mini-tools button[aria-pressed=true]{outline:2px solid #f7d67d;color:#fff2ba}
.ri-mini-tools{flex-wrap:wrap}

/* Independent resizable panels. Geometry is restricted to the approved axes. */
.realm-stage .ri-user-width{width:var(--ri-user-width)!important;max-width:none!important;min-width:0!important;box-sizing:border-box}
.realm-stage .ri-user-height{height:var(--ri-user-height)!important;max-height:none!important;min-height:0!important;overflow:auto!important;overscroll-behavior:contain;box-sizing:border-box}
.ri-editor-frame[data-resize]:not([data-resize=""])[data-selected=true]:after{content:"";position:absolute;right:0;bottom:0;width:16px;height:16px;background:linear-gradient(135deg,transparent 48%,#ffe2a0 49%,#ffe2a0 57%,transparent 58%,transparent 70%,#ffe2a0 71%,#ffe2a0 79%,transparent 80%);pointer-events:none}
.ri-editor-controls input[type=number]{width:90px;max-width:100%;min-height:32px;box-sizing:border-box}
.realm-stage.ri-touch .ri-editor-controls input[type=number]{font-size:16px;min-height:44px}
.realm-stage.ri-touch .ri-menu{right:max(2px,env(safe-area-inset-right,0px));bottom:max(2px,env(safe-area-inset-bottom,0px))}
.realm-stage.ri-touch .ri-menu[data-mode=collapsed] .ri-menu-strip{max-height:calc(100cqh - 65px);overflow:auto;overscroll-behavior:contain}
@container(max-width:499px){.realm-stage.ri-touch .ri-menu[data-mode=expanded] .ri-menu-strip{grid-template-columns:repeat(5,44px)}}
.realm-stage.ri-touch.realm-ui2.realm-compact #realm-party-frames .realm-unit-frame{min-width:0}
.realm-stage.ri-touch.realm-ui2.realm-compact #realm-party-frames .realm-unit-select{min-height:38px}
.realm-stage.ri-touch.realm-ui2.realm-compact[data-touch-landscape=true] #realm-party-frames .realm-party-body{grid-template-columns:repeat(2,minmax(0,1fr));gap:3px}
.realm-stage.ri-touch.realm-ui2.realm-compact[data-touch-landscape=true] .realm-hud-left #realm-party-frames:not([hidden]){width:min(300px,43cqw);top:76px}
.realm-stage.ri-touch.realm-ui2.realm-compact[data-touch-landscape=true] #realm-party-frames .realm-unit-frame{min-height:36px}
.realm-stage.ri-touch.realm-ui2.realm-compact[data-details=open] #realm-party-frames .realm-party-body{max-height:min(44cqh,320px);overflow:auto;overscroll-behavior:contain}
.realm-stage.ri-touch.realm-ui2.realm-compact .realm-hud-right .realm-minimap-box .ri-mini-tools{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:2px}
.realm-stage.ri-touch .ri-mini-tools button{min-width:0;width:100%;min-height:36px;padding:2px}
.realm-stage.ri-touch .ri-mini-tools button:last-child:not([hidden]){grid-column:1/-1}

/* Focus remains visible in all preview windows; no global outline reset. */
.realm-stage:is(.ri-desktop,.ri-touch) :is(.realm-drawer,.realm-dialogue,.realm-merchant-overlay,.realm-loot-window,.realm-player-inspect,#realm-fishing,.ri-menu,.ri-editor-panel) :is(button,input,select,textarea):focus-visible{outline:2px solid #f4d391;outline-offset:1px}
.realm-stage:is(.ri-desktop,.ri-touch) .ri-section-tabs{scroll-padding-inline:6px}
.realm-stage:is(.ri-desktop,.ri-touch) .ri-section-tabs button:focus-visible{outline:2px solid #f4d391;outline-offset:-2px}

.realm-stage:is(.ri-desktop,.ri-touch):has(.ri-mini-tools button:last-child:not([hidden]):not([disabled])) #realm-minimap{cursor:crosshair}
