/* Design tokens for the web level editor and the admin site: colours, spacing and type, also read by the map drawing in JS.
   Two colour sets: dark (the default) and light. js/theme.js sets <html data-theme="light|dark"> when the user has chosen
   one; without a choice the computer's own setting decides (prefers-color-scheme). The map's colours are the level's
   picture and stay the same in both. */
:root {
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --font-size-sm: 0.8125rem;
  --font-size-md: 0.9375rem;
  --font-size-lg: 1.125rem;
  --font-family: system-ui, "Segoe UI", sans-serif;

  color-scheme: dark;
  --surface-page: #1e2430;
  --surface-panel: #2a3242;
  --surface-control: #3a4458;
  --surface-control-hover: #4a5670;
  --surface-selected: #f2c14e;
  --surface-primary: #3f8f5a;
  --surface-primary-hover: #4ca86b;
  --surface-overlay: rgb(30 36 48 / 0.85);
  --text-default: #eef1f6;
  --text-muted: #b4bccb;
  --text-on-selected: #1e2430;
  --text-on-primary: #ffffff;
  --text-on-overlay: #eef1f6;
  --text-accent: #f2c14e;
  --text-error: #ff8a80;
  --text-warning: #ffd36e;
  --text-approved: #8fe3a2;
  --text-info: #8ec5ff;
  --badge-approved: rgb(143 227 162 / 0.15);
  --badge-warning: rgb(255 211 110 / 0.15);
  --badge-error: rgb(255 138 128 / 0.15);
  --badge-info: rgb(142 197 255 / 0.15);
  --border-subtle: #46506a;
  --focus-ring: #8ec5ff;
  --shadow: rgb(0 0 0 / 0.4);

  /* The map, as drawn on the canvas. */
  --map-sky: #9fd3f0;
  --map-grid: rgb(255 255 255 / 0.25);
  --map-wall: #7a5a3c;
  --map-wall-edge: #4e3824;
  --map-pipe: #8d969e;
  --map-pipe-edge: #5c646b;
  --map-water: #2f76c8;
  --map-error: #e53935;
  --map-hover: rgb(255 255 255 / 0.5);
  --map-wait: #1e2430;
  --map-wait-label: rgb(255 255 255 / 0.85);
  --map-screen: #f2c14e;
  --map-outside: rgb(30 36 48 / 0.45);
}

/* Light: chosen, or the computer's setting when nothing is chosen. The two blocks are the same - keep them so. */
:root[data-theme="light"] {
  color-scheme: light;
  --surface-page: #eef1f6;
  --surface-panel: #ffffff;
  --surface-control: #e3e8f0;
  --surface-control-hover: #d3dae6;
  --surface-selected: #e0a81e;
  --surface-primary: #2f7d4a;
  --surface-primary-hover: #3a8f58;
  --text-default: #1e2430;
  --text-muted: #566175;
  --text-on-selected: #1e2430;
  --text-accent: #8a5a00;
  --text-error: #b3261e;
  --text-warning: #8a5a00;
  --text-approved: #22703a;
  --text-info: #1f5fbf;
  --badge-approved: rgb(34 112 58 / 0.12);
  --badge-warning: rgb(224 168 30 / 0.2);
  --badge-error: rgb(179 38 30 / 0.1);
  --badge-info: rgb(31 95 191 / 0.1);
  --border-subtle: #cbd2dd;
  --focus-ring: #2f6fd1;
  --shadow: rgb(30 36 48 / 0.18);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --surface-page: #eef1f6;
    --surface-panel: #ffffff;
    --surface-control: #e3e8f0;
    --surface-control-hover: #d3dae6;
    --surface-selected: #e0a81e;
    --surface-primary: #2f7d4a;
    --surface-primary-hover: #3a8f58;
    --text-default: #1e2430;
    --text-muted: #566175;
    --text-on-selected: #1e2430;
    --text-accent: #8a5a00;
    --text-error: #b3261e;
    --text-warning: #8a5a00;
    --text-approved: #22703a;
    --text-info: #1f5fbf;
    --badge-approved: rgb(34 112 58 / 0.12);
    --badge-warning: rgb(224 168 30 / 0.2);
    --badge-error: rgb(179 38 30 / 0.1);
    --badge-info: rgb(31 95 191 / 0.1);
    --border-subtle: #cbd2dd;
    --focus-ring: #2f6fd1;
    --shadow: rgb(30 36 48 / 0.18);
  }
}
