/* Controls float above the scene; they never reserve a row or side rail. */
.touch-dock[hidden]{display:none!important}
.touch-dock{position:absolute;inset:0;z-index:3;pointer-events:none;user-select:none;-webkit-user-select:none;--touch-edge:12px}
.touch-movement,.touch-actions{position:absolute;bottom:var(--touch-edge);display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;width:140px;min-width:0;align-items:center;justify-items:center;pointer-events:none}
.touch-movement{left:var(--touch-edge)}
.touch-actions{right:var(--touch-edge);grid-template-columns:repeat(2,64px);grid-template-rows:repeat(2,64px);gap:12px}
body.arcade-open #arcade-play .touch-button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;min-width:44px;min-height:44px;width:56px;height:56px;margin:0;padding:3px;border:1.5px solid #eaf3ffc2;border-radius:50%;background:rgb(16 25 41 / 32%);color:#fff;box-shadow:0 1px 6px #0004,inset 0 0 0 3px #ffffff0a;text-shadow:0 1px 3px #000;font-family:inherit;font-size:10px;font-weight:700;line-height:1.1;letter-spacing:0;opacity:.72;cursor:pointer;pointer-events:auto;touch-action:none;-webkit-tap-highlight-color:transparent;transition:background .1s,box-shadow .1s,opacity .1s}
body.arcade-open #arcade-play .touch-button span{font:700 10px/1.1 Arial,Helvetica,sans-serif;letter-spacing:0;pointer-events:none}
.touch-button svg{width:24px;height:24px;flex-shrink:0;pointer-events:none}
body.arcade-open #arcade-play .touch-button:focus-visible{outline:3px solid #ffc83d;outline-offset:2px;opacity:1}
body.arcade-open #arcade-play .touch-button.is-held{background:rgb(55 157 203 / 55%);border-color:#fff;box-shadow:0 0 16px #8fe7ff8c,inset 0 0 0 3px #ffffff40;opacity:1;transform:none}
.touch-actions>.touch-button:nth-child(1){grid-column:2;grid-row:2}
.touch-actions>.touch-button:nth-child(2){grid-column:2;grid-row:1}
.touch-actions>.touch-button:nth-child(3){grid-column:1;grid-row:2}
.touch-actions>.touch-button:nth-child(4){grid-column:1;grid-row:1}
body.arcade-open #arcade-play .touch-actions>.touch-button:first-child{width:64px;height:64px;background:rgb(36 93 123 / 35%);border-width:2px}
body.arcade-open #arcade-play .touch-actions>.touch-button:first-child.is-held{background:rgb(55 157 203 / 65%)}
.touch-actions[data-count="0"]{display:none}
/* Board games keep their stack/flippers and live information above the thumbs. */
.touch-dock[data-game="block-battle"] .touch-actions{grid-template-rows:44px 64px;row-gap:4px}
body.arcade-open #arcade-play .touch-dock[data-game="block-battle"] .touch-actions>.touch-button:nth-child(even){width:44px;height:44px}
body.arcade-open #arcade-play .touch-dock[data-game="block-battle"] .touch-actions>.touch-button:nth-child(-n+2) span{display:none}
.touch-dock[data-game="pinball-clash"] .touch-actions{grid-template-rows:64px}
.touch-dock[data-game="pinball-clash"] .touch-actions>.touch-button:nth-child(1){grid-row:1;grid-column:2}
.touch-dock[data-game="pinball-clash"] .touch-actions>.touch-button:nth-child(2){grid-row:1;grid-column:1}
.touch-dpad{grid-template-columns:repeat(3,44px);grid-template-rows:repeat(3,44px);gap:4px}
.touch-dpad [data-direction=up]{grid-column:2;grid-row:1}
.touch-dpad [data-direction=left]{grid-column:1;grid-row:2}
.touch-dpad [data-direction=down]{grid-column:2;grid-row:3}
.touch-dpad [data-direction=right]{grid-column:3;grid-row:2}
body.arcade-open #arcade-play .touch-dpad .touch-button{width:44px;height:44px;border-radius:13px}
body.arcade-open #arcade-play .touch-dpad .touch-button span{font-size:25px}
body.arcade-open #arcade-play .touch-axis .touch-button{width:64px;height:64px}
body.arcade-open #arcade-play .touch-axis .touch-button:not(:has(svg)) span{font-size:24px}
.touch-axis:has(>button:nth-child(3)){grid-template-columns:repeat(3,44px);gap:4px}
body.arcade-open #arcade-play .touch-axis:has(>button:nth-child(3)) .touch-button{width:44px;height:56px;border-radius:16px}
.touch-upgrades{position:absolute;right:0;bottom:calc(100% + 8px);display:grid;grid-template-columns:repeat(3,44px);gap:4px;pointer-events:none}
body.arcade-open #arcade-play .touch-upgrades .touch-button{width:44px;height:44px;border-radius:14px;padding:2px}
body.arcade-open #arcade-play .touch-upgrades .touch-button span{font-size:9px}
.touch-stick{grid-column:1/-1;position:relative;width:140px;height:140px;touch-action:none;pointer-events:auto}
.touch-stick-ring{position:absolute;left:var(--stick-x,50%);top:var(--stick-y,50%);width:96px;height:96px;transform:translate(-50%,-50%);border:2px solid #eaf3ff9c;border-radius:50%;background:rgb(16 25 41 / 20%);box-shadow:inset 0 0 0 6px #ffffff0c,0 1px 6px #0003;pointer-events:none;opacity:.72}
.touch-stick-ring i{position:absolute;left:27px;top:27px;width:38px;height:38px;border:2px solid #edf8ffb3;border-radius:50%;background:rgb(171 219 242 / 28%);transform:translate(var(--thumb-x,0),var(--thumb-y,0));box-shadow:0 1px 5px #0003}
.touch-stick-label{position:absolute;bottom:0;left:0;right:0;text-align:center;font:700 9px/1 Arial,Helvetica,sans-serif;letter-spacing:.12em;color:#eaf3ff99;text-shadow:0 1px 3px #000;pointer-events:none}
.touch-stick.is-held .touch-stick-ring{border-color:#fff;opacity:1;box-shadow:0 0 16px #8fe7ff70,inset 0 0 0 6px #ffffff14}
.touch-stick.is-held .touch-stick-ring i{background:rgb(104 205 241 / 65%);border-color:#fff}
.touch-dock.is-inactive{visibility:hidden}
body.touch-games #arcade-detail .detail-common-controls{display:none}
body.touch-games.arcade-open .arcade-stage{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto}
body.touch-games.arcade-open #arcade-canvas{touch-action:none}
@media(max-width:360px){.touch-dock{--touch-edge:6px}}
@media(orientation:landscape) and (max-height:400px){.touch-dock{--touch-edge:8px}}
@media(prefers-reduced-motion:reduce){body.arcade-open #arcade-play .touch-button{transition:none}}

/* Touch devices and compact windows use a leaderboard drawer. */
body.touch-games.arcade-open .arcade-play-layout{grid-template-columns:minmax(0,1fr)}
body.touch-games.arcade-open .arcade-scoreboard{display:none;position:absolute;inset:8px 8px 8px auto;z-index:11;width:min(330px,calc(100% - 16px));overflow:auto}
body.touch-games.arcade-open .show-standings .arcade-scoreboard{display:block}
body.touch-games.arcade-open #arcade-close-standings{display:block;float:right;width:44px;margin:8px;font-size:22px;padding:0}
body.touch-games.arcade-open .arcade-scoreboard .lb-panel{clear:both}
body.touch-games.arcade-open #arcade-play{padding: max(4px,env(safe-area-inset-top)) max(4px,env(safe-area-inset-right)) max(4px,env(safe-area-inset-bottom)) max(4px,env(safe-area-inset-left));height:100dvh;overflow:hidden}
body.touch-games.arcade-open .arcade-window{height:100%;min-height:0;gap:5px}
body.touch-games.arcade-open .arcade-window-bar{position:static;min-height:50px;padding:2px 8px;gap:8px;box-shadow:none}
body.touch-games.arcade-open .arcade-window-brand{display:none}
body.touch-games.arcade-open .arcade-play-layout{flex:1;min-height:0;gap:0}
body.touch-games.arcade-open .arcade-cabinet{min-height:0;padding:2px;border-radius:14px}
body.touch-games.arcade-open .arcade-stage{height:100%;min-height:0}
body.touch-games.arcade-open .arcade-viewport{min-height:0;aspect-ratio:auto}
body.touch-games.arcade-open .arcade-play-footer{display:none}
body.touch-games.arcade-open .arcade-hud{padding:3px 5px;gap:5px}
body.touch-games.arcade-open .arcade-run-score>span{padding:3px;font-size:9px}
body.touch-games.arcade-open .arcade-run-score b{font-size:14px}
@media(max-width:360px) and (orientation:portrait){
 body.touch-games.arcade-open .arcade-play-heading .eyebrow{display:none}
 body.touch-games.arcade-open .arcade-window-bar{padding:2px 4px;gap:4px}
}
@media(max-width:850px){
 body.arcade-open:not(.touch-games) .arcade-play-layout{grid-template-columns:minmax(0,1fr)}
 body.arcade-open:not(.touch-games) .arcade-scoreboard{display:none;position:absolute;inset:8px 8px 8px auto;z-index:11;width:min(330px,calc(100% - 16px));overflow:auto}
 body.arcade-open:not(.touch-games) .show-standings .arcade-scoreboard{display:block}
 body.arcade-open:not(.touch-games) #arcade-close-standings{display:block;width:44px;float:right}
}
@media(any-pointer:coarse){
 body .header .btn,body .nav-tab,body .collection-filter,body .shelf-more,body .text-button{min-height:44px}
 body input,body select,body textarea{font-size:16px}
 body .account-menu{max-width:calc(100vw - 24px)}
}

body #arcade-detail #arcade-touch-tip{font-size:12px;line-height:1.4;color:var(--muted);margin:0}

.touch-axis:has(>button:nth-child(3)){grid-template-columns:repeat(3,minmax(0,1fr))}
