/* Platform shell. Budget is 60KB for the whole shell, so this stays plain. */

:root {
  --ink: #1b1b1b;
  --paper: #fbfaf7;
  --rule: #d8d4cc;
  /* A separate token from `--rule`, and the reason is a measurement. A button here has a
     transparent background, so its BORDER is the whole boundary of the control — WCAG
     1.4.11 non-text contrast, 3:1. `--rule` is a decorative hairline at 1.42:1 against
     paper, which is correct for a separator under a heading and invisible as a control
     edge. One token was doing both jobs and only one of them well. Measured in
     `scripts/sweep.mjs`; the floors there are per-use, not per-colour. */
  --edge: #8c8880;
  --focus: #1a5fb4;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ece9e3;
    --paper: #17181a;
    --rule: #3a3c40;
    --edge: #6b6d72;
    --focus: #8ab4f8;
  }
}

body {
  margin: 0;
  padding: 0 16px 32px;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 system-ui, sans-serif;
}

h1 {
  font-size: 1.5rem;
  padding-block: 16px;
  border-bottom: 1px solid var(--rule);
}

/* Accessibility baseline: visible focus everywhere, and a skip link that is only
   hidden until it is focused. Never remove the outline. */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  position: static;
  display: inline-block;
  /* The 44px floor is not only for the controls a player uses often. The skip link is the
     first thing a keyboard user reaches and the only one they cannot see beforehand. */
  min-height: 44px;
  padding: 12px 14px;
}

button {
  font: inherit;
  /* PLATFORM.md Input: hit targets at least 44px, with spacing to match. Touch is the
     primary design target, so this is the floor every game inherits. */
  min-height: 44px;
  min-width: 44px;
  padding: 9px 14px;
  margin: 0 8px 8px 0;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--edge);
  border-radius: 6px;
}

/* Rev 21 input contract. Set deliberately so a game gesture does not fight page scroll,
   and so the page still scrolls where the game does not need the gesture. `manipulation`
   also removes the 300ms double-tap delay on a tap target. */
button,
.game-row,
.mode-toggle,
.archive-row {
  touch-action: manipulation;
}

/* A board that owns its own gestures says so; everything else lets the page scroll.
   BOTH halves of the rev-21 rule, not just the first: `touch-action: none` on every board
   also kills pinch-zoom on it, which is a low-vision player's only way to read a small
   tile, and most games never take a gesture at all. So the default preserves scroll and
   zoom, and a game that genuinely owns dragging opts in from its own mount():

     rootEl.classList.add('owns-gestures');

   That opt-in is deliberately the same moment a game commits to dragging — which is the
   moment it also owes a tap-only equivalent (tap the source, tap the destination). Drag is
   never the sole route to an action. */
.board-surface {
  touch-action: manipulation;
}

.board-surface.owns-gestures {
  touch-action: none;
}

/* No hover-only affordance, anywhere. Hover may enhance; it may never be the only way to
   learn or do something, because a touch device has no hover. Enforced as an invariant in
   platform/test/accessibility.test.js rather than left to review: no `:hover` rule in this
   stylesheet may change display, visibility, opacity or content. */

.mode-current,
.result-caption {
  color: var(--ink);
  opacity: 0.8;
  font-size: 0.9rem;
}

.result {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}

.result-grid {
  font-size: 1.25rem;
  line-height: 1.2;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
