/* Fullscreen keeps input in the same top-layer element as the canvas. */
html[data-controls=touch] .arcade-player.expanded .cabinet .screen {
 inset:0;width:100%;height:100%;max-height:none;margin:0;
}
html[data-controls=touch] .arcade-player.expanded .touch {
 position:absolute;inset:0;z-index:10;pointer-events:none;
}
html[data-controls=touch] .arcade-player.expanded .touch::before {display:none}
html[data-controls=touch] .arcade-player.expanded .touch .dpad,
html[data-controls=touch] .arcade-player.expanded .touch .actions,
html[data-controls=touch] .arcade-player.expanded .touch .system-buttons {pointer-events:auto}
html[data-controls=touch] .arcade-player.expanded .bar {z-index:12}
html[data-controls=touch] .arcade-player.expanded .dpad,
html[data-controls=touch] .arcade-player.expanded .actions {opacity:.62;transition:opacity .12s}
html[data-controls=touch] .arcade-player.expanded .dpad:active,
html[data-controls=touch] .arcade-player.expanded .actions:active {opacity:.95}
html[data-controls=touch] .arcade-player.expanded .rotate-tip {display:none}
/* Three-action games use one reachable row; fighters keep punch above kick. */
html[data-controls=touch] .arcade-player .arcade-controller .actions[data-count="3"] {grid-template-columns:repeat(3,48px);gap:10px}
html[data-controls=touch] .arcade-player .actions[data-count="3"] button {width:48px;height:48px}
html[data-controls=touch] .arcade-player .actions[data-count="6"] .action-key {font-size:13px}
html[data-controls=touch] .arcade-player .actions[data-count="6"] .action-caption {font-size:8px}
@media(orientation:landscape) {
 /* Browser safe-area values handle either direction of rotation on iPhone. */
 html[data-controls=touch] .arcade-player.expanded .dpad {
  left:calc(max(20px,env(safe-area-inset-left)) + 12px);
  bottom:calc(max(20px,env(safe-area-inset-bottom)) + 12px);
  width:124px;height:124px;
 }
 html[data-controls=touch] .arcade-player.expanded .actions,
 html[data-controls=touch] .arcade-player.expanded .arcade-controller .actions[data-count] {
  right:calc(max(20px,env(safe-area-inset-right)) + 12px);
  bottom:calc(max(20px,env(safe-area-inset-bottom)) + 12px);
 }
 html[data-controls=touch] .arcade-player.expanded .arcade-controller .actions[data-count="6"],
 html[data-controls=touch] .arcade-player.expanded .arcade-controller .actions[data-count="3"] {grid-template-columns:repeat(3,52px);gap:12px}
 html[data-controls=touch] .arcade-player.expanded .actions[data-count="6"] button,
 html[data-controls=touch] .arcade-player.expanded .actions[data-count="3"] button {width:52px;height:52px}
 html[data-controls=touch] .arcade-player.expanded .system-buttons {left:calc(max(16px,env(safe-area-inset-left)) + 8px)}
 html[data-controls=touch] .arcade-player.expanded .bar {right:calc(max(16px,env(safe-area-inset-right)) + 8px)}
}
@media(orientation:landscape) and (min-width:900px) and (min-height:410px) {
 html[data-controls=touch] .arcade-player.expanded .arcade-controller .actions[data-count="6"],
 html[data-controls=touch] .arcade-player.expanded .arcade-controller .actions[data-count="3"] {grid-template-columns:repeat(3,56px)}
 html[data-controls=touch] .arcade-player.expanded .actions[data-count="6"] button,
 html[data-controls=touch] .arcade-player.expanded .actions[data-count="3"] button {width:56px;height:56px}
}
/* PC: spend the viewport on the game and retain a compact keyboard legend. */
.keyboard-strip {display:none}
html[data-controls=desktop] .arcade-player #player {max-width:none;padding:8px}
html[data-controls=desktop] .arcade-player .cabinet {
 height:calc(100dvh - 16px);min-height:320px;padding:0 8px;
 display:grid;grid-template-rows:44px minmax(0,1fr) 44px;
}
html[data-controls=desktop] .arcade-player .marquee,
html[data-controls=desktop] .arcade-player .cabinet::before,
html[data-controls=desktop] .arcade-player .cabinet::after {display:none}
html[data-controls=desktop] .arcade-player .bar {grid-row:1;min-height:44px}
html[data-controls=desktop] .arcade-player .cabinet .screen {
 grid-row:2;position:relative;inset:auto;width:100%;height:100%;
 max-height:none;min-height:0;aspect-ratio:auto;margin:0;align-self:stretch;
 border-width:3px;border-radius:8px;
}
html[data-controls=desktop] .arcade-player .touch {display:none}
html[data-controls=desktop] .arcade-player .keyboard-strip {
 display:flex;align-items:center;justify-content:center;gap:16px;grid-row:3;
 margin:0;font:11px/1.3 monospace;color:#d6dfc5;flex-wrap:wrap;
}
html[data-controls=desktop] .arcade-player .keyboard-strip span {white-space:nowrap}
html[data-controls=desktop] .arcade-player.expanded .cabinet {
 height:100dvh;min-height:0;grid-template-rows:44px minmax(0,1fr) 36px;
}
@media(max-width:700px) {
 html[data-controls=desktop] .arcade-player .keyboard-strip {gap:6px;font-size:9px}
 html[data-controls=desktop] .arcade-player .keyboard-strip kbd {font-size:9px;padding:2px}
}
/* Printed legends sit below physical rubber caps, outside the moving surface. */
html[data-controls] .arcade-player .cabinet .system-buttons {gap:10px}
html[data-controls] .arcade-player .cabinet .system-buttons button {
 position:relative;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;
 width:60px;min-width:60px;min-height:52px;height:52px;padding:29px 0 2px;
 border:0;border-radius:0;background:none;box-shadow:none;gap:0;
 color:#e6e2d4;text-shadow:0 1px 3px #000;font:700 9px/1.3 monospace;
}
html[data-controls] .arcade-player .cabinet .system-buttons button::before {
 content:'';position:absolute;top:3px;left:0;width:60px;height:24px;
 background:url('assets/retro-rubber-cap.webp') center/contain no-repeat;
 transform:rotate(-12deg);pointer-events:none;transition:transform .08s,filter .08s;
}
html[data-controls] .arcade-player .cabinet .system-buttons button span {display:block;font:700 9px/1.3 monospace;letter-spacing:.1em}
html[data-controls] .arcade-player .cabinet .system-buttons button i {display:none}
html[data-controls] .arcade-player .cabinet .system-buttons button.pressed {transform:none;filter:none;box-shadow:none}
html[data-controls] .arcade-player .cabinet .system-buttons button.pressed::before {transform:rotate(-12deg) translateY(2px);filter:brightness(.72)}
html[data-controls] .arcade-player .cabinet #fullscreen {
 position:relative;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;
 width:84px;min-height:52px;height:52px;padding:0 0 2px;
 border:0;border-radius:0;background:none;box-shadow:none;color:#e6e2d4;
 font-size:0;text-shadow:0 1px 3px #000;
}
html[data-controls] .arcade-player .cabinet #fullscreen::before {
 content:'';display:block;position:absolute;left:12px;top:3px;margin:0;width:60px;height:24px;
 background:url('assets/retro-rubber-cap.webp') center/contain no-repeat;
}
html[data-controls] .arcade-player .cabinet #fullscreen::after {content:attr(data-label);font:700 8px/1.3 monospace;letter-spacing:.05em;pointer-events:none}
html[data-controls] .arcade-player .cabinet #fullscreen:active::before {transform:translateY(2px);filter:brightness(.72)}
html[data-controls=desktop] .arcade-player .cabinet {grid-template-rows:58px minmax(0,1fr) 44px}
html[data-controls=desktop] .arcade-player.expanded .cabinet {grid-template-rows:58px minmax(0,1fr) 36px}
html[data-controls=desktop],html[data-controls=desktop] body {height:100%;overflow:hidden}
html[data-controls=desktop] .arcade-player #player {height:100dvh;overflow:hidden}
html[data-controls=desktop] .arcade-player #player>.guide,
html[data-controls=desktop] .arcade-player #player>.reset-note,
html[data-controls=desktop] .arcade-player #player>details {display:none}
