/* Shared menu navigation. Loaded last; gameplay controls and world geometry
   retain their own layout. Existing art files are unchanged. */
:root{--menu-nav-top:calc(env(safe-area-inset-top,0px) + 12px);--menu-header:calc(env(safe-area-inset-top,0px) + 72px);--menu-bottom:max(16px,env(safe-area-inset-bottom,0px))}
:is(#overlay,#panel:not(#overlay)):not([data-front="run-pause"]):not([data-front="run-settings"]) .menu-nav:not([hidden]){position:fixed!important;z-index:40;inset:var(--menu-nav-top) 16px auto!important;width:auto!important;height:44px!important;min-height:44px;margin:0!important;padding:0!important;border:0!important;background:none!important;display:flex!important;align-items:center;gap:12px;pointer-events:none;box-shadow:none!important}
.menu-nav::before{content:'';position:absolute;z-index:-1;left:-16px;right:-16px;top:calc(-12px - env(safe-area-inset-top,0px));bottom:-12px;background:linear-gradient(#032348fa,#032348f2);border-bottom:1px solid #4abde94d;pointer-events:none}
:is(#overlay,#panel:not(#overlay)):not([data-front="run-pause"]):not([data-front="run-settings"]) .menu-nav button.menu-nav-back:is(#menu-setup-back,#select-back,#backhome,#closepanel),:is(#overlay,#panel:not(#overlay)):not([data-front="run-pause"]):not([data-front="run-settings"]) .menu-nav button.menu-nav-settings:is(#menu-settings,#setup-settings,#selection-settings,#results-settings){position:fixed!important;z-index:42!important;display:flex!important;align-items:center;justify-content:center;flex:none;inset:var(--menu-nav-top) auto auto 16px!important;width:76px!important;height:44px!important;min-width:76px!important;min-height:44px!important;max-width:none!important;margin:0!important;padding:0 8px!important;border:1px solid #65cfff!important;border-radius:12px!important;background:linear-gradient(#07446c,#01243e)!important;box-shadow:inset 0 1px 2px #a9efff33!important;color:#f1fbff!important;font:750 15px/1.2 GameText,system-ui!important;letter-spacing:0!important;text-shadow:none!important;opacity:1!important;visibility:visible!important;transform:none!important;filter:none!important;pointer-events:auto!important;touch-action:manipulation;white-space:nowrap}
:is(#overlay,#panel:not(#overlay)):not([data-front="run-pause"]):not([data-front="run-settings"]) .menu-nav button.menu-nav-settings:is(#menu-settings,#setup-settings,#selection-settings,#results-settings){inset:var(--menu-nav-top) 16px auto auto!important;margin-left:0!important;width:44px!important;min-width:44px!important;padding:10px!important}
:is(#overlay,#panel:not(#overlay)):not([data-front="run-pause"]):not([data-front="run-settings"]) .menu-nav button.menu-nav-back:is(#menu-setup-back,#select-back,#backhome,#closepanel)::before,:is(#overlay,#panel:not(#overlay)):not([data-front="run-pause"]):not([data-front="run-settings"]) .menu-nav button.menu-nav-back:is(#menu-setup-back,#select-back,#backhome,#closepanel)::after,:is(#overlay,#panel:not(#overlay)):not([data-front="run-pause"]):not([data-front="run-settings"]) .menu-nav button.menu-nav-settings:is(#menu-settings,#setup-settings,#selection-settings,#results-settings)::before,:is(#overlay,#panel:not(#overlay)):not([data-front="run-pause"]):not([data-front="run-settings"]) .menu-nav button.menu-nav-settings:is(#menu-settings,#setup-settings,#selection-settings,#results-settings)::after{content:none!important;display:none!important}
:is(#overlay,#panel:not(#overlay)):not([data-front="run-pause"]):not([data-front="run-settings"]) .menu-nav button>*{visibility:visible!important}
.menu-nav-settings svg{display:block;width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linejoin:round}
:is(#overlay,#panel:not(#overlay)):not([data-front="run-pause"]):not([data-front="run-settings"]) .menu-nav button:focus:not(:focus-visible){outline:none!important}
:is(#overlay,#panel:not(#overlay)):not([data-front="run-pause"]):not([data-front="run-settings"]) .menu-nav button:focus-visible{outline:3px solid #ffe581!important;outline-offset:3px!important}
:is(#overlay,#panel:not(#overlay)):not([data-front="run-pause"]):not([data-front="run-settings"]) .menu-nav button:disabled{opacity:.5!important}
:is(#overlay,#panel:not(#overlay)):not([data-front="run-pause"]):not([data-front="run-settings"]) .menu-nav button[hidden]{display:none!important}
/* Keep all content reachable on short screens; Back and Settings stay put. */
#overlay:has(#home:not([hidden])),#overlay:has(#characterselect:not([hidden])){overflow-y:auto!important;overscroll-behavior:contain;touch-action:pan-y;scroll-padding-top:var(--menu-header)}
#home:has(#menu-front:not([hidden])),#home:has(#menu-setup:not([hidden])){height:auto!important;overflow:visible!important}
#menu-front{height:auto!important;min-height:100dvh!important;overflow:visible!important;padding-top:var(--menu-header)!important;background:#04305d url('menu-stage-day.png') center/cover!important}
#menu-front .menu-approved-composition{position:relative;left:auto;top:auto;transform:none;width:100%;max-width:520px;margin:0 auto;aspect-ratio:853/1844}
#menu-front .menu-approved-art{clip-path:polygon(0 0,82% 0,82% 10%,100% 10%,100% 100%,0 100%)}
#menu-setup[data-story-approved]:not([data-story-approved=""]){height:auto!important;min-height:100dvh!important;overflow:visible!important;background:#075eae url('menu-story-background.png') center/cover}
#menu-setup[data-story-approved]:not([data-story-approved=""]) .story-approved-surface{position:relative;left:auto;top:auto;transform:none;width:100%;max-width:520px;margin:0 auto;aspect-ratio:852/1846}
#menu-setup[data-story-approved]:not([data-story-approved=""]) #story-approved-art{mask-image:linear-gradient(transparent 0 12%,#000 12%)}
#menu-setup[data-story-approved]:not([data-story-approved=""]) .story-approved-surface::before{display:none}
#home #menu-setup[data-mode="free"]{height:max(740px,100dvh);overflow:visible}
#menu-setup[data-mode="free"]::before{clip-path:polygon(0 0,80% 0,80% 50%,100% 50%,100% 100%,0 100%)}
#characterselect[data-step="character"],#characterselect[data-step="loadout"]{height:max(760px,calc(100dvh - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)));margin-top:0;overflow:visible}
#characterselect[data-step="character"]::before{clip-path:polygon(0 0,80% 0,80% 45%,100% 45%,100% 100%,0 100%)}
#characterselect[data-step="loadout"]::before{clip-path:polygon(0 0,80% 0,80% 70%,100% 70%,100% 100%,0 100%)}
/* Full-screen menu sheets share a fixed header and their own scrolling body. */
body #panel:not([data-front="run-pause"]):not([data-front="run-settings"]){position:fixed!important;inset:0!important;transform:none!important;width:100vw!important;max-width:none!important;height:100dvh!important;max-height:none!important;margin:0!important;padding:0!important;border:0!important;border-radius:0!important;overflow:hidden!important;background-color:#071f39!important}
body #panel:not([data-front="run-pause"]):not([data-front="run-settings"])>#panelbody{position:absolute!important;inset:var(--menu-header) 0 var(--menu-bottom)!important;width:100%!important;height:auto!important;min-height:0!important;max-height:none!important;box-sizing:border-box;margin:0!important;padding:var(--menu-panel-padding,16px)!important;overflow:auto!important;overscroll-behavior:contain}
body #panel .menu-nav h2{position:static;display:block!important;flex:1;min-width:0;margin:0!important;padding:0;font:800 18px/1.2 GameText,system-ui!important;color:#effaff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:center}
body #panel:is([data-front="crew"],[data-front="store"],[data-front="daily"],[data-front="world"])>.menu-nav h2{display:none!important}
body #panel:is([data-front="crew"],[data-front="store"],[data-front="daily"],[data-front="world"])>#panelbody{padding:0!important}
body #panel[data-front="store"] .shop-shell{min-height:680px;position:relative;inset:auto;margin:0 2.5%;width:95%;height:calc(100dvh - var(--menu-header) - var(--menu-bottom));box-sizing:border-box}
body #panel[data-front="store"] .shop-shell>header{background:none!important}
body #panel[data-front="store"] .shop-shell>header>h1{display:block;clip-path:none;position:absolute;left:0;top:8px;width:auto;height:auto;margin:0;font:900 28px/1.2 GameText;color:#fff0bb;overflow:visible}
body #panel[data-front="crew"] .crew-menu-stage{position:relative;inset:auto;margin:0 4.5%;width:91%;height:calc(100dvh - var(--menu-header) - var(--menu-bottom));min-height:680px}
body #panel[data-front="daily"] .daily-screen{height:max(680px,calc(100vw * 1681 / 935));overflow:visible}
body #panel[data-front="daily"] .daily-composition::before{clip-path:polygon(0 0,80% 0,80% 12%,100% 12%,100% 100%,0 100%)}
body #panel[data-front="world"] .world-screen{height:max(720px,calc(100vw * 1683 / 934 + 70px));overflow:visible}
body #panel[data-front="world"] .world-heading{background:none}
body #panel[data-front="world"] .world-heading h1{clip-path:none;width:auto;height:auto;position:static;display:block;margin:24px 16px;font:900 28px/1.2 GameText;color:#fff0bb;text-align:center}
/* Pause Settings returns to Pause through its existing handler. */
#panel[data-front="run-settings"] .run-back{position:fixed;top:var(--menu-nav-top);left:16px;min-width:76px;min-height:44px;height:44px;margin:0;border-radius:12px;font-size:15px;background:linear-gradient(#07446c,#01243e);border:1px solid #65cfff}
#panel[data-front="run-pause"]>.menu-nav,#panel[data-front="run-settings"]>.menu-nav{display:none!important}
/* Replace raster navigation regions with live headings; retain the original art. */
#home #menu-setup[data-story-approved]:not([data-story-approved=""]){padding-top:var(--menu-header)!important}
#home #menu-setup[data-story-approved]:not([data-story-approved=""]) #story-approved-art{mask-image:none;clip-path:polygon(25% 0,75% 0,75% 10%,100% 10%,100% 100%,0 100%,0 10%,25% 10%)}
body #panel[data-front="crew"] .crew-menu-heading{background:none;mask-image:none}
body #panel[data-front="crew"] .crew-menu-heading>h1,body #panel[data-front="store"] .shop-shell[data-shop-view]>header>h1{position:absolute!important;left:16px!important;top:20px!important;width:auto!important;height:auto!important;overflow:visible!important;clip-path:none!important;margin:0!important;color:#fff0bb;font:900 26px/1.2 GameText!important}
body #panel[data-front="crew"] .crew-menu-heading>p{position:absolute;left:16px;top:58px;width:auto;height:auto;clip-path:none;font:650 10px/1.4 GameText;color:#c3e4ff;margin:0}
.control-tips{margin:16px 0;color:#def1ff}.control-tips summary{cursor:pointer;min-height:44px;display:flex;align-items:center;gap:8px}.control-tips summary::before{content:'▸'}.control-tips[open] summary::before{content:'▾'}
/* Live headings avoid cropped logos and inactive settings icons in raster headers. */
#home #menu-setup[data-story-approved]:not([data-story-approved=""]) #story-approved-art{clip-path:none;mask-image:linear-gradient(transparent 0 11%,#000 14%)}
#home #menu-setup[data-story-approved]:not([data-story-approved=""]) .story-approved-surface::before{display:block;content:'';position:absolute;z-index:1;inset:0 25% auto;height:12%;background:url('menu-logo.png') center/contain no-repeat;pointer-events:none}
#home #menu-setup[data-mode="free"]::before,#characterselect[data-step]::before{display:none}
#home #menu-setup[data-mode="free"] #setup-title{position:absolute;top:calc(var(--menu-header) + 20px);left:4%;width:92%;height:auto;display:block;opacity:1;font:950 34px/1.2 GameText;color:#fff1bb;text-align:center;margin:0}
#home #menu-setup[data-mode="free"] #setup-subtitle{position:absolute;top:calc(var(--menu-header) + 66px);left:4%;width:92%;height:auto;display:block;opacity:1;font:650 12px/1.4 GameText;color:#def4ff;text-align:center;margin:0}
#characterselect[data-step] #select-destination{top:calc(var(--menu-header) + 8px);left:4%;right:4%;width:92%;height:auto;font-size:11px;text-align:center;background:none}
#characterselect[data-step] #select-title{top:calc(var(--menu-header) + 32px);left:4%;width:92%;height:auto;opacity:1;display:block;font:950 clamp(20px,6vw,28px)/1.2 GameText;text-align:center;color:#fff1bb;margin:0;white-space:normal;overflow:visible}
#panel .menu-nav{justify-content:flex-start}
#panel[data-front="daily"] .menu-nav{justify-content:flex-start}
#panel:is([data-front="daily"],[data-front="crew"],[data-front="world"],[data-front="store"]){--menu-panel-padding:0px}
#home #menu-setup[data-story-approved]:not([data-story-approved=""]) .story-approved-surface::before{left:25%;right:25%;top:0;bottom:auto;width:50%;height:12%;transform:none;background-size:contain;background-position:center;background-repeat:no-repeat}
#home #menu-setup[data-mode="free"] .premium-top,#characterselect[data-step] .premium-top{display:none}
.menu-nav::before{background:#032348}
button:focus:not(:focus-visible){outline:none}
button:focus-visible{outline:3px solid #ffe581;outline-offset:3px}
#overlay:has(#results:not([hidden])){overflow-y:auto!important;scroll-padding-top:var(--menu-header)}
#results{height:max(760px,100dvh);overflow:visible}
#results::before{display:none}
#results .result-top #result-context{top:calc(var(--menu-header) + 6px);left:5%;width:90%;text-align:center;background:#001c38}
#menu-front .menu-approved-art{clip-path:none}
#menu-front .menu-approved-composition{margin-top:0}
#menu-front .menu-approved-art{mask-image:linear-gradient(transparent 0 18%,#000 21%)}
#menu-front .menu-approved-composition::before{content:'';position:absolute;z-index:1;left:15%;right:15%;top:3%;height:18%;background:url('menu-logo.png') center/contain no-repeat;pointer-events:none}

#results .result-top #result-context{position:fixed;z-index:41;top:var(--menu-nav-top);left:108px;right:16px;width:auto;height:44px;display:flex;align-items:center;justify-content:center;white-space:pre-line;margin:0;padding:0 8px;border:0;background:none;font:750 11px/1.4 GameText;text-align:center}
#results #resultlabel{display:none}
#panel:not(#home):is([data-front="run-pause"],[data-front="run-settings"])>.menu-nav{display:none!important}

#overlay #characterselect[data-step]{height:max(760px,calc(100dvh - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)))!important;max-height:none!important;flex-shrink:0}
#panel #panelbody .shop-shell[data-shop-view]{min-height:680px!important;height:calc(100dvh - var(--menu-header) - var(--menu-bottom));flex-shrink:0}
/* Preflight art uses its own safe-area origin; fixed navigation uses the viewport. */
#overlay #characterselect[data-step]{margin-top:env(safe-area-inset-top,0px)}
#characterselect[data-step] #select-destination{top:80px}
#characterselect[data-step] #select-title{top:104px}
/* Store availability text belongs after the actions, never over Restore Purchases. */
#panel #panelbody #shop-message{position:static;inset:auto;grid-row:-1;max-height:none;margin:6px 8px;padding:4px 7px;font:500 11px/1.4 GameText}
/* Preflight spans the viewport; cqw fallback keeps its full-width sizing. */
#overlay #characterselect[data-step]{container-type:normal!important}
#panel[data-front="run-settings"] .run-back{position:absolute;top:12px}
#overlay #characterselect[data-step],#home #menu-setup[data-mode="free"],#results{isolation:auto!important}
/* Currency has a dedicated second header row on menu screens. */
:root{--menu-header:calc(env(safe-area-inset-top,0px) + 124px)}
.menu-nav::before{bottom:-64px}
.menu-gem-balance,
body #panel :is(#shop-wallet,#crew-gems){position:fixed!important;inset:calc(var(--menu-nav-top) + 52px) 16px auto auto!important;z-index:42!important;display:flex!important;align-items:center!important;justify-content:center!important;gap:6px!important;width:auto!important;max-width:calc(100vw - 32px)!important;height:44px!important;min-height:44px!important;margin:0!important;padding:0 10px!important;border:1px solid #65cfff!important;border-radius:12px!important;background:#01243e!important;color:#effaff!important;font:750 14px/1.2 GameText,system-ui!important;box-shadow:none!important;white-space:nowrap;transform:none!important}
.menu-gem-balance{pointer-events:none}
.menu-gem-balance[hidden]{display:none!important}
.wallet-gem{width:26px!important;height:26px!important;object-fit:contain!important;flex:none}
.wallet-unit{font:650 12px/1.2 GameText,system-ui!important;color:#bde9ff}
body #panel :is(#shop-wallet,#crew-gems) b{width:22px;height:22px;display:grid;place-items:center;margin-left:2px;font:800 20px/1 GameText;border:0;background:none}
#characterselect[data-step] #select-destination{top:132px}
#characterselect[data-step] #select-title{top:156px}

body #panel .menu-nav :is(#shop-wallet,#crew-gems){pointer-events:auto!important}
/* Reserve room for the second row without letting preflight art cover its title. */
#overlay #characterselect[data-step]{height:max(960px,calc(100dvh - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)))!important}

/* Pack art uses the same existing blue Gems as the wallet and daily rewards. */
body #panel[data-front="store"] .gems-approved-banner{background:#002b51 url('menu-blue-gems.png') right center/42% auto no-repeat!important;border:1px solid #65cfff!important;padding:8px!important;box-sizing:border-box}
body #panel[data-front="store"] .gems-approved-banner h2{margin:0;color:#b4edff;font:900 24px/1.1 GameText}
body #panel[data-front="store"] .gems-approved-banner p{margin:4px 0 0;color:#e5f7ff;font:600 11px/1.2 GameText}

/* Explicit viewport positioning and z-index keep native WebKit header controls
   above the backdrop after compositing settles. Reserve the Back column. */
body #panel .menu-nav h2{margin-left:92px!important}

/* One difficulty selector for Story and Free Climb. Selection changes its
   highlight and explanation, never the scenic shell or control geometry. */
#home #menu-setup{--difficulty-top:66%}
#home #menu-setup[data-story-shell="new"]{--difficulty-top:71.2%}
#home #menu-setup[data-story-shell="mid"]{--difficulty-top:65.6%}
#home #menu-setup[data-story-shell="complete"]{--difficulty-top:67.5%}
#home #menu-setup[data-mode="free"]{--difficulty-top:54.2%}
#home #menu-setup[data-mode] .story-approved-surface>.difficulty-control{display:grid!important;position:absolute;top:var(--difficulty-top)!important;left:3%!important;right:3%!important;width:auto!important;height:120px!important;min-height:120px!important;padding:10px!important;box-sizing:border-box;grid-template-columns:1fr!important;grid-template-rows:16px 44px 26px!important;gap:4px!important;border:1px solid #56c7ff;border-radius:12px;background:linear-gradient(115deg,#062852,#031c3d)!important;box-shadow:inset 0 0 0 1px #a4e7ff66,0 0 8px #009eea77}
#home #menu-setup[data-mode] .story-approved-surface>.difficulty-control>span{display:flex!important;align-items:center;gap:5px;align-self:center!important;grid-area:1/1;font:850 12px/16px GameText,system-ui!important;letter-spacing:.03em;text-align:left;color:#c8f5ff}
#home #menu-setup[data-mode] .difficulty-control>span::after{content:none!important}
.difficulty-icon{width:16px;height:16px;flex:none}
#home #menu-setup[data-mode] .story-approved-surface>.difficulty-control>#difficulty-pills{display:grid!important;position:static!important;inset:auto!important;grid-area:2/1!important;width:100%!important;height:44px!important;padding:0!important;gap:6px!important;border:0!important;border-radius:0;background:none!important;grid-template-columns:repeat(3,minmax(0,1fr))}
#home #menu-setup[data-mode] .story-approved-surface>.difficulty-control>#difficulty-pills button{display:block!important;position:relative!important;inset:auto!important;width:auto!important;height:44px!important;min-height:44px!important;min-width:0!important;padding:0!important;border:1px solid #65c9ff!important;border-radius:9px!important;background:linear-gradient(#093a66,#052650)!important;color:#dff6ff!important;font:850 11px/1.2 GameText,system-ui!important;letter-spacing:0!important;box-shadow:none!important}
#home #menu-setup[data-mode] .story-approved-surface>.difficulty-control>#difficulty-pills button[aria-pressed="true"]{background:linear-gradient(#fff189,#ffc323)!important;border-color:#fff299!important;color:#04172d!important;box-shadow:0 0 7px #ffd528!important}
#home #menu-setup[data-mode] .story-approved-surface>.difficulty-control>#difficulty-note{display:block!important;grid-area:3/1!important;align-self:center!important;margin:0!important;font:600 10px/13px GameText,system-ui!important;text-align:left;color:#d7edff}
#home #menu-setup[data-mode] .story-approved-surface>#play{top:calc(var(--difficulty-top) + 132px)!important;min-height:44px!important}
#home #menu-setup[data-mode="free"] #free-climb-actions{top:calc(var(--difficulty-top) + 204px)!important}
/* Completed chapters retain visible scenery and a bright, opaque status badge.
   Dark locked tiles and gold selected outlines keep their distinct meanings. */
#home #menu-setup[data-mode="story"] #levelselect .chapter-complete{background:#07513e!important;border-color:#6de8b0!important}
#home #menu-setup[data-mode="story"] #levelselect .chapter-complete .chapter-art{filter:none!important;opacity:1!important}
#home #menu-setup[data-mode="story"] #levelselect .chapter-complete::after{inset:45% 0 0;background:linear-gradient(transparent,#073d35e6 85%)!important}
#home #menu-setup[data-mode="story"] #levelselect .chapter-check{position:relative;z-index:1;display:block;padding:3px 2px!important;margin:3px 0!important;border-radius:4px;background:#b4ffd3;color:#063a27!important;font:850 clamp(7px,2.1vw,10px)/1.2 GameText!important;white-space:nowrap;text-shadow:none}
#home #menu-setup .chapter-check::after{content:none}
#home #menu-setup[data-mode="story"] #levelselect button[aria-pressed="true"]{border:2px solid #ffe879!important}
#home #menu-setup[data-mode="story"] #story-selected[data-complete="true"]{background-image:linear-gradient(90deg,#063b4ee8 0%,#07556b99 48%,#04284e10 100%),var(--chapter-live-art)!important;border-color:#7befbe!important}
#home #menu-setup[data-mode="story"] #story-selected[data-complete="true"]>span{display:table!important;padding:4px 6px;background:#b4ffd3;color:#063a27!important;border-radius:5px;font:850 10px/1.2 GameText!important;letter-spacing:.02em;text-shadow:none}
/* The old Play label is baked into Story art. Cover that region and render the
   moved action as a real button, so its visible and tappable bounds agree. */
#home #menu-setup[data-mode="story"] .difficulty-control::after{content:'';display:block;position:absolute;z-index:-1;top:100%;left:-1px;right:-1px;height:80px;background:#032348;border-radius:0 0 12px 12px;pointer-events:none}
#home #menu-setup[data-mode="story"] .story-approved-surface>#play{border:2px solid #fff3a2!important;border-radius:26px!important;background:linear-gradient(#fff36d,#ffc023 56%,#f99e10)!important;color:#061933!important;font:900 18px/1 GameText!important;box-shadow:inset 0 1px 4px #fffbd5,0 0 0 2px #08a5ef,0 0 10px #ffc62d!important}
/* Portrait gameplay skies keep their horizon/terrain low in the image.
   Show those landmarks in the wide chapter feature rather than empty sky. */
#home #menu-setup[data-mode="story"] #story-selected{background-position:center 85%!important}
/* Shop navigation uses one viewport row, independent of department grid rows. */
body #panel[data-front="store"] #panelbody .shop-shell{margin-top:56px!important}
body #panel[data-front="store"] > .shop-sections{position:fixed!important;top:var(--menu-header)!important;left:2.5%!important;width:95%!important;height:44px!important;min-height:44px!important;display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:5px!important;padding:0!important;margin:0!important;z-index:45!important;background:#032348!important;box-shadow:0 0 0 6px #032348!important}
body #panel[data-front="store"] > .shop-sections button{width:100%!important;min-width:0!important;height:44px!important;padding:4px 1px!important;font:800 10px/1.2 GameText!important;white-space:nowrap}
/* A single scenic layer avoids hard joins between independent header crops. */
body #panel[data-front="store"] #panelbody .shop-shell>header{background:none!important;mask-image:none!important}
/* Keep the optional ad reward above retry, with its explicit Watch Ad label. */
#overlay #results #double-crystals{top:61.3%!important;left:5%!important;width:90%!important;height:56px!important;min-height:56px!important;padding:8px!important;font:850 14px/1.25 GameText!important;border:2px solid #a8f6ff!important;border-radius:12px!important;background:linear-gradient(#075d7e,#023553)!important;color:#edffff!important}
body #panel[data-front="store"] > .shop-sections button{display:flex!important;flex-direction:row!important;align-items:center!important;justify-content:center!important;gap:3px!important}

#overlay #results #reward-confirmation{position:absolute;top:61.3%;left:5%;width:90%;height:56px;box-sizing:border-box;display:flex;align-items:center;justify-content:center;margin:0;padding:8px;border:2px solid #9fffd0;border-radius:12px;background:#084a38;color:#dcffeb;font:850 14px/1.25 GameText;text-align:center}

/* The forest hub is the departure point for one continuous ascent. */
#home #menu-setup[data-mode="story"] .story-approved-surface>#setup-subtitle{left:4%!important;right:4%!important;width:92%!important;min-height:40px;height:auto!important;transform:translateY(8px);padding:8px 3px!important;font:800 clamp(9px,2.5vw,12px)/1.3 GameText!important;letter-spacing:0!important;background:#06356c!important}

/* Flow content below the fixed header; percentage positions could overlap on
   native safe areas and short screens. Keep one existing scenic background. */
#home #menu-setup[data-mode="free"]{container-type:normal;height:auto!important;min-height:100dvh!important;padding:calc(var(--menu-header) + 16px) 4% 28px!important}
#home #menu-setup[data-mode="free"] .story-approved-surface{display:flex;flex-direction:column;gap:12px;width:100%;max-width:520px;margin:0 auto}
#home #menu-setup[data-mode="free"] :is(#setup-title,#setup-subtitle,#free-climb-feature,#free-climb-actions),#home #menu-setup[data-mode="free"] .story-approved-surface>:is(.difficulty-control,#play){position:relative!important;inset:auto!important;width:100%!important;margin:0!important;flex-shrink:0}
#home #menu-setup[data-mode="free"] #setup-title{font-size:32px!important}
#home #menu-setup[data-mode="free"] #setup-subtitle{max-width:none;font-size:11px!important;white-space:normal;padding:6px;background:#06356ce8;border-radius:8px}
#home #menu-setup[data-mode="free"] #free-climb-feature{height:230px;align-items:center}
#home #menu-setup[data-mode="free"] #free-climb-art{height:210px;max-width:100%}
#home #menu-setup[data-mode="free"] .free-stats{height:auto;min-height:200px;margin:0}
#home #menu-setup[data-mode="free"] #play{height:56px}
#home #menu-setup[data-mode="free"] #free-climb-actions{height:auto;display:grid;grid-template-columns:1fr 1fr;gap:10px}
#home #menu-setup[data-mode="free"] #free-climb-actions button{min-height:44px}

/* Results use content rows instead of independently positioned percentages.
   Optional rewards and pending-save controls reserve their own space. */
#overlay #results{container-type:normal;height:auto!important;min-height:100dvh!important;padding:calc(var(--menu-header) + 16px) 5% 28px!important;box-sizing:border-box;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;align-content:start}
#overlay #results:not([hidden]){display:grid}
#overlay #results .result-top{display:contents}
#overlay #results .result-top .premium-logo{display:none}
#overlay #results .result-top #result-context{z-index:43;right:76px;font-size:10px}
#overlay #results .result-banner{position:relative;inset:auto;width:100%;height:180px;grid-column:1/-1;grid-row:1;align-items:center;animation:none!important}
#overlay #results .result-crew{height:180px!important;max-width:100%;transform:none!important}
#overlay #results #resulttitle{position:static;align-self:center;font-size:clamp(28px,9vw,44px);overflow-wrap:anywhere;line-height:1.05}
#overlay #results :is(.flight-score,.result-stats,#reason,#again,#change-character,#rewards,#double-crystals,#reward-confirmation){position:relative!important;inset:auto!important;width:100%!important;height:auto!important;margin:0!important;max-width:none!important;grid-column:1/-1}
#overlay #results .flight-score{grid-row:2;min-height:104px;padding:12px}
#overlay #results .result-stats{grid-row:3;min-height:80px}
#overlay #results #rewards{grid-row:4}
#overlay #results :is(#double-crystals,#reward-confirmation){grid-row:5;min-height:56px!important}
#overlay #results #reason{grid-row:6;min-height:52px;padding:12px;font-size:12px}
#overlay #results #again{grid-row:7;min-height:56px}
#overlay #results #change-character{grid-row:8;min-height:48px}
#overlay #results :is(#replay,#world-result-button,#share){position:relative!important;inset:auto!important;width:100%!important;height:auto!important;min-height:48px!important;padding:8px!important;margin:0!important}
#overlay #results #replay{grid-row:9;grid-column:1}
#overlay #results #world-result-button{grid-row:9;grid-column:2}
#overlay #results #share{grid-row:10;grid-column:1/-1}
#overlay #results #retrysave{min-height:44px}

#overlay>.menu-nav #result-context{position:fixed;z-index:43;top:var(--menu-nav-top);left:108px;right:16px;height:44px;display:flex;align-items:center;justify-content:center;margin:0;padding:0 8px;box-sizing:border-box;font:750 10px/1.35 GameText;color:#b9f5ff;white-space:pre-line;text-align:center;pointer-events:none}

/* Keep controls in the fixed header layer. Nested fixed descendants can retain
   stale paint positions in Android WebView even when hit-test bounds are right. */
:is(#overlay,#panel:not(#overlay)):not([data-front="run-pause"]):not([data-front="run-settings"]) .menu-nav button.menu-nav-back:is(#menu-setup-back,#select-back,#backhome,#closepanel),:is(#overlay,#panel:not(#overlay)):not([data-front="run-pause"]):not([data-front="run-settings"]) .menu-nav button.menu-nav-settings:is(#menu-settings,#setup-settings,#selection-settings,#results-settings){position:absolute!important;inset:0 auto auto 0!important}
:is(#overlay,#panel:not(#overlay)):not([data-front="run-pause"]):not([data-front="run-settings"]) .menu-nav button.menu-nav-settings:is(#menu-settings,#setup-settings,#selection-settings,#results-settings){inset:0 0 auto auto!important}
