/* Critical substrate: include this sheet in every first-party document before async startup.
   Geometry is viewport-owned; route scenes never transform the metal or lower controls. */
:root{--portal-strip:#b026ff;--strip-dim:#4f1173;--shell-rail:15px;--shell-top:calc(52px + env(safe-area-inset-top,0px));--shell-left:calc(15px + env(safe-area-inset-left,0px));--shell-right:calc(15px + env(safe-area-inset-right,0px));--shell-dock:calc(80px + env(safe-area-inset-bottom,0px));--shell-bottom:calc(var(--shell-dock) + 15px);--myr5-bar:var(--shell-bottom);--shell-metal:var(--portal-metal,#4d3d4f);--shell-light:#c9d1c7;--shell-dark:#1b242e;--shell-well-height:calc(100dvh - var(--shell-top) - var(--shell-bottom))}
html{scroll-padding-block:var(--shell-top) var(--shell-bottom)}
/* CSS-only rails survive unavailable JavaScript, WebGL, auth and pack loading. */
html:not(.shell-ready):not(.shell-disabled)::before{content:'';position:fixed;inset:0;z-index:2147483000;box-sizing:border-box;pointer-events:none;border-style:ridge;border-color:#4d3d4f;border-width:var(--shell-top) var(--shell-right) var(--shell-bottom) var(--shell-left);box-shadow:inset 0 0 0 2px #141e26,inset 0 5px 10px #000a}
html:not(.shell-ready):not(.shell-disabled) body{padding:var(--shell-top) var(--shell-right) var(--shell-bottom) var(--shell-left);box-sizing:border-box;min-height:100dvh}
.myr5-shell#myr5Shell{position:fixed!important;inset:0!important;width:100vw!important;height:100dvh!important;max-width:none!important;max-height:none!important;box-sizing:border-box!important;margin:0!important;padding:0!important;z-index:2147483000!important;pointer-events:none!important;transform:none!important;translate:none!important;zoom:1!important;visibility:visible!important;clip-path:none!important;overflow:visible!important;contain:none!important;isolation:isolate;touch-action:auto}
.shell-metal{position:absolute;inset:0;pointer-events:none;filter:drop-shadow(0 2px 3px #0009)}
/* Portal frame recipe: copied from modules/portal/portal.css (:12 shades, :15 box, :16 merged with :221, :18 lip, :20-21 bolts, :25-36 energy),
   every selector prefixed #myr5Shell and re-pointed at the shell well (shell vars instead of the face, cap, side and myr5-bar vars). Markup: portal-look.mjs frameHtml(). */
#myr5Shell{--portal-rail:15px;--pm:var(--portal-metal,#4d3d4f)}
#myr5Shell .portal-frame{--mh:color-mix(in srgb,var(--pm) 62%,#fff);--md:color-mix(in srgb,var(--pm) 75%,#000);--mx:color-mix(in srgb,var(--pm) 55%,#000);--me:color-mix(in srgb,var(--pm) 90%,#fff)}
#myr5Shell .portal-frame{--screw:#cbbab0 0 1.4px,#57474f 1.9px 3px,#0000 3.5px;position:absolute;z-index:1;box-sizing:border-box;left:var(--shell-left);top:var(--shell-top);width:calc(100vw - var(--shell-left) - var(--shell-right));height:var(--shell-well-height);border-radius:3px;pointer-events:none;box-shadow:0 0 0 calc(var(--portal-rail) + 1px) #0e0a12,0 8px 16px calc(var(--portal-rail) - 2px) #000b}
#myr5Shell .portal-frame:before{content:'';position:absolute;top:calc(-1*var(--shell-top));left:calc(-1*var(--shell-left));right:calc(-1*var(--shell-right));bottom:calc(-1*var(--shell-bottom));padding:var(--shell-top) var(--shell-right) var(--shell-bottom) var(--shell-left);border-radius:calc(var(--portal-rail)/2 + 3px);background:repeating-linear-gradient(0deg,#0000 0 25px,#0b071966 26px,#d3bed92e 27px,#0000 29px),repeating-linear-gradient(90deg,#0000 0 3px,#ffffff06 3px 4px),linear-gradient(160deg,var(--mh,#7e6a7c),var(--pm,#4d3d4f) 26%,var(--md,#3b2f42) 52%,var(--mx,#2b2132) 78%,var(--me,#564458));box-shadow:inset 0 1px #e6d2da99,inset 1px 0 #d6c0cc44,inset 0 -2px #000a,inset -1px 0 #0007;-webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);-webkit-mask-composite:xor;mask-composite:exclude}
#myr5Shell .portal-frame:after{content:'';position:absolute;inset:0;border-radius:inherit;box-shadow:0 0 0 1px #0e0a12,0 0 0 2.5px #bba4b355,inset 0 4px 6px #000b,inset 3px 0 5px #0007,inset -2px 0 4px #0006,inset 0 -2px 4px #0007}
#myr5Shell .portal-frame i{position:absolute;width:10px;height:10px;margin:-5px;left:calc(var(--x)*(100% + var(--portal-rail)) - var(--portal-rail)/2);top:calc(var(--y)*(100% + var(--portal-rail)) - var(--portal-rail)/2);border-radius:50%;background:radial-gradient(circle at 50% 40%,#3a2d3e,#150f19 70%);box-shadow:0 1px 1px #000a,0 -1px #e6d2da40}
#myr5Shell .portal-frame i:before{content:'';position:absolute;inset:1px;clip-path:polygon(25% 6%,75% 6%,100% 50%,75% 94%,25% 94%,0 50%);background:radial-gradient(circle at 34% 28%,#f4e8dd,#bca6b2 32%,#6d5a6b 68%,#3a2d3e)}
#myr5Shell .portal-energy{position:absolute;inset:calc(var(--portal-rail)/-2);opacity:.55;transition:opacity .4s}
#myr5Shell .portal-energy.hot{opacity:1}
#myr5Shell .portal-energy>span{position:absolute;overflow:hidden;border-radius:2px;background:#0d0a10;box-shadow:0 0 0 1px #0000004d,0 0 5px var(--portal-strip-glow,#b026ff40)}
#myr5Shell .portal-energy>span:nth-child(odd){left:0;right:0;height:4px}
#myr5Shell .portal-energy>span:nth-child(1){top:-2px}
#myr5Shell .portal-energy>span:nth-child(3){bottom:-2px}
#myr5Shell .portal-energy>span:nth-child(even){top:0;bottom:0;width:4px}
#myr5Shell .portal-energy>span:nth-child(2){right:-2px}
#myr5Shell .portal-energy>span:nth-child(4){left:-2px}
#myr5Shell .portal-energy>span>span{position:absolute;left:0;top:0;background:repeating-linear-gradient(var(--dir),var(--energy));box-shadow:inset 0 0 1px 1px #0d0a10b0}
#myr5Shell .portal-energy>span:nth-child(odd)>span{--dir:90deg;height:100%;width:calc(100% + var(--energy-px))}
#myr5Shell .portal-energy>span:nth-child(even)>span{--dir:180deg;width:100%;height:calc(100% + var(--energy-px))}
/* All native modals retain focus/inert/close semantics; only their content well changes. */
html.shell-ready dialog.shell-dialog[open]{position:fixed!important;inset:var(--shell-top) var(--shell-right) var(--shell-bottom) var(--shell-left)!important;width:calc(100vw - var(--shell-left) - var(--shell-right))!important;height:var(--shell-well-height)!important;min-width:0!important;min-height:0!important;max-width:none!important;max-height:var(--shell-well-height)!important;margin:0!important;box-sizing:border-box!important;transform:none!important;translate:none!important;scale:none!important;rotate:none!important;clip-path:none!important;contain:none!important;border-radius:3px!important;overflow:auto;overscroll-behavior:contain;scroll-padding:12px;touch-action:pan-x pan-y}
html.shell-ready dialog.shell-dialog::backdrop{background:#111a24c9!important;backdrop-filter:none!important}
html.shell-ready dialog.shell-dialog>:not(#myr5Shell):not(.portal-peer-ui){max-width:100%;box-sizing:border-box;zoom:1!important;visibility:visible;translate:none!important}
html.shell-ready dialog.shell-dialog :is(form,fieldset,section,.entry,.actions){min-width:0;overflow-wrap:anywhere}
html.shell-ready dialog.shell-dialog :is(input,select,textarea){max-width:100%;box-sizing:border-box}
html.shell-ready dialog.shell-dialog :is(button,a,input,select,textarea):focus-visible{outline:3px solid #ffdda0;outline-offset:2px}
/* Existing room-specific layouts remain intact behind one continuous housing. */
html.shell-ready :is(#portalHome,#restScreen){position:fixed!important;inset:var(--shell-top) var(--shell-right) var(--shell-bottom) var(--shell-left)!important;width:auto!important;height:auto!important;max-height:var(--shell-well-height)}
html.shell-ready #portalBoardHost{--portal-top-band:0px;inset:0!important}
html.shell-ready #portalHome .portal-frame,html.shell-ready #portalChrome>.portal-frame{display:none!important}
html.shell-ready #portalChrome.portal-standalone .portal-standalone-aura{inset:var(--shell-top) var(--shell-right) 0 var(--shell-left)}
html.shell-ready #portalChrome{pointer-events:none!important}
html.shell-ready #homeScreen{margin-inline:var(--shell-left) var(--shell-right);padding-top:var(--shell-top);padding-bottom:var(--shell-bottom);box-sizing:border-box}
/* A dialog scene cannot float a fixed action over the hardware. */
html.shell-ready dialog.shell-dialog :is(.ach-close,.ach-head,.cw-header){max-width:100%}
html.shell-ready dialog.shell-dialog .portal-peer-ui{display:none!important}
/* Dock is physically the lower rail, and stays fixed even when its owner scrolls. */
html.shell-ready #myr5Shell #coachDock.coach-dock{position:fixed!important;inset:auto 0 0!important;box-sizing:border-box!important;width:100vw!important;height:var(--shell-dock)!important;max-width:none!important;display:flex!important;align-items:center!important;justify-content:space-around!important;gap:0!important;margin:0!important;padding:4px max(2px,env(safe-area-inset-right)) env(safe-area-inset-bottom) max(2px,env(safe-area-inset-left))!important;transform:none!important;translate:none!important;pointer-events:none!important;overflow:visible!important;visibility:visible!important}
html.shell-ready #myr5Shell #coachDock :is(button,a).dock-control,html.shell-ready #myr5Shell #coachDock .dock-sound{position:relative!important;box-sizing:border-box;flex:0 0 44px!important;width:44px!important;min-width:44px!important;height:48px!important;min-height:44px!important;padding:0!important;pointer-events:auto;touch-action:manipulation;letter-spacing:0;font-size:0!important}
html.shell-ready #myr5Shell #coachDock :is(button,a).dock-portal{position:relative!important;inset:auto!important;translate:none!important;flex:0 0 48px!important;width:48px!important;min-width:48px!important;height:48px!important;min-height:44px!important;padding:0!important;pointer-events:auto;touch-action:manipulation;font-size:0!important}
html.shell-ready #myr5Shell #coachDock :is(button,a)>span:not(.shell-sound-icon){font-size:0!important;min-width:0!important}
html.shell-ready #myr5Shell #coachDock .dock-control>span{display:grid;place-items:center}
html.shell-ready #myr5Shell #coachDock .dock-control>span svg{width:22px;height:22px;filter:drop-shadow(0 1px #f3ffe588)}
html.shell-ready #myr5Shell #coachDock .dock-portal>span{display:none!important;content:none!important}
/* Owner rule (PLAN-r2 §2): the dock carries engraved/lit symbols only. Names stay in aria-label/title. */
html.shell-ready #myr5Shell #coachDock :is(.dock-settings,.dock-scoreboard,.dock-food,.dock-achievements,.dock-pod):after,html.shell-ready #myr5Shell #coachDock .dock-sound .cb-label{display:none!important;content:none!important}
html.shell-ready #myr5Shell #coachDock .dock-portal>svg{display:block;width:26px;height:26px}
html.shell-ready #myr5Shell #coachDock :is(button,a):active{transform:translateY(3px)!important;box-shadow:inset 1px 3px 4px #13242a99,0 1px #13232c!important}
html.shell-ready #myr5Shell #coachDock .dock-control:is(:active,[aria-current=page])>span{transform:translateY(3px);box-shadow:inset 1px 3px 5px #172c33aa,0 1px #13232c}
html.shell-ready #myr5Shell #coachDock :is(button,a):focus-visible{outline:3px solid #ffe09a!important;outline-offset:1px!important}
html.shell-ready #myr5Shell #coachDock :is(:disabled,[aria-disabled=true]){opacity:.38!important;filter:grayscale(1)!important;cursor:not-allowed!important;transform:none!important}
html.shell-ready #myr5Shell #coachDock [aria-busy=true]{animation:shell-pending 1.2s ease-in-out infinite}
@keyframes shell-pending{50%{filter:brightness(1.6)}}
html.shell-ready #myr5Shell #coachDock .dock-live{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
/* The phase owner alone may release the housing. Solo tracking and rest never do. */
html[data-game-active=true]:not([data-game-framed=true]) #myr5Shell,html[data-game-active=true]:not([data-game-framed=true])::before{display:none!important}
html.shell-ready:is([data-game-active=false],[data-game-framed=true]) #myr5Shell.myr5-shell{display:block!important}
html.shell-ready[data-game-active=true]:not([data-game-framed=true]) dialog.shell-dialog[open]{inset:0!important;width:100vw!important;height:100dvh!important;max-height:100dvh!important}
/* Flat service content becomes inset glass, with localized text kept on the display. */
html.shell-ready dialog.shell-dialog :is(input:not([type=checkbox],[type=range],[type=radio]),select,textarea){min-height:44px}
html.shell-ready dialog.shell-dialog :is(.status,.hint[role=status],.entry-copy,.account-status){overflow-wrap:anywhere}
/* Explicit standalone content host; attach class in documents with an existing layout. */
.shell-content{box-sizing:border-box;position:relative;max-height:var(--shell-well-height);overflow:auto;overscroll-behavior:contain;margin:var(--shell-top) var(--shell-right) var(--shell-bottom) var(--shell-left);padding:clamp(12px,3vw,28px);}
.shell-content :is(input,select,textarea,button){max-width:100%;box-sizing:border-box}.shell-content :is(button,a,input,select,textarea):focus-visible{outline:3px solid #ffe09a;outline-offset:2px}
html.shell-ready .shell-content{min-height:var(--shell-well-height)}
@media(orientation:landscape) and (max-height:500px){:root{--shell-dock:calc(60px + env(safe-area-inset-bottom,0px));--shell-rail:10px;--shell-top:calc(40px + env(safe-area-inset-top,0px))}}
@media(prefers-reduced-motion:reduce){#myr5Shell *,#myr5Shell *:before,#myr5Shell *:after{animation:none!important;transition:none!important}}
@media(forced-colors:active){#myr5Shell .portal-frame:before,#myr5Shell .portal-frame i{border:1px solid CanvasText;background:Canvas}#myr5Shell button{border:2px solid ButtonText!important}.shell-content{border:3px solid CanvasText}}
/* Common service action hardware; inset copy and destructive meaning stay readable. */
html.shell-ready dialog.shell-dialog button:disabled{cursor:not-allowed}
html.shell-ready dialog.shell-dialog :is(output,progress,[role=progressbar],.status,[role=alert]){max-width:100%;box-sizing:border-box;overflow-wrap:anywhere}
html.shell-ready #portalExitButton{font-size:0!important;width:44px!important;height:44px!important;padding:8px!important}
html.shell-ready #portalExitButton svg{display:block;width:24px;height:24px}
/* Renderer mounts cannot cover the stationary rails in load/pause/error phases. */
html.shell-ready[data-game-active=false] :is([data-game-instance],[data-flight-instance]):not(dialog),html.shell-ready[data-game-framed=true] [data-flight-instance]:not(dialog){position:fixed!important;inset:var(--shell-top) var(--shell-right) var(--shell-bottom) var(--shell-left)!important;width:auto!important;height:auto!important;max-width:calc(100vw - var(--shell-left) - var(--shell-right))!important;max-height:var(--shell-well-height)!important;z-index:2147482900!important;box-sizing:border-box;overflow:hidden}
html.shell-ready dialog.shell-dialog>:not(#myr5Shell):not(.portal-peer-ui){visibility:visible!important}
/* Keep legacy sheets from changing dock reservation after the critical sheet loads. */
html:not(.shell-disabled):root{--myr5-bar:var(--shell-bottom)}
html.shell-ready .shell-workbench.editor-shell{box-sizing:border-box;width:calc(100vw - var(--shell-left) - var(--shell-right))!important;max-width:none!important;height:var(--shell-well-height)!important;margin:var(--shell-top) var(--shell-right) var(--shell-bottom) var(--shell-left)!important;border-radius:3px!important;overflow:hidden}
html.shell-ready:has(body>main.shell-content) body{margin:0!important;padding:0!important;display:block!important;min-height:100dvh}
html.shell-ready main.shell-content{width:calc(100vw - var(--shell-left) - var(--shell-right))!important;max-width:none!important;height:var(--shell-well-height)!important;min-height:0!important;margin:var(--shell-top) var(--shell-right) var(--shell-bottom) var(--shell-left)!important}
html.shell-ready .app-update-banner{left:calc(var(--shell-left) + 6px)!important;right:calc(var(--shell-right) + 6px)!important;max-width:calc(100vw - var(--shell-left) - var(--shell-right) - 12px)!important;box-sizing:border-box}
/* The actuator cap travels; the hit region and its mounting socket stay fixed. */
html.shell-ready #myr5Shell #coachDock :is(button,a):is(.dock-control,.dock-portal){transform:none!important}
html.shell-ready #myr5Shell #coachDock .dock-portal:is(:active,[aria-current=page])>svg{translate:0 3px;filter:drop-shadow(0 1px 3px var(--portal-strip))}
/* World Fly pod: one cockpit. The shell rails are the canopy frame in every flight phase;
   the ship's own thin rails and safe-area offsets give way to the shell's. */
html.shell-ready [data-coach-flight] [data-flight-rail]{display:none!important}
html.shell-ready [data-coach-flight] [data-flight-top]{top:0!important}
html.shell-ready [data-coach-flight] [data-flight-bottom]{bottom:0!important}
html.shell-ready [data-coach-flight] [data-flight-launch]{bottom:150px!important}
