.touch-ui{display:none}
@media (any-pointer:coarse){
 #arcade{--gold:#e5bd79;--pad:clamp(108px,32vw,146px);--key:clamp(44px,13vw,60px);display:grid;grid-template-columns:1fr 1fr;grid-template-areas:"head head" "screen screen" "system system" "pad keys";align-items:center;justify-items:center;gap:10px 6px;max-width:850px;padding:8px max(6px,env(safe-area-inset-right)) 10px max(6px,env(safe-area-inset-left));box-sizing:border-box}
 #arcade header{width:100%;grid-area:head;gap:8px;align-items:center}
 #arcade header h1{font-size:20px}#arcade header span{font-size:13px}
 #arcade section{grid-area:screen;margin:0;width:min(100%,640px)}
 #arcade footer{display:none}
 .touch-ui{display:flex}
 .system-keys{grid-area:system;gap:12px;justify-content:center}
 .touch-ui button,button.expand{touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent}
 .system-keys button,.expand{border:1px solid #74644e;background:#28241e;color:#f6dec0;border-radius:7px;font:600 14px/1.15 system-ui;padding:0 16px;min-height:44px}
 button.expand{margin-left:auto;padding:0 10px;align-items:center;justify-content:center}
 .pad,.action-keys{touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
 .pad{position:relative;grid-area:pad;width:var(--pad);aspect-ratio:1;border-radius:50%;border:2px solid #716147;background:radial-gradient(circle,#514737 0 16%,#302b24 17% 53%,#3e372c 54% 57%,#29251f 58%);color:#ddc59d}
 .pad span{pointer-events:none;position:absolute;width:28%;height:28%;display:grid;place-items:center;font:700 20px/1 system-ui;border-radius:50%}
 .pad [data-dir="4"]{top:3%;left:36%}.pad [data-dir="5"]{bottom:3%;left:36%}
 .pad [data-dir="6"]{left:3%;top:36%}.pad [data-dir="7"]{right:3%;top:36%}
 .action-keys{grid-area:keys;display:grid;grid-template-columns:repeat(2,var(--key));gap:7px}
 .action-keys button{width:var(--key);height:var(--key);border-radius:50%;border:2px solid #8d7856;background:#40372d;color:#fff2d8;font:700 20px/1 system-ui;padding:0;box-shadow:inset 0 -3px #29231e}
 .action-keys button:first-child{border-color:#d39c55;background:#68492b}
 .touch-ui .pressed{color:#231c12;background:#edc587;box-shadow:none}
 .touch-ui[aria-disabled="true"]{opacity:.5}
 #arcade .ejs_virtualGamepad_parent{display:none!important}
}
@media (any-pointer:coarse) and (min-aspect-ratio:13/10) and (min-width:510px){
 #arcade{--pad:clamp(98px,17vw,140px);--key:clamp(44px,7.4vw,58px);grid-template-columns:var(--pad) minmax(0,1fr) max-content;grid-template-areas:"head head head" "pad screen keys" ". system .";gap:4px 8px}
 #arcade section{width:min(100%,calc((100dvh - 121px)*1.33333))}
}
html:fullscreen{background:#151513;display:grid;align-content:center}
html:fullscreen #arcade{width:100vw;max-width:none}

