/* Fix My Fail 0.8.3: an immersive game canvas, not a framed web page. */
html.immersive-game,html.immersive-game body{height:100%;width:100%;overflow:hidden;background:#102c50}
.immersive-game body{height:100vh;height:100dvh;min-height:0;max-height:100dvh;min-width:280px;margin:0;padding:var(--safe-top) 0 0;display:flex;flex-direction:column;position:relative;color:#fff6e7;isolation:isolate}
.immersive-game body,.immersive-game body *{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
.immersive-game input,.immersive-game textarea,.immersive-game select,.immersive-game [data-allow-selection],.immersive-game [contenteditable="true"],.immersive-game [contenteditable=""],.immersive-game [contenteditable="plaintext-only"]{-webkit-user-select:text;user-select:text;-webkit-touch-callout:default}
.immersive-backdrop{position:fixed;inset:0;z-index:-2;background:#132e55 url('./v2-scene.png') center center/cover no-repeat;pointer-events:none}
.immersive-backdrop::after{content:'';position:absolute;inset:0;background:linear-gradient(180deg,#071b36a8 0%,#10254310 28%,#101f3e00 61%,#09172ec9 100%);pointer-events:none}
.immersive-game .intro-rail,.immersive-game .side-rail,.immersive-game .site-footer,.immersive-game .prototype-badge,.immersive-game .site-header .language-switch,.immersive-game .game-advice{display:none!important}
.immersive-game .site-header{flex:0 0 44px;min-height:44px;height:44px;width:100%;max-width:760px;padding:0 max(12px,var(--safe-right)) 0 max(12px,var(--safe-left));margin:0 auto;display:flex;overflow:visible;align-items:center;z-index:4}
.immersive-game .brand{max-width:55%;width:167px;min-width:0;filter:drop-shadow(0 3px 3px #071b39bb)}
.immersive-game #illustrated-brand{width:167px;max-height:37px;max-width:100%}
.immersive-game .header-right{display:flex;align-items:center;gap:7px;flex:none}
.immersive-game .header-right .icon-button,.immersive-game #restart-level{position:static;display:grid!important;place-items:center;flex:0 0 44px;width:44px;min-width:44px;height:44px;min-height:44px;padding:4px;font-size:26px;line-height:1;border-radius:15px;border:1px solid #e9f5ff80;background:linear-gradient(145deg,#e7f4ffed,#bbd4ebdf);color:#23375c;box-shadow:inset 0 1px 0 #fff,0 3px 0 #071a3866,0 5px 15px #071a3833}
.immersive-game .header-right .icon-button svg{width:23px;height:23px}
.immersive-game #restart-level.needs-reset{background:linear-gradient(#fff4b4,#ffbe54)}
.immersive-game .app-layout{display:block;flex:1 1 0;min-height:0;width:100%;max-width:none;margin:0;padding:0}
.immersive-game .game-shell{display:flex;flex-direction:column;height:100%;min-height:0;max-height:100%;width:100%;max-width:none;border:0;border-radius:0;box-shadow:none;background:transparent;overflow:hidden;position:relative}
.immersive-game .game-heading{position:relative;flex:0 0 60px;min-height:60px;height:60px;width:100%;max-width:760px;align-self:center;margin:0;padding:6px max(12px,var(--safe-right)) 2px max(12px,var(--safe-left));gap:10px;overflow:hidden;background:transparent}
.immersive-game .game-heading>.icon-button{width:44px;min-width:44px;height:46px;min-height:44px;flex:0 0 44px;border:1px solid #f5e4bc;border-radius:13px;box-shadow:0 3px 0 #071a3855,0 3px 14px #071a3855}
.immersive-game .game-heading>div:nth-child(2){padding-right:83px;min-width:0;align-self:center}
.immersive-game .game-heading p{font-size:8px!important;line-height:1.3;letter-spacing:.6px!important;margin:0 0 3px;color:#cfeaff;white-space:nowrap;text-shadow:0 1px 2px #081b3c}
.immersive-game .game-heading h2{font-size:15px!important;line-height:1.15!important;max-height:2.3em;margin:0;color:#fffaf1;text-shadow:0 2px 3px #092139;white-space:normal;overflow:hidden;-webkit-line-clamp:2}
.immersive-game .game-heading .level-counter{position:absolute;right:max(12px,var(--safe-right));top:3px;margin:0;min-height:22px;border-radius:9px;padding:4px 8px;font-size:10px!important;color:#5b3513;border:1px solid #ffd98b;background:linear-gradient(#fff7ce,#ffc56b);box-shadow:0 2px 0 #80532a66}
.immersive-game .game-heading .coin-hud{position:absolute;right:max(12px,var(--safe-right));bottom:4px;min-height:29px;min-width:80px;justify-content:center;font-size:11px;padding:3px 7px;border:1px solid #fada98;border-radius:10px;background:linear-gradient(#fff6c9,#ffd37c)}
.immersive-game .challenge-strip{position:relative;flex:0 0 25px;min-height:25px;width:100%;max-width:760px;align-self:center;display:flex;align-items:center;gap:7px;border:0;padding:2px max(12px,var(--safe-right)) 4px max(12px,var(--safe-left));overflow:hidden;background:transparent}
.immersive-game .difficulty-badge{font-size:9px;padding:3px 6px;border:1px solid #ecdcaf88;background:#fff3d7e6;color:#6f4b27;box-shadow:none;white-space:nowrap;flex:none}
.immersive-game .stage-status{position:static;transform:none;background:transparent;border:0;box-shadow:none;padding:0;min-height:0;max-width:none;flex:1;min-width:0;color:#e2f3ff;font-size:8px;letter-spacing:.1px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;pointer-events:none}
.immersive-game #stage-status-text{overflow:hidden;text-overflow:ellipsis}
.immersive-game .status-dot{width:4px;height:4px;flex:none}
.immersive-game .checkpoint-count{font-size:9px;white-space:nowrap;flex:none;border-color:#ecd69eaa!important;background:#fff5d9e8;padding:3px 5px}
.immersive-game #mechanic-label{display:none}
.immersive-game .daily-banner{flex:0 0 32px;min-height:32px;background:#263a64d9;color:#fff1bd;border:0;margin:0 max(12px,var(--safe-left));border-radius:12px;padding:3px 9px;font-size:10px}
.immersive-game #leave-daily{min-height:28px;color:#fff1bd;font-size:10px}
.immersive-game .game-stage,.immersive-game .guide-layout .game-stage,.immersive-game .precision-open .game-stage{position:relative;flex:1 1 0;min-height:0!important;max-height:none!important;height:auto!important;aspect-ratio:auto;width:100%;border:0;background:transparent;overflow:hidden}
.immersive-game .game-stage canvas{width:100%!important;height:100%!important;max-width:none!important;aspect-ratio:auto;display:block;background:transparent;touch-action:none}
.immersive-game .game-controls{position:relative;z-index:3;align-self:center;flex:0 0 auto;width:100%;max-width:600px;display:grid;grid-template-columns:repeat(6,minmax(0,1fr));grid-template-rows:44px 52px 46px;gap:7px 7px;margin:0;padding:8px max(12px,var(--safe-right)) 10px max(12px,var(--safe-left));min-height:0;max-height:none;border:0;border-radius:22px 22px 0 0;background:linear-gradient(180deg,#102a4b00,#11264499 50%,#0c1c35d9)}
.immersive-game .game-controls .adjust-row,.immersive-game .game-controls .precision-row{display:contents;margin:0}
.immersive-game .game-controls .selection-label{display:none}
.immersive-game .game-controls .rotation-controls{grid-column:1/4;grid-row:1;display:flex;gap:5px;min-width:0;width:100%;align-self:stretch}
.immersive-game .game-controls:not(:has(#select-next:not([hidden]))) .rotation-controls{grid-column:1/5}
.immersive-game .game-controls .rotation-controls .rotate-button,.immersive-game .game-controls .rotation-controls #angle-label{width:auto;min-width:0;max-width:none;min-height:44px;height:44px;flex:1;border-radius:14px;padding:4px;box-shadow:inset 0 1px 0 #fff,0 3px 0 #071b3566; background:linear-gradient(145deg,#fffff6f5,#cbdcedee);border:1px solid #f3fbffb0}
.immersive-game .game-controls .rotation-controls #angle-label{font-size:19px;flex:1.12}
.immersive-game #rotate-left::after,.immersive-game #rotate-right::after{font-size:7px}
.immersive-game #angle-label::after{font-size:6.5px}
.immersive-game .game-controls #select-next{grid-column:4/5;grid-row:1;width:100%;max-width:none;height:44px;min-height:44px;border-radius:14px;font-size:0!important;padding:3px!important;gap:3px;display:flex;flex-direction:column;box-shadow:0 3px 0 #071b3566;background:linear-gradient(#e4f2ff,#b4cff1)!important}
.immersive-game .game-controls #select-next::before{width:20px;height:8px;margin:0;transform:rotate(-18deg)}
.immersive-game .game-controls #select-next::after{content:'Switch';font-size:8px}
.immersive-game[lang=sv] .game-controls #select-next::after{content:'Byt ramp'}
.immersive-game .game-controls #precision-toggle{grid-column:5/7;grid-row:1;display:flex;align-items:center;justify-content:center;width:100%;min-height:44px;height:44px;max-width:none;border-radius:14px;font-size:10px;padding:5px 7px;background:linear-gradient(150deg,#f3eefff5,#c6c9e7ee);border:1px solid #e3e8ff;box-shadow:0 3px 0 #071b3566}
.immersive-game .game-controls .main-actions{grid-column:1/-1;grid-row:2;margin:0}
.immersive-game .primary-button#run-button{height:52px;min-height:52px;border-radius:18px;font-size:25px;padding:5px 30px;color:#fffde8;border:1px solid #ffd683;background:linear-gradient(#ffb838 0%,#ff8a16 35%,#ef5210 100%);box-shadow:inset 0 2px 0 #fff4b3,0 4px 0 #97370e,0 7px 16px #091a3c99;text-shadow:0 2px 0 #b74010}
.immersive-game .help-row{grid-column:1/-1;grid-row:3;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;margin:0;padding:0}
.immersive-game .help-row:not(:has(#extra-button:not([hidden]))){grid-template-columns:repeat(2,minmax(0,1fr))}
.immersive-game .help-row.daily-help{grid-template-columns:1fr}
.immersive-game .help-row button{min-height:46px;height:46px;font-size:11px!important;border-radius:16px;padding:4px 18px 4px 6px!important;gap:6px;box-shadow:inset 0 1px 0 #fff,0 3px 0 #071b3577}
.immersive-game .help-row button svg{width:26px!important;height:29px!important}
.immersive-game .help-row button span[id$='-count']{top:3px;right:5px;font-size:9px;min-width:17px;width:auto;height:17px;line-height:1;padding:0 3px}
.immersive-game .game-nav{position:relative;z-index:4;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));align-self:center;flex:0 0 calc(67px + var(--safe-bottom));min-height:calc(67px + var(--safe-bottom));width:100%;max-width:600px;gap:7px;margin:0;padding:5px max(12px,var(--safe-right)) calc(7px + var(--safe-bottom)) max(12px,var(--safe-left));border:0;border-radius:0;background:linear-gradient(#10213bb3,#08182ee8)}
.immersive-game .game-nav button{min-height:53px;height:53px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;border-radius:16px;border:1px solid #dae8ff45;background:linear-gradient(150deg,#314c75de,#172c51f2);color:#eaf3ff;font-size:9px!important;font-weight:800!important;padding:3px 2px;text-shadow:0 1px 1px #101e3d;box-shadow:inset 0 1px 0 #dae8ff22,0 3px 0 #06162cb0}
.immersive-game .game-nav button svg{width:26px;height:26px;stroke:#c6e5ff;filter:drop-shadow(0 2px 1px #07163188)}
.immersive-game .game-nav button.active{background:linear-gradient(#ffe8a7,#ffa844);border-color:#fff0bc;color:#744019;text-shadow:none}
.immersive-game .game-nav button.active svg{stroke:#9a4e19}
.immersive-game .game-nav button[data-open=shop]{background:linear-gradient(#ab8dfb,#6a4cc7);border-color:#d2bdff;color:#fff;box-shadow:inset 0 1px 0 #e4d1ff,0 3px 0 #32226d}
.immersive-game .game-nav button[data-open=shop] svg{stroke:#fff3b0}
.immersive-game .game-nav button[data-open=daily]:not(.active){background:linear-gradient(#277f88,#175263);border-color:#8cdde1a6}
.immersive-game .game-nav button[data-open=daily]:not(.active) svg{stroke:#e0ffce}
.immersive-game .game-nav button:active:not(:disabled),.immersive-game .header-right button:active:not(:disabled){transform:translateY(2px);filter:brightness(1.08)}
.immersive-game .modal-backdrop{z-index:50;align-items:flex-end;justify-content:center;padding:calc(var(--safe-top) + 10px) max(10px,var(--safe-right)) calc(var(--safe-bottom) + 10px) max(10px,var(--safe-left));background:#05142da3;backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px)}
.immersive-game .modal{max-width:500px;max-height:100%;border:2px solid #fff0cf;border-radius:27px;box-shadow:0 18px 60px #031125d9,0 5px 0 #9e735177;background:linear-gradient(150deg,#fffdf6,#fcf1df);padding:22px;color:#192b50;overflow:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
.immersive-game .modal-head .icon-button{min-width:44px;width:44px;min-height:44px;height:44px;background:linear-gradient(#fff7df,#efd7b9);border:1px solid #dbb88d;box-shadow:0 2px 0 #b9916c}
.immersive-game .modal .primary-button,.immersive-game .modal .secondary-button,.immersive-game .modal .product button{min-height:44px}
.immersive-game .modal-head h2{font-size:26px;color:#192b50}
.immersive-game .precision-panel{position:absolute!important;left:10px;right:10px;bottom:calc(100% + 8px)!important;z-index:8;background:linear-gradient(#fffdf7,#f6eddf);border:2px solid #f2d8ac;box-shadow:0 8px 28px #071a3999;max-height:calc(100dvh - 180px);overflow-y:auto;color:#253557}
.immersive-game #level-tip{position:absolute;left:12px;right:12px;bottom:calc(249px + var(--safe-bottom));max-height:110px;overflow-y:auto;background:#fff6dcf2;border:1px solid #e3c38c;z-index:5;color:#493926;pointer-events:auto}
.immersive-game .toast{z-index:70;bottom:calc(75px + var(--safe-bottom));max-width:calc(100% - 28px)}
.immersive-game button:focus-visible,.immersive-game a:focus-visible,.immersive-game canvas:focus-visible{outline:3px solid #ffdf7e;outline-offset:2px}
@media(min-width:701px){.immersive-game .game-heading{max-width:700px}.immersive-game .challenge-strip{max-width:700px}.immersive-game .modal-backdrop{align-items:center}.immersive-game .modal{max-width:520px}}
@media(max-height:700px) and (orientation:portrait){.immersive-game .site-header{flex-basis:40px;min-height:40px;height:40px}.immersive-game #illustrated-brand{width:150px}.immersive-game .game-heading{flex-basis:52px;min-height:52px;height:52px}.immersive-game .game-heading h2{font-size:13px!important}.immersive-game .challenge-strip{flex-basis:22px;min-height:22px}.immersive-game .game-controls{grid-template-rows:44px 48px 44px;gap:5px;padding-top:4px;padding-bottom:7px}.immersive-game .primary-button#run-button{height:48px;min-height:48px;font-size:22px}.immersive-game .help-row button{height:44px;min-height:44px}.immersive-game .game-nav{flex-basis:calc(60px + var(--safe-bottom));min-height:calc(60px + var(--safe-bottom));padding-top:2px;padding-bottom:calc(5px + var(--safe-bottom))}}
@media(max-width:360px){.immersive-game .brand,.immersive-game #illustrated-brand{width:145px}.immersive-game .site-header{padding-left:8px;padding-right:8px}.immersive-game .game-controls,.immersive-game .game-nav{padding-left:8px;padding-right:8px;gap:6px}.immersive-game .game-heading{gap:6px;padding-left:8px;padding-right:8px}.immersive-game .help-row button{font-size:10px!important;gap:3px;padding-left:4px!important}.immersive-game .game-heading h2{font-size:13px!important}.immersive-game .game-nav button{font-size:8px!important}}
@media(orientation:landscape) and (max-height:600px){
 .immersive-game body{display:block;padding:0;height:100dvh;min-height:0;overflow:hidden}
 .immersive-game .site-header{position:absolute;top:var(--safe-top);left:var(--safe-left);width:calc(100% - 310px - var(--safe-left));max-width:none;height:46px;min-height:46px;margin:0;padding:1px 8px;z-index:6}
 .immersive-game .app-layout{position:absolute;inset:0;margin:0;min-height:0;padding:0}
 .immersive-game .game-shell{display:block;position:static}
 .immersive-game .game-heading{position:absolute;right:var(--safe-right);top:calc(var(--safe-top) + 5px);width:300px;height:60px;min-height:60px;padding:5px 8px;z-index:3}
 .immersive-game .challenge-strip{position:absolute;right:var(--safe-right);top:calc(var(--safe-top) + 66px);width:300px;padding:1px 8px;z-index:3}
 .immersive-game .game-stage,.immersive-game .guide-layout .game-stage,.immersive-game .precision-open .game-stage{position:absolute;left:var(--safe-left);top:calc(var(--safe-top) + 48px);right:calc(310px + var(--safe-right));bottom:var(--safe-bottom);width:auto!important;height:auto!important;min-height:0!important;max-height:none!important}
 .immersive-game .game-controls{position:absolute;right:var(--safe-right);bottom:calc(var(--safe-bottom) + 65px);width:300px;grid-template-rows:44px 48px 44px;gap:5px;padding:6px 8px 7px;background:#112b4bad;border-radius:18px;z-index:4}
 .immersive-game .primary-button#run-button{height:48px;min-height:48px;font-size:21px}
 .immersive-game .help-row button{height:44px;min-height:44px;font-size:9px!important;gap:3px}.immersive-game .help-row button svg{width:20px!important}
 .immersive-game .game-nav{position:absolute;right:var(--safe-right);bottom:0;width:300px;min-height:calc(60px + var(--safe-bottom));height:calc(60px + var(--safe-bottom));padding:2px 8px calc(5px + var(--safe-bottom));gap:5px;z-index:4}
 .immersive-game .game-nav button{height:53px;font-size:8px!important}.immersive-game .game-heading>div:nth-child(2){padding-right:78px}
 .immersive-game .daily-banner{position:absolute;left:max(8px,var(--safe-left));right:calc(320px + var(--safe-right));top:calc(var(--safe-top) + 46px);z-index:4;font-size:9px}
 .immersive-game #level-tip{right:calc(320px + var(--safe-right));bottom:calc(12px + var(--safe-bottom));max-height:95px}
 .immersive-game .modal-backdrop{align-items:center}.immersive-game .precision-panel{max-height:calc(100dvh - 85px);bottom:calc(100% + 4px)!important}
}
@media(prefers-reduced-motion:reduce){.immersive-game *, .immersive-game *::before,.immersive-game *::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}

.immersive-game #restart-level{display:flex!important;flex-direction:column;gap:0;font-size:0;padding:2px;justify-content:center;align-items:center}
.immersive-game #restart-level::before{content:'↻';font-size:24px;line-height:1}
.immersive-game #restart-level::after{content:'Restart';font-size:8px;line-height:1.2;font-weight:800}
.immersive-game[lang=sv] #restart-level::after{content:'Börja om'}

/* 0.8.4: full painted scene, restored detail and low-cost living atmospheres. */
.immersive-backdrop{background-size:100% 100%;background-color:#142b40}
#living-world-canvas{position:absolute;inset:0;width:100%;height:100%;display:block;pointer-events:none;-webkit-user-select:none;user-select:none}
.immersive-backdrop:has(#living-world-canvas)::after{background:linear-gradient(180deg,#06172d20,transparent 20%,transparent 70%,#07162c24)}

/* Build 54: the extra-move purpose stays visible on the actual control. */
.immersive-game #extra-button .extra-copy{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;gap:3px;min-width:0;line-height:1.1;color:#163f52;text-shadow:none;-webkit-text-fill-color:currentColor;-webkit-text-stroke:0}
.immersive-game #extra-button .extra-copy strong{font:800 11px/1.1 system-ui}
.immersive-game #extra-button .extra-purpose{font:650 9px/1.1 system-ui;white-space:nowrap}
.immersive-game #extra-button svg{flex:0 0 20px;width:20px!important}
.immersive-game #extra-button.is-active{background:linear-gradient(#deffe9,#80dfbd)!important;border:2px solid #f5ffd5;box-shadow:0 0 0 2px #54c9a65c,0 3px 0 #1b7264}
.immersive-game #extra-move-help{grid-column:1/-1;grid-row:4;margin:0;padding:5px 8px;border-radius:9px;background:#143b56;color:#f3fcff;font:600 10px/1.35 system-ui;text-shadow:none;-webkit-text-fill-color:currentColor;-webkit-text-stroke:0;text-align:center}
.immersive-game #extra-move-help[hidden]{display:none}
.extra-ramp-rule{padding:14px;border:1px solid #a6c9cc;border-radius:14px;background:#e5f5f2;color:#193e50!important;font:650 15px/1.5 system-ui!important;text-shadow:none!important;-webkit-text-stroke:0!important;-webkit-text-fill-color:currentColor!important}
.immersive-game #extra-button{padding-right:20px!important;gap:3px}
@media(max-width:360px){.immersive-game #extra-button svg{display:none}.immersive-game #extra-button .extra-copy strong{font-size:10px}.immersive-game #extra-button .extra-purpose{font-size:9px}}

@media(orientation:landscape) and (max-height:600px){.immersive-game #extra-button svg{display:none}.immersive-game #extra-button .extra-copy strong{font-size:10px}.immersive-game #extra-button .extra-purpose{font-size:9px}}
