/* The house system supplies type, colors and spacing; this file owns game UI. */
/* The player flows with the page: no height cap and no inner scroll, so the controls, readouts, scrubber and
   legal line are always reachable by scrolling the page itself. The board keeps its square ratio. */
/* Layout stability (CLS): agi-gameplay.js builds the arcade after first paint, so the mount reserves the arcade's
   measured height from the start and the FAQ and footer below never jump. Desktop reserves a few px over the
   measured 888-945px (fb-arcctl, with the action controller) and the arcade stretches to fill it; one column
   reserves toolbar + square board + controller (160px) + panel, measured 1536-1636px at 640-800px, and below 640px a
   lower bound that already reaches past the fold. Without scripts there is nothing to reserve. */
#agi-gameplay-mount { --arcade-reserve:950px; min-height:var(--arcade-reserve); }
@media(min-width:1240px) { #agi-gameplay-mount { --arcade-reserve:935px; } }
@media(max-width:800px) { #agi-gameplay-mount { --arcade-reserve:calc(77px + min(670px, 100vw - 88px) + 910px); } }
@media(max-width:639px) { #agi-gameplay-mount { --arcade-reserve:calc(115px + min(670px, 100vw - 48px) + 895px); } }
@media(scripting:none) { #agi-gameplay-mount { min-height:0; } }
#agi-gameplay-mount > .arcade { display:flex; flex-direction:column; min-height:var(--arcade-reserve); }
#agi-gameplay-mount > .arcade > .arcade__layout { flex:1 1 auto; }
.arcade { --arcade-line:var(--border,rgba(255,255,255,.14)); border:1px solid var(--arcade-line); border-radius:var(--radius-lg,20px); max-height:none; margin-inline:auto; overflow:visible; background:var(--surface,#10141d); }
.arcade *, .arcade *::before, .arcade *::after { box-sizing:border-box; }
.arcade [hidden] { display:none!important; }
.arcade button, .arcade select { font:inherit; min-height:44px; border:1px solid var(--arcade-line); border-radius:var(--radius-sm,8px); color:inherit; background:rgba(255,255,255,.04); padding:10px 16px; cursor:pointer; }
/* Controls follow the launch buttons: pills, one cyan primary, the rest compact outlines (44px on phones). */
.arcade button { min-height:40px; padding:0 16px; border-color:var(--line-control,rgba(246,240,228,.22)); border-radius:999px; background:transparent; color:var(--paper,#f6f0e4); font-size:.875rem; font-weight:600; line-height:1; letter-spacing:-.005em; transition:background-color .15s ease,border-color .15s ease,color .15s ease; }
.arcade button:hover:not(:disabled) { background:rgba(246,240,228,.06); border-color:var(--line-hover,rgba(246,240,228,.32)); }
.arcade button.arcade__primary { min-height:48px; padding:0 22px; border-color:var(--cyan,#53d9d4); background:var(--cyan,#53d9d4); color:#06110f; font-size:.9375rem; }
.arcade button.arcade__primary:hover:not(:disabled) { border-color:#7de3df; background:#7de3df; }
@media(max-width:639px),(pointer:coarse) { .arcade button { min-height:44px; } .arcade button.arcade__primary { min-height:48px; } }
.arcade button:focus-visible, .arcade select:focus-visible, #arcade-board:focus-visible { outline:3px solid var(--cyan,#8bd8f4); outline-offset:3px; }
.arcade button:disabled { opacity:.45; cursor:not-allowed; }
.arcade select { background:#151a25; max-width:100%; }
.arcade__toolbar { display:flex; align-items:center; gap:16px; flex-wrap:wrap; padding:20px 24px; border-bottom:1px solid var(--arcade-line); }
.arcade__toolbar label { font-size:14px; font-weight:600; }
.arcade__toolbar select { min-width:260px; }
/* Board, then the ARC action controller under it, in the left column; the panel spans both rows beside them. */
.arcade__layout { display:grid; grid-template-columns:minmax(0,1.25fr) minmax(300px,1fr); grid-template-rows:auto 1fr; grid-template-areas:'screen panel' 'pad panel'; }
.arcade__screen { grid-area:screen; display:flex; align-items:center; justify-content:center; padding:28px 28px 16px; background:#080b12; min-width:0; }
.arcade__board { position:relative; width:100%; max-width:640px; }
#arcade-board { display:block; width:100%; height:auto; aspect-ratio:1; image-rendering:pixelated; background:#080b12; cursor:default; touch-action:manipulation; }
#arcade-board.is-select { cursor:crosshair; }
.arcade__loading { position:absolute; inset:0; display:grid; place-items:center; padding:24px; background:#080b12; color:var(--muted,#b6bdcb); text-align:center; }
/* Where the last ACTION6 selected a cell (Alcor's or yours); it stays until the next action. */
.arcade__mark { position:absolute; pointer-events:none; box-shadow:0 0 0 2px var(--cyan,#53d9d4),0 0 0 4px rgba(5,6,8,.85); border-radius:2px; }
.arcade__panel { grid-area:panel; padding:clamp(24px,3vw,44px); min-width:0; border-left:1px solid var(--arcade-line); }
/* The controller is the ARC-AGI-3 action set: ACTION1-4 on the pad, ACTION5 Action, ACTION7 Undo, RESET, and
   ACTION6 (select a cell) on the board. Actions a game does not expose keep their space but are not shown, so
   switching games never moves anything. During a replay the keys are inert and Alcor's key is lit. */
.arcade__pad { grid-area:pad; min-width:0; display:flex; flex-direction:column; align-items:center; gap:12px; padding:4px 20px 24px; background:#080b12; }
.arcade__panel p.arcade__pad-title, .arcade p.arcade__pad-title { margin:0; font-size:11px; line-height:1.3; font-weight:600; letter-spacing:.12em; text-transform:uppercase; color:var(--muted,#b6bdcb); text-align:center; }
.arcade__pad-title span { letter-spacing:.02em; text-transform:none; font-weight:500; }
.arcade__pad-body { display:flex; flex-wrap:wrap; align-items:center; justify-content:center; gap:12px 28px; }
.arcade__dpad { display:grid; grid-template-columns:repeat(3,58px); grid-template-areas:'. up .' 'left down right'; gap:6px; }
.arcade__dpad [data-action="1"] { grid-area:up; }.arcade__dpad [data-action="2"] { grid-area:down; }.arcade__dpad [data-action="3"] { grid-area:left; }.arcade__dpad [data-action="4"] { grid-area:right; }
.arcade__keys { display:grid; grid-template-columns:repeat(2,minmax(86px,auto)); gap:6px; }
.arcade button.arcade__key { min-height:50px; padding:5px 8px; border-radius:12px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; background:rgba(246,240,228,.03); }
.arcade__glyph { font-size:19px; line-height:1; }
.arcade__key--word .arcade__glyph { font-size:14px; }
.arcade__code { font-size:9.5px; line-height:1; font-weight:600; letter-spacing:.06em; color:var(--muted,#b6bdcb); font-variant-numeric:tabular-nums; }
/* ACTION6 is a board action, so it is a label, not a button: "ACTION6 · select a cell" on two short lines. */
.arcade p.arcade__select { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; min-height:50px; margin:0; padding:5px 8px; border:1px dashed var(--line-control,rgba(246,240,228,.22)); border-radius:12px; font-size:11.5px; line-height:1.1; font-weight:600; color:var(--paper,#f6f0e4); text-align:center; white-space:nowrap; }
.arcade__select-code { display:inline-flex; align-items:center; gap:5px; }
.arcade__sep { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
.arcade__crosshair { position:relative; flex:0 0 10px; width:10px; height:10px; border:1.5px solid currentColor; border-radius:50%; color:var(--muted,#b6bdcb); }
.arcade__crosshair::after { content:''; position:absolute; inset:2.5px; border-radius:50%; background:currentColor; }
.arcade .is-unavailable { visibility:hidden; }
.arcade__pad.is-replay button.arcade__key:disabled { opacity:.62; cursor:default; }
.arcade button.arcade__key.is-active, .arcade__pad.is-replay button.arcade__key.is-active:disabled, .arcade p.arcade__select.is-active { opacity:1; border-color:var(--cyan,#53d9d4); border-style:solid; background:rgba(83,217,212,.16); color:var(--paper,#f6f0e4); }
.arcade .is-active .arcade__code { color:var(--cyan,#53d9d4); }
/* The panel title's size and measure; its face, weight, leading, tracking and space below are the site's h2
 * standard (arcana.css). */
#agi-gameplay-mount .arcade__panel h2 { max-width:none; font-size:clamp(26px,3vw,38px); text-wrap:wrap; }
.arcade__panel p { font-size:14px; line-height:1.65; }
.arcade__instructions { color:var(--muted,#b6bdcb); min-height:4.95em; margin:0 0 20px; }
.arcade__modes { display:flex; flex-wrap:wrap; align-items:center; gap:10px; margin-bottom:24px; }
.arcade__readouts { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; padding:16px 0; margin-bottom:20px; border-top:1px solid var(--arcade-line); border-bottom:1px solid var(--arcade-line); }
.arcade__readouts span { display:block; font-size:12px; color:var(--muted,#b6bdcb); margin-bottom:6px; }
.arcade__readouts strong { font-size:18px; font-variant-numeric:tabular-nums; }
/* Layout stability: the replay transport keeps its slot in manual play too, so the panel (and the FAQ and footer
   under it) never moves when a game loads or the mode changes. The idle transport stays in the slot invisibly
   (visibility removes it from focus and the accessibility tree). */
.arcade__controls { display:grid; }
.arcade__controls > * { grid-area:1/1; min-width:0; }
.arcade .arcade__controls > [hidden] { display:block!important; visibility:hidden; }
/* Resume / Next move / Speed: 12px between every control; the Speed label sits 8px off its select and
   wraps as one unit onto its own row on narrow panels. */
.arcade__transport { display:flex; flex-wrap:wrap; gap:12px; align-items:center; }
.arcade__transport label { display:inline-flex; align-items:center; gap:8px; margin-left:4px; font-size:13px; font-weight:600; color:var(--muted,#b6bdcb); white-space:nowrap; }
.arcade__transport select { min-height:40px; padding:0 12px; border-radius:999px; color:var(--paper,#f6f0e4); }
@media(max-width:639px),(pointer:coarse) { .arcade__transport select { min-height:44px; } }
.arcade__timeline { display:block; margin-top:20px; font-size:12px; color:var(--muted,#b6bdcb); font-variant-numeric:tabular-nums; }
.arcade__timeline input { display:block; width:100%; min-height:36px; margin:4px 0 0; accent-color:var(--cyan,#8bd8f4); cursor:pointer; }
.arcade .arcade__reset { border:0; padding-left:0; color:var(--muted,#b6bdcb); margin-top:14px; background:transparent; }
.arcade__status { margin:12px 0; color:var(--cyan,#8bd8f4); min-height:3.3em; }
.arcade__status.is-error { color:#ffb3b3; }
.arcade__panel .arcade__credit { margin:16px 0 0; padding-top:16px; border-top:1px solid var(--arcade-line); color:var(--muted,#b6bdcb); font-size:11px; }
@media(max-width:800px) { .arcade__layout { grid-template-columns:1fr; grid-template-rows:auto; grid-template-areas:'screen' 'pad' 'panel'; }.arcade__screen{padding:18px 18px 12px}.arcade__pad{padding:4px 12px 20px}.arcade__panel{border-left:0;border-top:1px solid var(--arcade-line)}.arcade__toolbar{padding:16px}.arcade__toolbar select{min-width:0;flex:1} }
/* Phones: the label takes its own line so the game picker has the whole row instead of being cut off. The pad
   tightens so D-pad and keys share one row from 360px; narrower screens wrap the keys under the D-pad. */
@media(max-width:639px) { .arcade__toolbar label{flex:0 0 100%}.arcade__toolbar select{flex:1 1 100%;width:100%}.arcade__pad{padding:4px 4px 20px}.arcade__pad-body{gap:12px 10px}.arcade__dpad{grid-template-columns:repeat(3,48px)}.arcade__keys{grid-template-columns:repeat(2,74px)}.arcade p.arcade__select{padding:4px;font-size:10.5px;white-space:normal} }
@media(max-width:374px) { .arcade__dpad{grid-template-columns:repeat(3,44px);gap:4px}.arcade__keys{grid-template-columns:repeat(2,68px);gap:4px}.arcade__pad-body{gap:10px 8px} }
@media(prefers-reduced-motion:reduce) { .arcade *, .arcade *::before,.arcade *::after { scroll-behavior:auto; transition:none!important; } }
