/* Depends on the generated LLTC design-system bundles (the source of truth) being loaded
   FIRST — each page <link>s them, in order, right before this file:
       shared/tokens/tokens.css   (primitives: --color-*, --radius-*, --font-*, --motion-*)
       shared/tokens/semantic.css (aliases:    --surface-*, --text-*, --action-*, --feedback-*)
       shared/tokens/skins.css    (active skin overrides: --skin-*)
   They're loaded via <link> (not @import here) so the four sheets fetch in PARALLEL — an
   @import chain would stall this sheet behind three sequential round-trips (FOUC on load).
   The bundles are vendored by `npm run sync:tokens` from docs/lltc-docs/design-system/
   tokens/build/css — never hand-edit them; re-sync and commit instead.

   ─────────────────────────────────────────────────────────────────────────────
   LLTC games — shared design foundation ("base template")
   ─────────────────────────────────────────────────────────────────────────────
   The single source of truth for the games' look is the design-system, @imported above.
   This file is the games' ADAPTER + component kit: it aliases the generated token names
   to the short names the game CSS uses, applies a per-game skin, and defines the branded
   component primitives. It matches the landing site (apps/site/app/globals.css) because
   both derive from the same tokens.

   Consumed by BOTH thin static clients (controller + screen) via a plain <link>, so
   there's no build step (same zero-install spirit as loading the Colyseus SDK from a
   CDN). Fonts (Anton / Public Sans / Courier Prime / Saira Stencil One) are loaded via
   <link> in each page's <head>.

   Layers:
     1. brand-primitive aliases — short names over the generated color / font / radius tokens.
     2. semantic aliases        — game names over the design-system semantic layer;
                                  a game skin retargets THESE, never the components.
     3. per-game skin hooks     — [data-game="…"] on <body> shifts the aliases.
     4. component kit           — branded, game-agnostic primitives shared across phases
                                  and (Pass 2) the home/game-select screen.
   Values NOT in the token set (pressed-state darkens, hairline alphas, background tints)
   stay as local literals, flagged inline. Game-specific phase classes (.opt, .banner,
   the screen's .g-*) live in each page's own <style>, expressed in these tokens. */

:root {
  color-scheme: light;

  /* 1 ── brand primitives → short aliases over the generated color / font / radius tokens. ── */
  --ox: var(--color-oxblood-500);
  --ox-deep: var(--color-oxblood-600);       /* pressed oxblood */
  --mustard: var(--color-mustard-500);
  --olive: var(--color-olive-500);
  --field: var(--color-field-500);
  --ink: var(--color-ink-500);
  --concrete: var(--color-concrete-500);
  --newsprint: var(--color-newsprint-500);
  --paper-dim: var(--surface-pageAlt);       /* #DBD7C6 */
  --paper-card: var(--color-paperCard-500);
  --paper-well: #f3eede;                      /* recessed-field tint (no token) */

  --radius: var(--radius-sm);
  --ease-stamp: var(--motion-easing-stamp);

  /* Fonts: generated primary + fallback names, then hard fallbacks. Actual webfonts are
     loaded by each page's <link> (Anton / Public Sans / Courier Prime / Saira Stencil). */
  --font-display: var(--font-display-primary), var(--font-display-fallback), "Arial Narrow", system-ui, sans-serif;
  --font-body: var(--font-body-primary), var(--font-body-fallback), system-ui, sans-serif;
  --font-mono: var(--font-mono-primary), var(--font-mono-fallback), ui-monospace, monospace;
  --font-stencil: var(--font-stencil-primary), var(--font-stencil-fallback), var(--font-display);

  /* 2 ── semantic aliases → the design-system semantic layer. --surface-page/-card and
     --text-muted are inherited straight from semantic.css; these map the rest. ──────── */
  --surface-sunken: var(--paper-well);        /* default well; the NTK skin deepens it */
  --surface-band: var(--surface-overlayInk);  /* rgba(33,30,26,0.08) letterhead tint */

  --text: var(--text-primary);
  --text-muted: var(--text-secondary);        /* override semantic's concrete → #4D4942 for body-muted legibility */
  --text-faint: var(--color-concrete-500);    /* the faintest ink */

  --accent: var(--action-primary-bg);         /* oxblood */
  --accent-press: var(--ox-deep);
  --accent-2: var(--color-mustard-500);       /* stamp gold */

  /* role / status inks (design-system feedback tokens where they exist) */
  --ok: var(--feedback-ok);                    /* field green — connected / truth / innocent */
  --warn: #8a6a1f;                             /* legibility-tuned amber TEXT (token mustard too light on paper) */
  --err: var(--feedback-danger);               /* oxblood — dropped / faker / wrong */

  --hairline: rgba(33, 30, 26, 0.22);          /* local: no hairline-alpha token */
  --hairline-strong: rgba(33, 30, 26, 0.5);

  /* tints — accent colours washed over paper for fills (local: no tint tokens) */
  --tint-accent: rgba(122, 46, 42, 0.10);
  --tint-ok: rgba(74, 97, 70, 0.14);
  --tint-warn: rgba(200, 155, 60, 0.16);
  --tint-gold: rgba(200, 155, 60, 0.14);
}

/* 3 ── per-game skin hooks ────────────────────────────────────────────────────
   A skin retargets ONLY the semantic aliases. Components below never hard-code a
   brand primitive, so a new game is a handful of lines here + its own phase CSS. */

/* NEED TO KNOW — cold, redacted counterintelligence dossier. Applies the design-system
   "need-to-know" skin (source/skins/need-to-know.json: manila card + oxblood) at the
   route root, per the consumer template. manila = --surface-cardMuted (#D8CBA8). */
body[data-game="need-to-know"] {
  --surface-card: var(--surface-cardMuted);  /* manila dossier #D8CBA8 */
  --surface-sunken: #cbbd97;                 /* deeper manila well (no token) */
  --surface-band: rgba(33, 30, 26, 0.09);
  --accent: var(--action-primary-bg);
  --accent-2: var(--color-mustard-500);
}

/* ─────────────────────────────────────────────────────────────────────────────
   4 ── component kit — branded, game-agnostic primitives
   Both clients + the future home screen build UI from these. Phase-specific classes
   in each page reference the same tokens so everything stays one system.
   ───────────────────────────────────────────────────────────────────────────── */

* { box-sizing: border-box; }

button, input, select, textarea { font-family: inherit; }

/* Stamp buttons — uppercase, hard 2px radius, ink border, tactile 1px press. */
button, .btn {
  font-family: var(--font-body);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--newsprint);
  padding: 0.85rem 1rem;
  font-size: 1.02rem;
  cursor: pointer;
  transition: transform 120ms var(--ease-stamp), background-color 120ms var(--ease-stamp);
}
button:hover:not(:disabled), .btn:hover:not(:disabled) {
  background: var(--accent-press);
  transform: translate(1px, 1px);
}
button:disabled, .btn:disabled { opacity: 0.5; cursor: default; }

/* Secondary — olive institutional fill (the "notify / less-loud" action). */
button.secondary, .btn.secondary {
  background: var(--olive);
  color: var(--newsprint);
}
button.secondary:hover:not(:disabled), .btn.secondary:hover:not(:disabled) {
  background: #505134;
}

:where(button, .btn, input, .seg button, .opt, .suspect):focus-visible {
  outline: 3px solid var(--mustard);
  outline-offset: 2px;
}

/* Fields read as recessed wells on the paper. */
input {
  width: 100%;
  padding: 0.85rem;
  font-size: 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--ink);
  background: var(--surface-well, var(--paper-well));
  color: var(--text);
  box-shadow: inset 0 1px 2px rgba(33, 30, 26, 0.12);
}
input::placeholder { color: #6f695c; }

/* Card — the workhorse cream surface with an ink hairline frame. */
.card {
  background: var(--surface-card);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Eyebrow / letterhead — the institutional masthead voice. */
.eyebrow {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  text-align: center;
}

/* Letterhead band — full-bleed masthead flush to a card's top edge (bled past the
   card padding with the --card-pad trick, matching the site). */
.letterhead {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  margin: calc(-1 * var(--card-pad, 20px)) calc(-1 * var(--card-pad, 20px)) 1rem;
  padding: 0.65rem var(--card-pad, 20px);
  background: var(--surface-band);
  border-bottom: 1px solid var(--accent);
  border-radius: var(--radius) var(--radius) 0 0;
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--accent);
}

/* Status pill — printed record slip. */
.status {
  font-size: 0.85rem;
  text-align: center;
  padding: 8px;
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  font-family: var(--font-mono);
}
.status.ok   { background: var(--tint-ok);   color: var(--ok);   border-color: rgba(74, 97, 70, 0.5); }
.status.warn { background: var(--tint-warn); color: var(--warn); border-color: rgba(200, 155, 60, 0.6); }
.status.err  { background: var(--tint-accent); color: var(--err); border-color: rgba(122, 46, 42, 0.5); }

.divider { height: 1px; background: var(--hairline); margin: 4px 0; border: none; }

.muted { color: var(--text-muted); font-size: 0.8rem; text-align: center; }

/* Segmented control (lobby length toggle, and reusable elsewhere). */
.seg {
  display: flex;
  gap: 0;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
}
.seg button {
  flex: 1;
  background: var(--surface-sunken);
  border: none;
  border-radius: 0;
  color: var(--text-muted);
  padding: 10px 8px;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
}
.seg button.sel { background: var(--accent); color: var(--newsprint); }
.seg button:disabled { cursor: default; opacity: 0.9; }
/* Neutralize the generic button:hover fill/press for the segmented control (these are
   toggle chips, not action buttons). Specificity beats `button:hover:not(:disabled)`. */
.seg button:hover:not(:disabled) { background: var(--surface-sunken); transform: none; }
.seg button.sel:hover:not(:disabled) { background: var(--accent); }

/* Stamp-in entrance, shared with the site. */
@keyframes stamp-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Game catalog: the lobby browse renders as slate handbills (controller CSS) and the selection
   pick as the Recreation Order (ditto). .catalog remains only as the plain-list fallback. */
.catalog { display: flex; flex-direction: column; gap: 10px; margin: 8px 0; }

.hide { display: none !important; }
