/* External controls never share the emulator's image area. */
body[data-game]{--shell:#c82e35;--shell-light:#ef5651;--shell-deep:#701b2a;--button:#8d1826;--button-light:#d94441;--glow:#ffb15f;background:radial-gradient(ellipse at 50% 10%,#421c27 0,#170e19 55%,#0b0b12 100%);}
body[data-game="blue"]{--shell:#2869b5;--shell-light:#71b7ed;--shell-deep:#15386c;--button:#1b4a84;--button-light:#3c86c5;--glow:#8ee1ff;}
body[data-game="green"]{--shell:#36835c;--shell-light:#79c895;--shell-deep:#174d39;--button:#205f43;--button-light:#469b6c;--glow:#b8f3b0;}
body[data-game] main{max-width:1040px;padding-top:22px;}
body[data-game] header{max-width:560px;margin:0 auto 22px;}
body[data-game] .eyebrow,body[data-game] h1,body[data-game] #systemName{text-align:center;}
body[data-game] h1{font-size:clamp(1.6rem,5vw,2.5rem);letter-spacing:-.04em;}
body[data-game] .eyebrow{font-size:.65rem;color:var(--glow);}
body[data-game] #systemName{font-size:.8rem;letter-spacing:.12em;text-transform:uppercase;}
body[data-game] .brand{color:var(--glow);}
#emulatorPanel{margin:26px auto 0;width:100%;max-width:540px;}
.console{padding:12px 16px 24px;background:linear-gradient(135deg,var(--shell-light),var(--shell) 40%,var(--shell-deep));border:1px solid #ffb2a65c;border-radius:38px 38px 70px 38px;box-shadow:inset 0 3px 1px #ffffff50,inset 0 -8px 0 #0005,0 22px 55px #0008;position:relative;isolation:isolate;}
.shoulders{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:0 7px 12px;}
.shoulders>span{font-size:9px;font-weight:800;letter-spacing:.2em;color:#fff9;}
.pad{font:inherit;cursor:pointer;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;touch-action:none;color:#ffe7c8;background:linear-gradient(145deg,var(--button-light),var(--button));border:1px solid #ffffff26;box-shadow:inset 0 2px 2px #ffffff30,0 5px 0 #3b0b19,0 7px 10px #0005;transition:filter .1s,transform .06s;}
.pad:disabled{cursor:wait;filter:saturate(.5);}
.pad.pressed,.pad:active{transform:translateY(3px);box-shadow:inset 0 2px 5px #0006,0 2px 0 #3b0b19;filter:brightness(1.2);}
.pad:focus-visible,.tool:focus-visible{outline:3px solid #ffe4a0;outline-offset:4px;}
.shoulder{width:92px;height:34px;border-radius:16px 16px 9px 9px;font-weight:900;font-style:italic;}
.console-body{display:grid;grid-template-columns:1fr 1fr;grid-template-areas:"screen screen" "shoulders shoulders" "left right" "system system";gap:16px 8px;}
.shoulders{grid-area:shoulders;padding:0 4px;}
.screen-bezel{grid-area:screen;background:linear-gradient(145deg,#39343b,#1b1821);border:2px solid #140e17;border-radius:18px 18px 28px 18px;padding:12px 12px 8px;box-shadow:inset 0 1px 1px #fff4,0 3px 0 #ffb4a530;min-width:0;}
.screen-top{display:flex;justify-content:space-between;align-items:center;font-size:7px;letter-spacing:.12em;color:#bab1ba;margin-bottom:9px;}
.power{display:flex;align-items:center;gap:5px;}.power i{width:5px;height:5px;border-radius:50%;background:#b5ff73;box-shadow:0 0 7px #a5f96b;}
#game{min-height:0!important;height:auto!important;width:100%;aspect-ratio:3/2;border-radius:2px;background:#09080d;overflow:hidden;outline:4px solid #0e0b12;}
body[data-game="blue"] #game,body[data-game="green"] #game{aspect-ratio:10/9;}
#game .ejs_virtualGamepad_parent{display:none!important;pointer-events:none!important;}
#game:not(.menu-open) .ejs_menu_bar,#game:not(.menu-open) .ejs_context_menu{display:none!important;}
#game.menu-open .ejs_menu_bar{opacity:1!important;visibility:visible!important;transform:none!important;max-height:100%;overflow:auto;}
body.emulator-menu-open #emulatorPanel:not(:fullscreen):not(.expanded){position:relative;z-index:2000;}
body.emulator-menu-open .console-stage{overflow:visible;}
#game.menu-open:before{content:"";position:fixed;inset:0;background:#09050edb;z-index:9998;pointer-events:none;}
#game.menu-open .ejs_menu_bar{position:fixed!important;inset:16px!important;margin:auto!important;width:min(560px,calc(100vw - 32px))!important;height:fit-content!important;max-height:calc(100dvh - 32px)!important;display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;padding:14px!important;overflow:auto!important;transform:none!important;border:1px solid #e9787055;border-radius:18px;background:#251923!important;box-shadow:0 18px 80px #000a;pointer-events:auto!important;z-index:9999;box-sizing:border-box;}
#game.menu-open .ejs_menu_bar>.ejs_menu_button,#game.menu-open .ejs_menu_bar>div{min-width:0;max-width:100%;}
#game.menu-open .ejs_menu_bar .ejs_menu_button{width:100%!important;min-height:44px!important;margin:0!important;padding:9px!important;box-sizing:border-box;white-space:normal;}
#game.menu-open .ejs_menu_bar .ejs_menu_text{position:static!important;display:block!important;opacity:1!important;transform:none!important;font-size:12px!important;white-space:normal;overflow-wrap:anywhere;}
#game.menu-open .ejs_menu_bar .ejs_menu_bar_spacer{display:none!important;}
#game.menu-open .ejs_volume_parent{grid-column:1/-1;width:100%!important;}
.menu-close{grid-column:1/-1;position:sticky;top:0;z-index:2;min-height:42px;margin:0 0 6px;border:1px solid #e9787055;border-radius:10px;padding:10px;background:#571e2c;color:#ffe7d3;font:700 13px system-ui;cursor:pointer;text-align:right;}
#game.menu-open .ejs_settings_parent{position:fixed!important;inset:24px!important;width:min(520px,calc(100vw - 48px))!important;max-width:calc(100vw - 48px)!important;height:fit-content!important;max-height:calc(100dvh - 48px)!important;margin:auto!important;overflow:auto!important;transform:none!important;z-index:10001;box-sizing:border-box;white-space:normal!important;}
#game.menu-open .ejs_settings_parent:before,#game.menu-open .ejs_settings_parent:after{display:none!important;}
#game .ejs_popup_container{position:fixed!important;inset:0!important;width:100%!important;height:100dvh!important;overflow:auto!important;z-index:10002;}
@media(max-width:360px){#game.menu-open .ejs_menu_bar{grid-template-columns:1fr;}}
#game .ejs_start_button{position:absolute!important;left:50%!important;top:50%!important;bottom:auto!important;transform:translate(-50%,-50%)!important;z-index:20;max-width:90%;min-height:48px;padding:12px 18px;border-radius:14px;font:700 15px/1.3 system-ui;text-align:center;cursor:pointer;}
#game .ejs_start_button:focus-visible{outline:3px solid white;outline-offset:4px;}
.screen-brand{text-align:center;font-style:italic;font-weight:800;letter-spacing:.03em;color:#d4ccd9;font-size:14px;margin-top:11px;line-height:1.2;}
.screen-brand b{font-size:10px;letter-spacing:.08em;font-weight:600;}
.left-grip{grid-area:left;display:grid;place-items:center;}
.dpad{width:132px;height:132px;display:grid;grid-template-columns:repeat(3,44px);grid-template-rows:repeat(3,44px);filter:drop-shadow(0 2px 1px #0005);}
.dpad .pad{font-size:13px;border:0;box-shadow:inset 0 2px 1px #ffffff24,0 4px 0 #3b0b19;color:#ffc17e;}
.up{grid-area:1/2;border-radius:8px 8px 0 0;}.left{grid-area:2/1;border-radius:8px 0 0 8px;}.right{grid-area:2/3;border-radius:0 8px 8px 0;}.down{grid-area:3/2;border-radius:0 0 8px 8px;}
.dpad-center{grid-area:2/2;background:var(--button);position:relative;z-index:1;}
.dpad-center:after{content:"";position:absolute;inset:12px;border:1px solid #ffffff15;border-radius:50%;box-shadow:inset 1px 2px 4px #0005;}
.right-grip{grid-area:right;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;}
.action-pad{display:flex;gap:18px;align-items:center;padding:14px 0 6px;transform:rotate(-18deg);}
.action{width:58px;height:58px;border-radius:50%;font-size:23px;font-weight:900;transform:rotate(18deg);text-shadow:0 -1px #4b0b19;}
.action.pressed,.action:active{transform:rotate(18deg) translateY(3px);}
.speaker{display:flex;gap:5px;transform:rotate(-22deg);margin:9px 0 0 30px;}
.speaker i{display:block;width:4px;height:28px;border-radius:3px;background:#410e2080;box-shadow:1px 0 #ffb4a54d;}
.system-pad{grid-area:system;display:flex;justify-content:center;gap:20px;margin-top:-5px;position:relative;}
.pill{min-width:65px;min-height:28px;border-radius:18px;font-size:9px;letter-spacing:.08em;font-weight:800;}
.console-tools{display:flex;justify-content:center;gap:10px;margin:22px 0 10px;flex-wrap:wrap;}
.tool{border:1px solid #e0776355;background:#251620;color:#f8d6c2;border-radius:99px;padding:11px 17px;font:600 12px/1.3 inherit;cursor:pointer;min-height:42px;}
.tool[aria-pressed="true"]{background:#70302a;border-color:#e99061;color:#ffe7bb;}
.tool:disabled{opacity:.5;cursor:wait;}
.play-hint{font-size:.76rem;text-align:center;max-width:380px;margin:12px auto;color:#bb9ba5;}
body[data-game] #status{text-align:center;font-size:.8rem;margin:16px 0;}
.recovery-actions{display:flex;justify-content:center;gap:8px;flex-wrap:wrap;margin:12px 0;}
.support-info{max-width:540px;margin:14px auto;color:var(--muted);font-size:12px;}
.support-info summary{cursor:pointer;text-align:center;}
.support-info p{margin:8px 0;padding:10px;background:#241824;border-radius:10px;overflow-wrap:anywhere;}
.resume-prompt{position:fixed;inset:0;margin:auto;width:min(340px,calc(100vw - 36px));max-height:calc(100dvh - 36px);overflow:auto;border:1px solid #ef777080;border-radius:22px;padding:24px;background:#321624;color:#ffe7d3;text-align:center;box-shadow:0 20px 90px #000a;z-index:30000;}
.resume-prompt::backdrop{background:#08040bce;}
.resume-prompt h2{font:800 23px/1.2 system-ui;margin:0 0 12px;}
.resume-prompt p{font:14px/1.5 system-ui;color:#e8bfc7;margin:0 0 20px;}
.resume-prompt .tool{width:100%;min-height:52px;background:#d6373d;border-color:#fa9584;font:800 16px/1.3 system-ui;color:white;}
.resume-prompt .tool:focus-visible{outline:3px solid #ffd088;outline-offset:4px;}
body[data-game] main>.panel,body[data-game] footer{max-width:540px;margin-left:auto;margin-right:auto;}
body[data-game] main>.panel{background:#241824;border-color:#63333f;}
@media(max-width:420px){body[data-game] main{padding:14px 10px 28px;}body[data-game] header{margin-bottom:18px;}.console{padding:10px 12px 22px;border-radius:28px 28px 55px 28px;}.screen-bezel{padding:10px 9px 8px;}.console-body{gap:20px 6px;}.shoulders{padding:0 4px 12px;}.shoulder{width:76px;height:32px;}.dpad{width:126px;height:126px;grid-template-columns:repeat(3,42px);grid-template-rows:repeat(3,42px);}.action{width:53px;height:53px;}.action-pad{gap:12px;}.screen-brand{font-size:12px;}}
@media(orientation:landscape) and (min-width:640px) and (max-height:600px){
 body[data-game] main{max-width:1040px;padding:8px 12px;}body[data-game] header{margin-bottom:8px;max-width:none;}body[data-game] .eyebrow,body[data-game] h1,body[data-game] #systemName{display:none;}
 #emulatorPanel{max-width:1000px;margin-top:12px;}.console{border-radius:55px 55px 80px 80px;padding:8px 22px 15px;width:100%;}
 .shoulders{padding-bottom:6px;}.shoulder{width:100px;height:28px;}
 .console-body{grid-template-columns:140px minmax(0,1fr) 140px;grid-template-areas:"shoulders shoulders shoulders" "left screen right" "system screen right";gap:4px 14px;align-items:center;}
 .screen-bezel{max-width:470px;width:100%;justify-self:center;padding:7px 9px;}.screen-top{margin-bottom:5px;}.screen-brand{margin-top:6px;font-size:11px;}.screen-brand b{font-size:8px;}.system-pad{gap:10px;margin:0;}.pill{min-width:58px;min-height:26px;}.speaker{margin-top:16px;}
 .console-tools{margin:12px 0 0;}.play-hint{display:none;}
}
@media(prefers-reduced-motion:reduce){.pad{transition:none;}}

/* Phone skin: display above, a dedicated control deck below, edge to edge. */
.console-stage{width:100%;height:auto;min-height:0;border-radius:22px;overflow:hidden;background:var(--shell);}
body.console-expanded{overflow:hidden;overscroll-behavior:none;}
#emulatorPanel:is(:fullscreen,.expanded){position:fixed;inset:0;z-index:1000;width:100%;max-width:none;height:100dvh;margin:0;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);overflow:hidden;background:var(--shell);box-sizing:border-box;}
#emulatorPanel .console-stage{display:grid;grid-template-rows:minmax(0,1fr) auto;gap:0;}
#emulatorPanel:is(:fullscreen,.expanded) .console-stage{height:100%;min-height:0;border-radius:0;}
#emulatorPanel .console{width:100%;height:auto;min-width:0;min-height:0;padding:0 12px 8px;border:0;border-radius:0;background:linear-gradient(150deg,var(--shell-light),var(--shell) 40%,var(--shell-deep));box-shadow:none;}
#emulatorPanel .console-body{--controls-min:152; width:100%;min-width:0;height:auto;grid-template-columns:minmax(0,1fr) minmax(0,1fr);grid-template-areas:"screen screen" "shoulders shoulders" "left right" "system system";grid-template-rows:auto 36px clamp(152px,25dvh,230px) 44px;gap:10px 8px;align-items:stretch;}
#emulatorPanel .screen-bezel{width:calc(100% + 24px);max-width:none;height:auto;min-height:0;margin-left:0;justify-self:center;align-self:center;padding:8px 10px 6px;border:0;border-bottom:2px solid #120c17;border-radius:0;background:#15121b;display:flex;flex-direction:column;gap:6px;}
#emulatorPanel .screen-top{flex:none;margin:0;padding:0 2px;font-size:7px;}
#emulatorPanel #game{flex:none;min-height:0!important;height:auto!important;width:100%;aspect-ratio:3/2;outline:0;}
#emulatorPanel .screen-brand{flex:none;margin:0;font-size:12px;line-height:16px;}
#emulatorPanel .screen-brand b{font-size:9px;}
#emulatorPanel .shoulders{padding:0;gap:0;align-self:stretch;}
#emulatorPanel .shoulders>span{font-size:8px;letter-spacing:.18em;}
#emulatorPanel .shoulders .creator-credit{font-size:9px;letter-spacing:0;text-align:center;line-height:1.2;color:#ffe0ca;}
#emulatorPanel .shoulder{width:37%;height:100%;min-height:32px;border-radius:6px;font-size:16px;}
#emulatorPanel .left-grip{align-self:stretch;}
#emulatorPanel .right-grip{justify-content:center;gap:12px;}
#emulatorPanel .dpad{width:144px;height:144px;grid-template-columns:repeat(3,48px);grid-template-rows:repeat(3,48px);}
#emulatorPanel .action{width:62px;height:62px;font-size:26px;}
#emulatorPanel .action-pad{gap:16px;padding:0;}
#emulatorPanel .speaker{margin:6px 0 0 38px;}
#emulatorPanel .speaker i{height:26px;}
#emulatorPanel .system-pad{margin:0;gap:22px;align-items:center;}
#emulatorPanel .pill{min-width:65px;min-height:34px;}
#emulatorPanel .console-tools{margin:0;padding:6px 8px 8px;gap:8px;background:var(--shell-deep);flex-wrap:nowrap;}
#emulatorPanel .tool{min-height:38px;padding:8px 12px;font-size:11px;white-space:nowrap;background:#300d1d55;border-color:#ffffff26;}
#emulatorPanel .play-hint{display:none;}
#emulatorPanel:is(:fullscreen,.expanded) .console{height:100%;}
#emulatorPanel:is(:fullscreen,.expanded) .console-body{height:100%;grid-template-rows:auto 36px minmax(152px,1fr) 44px;}
@media(max-width:360px){
 #emulatorPanel .dpad{width:132px;height:132px;grid-template-columns:repeat(3,44px);grid-template-rows:repeat(3,44px);}
 #emulatorPanel .action{width:54px;height:54px;}
 #emulatorPanel .action-pad{gap:12px;}
}
@media(orientation:landscape) and (max-height:600px){
 #emulatorPanel .console{padding:0 14px 4px;}
 #emulatorPanel .console-body{--controls-min:104;grid-template-rows:auto 28px 104px 32px;gap:5px 8px;}
 #emulatorPanel:is(:fullscreen,.expanded) .console-body{grid-template-rows:auto 28px minmax(104px,1fr) 32px;}
 #emulatorPanel .screen-bezel{width:calc(100% + 28px);margin-left:0;padding:4px 10px;gap:2px;}
 #emulatorPanel .screen-top{display:none;}
 #emulatorPanel .screen-brand{font-size:9px;line-height:12px;}
 #emulatorPanel .shoulder{width:40%;min-height:28px;}
 #emulatorPanel .left-grip{justify-items:end;padding-right:32px;}
 #emulatorPanel .right-grip{align-items:flex-start;padding-left:32px;}
 #emulatorPanel .dpad{width:102px;height:102px;grid-template-columns:repeat(3,34px);grid-template-rows:repeat(3,34px);}
 #emulatorPanel .action{width:48px;height:48px;font-size:20px;}
 #emulatorPanel .speaker{display:none;}
 #emulatorPanel .pill{min-height:28px;}
 #emulatorPanel .console-tools{padding:3px 8px;}
 #emulatorPanel .tool{min-height:32px;padding:5px 12px;}
}


