/* Shared paper shell; scoped so the approved home artwork stays intact. */
html body #mainApp>.screen.active:not(#home){background:#faf7ef!important;border-radius:0 0 22px 22px!important;padding-bottom:24px!important}
html body #mainApp>header.top{border-radius:inherit!important}
/* One shared header/ad stays in view in every screen; normal flow reserves its space. */
html body #mainApp>header.top{position:sticky!important;top:0!important;z-index:50!important;background-color:#e9d5b3!important;background-image:linear-gradient(100deg,#fff5df33,transparent 35%,#b88a4330),var(--mr-wood-img)!important;background-size:auto,100% 240px!important;border-radius:20px 20px 0 0!important;box-shadow:0 5px 10px #43250e20!important}
html{scroll-padding-top:var(--modera-header-h,240px)}
html:has(#mainApp),html:has(#mainApp #home.active){height:auto!important;overflow-x:clip!important;overflow-y:auto!important}
body:has(#mainApp),body:has(#mainApp #home.active){height:auto!important;overflow:visible!important}
html body #mainApp:has(#home.active)>header.top{position:sticky!important;top:0!important}
html body #mainApp>header.top #moderaGlobalAdHost{padding-bottom:12px!important}
html body #mainApp>header.top .head{flex-wrap:nowrap!important}
html body #mainApp>header.top .dw-global-search{display:none!important}
html body #mainApp>header.top .sub:after{content:none!important}
html body #mainApp>.screen.active h2{font-family:system-ui,sans-serif!important;letter-spacing:-.025em!important;font-size:clamp(23px,3.5vw,34px)!important;line-height:1.2!important}
html body #mainApp .screenReturn{margin:8px 0 16px!important}
html body #mainApp .screenReturnButton{display:inline-flex;gap:8px;align-items:center;min-height:44px;padding:10px 16px!important;border:1px solid #d7c7ab;border-radius:12px;background:#fffdf8;color:#432d1b;text-decoration:none;font:700 14px system-ui;touch-action:manipulation}
html body #community .communityHeroText .kicker{color:#fff3d9!important;background:#ffffff18!important;border:1px solid #ffffff55!important;font:700 11px/1.4 system-ui!important;letter-spacing:.08em!important;padding:5px 10px;border-radius:20px}
html body #community .communityHeroText h2{color:#fffdf7!important}
html body #mainApp #marketplace .marketHeader{gap:14px;align-items:center;margin:0 0 18px!important;padding:16px!important;background:#fffdf8;border:1px solid #e2d7c4;border-radius:16px}
html body #mainApp #marketplace .marketHeader .kicker{font:700 10px system-ui!important;color:#73552f!important;letter-spacing:.08em!important}
html body #mainApp #marketplace .marketHeader h2{margin:5px 0 8px!important}
html body #mainApp #marketplace .marketHeader p{font-size:13px!important;line-height:1.5!important;margin:0!important;color:#665b4b!important}
html body #mainApp #marketplace .marketHeader>.btn{min-width:112px;padding:12px!important;font-size:13px!important;white-space:normal!important}
html body #mainApp #marketplace .card{padding:16px!important;border:1px solid #e2d7c4!important;border-radius:16px!important;background:#fffdf8!important}
html body #mainApp #marketplace .card p{font-size:14px;line-height:1.5}
#designer3d #designerScenePane[hidden],#designer3d #moduleStudio[hidden]{display:none!important}
#designer3d #designerScenePane:not([hidden]),#designer3d #moduleStudio:not([hidden]){display:block!important}
#designer3d .dw-mode-tabs{position:relative!important;top:auto!important;margin:4px 0 14px!important}
#designWorkspace .dw-bottom{position:static!important;inset:auto!important;grid-column:1/-1;clear:both;margin:20px 0 0!important;padding:10px!important;background:#f2ebde!important;backdrop-filter:none!important}
#designWorkspace .dw-categories{align-items:stretch!important}
#designWorkspace .dw-categories>button{height:auto!important;min-height:0!important;max-height:none!important}
#designWorkspace .dw-categories strong{white-space:normal!important;overflow:visible!important;line-height:1.3!important;min-height:2.6em;display:grid;align-items:center}
#designWorkspace .dw-categories small{padding-bottom:8px!important}
#designWorkspace .dw-layout,#designWorkspace .dw-library{max-width:100%;min-width:0}
@media(max-width:700px){
 html body #mainApp #home .mr-tools{grid-template-rows:repeat(5,minmax(70px,1fr))!important;height:max(350px,calc(100svh - var(--modera-header-h,230px) - 26cqw - 64px))!important}
 html body #mainApp #home .mr-tools>.mr-tool{height:100%!important;aspect-ratio:auto!important}
 html body #mainApp #home{padding-bottom:12px!important}
 html body #mainApp #designer3d.active{padding-bottom:18px!important}
 #designWorkspace{padding-bottom:0!important}
 #designWorkspace .dw-stage{position:relative!important;top:auto!important;max-height:none!important}
 #designWorkspace .dw-categories{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important}
 #designWorkspace .dw-models{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}

/* Keep the entire bottom rim above the browser controls. */
html body #mainApp{margin-bottom:calc(20px + env(safe-area-inset-bottom,0px))!important}
html body #home .mr-tool-wide{aspect-ratio:5.3!important;min-height:64px!important}
html body #home .mr-tool-wide .mr-tool-label{font-size:clamp(12px,3.75cqw,37px)!important}
html body #mainApp:has(#home.active){padding-bottom:8px!important}

html body #mainApp.app:has(#home.active){height:auto!important;min-height:0!important;max-height:none!important;block-size:auto!important;min-block-size:0!important}

@media(max-width:700px){html body #mainApp #home .mr-tools{height:var(--modera-home-grid-height,550px)!important}html body #mainApp:has(#home.active){margin-bottom:8px!important}}
/* Auth owns one scroll surface; keyboard focus must not scroll the underlying page. */
html:root:has(#authGate[style*="flex"]):has(#mainApp){overflow:hidden!important;overscroll-behavior:none}
body:has(#authGate[style*="flex"]){position:fixed!important;inset:0!important;width:100%!important;height:100%!important;overflow:hidden!important}
#authGate{height:100%!important;max-height:100%!important;overflow-y:auto!important;overflow-x:hidden!important;overscroll-behavior:contain;overflow-anchor:none;align-items:flex-start!important;padding:12px 12px calc(18px + env(safe-area-inset-bottom,0px))!important;box-sizing:border-box;scroll-padding-block:24px}
#authGate .authCard{max-height:none!important;overflow:visible!important;flex-shrink:0;margin-block:auto;box-sizing:border-box}
#authGate .authSubmit{min-height:48px;touch-action:manipulation}
#authGate input{font-size:16px!important;scroll-margin-block:24px}

/* Native tap response; keep return controls free of delayed press transitions. */
.screenReturnButton,.calcBack,a.back,button[data-action=back]{touch-action:manipulation!important;-webkit-tap-highlight-color:transparent;transition:none!important}
