/*
  Design tokens: the only place colors, spacing, type, radii, motion and layout widths are defined
  (docs/design-brief.md). Every component is built from these. test/tokens-contrast.test.js parses
  this file and checks the contrast of the pairs the components use, in both themes, and that the
  two dark blocks below are identical. Keep them in step.

  Breakpoints (custom properties cannot be used inside @media, so the numbers live here):
    phone to tablet 640px, tablet to desktop 1000px.

  Edge colors are blue and orange, never red and green, so they work for color-blind readers:
    --edge-off   the offense has the edge (blue)
    --edge-def   the defense has the edge (orange)
  The -text variants are for words on the surface, the -soft variants are fills behind text.
*/
:root {
  /* Surfaces and text */
  --color-bg: #f5f6f8;
  --color-surface: #ffffff;
  --color-surface-2: #eceff3;
  --color-text: #14181f;
  --color-muted: #525d6b;
  --color-border: #d5dae2;
  --color-border-strong: #7a8595;
  --color-accent: #1d4ed8;
  --color-accent-text: #ffffff;
  --color-danger: #b42318;
  --color-ok: #1d6b3a;
  --color-focus: #1d4ed8;

  /* Edge: blue = offense, orange = defense */
  --edge-off: #2563eb;
  --edge-off-text: #1a4fb0;
  --edge-off-soft: #e2ebfc;
  --edge-def: #c2570c;
  --edge-def-text: #9a4308;
  --edge-def-soft: #fbe9d9;

  /* Notices */
  --color-warn-soft: #fff3cf;
  --color-warn-text: #664500;
  --color-live: #b42318;

  /* Loading skeletons */
  --color-skeleton: #e2e6ec;
  --color-skeleton-glint: #f1f3f7;
  --color-scrim: rgb(0 0 0 / 50%);

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  /* Type */
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.25rem;
  --text-xl: 1.625rem;
  --text-2xl: 2rem;
  --leading-tight: 1.2;
  --leading-body: 1.5;

  /* Shape, depth, motion */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-pill: 999px;
  --shadow-1: 0 1px 2px rgb(16 24 40 / 8%);
  --shadow-2: 0 6px 20px rgb(16 24 40 / 16%);
  --motion-fast: 120ms;
  --motion-base: 220ms;
  --tap-target: 48px;
  --tap-target-compact: 44px;
  --focus-width: 3px;
  --focus-offset: 2px;

  /* Layout */
  --width-narrow: 480px;
  --width-medium: 640px;
  --width-wide: 960px;
  --width-game: 1200px;
  --z-sticky: 10;
  --z-popover: 20;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --color-bg: #0e1116;
    --color-surface: #171b22;
    --color-surface-2: #1f242d;
    --color-text: #e8ebf0;
    --color-muted: #9aa4b2;
    --color-border: #2a313c;
    --color-border-strong: #6b7686;
    --color-accent: #6b95ff;
    --color-accent-text: #0e1116;
    --color-danger: #ff8a80;
    --color-ok: #6fd391;
    --color-focus: #8db0ff;
    --edge-off: #5b9bff;
    --edge-off-text: #8dbaff;
    --edge-off-soft: #1b2a45;
    --edge-def: #f08a3a;
    --edge-def-text: #ffb070;
    --edge-def-soft: #3a2515;
    --color-warn-soft: #3a2f10;
    --color-warn-text: #ffd98a;
    --color-live: #ff8a80;
    --color-skeleton: #232932;
    --color-skeleton-glint: #2d3440;
    --color-scrim: rgb(0 0 0 / 65%);
    --shadow-1: 0 1px 2px rgb(0 0 0 / 40%);
    --shadow-2: 0 6px 20px rgb(0 0 0 / 55%);
  }
}

:root[data-theme='dark'] {
  --color-bg: #0e1116;
  --color-surface: #171b22;
  --color-surface-2: #1f242d;
  --color-text: #e8ebf0;
  --color-muted: #9aa4b2;
  --color-border: #2a313c;
  --color-border-strong: #6b7686;
  --color-accent: #6b95ff;
  --color-accent-text: #0e1116;
  --color-danger: #ff8a80;
  --color-ok: #6fd391;
  --color-focus: #8db0ff;
  --edge-off: #5b9bff;
  --edge-off-text: #8dbaff;
  --edge-off-soft: #1b2a45;
  --edge-def: #f08a3a;
  --edge-def-text: #ffb070;
  --edge-def-soft: #3a2515;
  --color-warn-soft: #3a2f10;
  --color-warn-text: #ffd98a;
  --color-live: #ff8a80;
  --color-skeleton: #232932;
  --color-skeleton-glint: #2d3440;
  --color-scrim: rgb(0 0 0 / 65%);
  --shadow-1: 0 1px 2px rgb(0 0 0 / 40%);
  --shadow-2: 0 6px 20px rgb(0 0 0 / 55%);
}
