/* Arcade games: shared layout for src/games/arcade.js. No keyframes; motion is JS-stepped and off under reduced motion. */
.arcade { --arc-cell: clamp(2.6rem, 8vw, 3.4rem);
  /* Board colours that hold up in every theme (25 Nov 2026 audit: in the dark theme --ink and --card are the page colour, so maze
     walls, the snake's head and the well vanished). Each is mixed from the theme's accent, so it contrasts on light and dark pages. */
  --arc-surface: #f3f0e8; --arc-surface: color-mix(in srgb, var(--accent, #2a6) 9%, var(--card, #f3f0e8));
  --arc-edge: #8a8a8a66; --arc-edge: color-mix(in srgb, var(--accent, #2a6) 45%, transparent);
  --arc-wall: #2b2b2b; --arc-wall: color-mix(in srgb, var(--accent, #2a6) 62%, var(--card, #2b2b2b));
  --arc-body: #2a6; --arc-body: color-mix(in srgb, var(--accent, #2a6) 55%, var(--card, #fff)); }
.arc-eyebrow { font-size: .78rem; letter-spacing: .08em; opacity: .75; }
.arc-env { display: block; width: 100%; height: auto; aspect-ratio: 8 / 3; object-fit: contain; border-radius: 12px; margin: .5rem 0; } /* the backdrops are 1600x600: shown whole, not cropped to 180px (25 Nov audit: heads and figures sliced) */
.arc-blurb { margin: .25rem 0 .5rem; }
.arc-howto { margin: .25rem 0 .75rem; }
.arc-howto ol { margin: .25rem 0 0 1.2rem; }
.arc-howto > summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.arc-howto[open] { padding: .25rem .75rem .6rem; border: 1px solid var(--line, #8a8a8a66); border-radius: 10px; }
.arc-howto li + li { margin-top: .2rem; }
.arc-board.is-ready, .arc-board.is-paused { opacity: .55; }
.arc-levels { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0; }
.arc-level { min-height: 44px; min-width: 44px; padding: .35rem .6rem; border-radius: 10px; border: 1px solid var(--line, #8a8a8a66); background: var(--card, transparent); display: grid; justify-items: center; line-height: 1.15; cursor: pointer; }
.arc-level.is-current { outline: 2px solid var(--accent, #2a6); outline-offset: 2px; }
.arc-level[disabled] { opacity: .5; cursor: not-allowed; }
.arc-level-n { font-weight: 700; }
.arc-level-name { font-size: .72rem; opacity: .8; }
.arc-level-stars { font-size: .75rem; letter-spacing: .05em; }
.arc-hud { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin: .5rem 0; font-variant-numeric: tabular-nums; }
.arc-status { min-height: 1.5em; margin: .25rem 0; }
.arc-board { position: relative; margin: .5rem auto; max-width: 100%; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.arc-grid { display: grid; gap: 3px; direction: rtl; justify-content: center; }
.arc-cell { display: grid; place-items: center; width: var(--arc-cell); height: var(--arc-cell); border-radius: 8px; background: var(--arc-surface); border: 1px solid var(--arc-edge); font-size: calc(var(--arc-cell) * .58); line-height: 1; padding: 0; color: inherit; }
button.arc-cell { cursor: pointer; }
button.arc-cell:focus-visible { outline: 3px solid var(--accent, #2a6); outline-offset: 1px; }
.arc-cell.is-wall { background: var(--arc-wall); border-color: transparent; background-image: repeating-linear-gradient(45deg, transparent 0 6px, rgba(0,0,0,.14) 6px 9px); }
.arc-cell.is-target { box-shadow: inset 0 0 0 3px var(--accent, #2a6); }
.arc-cell.is-found, .arc-cell.is-good { background: var(--good, #cfeedd); }
.arc-cell.is-bad { background: var(--bad, #f6d3d3); }
.arc-cell.is-selected { box-shadow: inset 0 0 0 3px var(--accent, #2a6); }
.arc-cell.is-player { background: var(--accent, #2a6); color: #fff; font-weight: 700; }
.arc-cell.is-chaser { background: var(--warn, #d98a2b); color: #fff; }
.arc-cell.is-fixed { opacity: .85; font-weight: 700; }
.arc-cell.is-blank { background: transparent; border-color: transparent; }
.arc-glyph { position: relative; display: inline-grid; place-items: center; }
.arc-sprite { position: absolute; inset: 10%; width: 80%; height: 80%; object-fit: contain; display: none; }
.arc-glyph.has-sprite .arc-sprite { display: block; }
.arc-glyph.has-sprite { color: transparent; }
.arc-controls { margin: .5rem 0; }
.arc-dpad { display: grid; justify-items: center; gap: .3rem; }
.arc-dpad-mid { display: flex; gap: 2.6rem; }
.arc-dpad .btn { min-width: 56px; min-height: 48px; font-size: 1.2rem; }
.arc-row { margin: .25rem 0; }
.arc-daily[aria-pressed="true"] { outline: 2px solid var(--accent, #2a6); }
.arc-results-card { margin-top: .75rem; }
.arc-badges { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.arc-badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; background: var(--accent, #2a6); color: #fff; font-size: .82rem; }
.arc-unlock { font-weight: 600; }
.arc-streak { margin-top: .5rem; }
.arc-foot { font-size: .8rem; }
.arc-choices { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin: .5rem 0; }
.arc-choice { min-height: 48px; min-width: 64px; padding: .4rem .9rem; font-size: 1.25rem; border-radius: 12px; border: 1px solid var(--line, #8a8a8a66); background: var(--card, transparent); color: inherit; cursor: pointer; }
.arc-choice.is-good { background: var(--good, #cfeedd); }
.arc-choice.is-bad { background: var(--bad, #f6d3d3); }
.arc-choice[disabled] { opacity: .55; cursor: default; }
.arc-big { font-size: clamp(2rem, 9vw, 3.4rem); text-align: center; margin: .4rem 0; line-height: 1.3; }
.arc-prompt { text-align: center; font-size: 1.15rem; margin: .4rem 0; }
.arc-lanes { display: grid; direction: rtl; gap: 4px; }
.arc-lane { position: relative; height: 300px; border-radius: 10px; background: var(--arc-surface); border: 1px solid var(--arc-edge); overflow: hidden; color: inherit; font: inherit; }
.arc-lane.is-basket { box-shadow: inset 0 -4px 0 var(--accent, #2a6); }
.arc-faller { position: absolute; left: 0; right: 0; text-align: center; font-size: 2.6rem; line-height: 1; font-weight: 700; }
.arc-basket { position: absolute; bottom: 4px; left: 0; right: 0; height: 3.4rem; display: grid; place-items: center; font-size: 2.4rem; line-height: 1; }
.arc-basket .arc-sprite-inline { inset: 0; margin: auto; width: auto; height: 100%; max-width: 100%; }
.arc-bar { height: 12px; border-radius: 6px; background: var(--line, #8a8a8a44); overflow: hidden; margin: .4rem 0; }
.arc-bar > span { display: block; height: 100%; background: var(--accent, #2a6); }
.arc-tablets { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; direction: rtl; }
.arc-tablet { border-radius: 14px 14px 6px 6px; border: 2px solid var(--line, #8a8a8a66); padding: .5rem; min-height: 200px; display: grid; gap: .3rem; align-content: start; }
.arc-slot { min-height: 44px; border-radius: 8px; border: 1px dashed var(--line, #8a8a8a66); display: flex; align-items: center; justify-content: center; padding: .2rem .4rem; }
.arc-slot.is-filled { border-style: solid; background: var(--good, #cfeedd); }
.arc-keyboard { display: grid; gap: 4px; direction: rtl; margin: .5rem 0; }
.arc-keyrow { display: flex; gap: 4px; justify-content: center; }
.arc-key { min-width: 2.2rem; min-height: 44px; font-size: 1.15rem; border-radius: 8px; border: 1px solid var(--line, #8a8a8a66); background: var(--card, transparent); color: inherit; cursor: pointer; }
.arc-typed { font-size: 2rem; min-height: 2.6rem; text-align: center; letter-spacing: .05em; }
.arc-stack { display: flex; flex-direction: column-reverse; gap: 4px; min-height: 180px; justify-content: flex-start; }
.arc-two { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.arc-bin { min-height: 64px; border-radius: 12px; border: 2px dashed var(--line, #8a8a8a66); display: grid; place-items: center; padding: .4rem; font-size: 1.1rem; cursor: pointer; background: var(--card, transparent); color: inherit; }
.arc-bin.is-good { background: var(--good, #cfeedd); }
.arc-bin.is-bad { background: var(--bad, #f6d3d3); }
.arc-snake-cell.is-snake { background: var(--arc-body); color: #fff; }
.arc-snake-cell.is-head { background: var(--accent, #2a6); color: #fff; box-shadow: inset 0 0 0 3px currentColor; }
.arc-ice { font-size: 3rem; text-align: center; line-height: 1; }
.arc-word-slots { display: flex; direction: rtl; gap: .35rem; justify-content: center; font-size: 1.8rem; margin: .4rem 0; }
.arc-word-slots > span { min-width: 1.6rem; border-bottom: 3px solid currentColor; text-align: center; }
.arc-train { display: flex; flex-wrap: wrap; direction: rtl; gap: .4rem; min-height: 56px; align-items: center; padding: .4rem; border-radius: 12px; border: 2px dashed var(--line, #8a8a8a66); }
@media (prefers-reduced-motion: reduce) { .arcade * { transition: none !important; } }
.arc-sprite-inline { position: absolute; inset: 6%; width: 88%; height: 88%; object-fit: contain; pointer-events: none; }
.arc-cell { position: relative; }
.arc-cast { max-height: 96px; display: block; margin: .25rem auto; }
.arc-host { display: flex; gap: .6rem; align-items: center; justify-content: center; }
.arc-host .arc-cast { max-height: 72px; margin: 0; }
.arc-board.is-paused { pointer-events: none; }
/* C-03 (12 Nov site check): a host or lane illustration sits in the flow beside its text, never over the board. The
   absolute .arc-sprite-inline is only for a picture inside its own positioned tile (a maze cell, a basket). */
.arc-host .arc-sprite-inline, .g1-lane .arc-sprite-inline { position: static; inset: auto; width: auto; height: auto; max-height: 72px; }
.arc-host .arc-cast { flex: 0 0 auto; }
.g1-lane-cast { max-height: 40px; margin: 0; display: inline-block; vertical-align: middle; }

/* Rimon on the board: cheers on a right answer, winces on a wrong one (src/games/arcade.js boardReact). */
.arc-hud { position: relative; }
.arc-react { inline-size: 3rem; block-size: 3rem; object-fit: contain; vertical-align: middle; margin-inline-start: .4rem; }
.arc-react.is-on[data-kind="cheer"] { animation: arc-cheer .6s ease-out; }
.arc-react.is-on[data-kind="oops"] { animation: arc-oops .45s ease-in-out; }
@keyframes arc-cheer { 0% { transform: translateY(0) scale(.8); } 40% { transform: translateY(-10px) scale(1.1); } 100% { transform: translateY(0) scale(1); } }
@keyframes arc-oops { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px) rotate(-6deg); } 75% { transform: translateX(5px) rotate(6deg); } }
@media (prefers-reduced-motion: reduce) { .arc-react.is-on { animation: none !important; } }

/* Drawn playfields (critique item 8; art in docs/images/paste/k-*.txt). Each picture is optional: a missing file leaves the
   flat board colours above, so nothing breaks before the art lands. */
.arcade[data-game="letterchomp"] .arc-cell.is-wall, .arcade[data-game="wordmaze"] .arc-cell.is-wall { background-image: url("../games/arcade/board/wall.png"), repeating-linear-gradient(45deg, transparent 0 6px, rgba(0,0,0,.14) 6px 9px); background-size: cover, auto; }
.arcade[data-game="letterchomp"] .arc-cell:not(.is-wall), .arcade[data-game="wordmaze"] .arc-cell:not(.is-wall) { background-image: url("../games/arcade/board/path.png"); background-size: cover; color: #2B2B2B; font-weight: 700; }
.arcade[data-game="syllablesnake"] .arc-snake-cell { background-image: url("../games/arcade/board/grass.png"); background-size: cover; color: #1d2a10; font-weight: 700; }
.arcade[data-game="syllablesnake"] .arc-snake-cell.is-snake { background: var(--arc-body) url("../games/arcade/board/snake-body.png") center / contain no-repeat; }
.arcade[data-game="syllablesnake"] .arc-snake-cell.is-head { background: var(--accent, #2a6) url("../games/arcade/board/snake-head.png") center / contain no-repeat; }
/* The well frames the falling cells: the board shrinks to its cells and the stones sit round them; the cells are see-through. */
.arcade[data-game="fallingletters"] .arc-grid { background: url("../games/arcade/board/well.png") center / 100% 100% no-repeat; border-radius: 12px; inline-size: fit-content; margin-inline: auto; padding: 3.4rem 2.6rem 3rem 5.8rem; } /* wider on the left: the bucket hangs there */
.arcade[data-game="fallingletters"] .arc-grid .arc-cell { background: rgba(246, 241, 231, .55); border-color: rgba(43, 43, 43, .18); color: #2B2B2B; font-weight: 700; }
.arcade[data-game="letterdrop"] .arc-lanes { background: url("../games/arcade/board/sky.png") center / cover no-repeat; border-radius: 12px; padding: .3rem; }
.arcade[data-game="letterdrop"] .arc-lane { background: rgba(255, 255, 255, .22); border-color: rgba(31, 58, 95, .25); color: #1F3A5F; }
.arc-train-art { block-size: 3.2rem; inline-size: auto; vertical-align: middle; }
/* The train reads right to left: the engine leads at the right, so it faces right with the words coupled behind it. */
.arc-train .arc-train-art { transform: scaleX(-1); }
.arc-ice-art { block-size: 7rem; inline-size: auto; display: block; margin-inline: auto; }

/* Start right under the title; and during a round on a phone, the board instead of the introduction (28 Nov 2026). */
.arc-quick { margin: .35rem 0 .5rem; }
/* The page already keeps 4.5rem clear for the sticky header (scroll-padding), so only a small margin is added here. */
.arc-hud { scroll-margin-top: 1rem; }
.arc-results { scroll-margin-top: 1rem; }
.arcade.is-playing .arc-quick { display: none !important; } /* important: the general rule that lays out one-button paragraphs is more specific */
@media (max-width: 760px) {
  .arcade.is-playing > .arc-eyebrow, .arcade.is-playing > .arc-env, .arcade.is-playing > .arc-blurb, .arcade.is-playing > .arc-howto,
  .arcade.is-playing > .arc-levels, .arcade.is-playing .arc-daily, .arcade.is-playing > .arc-foot, .arcade.is-playing > .arc-streak { display: none; }
  /* The game's name steps aside while a round runs (it stays for screen readers); half a title under the header looked broken. */
  .arcade.is-playing > h1, .arcade.is-playing > h2 { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; margin: 0; }
  /* Pause sits beside the score instead of taking a row of its own, so more of the board fits above the tab bar. */
  .arcade.is-playing > .arc-row { float: inline-end; margin: 0 0 .2rem .5rem; }
  .arcade.is-playing > .arc-row .arc-pause { min-block-size: 44px; padding-block: .3rem; }
  .arcade.is-playing > .arc-status { margin-block: .1rem .3rem; min-block-size: 1.4rem; }
  .arcade.is-playing > .arc-board { clear: both; }
  .arcade.is-playing > .arc-hud { scroll-margin-top: -.5rem; }
  .arcade.is-playing > .arc-hud { margin-block: 0 .2rem; gap: .1rem .4rem; font-size: .95rem; align-items: center; }
  /* One line of score, hearts and clock: the best score waits for the results card. */
  .arcade.is-playing > .arc-hud .arc-hud-best, .arcade.is-playing > .arc-hud .arc-hud-best + .arc-sep { display: none; }
  .arcade.is-playing > .arc-status { font-size: .92rem; }
  /* The teachers' strip above the page gives its row to the board while a round runs. */
  body:has(.arcade.is-playing) #alef-companions { display: none !important; }
  /* The host's picture and line shrink to one compact row above the board. */
  .arcade.is-playing .arc-host { gap: .45rem; justify-content: flex-start; }
  .arcade.is-playing .arc-host .arc-cast, .arcade.is-playing .arc-host .arc-sprite-inline { max-height: 44px; }
  .arcade.is-playing .arc-host .arc-prompt { font-size: 1rem; text-align: start; margin: .1rem 0; }
  .arcade.is-playing .arc-prompt { margin-block: .25rem; }
  .arcade.is-playing > .arc-board { margin-block: .25rem; }
}

.arcade[data-game="syllablesnake"] .arc-grid { width: min(100%, calc(var(--snake-size) * (var(--arc-cell) + 3px) - 3px)); margin-inline: auto; }
.arcade[data-game="syllablesnake"] .arc-snake-cell { box-sizing: border-box; width: 100%; height: auto; aspect-ratio: 1; min-width: 0; }
