.immersive-entry{border:1px solid #f3a48a88;background:#f3a48a14;color:inherit;min-height:46px;padding:10px 16px;border-radius:12px;font-family:inherit;font-size:13px;font-weight:600;cursor:pointer}
.immersive-entry:hover{background:#f3a48a28}.hud #exit-immersive{display:none}.play-guide[hidden]{display:none!important}
.play-guide{position:absolute;inset:0;z-index:12;display:grid;place-content:center;text-align:center;padding:22px;background:#182331ee;backdrop-filter:blur(12px);color:#f5f0e6}
.play-guide h2{font-size:clamp(22px,4vw,36px);margin:0 0 10px}.play-guide p{max-width:390px;margin:8px auto;font-size:14px;line-height:1.5}.guide-keys{display:flex;justify-content:center;gap:10px}.guide-keys span{padding:9px 13px;border:1px solid #c6ddd344;border-radius:12px;font-size:13px}.play-guide button{margin:14px auto 0;min-height:48px;padding:10px 24px}
.game-frame{--safe-top:env(safe-area-inset-top,0px);--safe-right:env(safe-area-inset-right,0px);--safe-bottom:env(safe-area-inset-bottom,0px);--safe-left:env(safe-area-inset-left,0px)}
.game-frame.is-immersive{position:fixed;inset:0;z-index:1000;width:100%;max-width:none;height:100vh;height:100svh;height:100dvh;height:var(--play-height,100dvh);margin:0;border:0;border-radius:0;overflow:hidden;background:#1b2836;display:grid;grid-template-rows:calc(52px + var(--safe-top)) 3px minmax(0,1fr);overscroll-behavior:none;isolation:isolate}
.is-immersive .hud{grid-row:1;padding:calc(4px + var(--safe-top)) max(10px,var(--safe-right)) 4px max(10px,var(--safe-left));gap:10px;min-width:0;background:#1b2533f2;color:#eef0e9;z-index:10;align-items:center;flex-wrap:nowrap}
.is-immersive .hud .hud-stage{flex:1;min-width:0;width:auto;max-width:220px;order:0;display:flex;flex-direction:column;gap:1px;align-items:flex-start}
.is-immersive .hud small{font-size:8px;letter-spacing:.08em;line-height:1.1}.is-immersive .hud strong{font-size:13px;line-height:1.2}.is-immersive .hud-stage strong{max-width:100%;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.is-immersive .hud #health{font-size:14px;color:#f6b298;letter-spacing:1px}
.is-immersive .hud #pause,.is-immersive .hud #exit-immersive{display:grid;place-items:center;flex:0 0 44px;min-width:44px;min-height:44px;height:44px;padding:0;font-size:23px;border-radius:12px;background:#ffffff0d;color:#fff;border:1px solid #b8c4d044;position:static;order:0}
.is-immersive .progress-track{grid-row:2;position:relative;height:3px;margin:0}.is-immersive .progress-track progress{height:3px}.is-immersive .progress-track span{display:none}
.is-immersive .game-stage,.is-immersive .game-stage:has(#screen.epilogue){grid-row:3;position:relative;height:100%;min-height:0;max-height:none;overflow:hidden}
.is-immersive #world,.is-immersive .game-stage:has(#screen.epilogue) #world{display:block;width:100%;height:100%;min-height:0;max-height:none;touch-action:none;outline-offset:-3px}
.is-immersive .game-caption,.is-immersive #best{display:none}.is-immersive .next-row{position:absolute;z-index:5;top:calc(59px + var(--safe-top));left:max(12px,var(--safe-left));right:max(12px,var(--safe-right));margin:0;min-height:0;padding:0;display:block;pointer-events:none;text-align:center}
.is-immersive #next-hazard{display:inline-block;max-width:min(70%,570px);padding:5px 10px;border-radius:10px;background:#162432b8;color:#f3f0e7;font-size:11px;line-height:1.35;text-wrap:balance;margin:0;border:1px solid #ddebd512}
.is-immersive[data-status="paused"] .next-row,.is-immersive[data-status="won"] .next-row,.is-immersive[data-immersive="ROTATE_PROMPT"] .next-row{visibility:hidden}
.is-immersive .touch-controls{--target:clamp(56px,17dvh,76px);position:absolute;z-index:8;left:0;right:0;bottom:0;margin:0;padding:0 max(12px,var(--safe-right)) max(10px,var(--safe-bottom)) max(12px,var(--safe-left));display:grid;grid-template-columns:var(--target) var(--target) 1fr var(--target) var(--target);gap:6px;align-items:end;pointer-events:none;background:none}
.is-immersive .touch-controls button{position:relative;isolation:isolate;pointer-events:auto;min-width:0;min-height:var(--target);width:var(--target);height:var(--target);padding:5px;border:1px solid #d6e2dd44;border-radius:20px;background:#1b2b3bbd;backdrop-filter:blur(8px);box-shadow:inset 0 1px 0 #fff2,0 4px 14px #0002;color:#f7f2e8;opacity:.82;font-size:11px;font-weight:700;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;transition:background .08s,opacity .08s,transform .08s;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:1px}
.is-immersive .touch-controls button span{font-size:23px;line-height:1.1}.is-immersive .touch-controls kbd{display:none}.is-immersive #jump{grid-column:4}.is-immersive #slide{grid-column:5}.is-immersive #left{grid-column:1}.is-immersive #right{grid-column:2}.is-immersive #sound{display:none}
.touch-controls button[data-held="true"],.is-immersive .touch-controls button[aria-pressed="true"],.is-immersive .touch-controls button:active{opacity:1;background:#efa98e;color:#142432;border-color:#ffe0cc;transform:translateY(2px);box-shadow:inset 0 2px 4px #3214}
.is-immersive .touch-controls button:disabled{opacity:.25;pointer-events:none}.is-immersive:has(.play-guide:not([hidden])) .touch-controls{visibility:hidden}
.is-immersive .game-screen{position:absolute;inset:0;display:grid;place-items:center;padding:12px max(16px,var(--safe-right)) 16px max(16px,var(--safe-left));overflow:auto;background:#16212cdb;z-index:9}
.is-immersive .game-screen[hidden]{display:none}.is-immersive .game-screen .screen-card{max-width:600px;width:100%;padding:12px;border:0;background:none;box-shadow:none}.is-immersive .game-screen h2{font-size:clamp(24px,5vh,40px);margin:4px 0}.is-immersive .game-screen p{font-size:13px;margin:5px 0;line-height:1.4}.is-immersive .screen-actions{display:flex;flex-wrap:wrap;gap:8px}.is-immersive .screen-actions button,.is-immersive .screen-actions a{min-height:44px;min-width:110px;padding:9px 13px}.is-immersive .run-stats{grid-template-columns:repeat(4,1fr);gap:6px;margin:8px 0}.is-immersive .run-stats dd{font-size:19px}.is-immersive .run-stats dt{font-size:10px}
.is-immersive .chapter-banner{top:55px;max-width:55%;padding:8px 12px;font-size:12px;pointer-events:none}.is-immersive .chapter-banner small{font-size:8px}
.is-immersive .game-screen.ceremony-screen{background:transparent;place-items:end center;pointer-events:none;padding-bottom:16px}.is-immersive .ceremony-card{pointer-events:auto;max-width:420px;background:#1b2939ee;padding:12px;border-radius:16px}.is-immersive .ceremony-card h2{font-size:18px}.is-immersive .ceremony-card button{min-height:44px}
@media(max-width:700px){.game-heading{flex-wrap:wrap;gap:12px}.immersive-entry{width:100%}.is-immersive .hud #time,.is-immersive .hud .hud-time,.is-immersive .hud .hud-score{display:none}.is-immersive .hud{gap:7px}.is-immersive .hud-stage strong{font-size:11px}.is-immersive .hud-tools strong{font-size:14px}.is-immersive[data-layout="portrait"] .touch-controls{--target:clamp(56px,17vw,72px);gap:5px}.is-immersive #next-hazard{max-width:92%;font-size:11px}.is-immersive .run-stats{grid-template-columns:repeat(4,1fr)}.is-immersive .screen-actions button,.is-immersive .screen-actions a{min-width:95px}}
@media(max-height:450px) and (orientation:landscape){.is-immersive .game-screen .screen-card{max-width:650px;padding:2px 14px}.is-immersive .screen-card>.eyebrow,.is-immersive .performance-note{display:none}.is-immersive .screen-actions{justify-content:center}.is-immersive .screen-card{text-align:center}.is-immersive .hud-time{display:none}.is-immersive .play-guide{padding:12px}.is-immersive .play-guide h2{font-size:24px}.is-immersive .play-guide p{font-size:12px}.is-immersive .guide-keys span{padding:6px 10px}.is-immersive .play-guide button{margin-top:8px}.is-immersive .chapter-banner{top:48px}}
@media(prefers-reduced-motion:reduce){.is-immersive .touch-controls button{transition:none}}
@media(max-height:600px) and (min-width:600px){.game-heading{display:flex;position:static;width:auto;height:auto;overflow:visible;clip-path:none;white-space:normal;margin:0 0 10px;align-items:center;gap:12px}.game-heading .eyebrow{display:none}.game-heading h1{font-size:21px;margin:0}.immersive-entry{min-height:44px;width:auto}}

.is-immersive .touch-controls #jump,.is-immersive .touch-controls #slide{min-width:0;min-height:var(--target);width:var(--target);height:var(--target)}
.is-immersive .touch-controls button span{color:inherit;margin:0}.is-immersive .hud small{color:#bac8d0}.play-guide #guide-exit{display:block;margin-top:8px;background:transparent;color:inherit;border:1px solid #e8eed944;font:inherit;min-height:44px}

.checkpoint-cue{display:none}.is-immersive .checkpoint-cue{display:inline}

.is-immersive:has(#world[data-status="won"]) .touch-controls,.is-immersive:has(#world[data-status="won"]) .next-row,.is-immersive:has(#world[data-status="won"]) .chapter-banner{visibility:hidden}

.immersive-entry:disabled{opacity:.5;cursor:wait}

/* Visible viewport follows Safari chrome; safe areas stay with the controls. */
.game-frame.is-immersive{top:var(--play-top,0px);bottom:auto}
.play-guide{padding:max(16px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));overflow-y:auto;overscroll-behavior:contain}
#immersion-help[hidden]{display:none!important}
#immersion-help{max-width:420px;margin:6px auto;padding:8px 12px;border:1px solid #c6ddd333;border-radius:12px;background:#ffffff08}
#immersion-help p{font-size:12px;line-height:1.45;margin:0}
#immersion-help button{min-height:44px;font-size:12px;margin-top:4px;padding:6px 12px;background:transparent;color:inherit}
@media(max-height:450px) and (orientation:landscape){.play-guide{place-content:start center}.play-guide .guide-keys{display:none}#immersion-help{max-width:600px}}

/* Pass 40.3: game-only launch and short landscape fit. No simulated rotation. */
.homescreen-guide{max-width:720px;margin:0 0 18px;padding:10px 14px;border:1px solid #f3a48a55;border-radius:12px;color:inherit;font:13px/1.5 system-ui,sans-serif}
.homescreen-guide summary{cursor:pointer;min-height:44px;display:flex;align-items:center;font-weight:650}
.homescreen-guide p{margin:8px 0}.homescreen-guide summary:focus-visible{outline:3px solid #f3a48a;outline-offset:4px}
.game-frame.is-immersive .game-screen{padding-bottom:max(16px,var(--safe-bottom))}
@media(max-height:450px) and (orientation:landscape){
 .game-frame.is-immersive{grid-template-rows:calc(48px + var(--safe-top)) 3px minmax(0,1fr)}
 .is-immersive .hud{gap:7px;padding-top:calc(2px + var(--safe-top));padding-bottom:2px}
 .is-immersive .hud-time,.is-immersive .hud-tools{display:none}
 .is-immersive .touch-controls{--target:clamp(44px,17dvh,64px)}
 .is-immersive .next-row{top:calc(51px + var(--safe-top))}
 .is-immersive .game-screen .screen-card{padding:0 10px}
 .is-immersive .game-screen h2{font-size:24px;line-height:1.05}
 .is-immersive .screen-card>p:not(.eyebrow),.is-immersive .screen-card .performance-note{display:none}
 .is-immersive .play-guide{place-content:safe center;gap:0}
 .is-immersive .play-guide h2{font-size:22px;margin-bottom:4px}
 .is-immersive .play-guide p{margin:4px auto}
}
