/* Native chooser: independent from game engines and their dialog styles. */
.sr-al-dialog{box-sizing:border-box;width:min(760px,calc(100vw - 24px));max-width:none;max-height:calc(100vh - 24px);max-height:calc(100dvh - 24px);margin:auto;padding:0;border:1px solid #a0e9ff88;border-radius:18px;background:#07162b;color:#f3fbff;box-shadow:0 24px 100px #000a;overflow:hidden}
.sr-al-dialog[open]{display:flex;flex-direction:column}
.sr-al-dialog::backdrop{background:#020817}
.sr-al-dialog *{box-sizing:border-box}
.sr-al-header{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;flex-shrink:0;padding:20px 22px 17px;border-bottom:1px solid #8cdafa30;background:linear-gradient(125deg,#123661,#07162b)}
.sr-al-kicker{margin:0 0 6px;color:#a5e7ff;font:800 10px/1.4 system-ui,sans-serif;letter-spacing:.16em}
.sr-al-header h2{margin:0;color:#fff;font:900 clamp(24px,6vw,34px)/1.05 system-ui,sans-serif;letter-spacing:-.04em}
.sr-al-header h2:focus{outline:none}
.sr-al-header #sr-al-intro{margin:7px 0 0;color:#c0d5e5;font:400 13px/1.45 system-ui,sans-serif}
.sr-al-close{flex:0 0 44px;width:44px;height:44px;padding:0;border:1px solid #8edcfa60;border-radius:10px;background:#07162b;color:#fff;font:400 30px/1 system-ui,sans-serif;cursor:pointer}
.sr-al-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;min-height:0;padding:16px;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
.sr-al-game{display:grid;grid-template-columns:76px minmax(0,1fr);align-content:start;align-items:center;gap:12px;margin:0;padding:14px;border:1px solid #8ddcff2e;border-radius:12px;background:linear-gradient(150deg,#14314a,#0c1c32);min-width:0}
.sr-al-art{position:relative;display:grid;place-items:center;width:76px;height:96px;min-width:0;border-radius:10px;background:radial-gradient(ellipse,#8ee5ff16,transparent 72%);overflow:hidden}
.sr-al-art img{position:absolute;inset:0;display:block;width:100%;height:100%;padding:3px;object-fit:contain;object-position:center;pointer-events:none}
.sr-al-art img[hidden]{display:none}
.sr-al-art:has(img:not([hidden]))>span{visibility:hidden}
.sr-al-art>span{color:#b5f1ff;font:800 45px/1 system-ui,sans-serif}
.sr-al-copy{min-width:0}
.sr-al-meta{margin:0 0 6px;color:#9be2f8;font:750 9px/1.5 system-ui,sans-serif;letter-spacing:.06em}
.sr-al-copy h3{margin:0;color:#fff;font:850 19px/1.14 system-ui,sans-serif;letter-spacing:-.025em}
.sr-al-description{margin:7px 0 0;color:#e2edf4;font:400 12px/1.45 system-ui,sans-serif}
.sr-al-controls{margin:8px 0 0;color:#a8c4d8;font:550 11px/1.4 system-ui,sans-serif}
.sr-al-play{grid-column:1/-1;display:flex;justify-content:space-between;align-items:center;gap:10px;width:100%;min-height:46px;margin:0;padding:11px 13px;border:1px solid #d6f9ff;border-radius:8px;background:#c8f3ff;color:#061526;font:850 12px/1.35 system-ui,sans-serif;cursor:pointer;touch-action:manipulation}
.sr-al-play:hover{background:#fff}
.sr-al-play:disabled{opacity:.6;cursor:wait}
.sr-al-dialog button:focus-visible{outline:3px solid #fff;outline-offset:3px}
.sr-al-footer{flex-shrink:0;padding:11px 18px;border-top:1px solid #8cdafa30;background:#07162b}
.sr-al-footer p{margin:0;color:#a8c4d8;text-align:center;font:500 11px/1.5 system-ui,sans-serif}
.sr-al-footer #sr-al-status:not(:empty){margin-top:6px;color:#fff}
body.sr-arcade-choosing{overflow:hidden}
@media(max-width:560px){.sr-al-dialog{width:calc(100vw - 20px);max-height:calc(100vh - 20px);max-height:calc(100dvh - 20px);border-radius:14px}.sr-al-header{padding:16px}.sr-al-list{grid-template-columns:minmax(0,1fr);padding:10px;gap:10px;scrollbar-gutter:auto}.sr-al-game{grid-template-columns:72px minmax(0,1fr);gap:10px;padding:12px}.sr-al-art{width:72px;height:86px}.sr-al-play{grid-column:2;min-height:44px;font-size:12px}.sr-al-copy h3{font-size:18px}.sr-al-description{font-size:12px}.sr-al-meta{font-size:9px}.sr-al-footer{padding:9px 12px}}
@media(max-width:340px){.sr-al-game{grid-template-columns:56px minmax(0,1fr)}.sr-al-art{width:56px;height:80px}.sr-al-play{grid-column:1/-1}}
@media(prefers-reduced-motion:reduce){.sr-al-dialog *{scroll-behavior:auto!important}}

/* ======================================================================================================================
   31 Oct 2026 polish: page lock + chess banner + game-dialog controls + phone layouts.
   Loads after style.css, vault-refinements.css and mobile-world.css; every rule is scoped to the game dialogs.
   Backdrops above are opaque on purpose: a blur over the animated page repainted that page every frame.
   ====================================================================================================================== */

/* While any game dialog is open (html.sr-dialog-open is set by arcade-launcher.js) the page behind it does not scroll, bounce or pull to refresh. */
html.sr-dialog-open{overflow:hidden;overscroll-behavior:none;scrollbar-gutter:stable}

/* Every game dialog: its own scroller contains the swipe, a double tap never zooms (touch-action is the intersection up the scroll chain, so it
   goes on the dialog AND, at zero specificity, on everything inside it), no grey tap flash, and it keeps off the notch in landscape. */
dialog.game-dialog,dialog.sr-fm-dialog,dialog.sc-dialog,dialog.sr-al-dialog{overscroll-behavior:contain;touch-action:manipulation;-webkit-tap-highlight-color:transparent;max-width:calc(100vw - 8px - env(safe-area-inset-left,0px) - env(safe-area-inset-right,0px))}
:where(dialog.game-dialog,dialog.sr-fm-dialog,dialog.sc-dialog,dialog.sr-al-dialog) *{touch-action:manipulation}

/* Game surfaces: nothing to select, no long-press callout. (Snowcross and Frost Run swipe, so they already hold touch-action:none; the chess board and the
   Frost Run canvas only take taps inside a dialog that must still scroll on a phone, so they keep pan.) */
dialog #chess-board,dialog #cave-game,dialog .touch-controls,dialog .sc-stage-wrap,dialog .sc-controls,dialog .sr-fm-board{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}

/* Game controls are 48px; selects are 16px so iOS never zooms the page on focus. */
#chess-dialog .small-button,#cave-dialog .small-button{min-height:48px;min-width:48px;padding:10px 16px;font-size:13px}
#chess-dialog .chess-sidebar select{min-height:48px;font-size:16px}

/* ---------- chess: the banner above the board (whose move, thinking, game over + New game) ---------- */
.chess-stage{display:flex;flex-direction:column;gap:8px;min-width:0;align-self:start}
.chess-banner{display:flex;align-items:center;gap:10px;min-height:48px;padding:6px 8px 6px 14px;border:1px solid #4a778d;border-radius:10px;background:#0d2535;color:#e8faff;font:800 14px/1.25 system-ui,-apple-system,"Segoe UI",sans-serif}
.chess-banner::before{content:"";flex:none;width:10px;height:10px;border-radius:50%;background:#6fa9bd}
.chess-banner-text{flex:1;min-width:0}
.chess-banner[data-tone=thinking]{border-color:#8feaff;background:#123a52}
.chess-banner[data-tone=thinking]::before{background:#8feaff;animation:chess-think 1s ease-in-out infinite}
.chess-banner[data-tone=check]{border-color:#ffb86b;background:#3a2410;color:#ffe9d0}
.chess-banner[data-tone=check]::before{background:#ffb86b}
.chess-banner[data-tone=over]{border-color:#9cffe0;background:#0e3a31;color:#e0fff5}
.chess-banner[data-tone=over]::before{background:#9cffe0}
.chess-banner-new{flex:none;min-width:96px;min-height:44px;padding:8px 14px;border:1px solid #96ecff;border-radius:9px;background:#b8f0ff;color:#061b26;font:900 13px/1 system-ui,-apple-system,"Segoe UI",sans-serif;cursor:pointer}
.chess-banner-new[hidden]{display:none}
@keyframes chess-think{0%,100%{transform:scale(.55);opacity:.45}50%{transform:scale(1);opacity:1}}
.chess-square.in-check{box-shadow:inset 0 0 0 4px #ff8a5c}
.chess-square:focus-visible{outline:3px solid #fff;outline-offset:-3px;z-index:2}
.chess-square:active .chess-piece{transform:scale(.9)}
#chess-board[aria-busy=true]{cursor:progress}

/* Small portrait phones: the chess dialog goes edge to edge so the squares stay 44px or more (360px wide: 8 x 44 = 352px of board). */
@media(max-width:420px){
  #chess-dialog{width:100vw;max-width:100vw;max-height:100dvh;padding:6px 4px 12px;border-radius:0;border-left-width:0;border-right-width:0}
  #chess-dialog .dialog-top{top:-6px;padding:6px 8px}
  #chess-dialog #chess-board{border-width:0}
  #chess-dialog .chess-sidebar{padding:0 8px}
}

/* ---------- landscape phones (short screens): the board is sized by the height, the controls sit beside it ---------- */
@media(orientation:landscape) and (max-height:520px){
  dialog.game-dialog{max-height:calc(100dvh - 6px)}
  #chess-dialog{width:min(980px,calc(100vw - 12px));padding:6px 12px 8px}
  #chess-dialog .dialog-top,#cave-dialog .dialog-top{position:static;margin:0 0 4px;padding:0}
  #chess-dialog .dialog-top .eyebrow,#cave-dialog .dialog-top .eyebrow{display:none}
  #chess-dialog .dialog-top h2,#cave-dialog .dialog-top h2{font-size:17px}
  #chess-dialog .chess-layout{grid-template-columns:auto minmax(0,1fr);gap:14px;align-items:start}
  #chess-dialog .chess-stage{width:min(calc(100dvh - 62px),calc(100vw - 340px))}
  #chess-dialog .chess-banner{display:none}
  #chess-dialog .chess-sidebar h3{margin-top:10px}
  #chess-dialog .chess-buttons{margin:10px 0}
  #chess-dialog #chess-moves{max-height:80px}
  /* Frost Run sizing moved to vault-refinements.css (31 Oct, games step 2): the stage fits the window; on a coarse-pointer landscape phone it is full bleed. */
  dialog.sr-fm-dialog[open]{display:grid;grid-template-columns:minmax(0,1.2fr) minmax(210px,1fr);grid-template-rows:repeat(6,min-content) 1fr;align-content:start;gap:6px 14px;width:min(900px,calc(100vw - 12px));padding:8px 14px}
  dialog.sr-fm-dialog .sr-fm-arena{grid-column:1;grid-row:1/span 7}
  dialog.sr-fm-dialog .sr-fm-header,dialog.sr-fm-dialog .sr-fm-instructions,dialog.sr-fm-dialog .sr-fm-modes,dialog.sr-fm-dialog .sr-fm-hud,dialog.sr-fm-dialog .sr-fm-status,dialog.sr-fm-dialog .sr-fm-actions{grid-column:2}
  dialog.sr-fm-dialog .sr-fm-header h2{font-size:22px}
  dialog.sr-fm-dialog .sr-fm-board{height:min(330px,calc(100dvh - 24px));min-height:150px}
  dialog.sr-fm-dialog .sr-fm-board[data-pairs="4"]{height:min(220px,calc(100dvh - 24px));min-height:110px}
  dialog.sc-dialog{width:min(920px,calc(100vw - 12px));max-height:calc(100dvh - 6px)}
  #sc-run:not([hidden]){display:grid;grid-template-columns:minmax(0,1.55fr) minmax(200px,1fr);grid-template-rows:repeat(5,min-content) 1fr;gap:6px 12px;align-items:start}
  #sc-run>.sc-stage-wrap{grid-column:1;grid-row:1/span 6;width:min(100%,calc((100dvh - 110px)*1.2));min-width:0;margin:0}
  #sc-run>.sc-hud,#sc-run>.sc-ride-status,#sc-run>.sc-heat,#sc-run>.sc-controls,#sc-run>.sc-tools{grid-column:2}
  #sc-run>.sc-controls{padding:4px 0;gap:6px}
}

@media(prefers-reduced-motion:reduce){
  .chess-banner::before{animation:none}
  .chess-square:active .chess-piece{transform:none}
  dialog.game-dialog,dialog.sr-fm-dialog,dialog.sc-dialog,dialog.sr-al-dialog{scroll-behavior:auto}
}

/* A play control whose script is still on its way (sr-boot sets .sr-boot-wait + aria-busy on press): visibly pressed, never a dead tap. Opacity and transform only. */
.sr-boot-wait,[aria-busy="true"].sr-al-play{opacity:.78;transform:scale(.97);cursor:progress}

/* ---------- THE SNOW ROACH PIECE SET (staged 11 Nov): SVG pieces at 92% of a square on every screen, art cropped to fill it ---------- */
#chess-board .chess-piece{width:92%;height:92%;display:block;font-size:0;line-height:0;text-shadow:none;flex:none}
#chess-board .chess-piece svg{display:block;width:100%;height:100%;overflow:visible}
#chess-board .chess-square{overflow:visible} /* the sliding piece is drawn outside its own square for 170 ms */
#chess-board .piece-white{--pc-fill:#f2fcff;--pc-line:#07202f;--pc-ice:#58d8ff;--pc-gem:#b8f0ff}
#chess-board .piece-black{--pc-fill:#0b2536;--pc-line:#c9f6ff;--pc-ice:#2fc4ff;--pc-gem:#2fc4ff}
#chess-board .pc-body{fill:var(--pc-fill);stroke:var(--pc-line);stroke-width:3.4;stroke-linejoin:round}
#chess-board .pc-line{fill:none;stroke:var(--pc-line);stroke-width:3.6;stroke-linecap:round}
#chess-board .pc-ice{fill:none;stroke:var(--pc-ice);stroke-width:3;stroke-linecap:round}
#chess-board .pc-eye{fill:var(--pc-line)}
#chess-board .pc-gem{fill:var(--pc-gem);stroke:var(--pc-line);stroke-width:2.6}
#chess-board .pc-flake-o{fill:none;stroke:var(--pc-line);stroke-width:7.5;stroke-linecap:round}
#chess-board .pc-flake{fill:none;stroke:var(--pc-fill);stroke-width:3.2;stroke-linecap:round}
/* the banner keeps one height whatever it says, so the board under it never jumps */
.chess-banner{height:52px;min-height:52px;overflow:hidden}
.chess-banner-text{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}
