/* Phase 5: viewport presentation. No world geometry or physics rules. */
:root{color-scheme:dark;--ink:#fff2ce;--muted:#d6e1ce;--surface:#203e36;--paper:#18352f;--line:#6c896e;--gold:#ffd16b;--focus:#fff2b1;font-family:system-ui,sans-serif}
html,body{width:100%;height:100%;overflow:hidden;overscroll-behavior:none;background:#aee3f5}body{touch-action:manipulation}
body .shell,:fullscreen .shell{width:100%;max-width:none;height:100dvh;max-height:none;margin:0;padding:0;position:relative;display:block}
.game-stage{position:absolute;inset:0;display:block;width:100%;height:100%;overflow:hidden}.game-frame{border:0;border-radius:0;background:#aee3f5}#game,#game canvas{width:100%;height:100%;display:block}#game{touch-action:none}
.heading,.game-footer,.portrait-help,.back-link{display:none!important}#status,#objective,#checkpoint-state,.hud{position:absolute!important;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;pointer-events:none}
.masthead{position:absolute;z-index:20;left:max(18px,env(safe-area-inset-left));right:max(18px,env(safe-area-inset-right));top:max(16px,env(safe-area-inset-top));padding:0;display:flex;justify-content:flex-start;gap:10px;pointer-events:none;color:#fff2ce}
.masthead>*{background:#18352fee;border:1px solid #71917a;padding:10px 14px;border-radius:6px;font-size:13px;font-weight:700;pointer-events:auto;min-height:44px;display:flex;align-items:center}.masthead #pause{margin-left:auto;gap:9px;background:#18352f;color:#fff2ce}.menu-active .masthead,.menu-active #notice,.menu-active #tutorial{visibility:hidden}
button{background:#294b40;color:#fff2ce;border:1px solid #6d8b72;border-radius:6px;min-height:44px;padding:10px 16px;font-weight:700;transition:background .15s,transform .15s;touch-action:manipulation}button:hover{background:#3b6250;color:#fff2ce}button:active{transform:translateY(1px)}
button.primary,#dial-test{background:#ffd16b;border:2px solid #ffd16b;color:#19352e;box-shadow:0 5px 12px #09241c30}button.primary:hover,#dial-test:hover{background:#ffe398;border-color:#ffe398;color:#19352e}button.secondary{background:#23483c;color:#fff2ce;border-color:#63856d}button:disabled{opacity:.5;cursor:default}
button:focus-visible,a:focus-visible,input:focus-visible,summary:focus-visible,#mechanism button:focus-visible{outline:3px solid var(--focus);outline-offset:4px}#game:focus-visible{outline:none}::selection{background:#ffd16b;color:#18352f}kbd{font:inherit;font-size:11px;background:#365748;border:1px solid #8ca488;color:#fff2ce}a{color:#fff2ce;text-decoration-thickness:1px;text-underline-offset:5px}
.loading{z-index:60;background:#18352f;color:#fff2ce;font-size:18px;gap:20px}.loading span{color:#ffd16b}
body .welcome{position:absolute;z-index:25;inset:0;transform:none;width:100%;height:100%;max-height:none;overflow:hidden;padding:0;background:#aee3f5;border:0;border-radius:0;box-shadow:none;color:#153b32}
/* V13 main-menu correction: the welcome screen previously left the live
   Phaser canvas visible behind it (camera parked at a fixed scroll into
   real Zone A geometry — ladders, crate, switch), which is what made the
   title screen read as "gameplay with a menu stuck on top" instead of a
   dedicated menu composition. The canvas is now hidden outright while
   mode==='welcome' (driven by the same body[data-mode] attribute
   presentation.js already sets for every other mode-specific rule in this
   file) and replaced by #menu-canvas (see below), built from the same
   verified Kenney files already used in-world — not a second gameplay
   view. */
body[data-mode="welcome"] #game canvas{visibility:hidden}
/* V13 menu rebuild (clean-source pass): the decorative scenery is no
   longer a stack of absolutely-positioned DOM layers fighting the rest of
   this stylesheet's cascade (that's what produced the duplicate-label and
   stray-strip bugs). It is now ONE <canvas id="menu-canvas"> painted once
   by src/v13/menu-scene.js, a small standalone module with zero Phaser
   dependency and zero shared CSS selectors — isolated architecture, per
   the brief. This is the only rule menu-scene.js's canvas needs: fill its
   container, sit behind the title/button/gear UI. */
.menu-canvas{position:absolute;inset:0;width:100%;height:100%;z-index:0;display:block}
.gear-btn{position:absolute;z-index:26;top:max(18px,env(safe-area-inset-top));right:max(18px,env(safe-area-inset-right));width:46px;height:46px;min-height:46px;padding:0;font-size:20px;line-height:1;border-radius:3px}
/* !important: style.css (shared across v10-v13's launcher pages, not
   edited here) carries a stray #new-adventure{width:100%;display:block}
   rule from the old full-width-button layout. Its ID selector otherwise
   outranks any class selector here regardless of source order; scoping
   the override to V13's own stylesheet with !important is the contained
   fix rather than touching a file shared with other versions. */
.menu-secondary{display:flex;flex-wrap:wrap;gap:10px 16px;align-items:center}
.menu-secondary button,.menu-secondary .title-return{flex:0 0 auto!important;width:auto!important;display:inline-flex!important;align-items:center;max-width:none;background:transparent;border:none;box-shadow:none;color:inherit;font-size:13px;font-weight:650;min-height:32px;padding:4px 2px;text-decoration:underline;text-underline-offset:3px;white-space:nowrap}
.menu-secondary button:hover,.menu-secondary .title-return:hover{opacity:.75}
/* Checkpoint/save text now lives inside the Tetapan dialog (moved there
   with the rest of .menu-secondary) instead of the initial welcome
   screen itself — the mockup's menu has none of this text visible. */
#settings #save-status{display:block;margin-top:14px;background:#23483c;color:#fff2ce}
.settings-menu{margin-top:18px;padding-top:14px;border-top:1px solid #6d8b72}
.title-copy{position:absolute;top:9%;left:7%;width:min(620px,52%)}.welcome h1{font-family:system-ui,sans-serif;font-size:clamp(54px,6.6vw,96px);font-weight:900;line-height:.97;letter-spacing:-.04em;color:#173e32;text-shadow:0 3px 0 #f9e8ba;margin:0 0 18px}.welcome h1 span{color:#fff0be;text-shadow:0 3px 0 #254e3d,2px 0 #254e3d,-2px 0 #254e3d}
.welcome p.title-tagline{color:#234b3c;font-weight:650;font-size:20px;line-height:1.5;margin:0 0 30px}.title-actions{max-width:380px;display:grid;gap:10px}.welcome .primary{font:700 18px system-ui,sans-serif;display:block;min-height:56px;width:100%;border-radius:6px;background:#ffd16b;color:#19352e;border-color:#ffd16b;box-shadow:0 5px 12px #09241c30}.welcome .primary:hover{background:#ffe398;color:#19352e}
/* V13 main-menu correction: the mockup's one prominent, large, all-caps
   MAIN button — bigger than the old primary button, not just re-skinned.
   #start/#continue-btn are never both visible at once (refreshMenu()'s
   existing hidden toggling), so this is always exactly one button.
   Earlier this hid the real text (font-size:0) and drew "MAIN" via an
   ::after pseudo-element instead — that's what produced the reported
   "MAIN overlaps Sambung Permainan" bug (the real text box still laid
   out and, under some cascades, still painted, behind the pseudo-element
   text). Fixed at the root: the button's own visible text is a literal,
   static "MAIN" in the HTML, full stop. refreshMenu() (game.js) now sets
   the save-state wording as this button's aria-label instead of its
   textContent, so the real action is still announced to screen readers
   without ever touching what sighted players see. */
.welcome .main-btn{min-height:76px;font-size:26px;letter-spacing:.04em;text-transform:uppercase}
#continue-btn,#new-adventure{margin:0}.welcome .small{font-size:12px;line-height:1.4;color:#fff2ce;background:#234b3c;padding:8px 12px;margin:0;border-radius:4px}
.title-return{font-size:13px;display:inline-flex;align-items:center}
#zone-toast,#notice,#tutorial{position:absolute;z-index:21;left:50%;transform:translateX(-50%);max-width:min(520px,calc(100% - 32px));width:max-content;pointer-events:none;text-align:center;font:650 14px/1.5 system-ui,sans-serif;color:#fff2ce;background:#203e36f5;border:1px solid #7a987d;border-radius:6px;padding:9px 16px;opacity:0;transition:opacity .2s}#zone-toast,#notice{top:max(74px,calc(env(safe-area-inset-top) + 60px))}#tutorial{bottom:28px}#zone-toast.show,#notice.show,#tutorial.show{opacity:1;transform:translateX(-50%)}body[data-notice="true"] #zone-toast{opacity:0}.zone-toast:not(.show){visibility:hidden}
body #mechanism{position:absolute;z-index:35;left:auto;right:max(24px,env(safe-area-inset-right));top:50%;bottom:auto;transform:translateY(-50%);width:min(420px,43vw);max-height:calc(100% - 48px);padding:24px;background:#183a32;color:#fff2ce;border:2px solid #b9a66c;border-radius:10px;box-shadow:0 12px 34px #10291c55;overflow:auto;overscroll-behavior:contain;scrollbar-color:#a2ae85 #183a32;scrollbar-width:thin}
#mechanism h2{font-size:25px;line-height:1.15;margin:0 0 14px;letter-spacing:-.025em}#mechanism p{font-size:14px;line-height:1.5;margin:10px 0;color:#e3e9d3}#mechanism output{display:block;font-size:24px;line-height:1.35;font-weight:750;color:#ffda81;font-variant-numeric:tabular-nums;overflow-wrap:anywhere;margin:16px 0 10px}.mechanism-actions{display:flex;flex-wrap:wrap;gap:8px}.mechanism-actions button{min-width:44px;min-height:44px;padding:9px 12px;font-size:14px}#token-options{display:grid;grid-template-columns:repeat(5,1fr);margin:16px 0}#pipe-options{margin:16px 0}#token-options button{padding:8px 3px}#mechanism [aria-pressed="true"]{background:#f5d987;color:#173b31;border-color:#f5d987;box-shadow:inset 0 0 0 2px #193e32}#worked-solution{font-size:14px;line-height:1.6;margin-top:16px;padding-top:14px;border-top:1px solid #6d8b72;color:#fff2ce;white-space:pre-line}
body[data-mode="mechanism"] .touch-controls,body[data-mode="mechanism-transition"] .touch-controls,body[data-mode="paused"] .touch-controls,body[data-mode="complete"] .touch-controls{display:none!important}body[data-mode="mechanism"] #tutorial,body[data-mode="mechanism-transition"] #tutorial,body[data-mode="complete"] .masthead{visibility:hidden}
dialog{background:#183a32;color:#fff2ce;border:2px solid #ad9b66;border-radius:10px;width:min(540px,calc(100% - 32px));padding:32px;max-height:calc(100dvh - 32px);box-shadow:0 18px 60px #07271c66;scrollbar-color:#a2ae85 #183a32;scrollbar-width:thin;overscroll-behavior:contain}dialog::backdrop{background:#0b2a24b8}dialog h2{color:#fff2ce;font-size:32px;line-height:1.1;letter-spacing:-.025em;margin:0 35px 16px 0}dialog p,dialog .small{font-size:14px;line-height:1.6;color:#e0e7ce}dialog .close{width:44px;height:44px;min-height:44px;color:#fff2ce;right:12px;top:12px}
.pause-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:24px}.pause-actions #resume{grid-column:1/-1}.dialog-return{display:inline-flex;align-items:center;min-height:44px;margin-top:16px;font-size:13px}.help-controls{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin:22px 0}.help-controls dt{font-weight:750;color:#ffda81;font-size:14px}.help-controls dd{margin:4px 0 0;font-size:13px;color:#e0e7ce}#help p+p{margin-top:12px}.audio-settings{border-color:#6d8b72}.audio-row label{color:#fff2ce;font-size:14px}.audio-row input[type=range]{accent-color:#ffda81;min-height:44px}.audio-row input[type=checkbox]{width:22px;height:22px;accent-color:#ffda81}.hint-list li,.level-card{background:#23483c;color:#fff2ce;border-color:#65816b}.level-card{border-radius:6px}.level-card-status{color:#ffda81}
#complete{inset:0;margin:0;width:100vw;max-width:none;height:100dvh;max-height:none;padding:30px;display:none;place-items:center;border:0;border-radius:0;background:#15372fed;overflow:auto}#complete[open]{display:grid}.victory-content{text-align:center;max-width:660px;width:100%}.victory-content h2{font-size:clamp(40px,6vw,76px);font-weight:900;line-height:.95;margin:12px 0 22px;color:#fff2ce;letter-spacing:-.035em}.victory-content h2 span{color:#ffd16b}.victory-flag{width:54px;height:54px;margin:auto;background:url('../../assets/kenney-pixel-platformer/Tiles/tile_0112.png') center/contain no-repeat;image-rendering:pixelated}.victory-content p.victory-message{font-size:18px;color:#e3e9d3}.results{display:flex;justify-content:center;gap:30px;padding:24px 0;margin:22px 0 14px;border-block:1px solid #6c896e}.results p{color:#ffda81;font-size:18px;font-weight:750;white-space:nowrap;font-variant-numeric:tabular-nums}.victory-content .dialog-actions{justify-content:center;margin-top:26px}.victory-content .dialog-actions button{min-width:165px;min-height:50px}
.touch-controls{left:max(18px,env(safe-area-inset-left));right:max(18px,env(safe-area-inset-right));bottom:max(20px,env(safe-area-inset-bottom));display:flex;justify-content:space-between;align-items:end;pointer-events:none;z-index:24;gap:14px}.touch-controls .touch-group{gap:10px;align-items:end}.touch-controls button{border:1px solid #9cb38f;background:#1b4035ec;color:#fff2ce;min-width:54px;min-height:54px;padding:8px;font-size:23px;border-radius:10px;pointer-events:auto;touch-action:none;user-select:none}.touch-controls .jump{min-width:78px;min-height:64px;background:#ffd16b;color:#173b31;font-size:14px}.touch-controls .interact{font-size:13px;min-width:60px;background:#41664e;color:#fff2ce}.touch-controls .crate-reset{position:absolute;left:0;right:auto;bottom:72px;font-size:11px;min-height:44px;width:auto}
[hidden]{display:none!important}
@media(max-width:700px) and (orientation:portrait){.title-copy{left:7%;top:8%;width:86%}.welcome h1{font-size:clamp(42px,11.5vw,65px);margin-bottom:12px}.welcome p.title-tagline{font-size:14px;margin-bottom:22px;max-width:280px}.title-actions{max-width:none}.welcome .primary{font-size:17px;min-height:52px}.title-return{left:7%;bottom:max(18px,env(safe-area-inset-bottom));font-size:12px}.masthead{left:12px;right:12px;top:max(12px,env(safe-area-inset-top));gap:7px;flex-wrap:nowrap}.masthead>*{padding:8px 10px;font-size:12px}.masthead kbd{display:none}
body #mechanism{left:10px;right:10px;top:auto;bottom:max(12px,env(safe-area-inset-bottom));transform:none;width:auto;max-height:78dvh;padding:18px}#mechanism h2{font-size:23px}#mechanism output{font-size:22px;margin:12px 0}#mechanism p{font-size:14px}.mechanism-actions{gap:7px}.mechanism-actions button{font-size:13px;padding:8px 10px}.touch-controls{left:12px;right:12px;gap:8px;bottom:max(16px,env(safe-area-inset-bottom))}.touch-controls .touch-group{gap:7px}.touch-controls button{min-width:48px;min-height:52px}.touch-controls .jump{min-width:68px;min-height:60px}.touch-controls .interact{min-width:52px}.touch-controls [data-hold="up"],.touch-controls [data-hold="down"]{min-width:44px;font-size:20px}.touch-controls.ladder-near .touch-group{gap:5px}.touch-controls.ladder-near{gap:5px}#tutorial{bottom:100px;font-size:13px}.results{gap:10px;flex-wrap:wrap;padding:18px 0}.results p{font-size:16px}.victory-content h2{font-size:48px}.victory-content p.victory-message{font-size:16px}#complete{padding:24px 16px}.victory-content .dialog-actions{gap:10px}.victory-content .dialog-actions button{min-width:140px}dialog{padding:24px}}
@media(max-height:560px) and (orientation:landscape){.title-copy{top:7%;left:7%;width:48%}.welcome h1{font-size:clamp(32px,7vh,46px);margin-bottom:8px}.welcome p.title-tagline{font-size:12px;margin-bottom:12px}.title-actions{gap:6px;max-width:330px}.welcome .primary{min-height:44px;font-size:15px}.welcome .small{font-size:10px;padding:5px 8px}.title-return{left:auto;right:7%;bottom:14px;font-size:11px}.masthead{top:max(8px,env(safe-area-inset-top));left:max(12px,env(safe-area-inset-left));right:max(12px,env(safe-area-inset-right))}.masthead>*{min-height:44px;padding:6px 12px}#zone-toast,#notice{top:60px;font-size:12px;padding:6px 12px}#tutorial{bottom:14px;font-size:12px}
body #mechanism{top:10px;bottom:10px;right:max(12px,env(safe-area-inset-right));width:min(480px,61vw);max-height:none;transform:none;padding:14px;display:grid;grid-template-columns:1fr 1fr;column-gap:14px;align-content:start}#mechanism h2{font-size:20px;grid-column:1/-1;margin:0 0 7px}#mechanism p{font-size:12px;margin:4px 0}#mechanism output{font-size:19px;margin:6px 0}#mechanism-rule{grid-column:1}#mechanism-value{grid-column:2;grid-row:2}#mechanism-feedback{grid-column:1}#token-options,#pipe-options{grid-column:2;grid-row:3 / span 2;margin:6px 0;gap:5px}#token-options{grid-template-columns:repeat(5,1fr)}#mechanism>.mechanism-actions:last-of-type{grid-column:1/-1;margin-top:8px;gap:6px}#mechanism .mechanism-actions button{font-size:12px;padding:7px 8px;min-width:38px;min-height:44px}#worked-solution{grid-column:1/-1;font-size:12px;margin:8px 0 0;padding-top:8px}.touch-controls{bottom:max(10px,env(safe-area-inset-bottom))}.touch-controls button{min-height:48px;min-width:50px}.touch-controls .jump{min-height:56px}.victory-content{max-width:700px}.victory-content h2{font-size:42px;margin:4px 0 10px}.victory-flag{display:none}.victory-content h2 br,.victory-message br{display:none}.victory-content p.victory-message{font-size:14px}.results{margin:12px 0 8px;padding:10px 0}.results p{font-size:16px}.victory-content .dialog-actions{margin-top:12px}.victory-content .dialog-return{margin-top:5px}#complete{padding:16px}dialog{padding:20px;max-height:calc(100dvh - 16px)}dialog h2{font-size:26px}.pause-actions{margin-top:14px;gap:7px}.help-controls{margin:12px 0;gap:8px}}
body[data-mode="mechanism"] #notice{visibility:hidden}
@media(max-height:700px) and (orientation:portrait){.title-copy{top:4%}.welcome h1{font-size:38px}.welcome p.title-tagline{font-size:12px;margin-bottom:12px}.welcome .primary{min-height:44px;font-size:15px}.welcome .small{font-size:10px;padding:6px 8px}.title-actions{gap:6px}.title-return{font-size:11px}}
@media(max-height:560px) and (orientation:landscape){body #mechanism{bottom:auto;max-height:calc(100% - 20px)}#mechanism>.mechanism-actions:not(#token-options):not(#pipe-options){grid-column:1/-1;grid-row:5;margin-top:10px}#worked-solution{grid-row:6}}

/* DENAI Level 1: wood-and-gold menu hierarchy consistent with Kenney's kit. */
.welcome .title-copy { width:min(580px,49%); top:11%; }
.welcome h1 {display:inline-block;background:#845035;border:6px solid #4d322b;
  border-radius:7px;box-shadow:0 9px 0 #452b25, inset 0 4px 0 #bb8550;
  padding:12px 24px 10px;color:#fff2ce;text-shadow:3px 4px 0 #4d322b;
  font-family:ui-monospace,Consolas,monospace;font-weight:900;line-height:.98;letter-spacing:-.035em;}
.welcome h1 span{display:block;font-size:.31em;letter-spacing:0;color:#ffe8ac;
 text-shadow:1px 2px 0 #4d322b;line-height:1.5;}
.welcome .title-tagline {display:inline-block;background:#e8b87a;border:3px solid #70452b;
 border-radius:4px;padding:5px 17px;font-family:ui-monospace,Consolas,monospace;font-weight:900;
 color:#4d322b;margin-top:9px;}
.welcome .main-btn {border:4px solid #925629;background:#ffda54;color:#573415;
 font-family:ui-monospace,Consolas,monospace;font-weight:900;box-shadow:0 6px 0 #8b5827;
 border-radius:9px;max-width:315px;}
.welcome .main-btn:hover {background:#ffe77b;}
@media(max-width:700px){.welcome .title-copy{width:65%;top:8%}.welcome h1{padding:7px 11px;border-width:3px;box-shadow:0 4px 0 #452b25}.welcome .title-tagline{font-size:11px;padding:3px 7px;margin-top:4px}.welcome .main-btn{min-height:48px;font-size:17px}}
