/* Atomschlag – design tokens (s9 wave 3, Coord/s9/UI-REDESIGN.md). Loaded before every other stylesheet.
   New styles use only these --ui-* tokens: no fixed colours or pixel values. The three UI styles (theme.js:
   :root[data-theme='ww2' | 'coldwar' | 'modern']) are skins on one layout: same sizes, own colours, fonts, textures.
   Lengths are rem so they grow with the UI scale of main.css (16 px at 1280×720 → 21.6 px at 1920×1080): the
   comments name the px value at 16 px. main.css maps the older names (--c-*, --f-*, --r, --dur-*) onto these. */

:root {
  /* spacing 4 / 8 / 12 / 16 / 24 / 32 / 48 px */
  --ui-space-1: 0.25rem;
  --ui-space-2: 0.5rem;
  --ui-space-3: 0.75rem;
  --ui-space-4: 1rem;
  --ui-space-5: 1.5rem;
  --ui-space-6: 2rem;
  --ui-space-7: 3rem;

  /* type: body text ≥ 14 px, labels ≥ 12 px, numbers tabular */
  --ui-fs-xs: 0.75rem;    /* 12 – labels, badges */
  --ui-fs-sm: 0.875rem;   /* 14 – descriptions, hints */
  --ui-fs-md: 1rem;       /* 16 – body, controls */
  --ui-fs-lg: 1.25rem;    /* 20 – section heads */
  --ui-fs-xl: 1.625rem;   /* 26 – dialog / card titles */
  --ui-fs-2xl: 2.25rem;   /* 36 – screen titles */
  --ui-lh: 1.4;
  --ui-lh-tight: 1.15;
  --ui-num: tabular-nums;

  /* control sizes: one hit height for buttons, inputs, tabs, segments; ≥ 44 px on touch (below) */
  --ui-hit: 2.25rem;
  --ui-hit-sm: 2rem;
  --ui-hit-lg: 3rem;
  --ui-icon: 1.25rem;

  /* focus ring (keyboard / gamepad), visible on every skin */
  --ui-focus-w: 2px;
  --ui-focus-gap: 2px;

  /* motion: 120 / 200 / 320 ms, one easing; only transform and opacity animate. --ui-move scales travel
     distances (translate px): 0 under reduced motion, which keeps a 120 ms crossfade at most. */
  --ui-dur-1: 120ms;
  --ui-dur-2: 200ms;
  --ui-dur-3: 320ms;
  --ui-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ui-move: 1;

  /* layers */
  --ui-z-dialog: 50;
  --ui-z-popover: 55; /* the select() listbox, also over dialogs */
  --ui-z-toast: 60;
  --ui-z-tooltip: 70;

  /* radii (skins round less or more by --ui-radius-k: 0 = square, 1 = default) */
  --ui-radius-k: 1;
  --ui-radius-sm: calc(2px * var(--ui-radius-k));
  --ui-radius: calc(4px * var(--ui-radius-k));
  --ui-radius-lg: calc(8px * var(--ui-radius-k));
  --ui-radius-pill: calc(999px * var(--ui-radius-k));

  /* shadow levels: 1 = resting control, 2 = panel / card, 3 = dialog / popover (static, never animated). Small and
     hard: a crisp contact edge plus a short drop pulled in by a negative spread, blur ≤ 20 px – big soft shadows
     over large panels cost raster time on every repaint (iPad profile, s9-smooth ui-perf-audit). */
  --ui-shadow-1: 0 1px 2px rgba(0, 0, 0, 0.35);
  --ui-shadow-2: 0 1px 0 rgba(0, 0, 0, 0.4), 0 6px 12px -4px rgba(0, 0, 0, 0.55);
  --ui-shadow-3: 0 2px 0 rgba(0, 0, 0, 0.4), 0 12px 20px -8px rgba(0, 0, 0, 0.7);

  /* brand (the Atomschlag logo is the same in every skin) and the experimental badge */
  --ui-brand-sun: #ff6a00;
  --ui-brand-flare: #ffd23a;
  --ui-brand-glow: #85da01;
  --ui-exp: #ffb000;
  --ui-exp-ink: #1b1300;
}
@media (pointer: coarse) {
  :root { --ui-hit: max(44px, 2.75rem); --ui-hit-sm: max(44px, 2.75rem); }
}
@media (prefers-reduced-motion: reduce) {
  :root { --ui-dur-2: 120ms; --ui-dur-3: 120ms; --ui-move: 0; }
}
html.reduce-motion { --ui-dur-2: 120ms; --ui-dur-3: 120ms; --ui-move: 0; }

/* ww2 – the command tent: warm paper, olive, brass, stencil + typewriter, film grain */
:root, :root[data-theme='ww2'] {
  --ui-font-display: 'Saira Stencil One', 'Black Ops One', system-ui, sans-serif;
  --ui-font-ui: 'Barlow Condensed', system-ui, sans-serif;
  --ui-font-num: 'Rajdhani', 'Barlow Condensed', system-ui, sans-serif;
  --ui-font-hand: 'Caveat', 'Segoe Print', cursive;
  --ui-font-type: 'Special Elite', 'Courier New', monospace;
  --ui-display-weight: 400;
  --ui-display-tracking: 0.05em;
  --ui-radius-k: 0.5;
  --ui-chamfer: 0px;
  --ui-border-w: 1px;
  --ui-bg: #15120d;
  --ui-surface: rgba(36, 33, 23, 0.94);
  --ui-surface-2: #2a271c;
  --ui-surface-3: #353124;
  --ui-sunken: rgba(0, 0, 0, 0.3);
  --ui-line: #574f36;
  --ui-line-strong: #7a6d48;
  --ui-text: #e2d6b5;
  --ui-text-dim: #a99c79;
  --ui-text-strong: #efe4c6;
  --ui-ink: #221c12;
  --ui-accent: #d6a948;
  --ui-accent-strong: #b3862f;
  --ui-on-accent: #1f1a10;
  --ui-accent-soft: rgba(214, 169, 72, 0.12);
  --ui-good: #8fb35a;
  --ui-warn: #e0a030;
  --ui-bad: #c8402a;
  --ui-team0: #5299ff;
  --ui-team1: #f24d40;
  --ui-glow: rgba(214, 169, 72, 0.38);
  --ui-input: rgba(10, 9, 6, 0.6);
  --ui-hover: rgba(214, 169, 72, 0.08);
  --ui-selected: rgba(214, 169, 72, 0.16);
  --ui-focus: #ffd98a;
  --ui-scrim: rgba(4, 5, 3, 0.66);
  --ui-texture: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.014) 0 2px, transparent 2px 6px);
}

/* coldwar – green phosphor CRT, amber warnings, monospace numerics, scanlines */
:root[data-theme='coldwar'] {
  --ui-font-display: 'Share Tech Mono', 'Consolas', monospace;
  --ui-font-ui: 'Barlow Condensed', system-ui, sans-serif;
  --ui-font-num: 'Share Tech Mono', 'Consolas', monospace;
  --ui-font-hand: 'Share Tech Mono', 'Consolas', monospace;
  --ui-font-type: 'Share Tech Mono', 'Consolas', monospace;
  --ui-display-weight: 400;
  --ui-display-tracking: 0.14em;
  --ui-radius-k: 0;
  --ui-chamfer: 0px;
  --ui-border-w: 1px;
  --ui-bg: #050b07;
  --ui-surface: rgba(12, 20, 14, 0.93);
  --ui-surface-2: #0f1b13;
  --ui-surface-3: #152519;
  --ui-sunken: rgba(0, 0, 0, 0.35);
  --ui-line: #22502f;
  --ui-line-strong: #38854a;
  --ui-text: #bff7c9;
  --ui-text-dim: #6fa47c;
  --ui-text-strong: #dcffe2;
  --ui-ink: #031208;
  --ui-accent: #5dff7a;
  --ui-accent-strong: #2fd158;
  --ui-on-accent: #021006;
  --ui-accent-soft: rgba(93, 255, 122, 0.1);
  --ui-good: #5dff7a;
  --ui-warn: #ffb000;
  --ui-bad: #ff5a3c;
  --ui-team0: #4fc3ff;
  --ui-team1: #ff6a4a;
  --ui-glow: rgba(93, 255, 122, 0.4);
  --ui-input: rgba(2, 8, 4, 0.8);
  --ui-hover: rgba(93, 255, 122, 0.08);
  --ui-selected: rgba(93, 255, 122, 0.14);
  --ui-focus: #ffb000;
  --ui-scrim: rgba(1, 5, 2, 0.74);
  --ui-shadow-1: none;
  --ui-shadow-2: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 4px 0 rgba(0, 0, 0, 0.45);
  --ui-shadow-3: 0 0 0 1px rgba(0, 0, 0, 0.7), 0 6px 0 rgba(0, 0, 0, 0.5);
  --ui-texture: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.18) 0 1px, transparent 1px 3px);
}

/* modern – slate glass, light 1 px lines, one cool blue accent, crisp chamfers */
:root[data-theme='modern'] {
  --ui-font-display: 'Rajdhani', 'Barlow Condensed', system-ui, sans-serif;
  --ui-font-ui: 'Barlow Condensed', system-ui, sans-serif;
  --ui-font-num: 'Rajdhani', 'Barlow Condensed', system-ui, sans-serif;
  --ui-font-hand: 'Rajdhani', 'Barlow Condensed', system-ui, sans-serif;
  --ui-font-type: 'Rajdhani', 'Barlow Condensed', system-ui, sans-serif;
  --ui-display-weight: 700;
  --ui-display-tracking: 0.08em;
  --ui-radius-k: 0.25;
  --ui-chamfer: 10px;
  --ui-border-w: 1px;
  --ui-bg: #0b0f14;
  --ui-surface: rgba(18, 22, 28, 0.82);
  --ui-surface-2: rgba(26, 32, 40, 0.9);
  --ui-surface-3: #222a35;
  --ui-sunken: rgba(0, 0, 0, 0.28);
  --ui-line: rgba(196, 208, 224, 0.2);
  --ui-line-strong: rgba(214, 224, 238, 0.42);
  --ui-text: #e6ecf3;
  --ui-text-dim: #93a1b2;
  --ui-text-strong: #ffffff;
  --ui-ink: #0a0e13;
  --ui-accent: #3d9bff;
  --ui-accent-strong: #2b7fe0;
  --ui-on-accent: #03101f;
  --ui-accent-soft: rgba(61, 155, 255, 0.12);
  --ui-good: #3ddc84;
  --ui-warn: #ffb02e;
  --ui-bad: #ff4d5e;
  --ui-team0: #3d9bff;
  --ui-team1: #ff4d4d;
  --ui-glow: rgba(61, 155, 255, 0.4);
  --ui-input: rgba(6, 9, 13, 0.6);
  --ui-hover: rgba(61, 155, 255, 0.08);
  --ui-selected: rgba(61, 155, 255, 0.16);
  --ui-focus: #9fceff;
  --ui-scrim: rgba(6, 9, 13, 0.7);
  --ui-shadow-2: 0 1px 0 rgba(0, 0, 0, 0.35), 0 8px 14px -6px rgba(0, 0, 0, 0.5);
  --ui-texture: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 40%);
}
