/* Cyberpunk TCG sim — shared design system.
 *
 * One file for every page the project serves: the live table (cpsim.play), the
 * step viewer (cpsim.viewer) and the tournament spectator (cpsim.spectator).
 * Pages that must stand alone (an exported replay) get it inlined by
 * `cpsim.theme.themed`; the play page links it from /static/theme.css.
 *
 * Art direction — five rules, enforced here and in every page's own CSS:
 *
 *  1. The card art is the brightest thing on screen. Surfaces are graphite in
 *     four steps; chrome never glows, and gradients stay under a few percent.
 *     A game action may light up for a moment (fx.js: a clash, sparks, a
 *     burn, since 2026-11-06); the interface around it never does.
 *  2. Colour is meaning, never decoration. Cyan is you and what you can act
 *     on; amber is the Rival and caution; red is loss and the irreversible;
 *     signal yellow means "a decision is yours" and nothing else; gold is Gigs.
 *  3. Engineered geometry. 2px corners, 1px hairlines, one chamfered corner
 *     marks a primary control. No pills except status chips, no soft blobs.
 *  4. Type carries hierarchy. Condensed capitals for labels and headings,
 *     plain sans at 14px+ for rules and choices, tabular figures for counts.
 *     Nothing animates over text; no glitch, no scanlines.
 *  5. Motion explains cause. It starts at the source and ends at the result,
 *     never loops, and has an instant equivalent (reduced motion).
 */

:root {
  color-scheme: dark;
  /* surfaces, darkest first */
  --s0: #08090c;   /* page */
  --s1: #0e1116;   /* table */
  --s2: #151920;   /* panels */
  --s3: #1c212b;   /* raised: buttons, cards in lists */
  --s4: #252b37;   /* hover */
  --line: #272d39;
  --line-2: #3a4252;

  /* text */
  --tx: #e8ebf1;
  --tx-2: #aab2c2;
  --tx-3: #8a93a6;

  /* meaning */
  --you: #35d7e8;
  --you-dim: rgba(53, 215, 232, .14);
  --rival: #ffa047;
  --rival-dim: rgba(255, 160, 71, .13);
  --danger: #ff5a67;
  --danger-dim: rgba(255, 90, 103, .14);
  --ok: #4fd98f;
  --turn: #fcee0a;
  --turn-dim: rgba(252, 238, 10, .12);
  --gig: #e9c46e;
  --gig-dim: rgba(233, 196, 110, .12);
  --on-accent: #0b0c0f;

  /* the game's four card colours, for RAM chips and deck spreads (cards.COLORS) */
  --c-red: #ff6b76;
  --c-blue: #5fb2ff;
  --c-green: #5ddc97;
  --c-yellow: #f4d23a;

  /* type */
  --font-ui: system-ui, "Segoe UI", Roboto, "Fira Sans", "DejaVu Sans", "Helvetica Neue", Arial, sans-serif;
  --font-display: "Bahnschrift SemiCondensed", "Bahnschrift", "Barlow Semi Condensed", "Fira Sans Condensed",
                  "Roboto Condensed", "Arial Narrow", system-ui, sans-serif;
  --font-mono: ui-monospace, "JetBrains Mono", "DejaVu Sans Mono", Consolas, Menlo, monospace;
  --fs-micro: 11px;
  --fs-small: 12.5px;
  --fs-body: 14px;
  --fs-lead: 16px;
  --fs-h2: 20px;
  --fs-h1: 28px;

  /* space */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  --radius: 2px;
  --chamfer: 10px;

  /* motion */
  --t-fast: 120ms;
  --t-std: 240ms;
  --t-slow: 420ms;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-in: cubic-bezier(.5, 0, .75, .3);

  --focus: 0 0 0 2px var(--s0), 0 0 0 4px var(--you);
  --elev-1: 0 2px 6px rgba(0, 0, 0, .45);
  --elev-2: 0 10px 28px rgba(0, 0, 0, .6);
  --elev-3: 0 24px 60px rgba(0, 0, 0, .75);
}

@media (prefers-reduced-motion: reduce) {
  :root { --t-fast: 0ms; --t-std: 0ms; --t-slow: 0ms; }
}
:root[data-motion="reduced"] { --t-fast: 0ms; --t-std: 0ms; --t-slow: 0ms; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--s0);
  color: var(--tx);
  font: var(--fs-body)/1.45 var(--font-ui);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--you); text-underline-offset: 2px; }
a:hover { color: #7de8f2; }
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius); }
::selection { background: var(--you); color: var(--on-accent); }

/* Scrollbars: thin, graphite */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }

/* ---- type helpers --------------------------------------------------------- */
.label {
  font: 600 var(--fs-micro)/1.2 var(--font-display);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--tx-3);
}
.display {
  font-family: var(--font-display);
  font-stretch: semi-condensed;
  letter-spacing: .04em;
}
.muted { color: var(--tx-2); }
.faint { color: var(--tx-3); }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- controls ------------------------------------------------------------- */
.btn, button.btn, a.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 34px; padding: 6px 14px;
  background: var(--s3); color: var(--tx);
  border: 1px solid var(--line-2); border-radius: var(--radius);
  font: 600 var(--fs-small)/1.2 var(--font-ui); letter-spacing: .02em;
  text-decoration: none; cursor: pointer;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.btn:hover:not(:disabled) { background: var(--s4); border-color: var(--tx-3); color: var(--tx); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn.primary {
  background: var(--you); color: var(--on-accent); border-color: var(--you);
  clip-path: polygon(0 0, calc(100% - var(--chamfer)) 0, 100% var(--chamfer), 100% 100%, 0 100%);
  padding-right: 20px;
}
.btn.primary:hover:not(:disabled) { background: #6fe6f2; border-color: #6fe6f2; color: var(--on-accent); }
.btn.decide {
  background: var(--turn); color: var(--on-accent); border-color: var(--turn);
  clip-path: polygon(0 0, calc(100% - var(--chamfer)) 0, 100% var(--chamfer), 100% 100%, 0 100%);
  padding-right: 20px;
}
.btn.decide:hover:not(:disabled) { background: #fff45e; color: var(--on-accent); }
.btn.danger { border-color: var(--danger); color: var(--danger); background: transparent; }
.btn.danger:hover:not(:disabled) { background: var(--danger-dim); color: #ff8a93; border-color: #ff8a93; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--tx-2); }
.btn.ghost:hover:not(:disabled) { background: var(--s3); color: var(--tx); border-color: var(--line-2); }
.btn.small { min-height: 28px; padding: 3px 10px; font-size: var(--fs-micro); }
.btn .kbd, kbd {
  font: 600 10px/1 var(--font-mono); padding: 2px 5px; border: 1px solid currentColor;
  border-radius: var(--radius); opacity: .7;
}

select, input[type=text], input[type=password], input[type=number], input[type=search], textarea {
  background: var(--s1); color: var(--tx);
  border: 1px solid var(--line-2); border-radius: var(--radius);
  font: var(--fs-body)/1.3 var(--font-ui); padding: 7px 10px; min-height: 34px;
}
select:hover, input:hover, textarea:hover { border-color: var(--tx-3); }
textarea { font-family: var(--font-mono); font-size: var(--fs-small); line-height: 1.45; }
input[type=checkbox], input[type=radio] { accent-color: var(--you); width: 16px; height: 16px; }
input[type=range] { accent-color: var(--you); }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: 99px; border: 1px solid var(--line-2);
  font: 600 var(--fs-micro)/1.5 var(--font-display); letter-spacing: .08em; text-transform: uppercase;
  color: var(--tx-2); white-space: nowrap;
}
.chip.you { color: var(--you); border-color: rgba(53, 215, 232, .45); }
.chip.rival { color: var(--rival); border-color: rgba(255, 160, 71, .45); }
.chip.ok { color: var(--ok); border-color: rgba(79, 217, 143, .45); }
.chip.danger { color: var(--danger); border-color: rgba(255, 90, 103, .5); }
.chip.turn { color: var(--on-accent); background: var(--turn); border-color: var(--turn); }
.chip.gig { color: var(--gig); border-color: rgba(233, 196, 110, .45); }

/* ---- surfaces ------------------------------------------------------------- */
.plate {
  background: var(--s2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.plate > header, .plate-head {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 10px 14px; border-bottom: 1px solid var(--line);
}
.plate-head h2, .plate > header h2 {
  margin: 0; font: 600 var(--fs-small)/1.2 var(--font-display);
  letter-spacing: .14em; text-transform: uppercase; color: var(--tx-2);
}

/* App bar, the same on every page */
.appbar {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: 48px; padding: 6px var(--sp-4);
  background: var(--s1); border-bottom: 1px solid var(--line);
}
.brand {
  display: flex; align-items: baseline; gap: 10px; white-space: nowrap;
  font: 700 13px/1 var(--font-display); letter-spacing: .2em; text-transform: uppercase;
  color: var(--tx); text-decoration: none;
}
.brand::before {
  content: ""; width: 10px; height: 10px; align-self: center;
  background: var(--turn);
  clip-path: polygon(0 0, 100% 0, 100% 60%, 60% 100%, 0 100%);
}
.brand small {
  font: 500 var(--fs-micro)/1 var(--font-ui); letter-spacing: .04em; text-transform: none; color: var(--tx-3);
}
.appbar nav { display: flex; gap: var(--sp-2); align-items: center; }
.appbar .spacer { flex: 1; }
.fan-note { color: var(--tx-3); font-size: var(--fs-micro); }

/* Dialogs share one frame */
dialog.sheet {
  padding: 0; border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--s2); color: var(--tx); box-shadow: var(--elev-3);
  max-width: min(960px, calc(100vw - 24px)); max-height: calc(100vh - 24px);
}
dialog.sheet::backdrop { background: rgba(4, 5, 8, .78); }
dialog.sheet > .sheet-head {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
dialog.sheet > .sheet-head h2 {
  margin: 0; flex: 1; font: 600 var(--fs-lead)/1.2 var(--font-display); letter-spacing: .06em; text-transform: uppercase;
}
dialog.sheet > .sheet-body { padding: 16px; overflow: auto; max-height: calc(100vh - 120px); }

/* Tables */
table.data { border-collapse: collapse; width: 100%; font-size: var(--fs-small); }
table.data th, table.data td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.data th {
  font: 600 var(--fs-micro)/1.2 var(--font-display); letter-spacing: .12em; text-transform: uppercase;
  color: var(--tx-3); position: sticky; top: 0; background: var(--s2);
}
table.data tbody tr:hover { background: var(--s3); }
.won { color: var(--ok); font-weight: 700; }
.lost { color: var(--danger); font-weight: 700; }

/* Die faces drawn as the solid's outline (d4 triangle … d20 hexagon) */
.die-shape polygon, .die-shape rect { fill: var(--gig-dim); stroke: currentColor; stroke-width: 5; stroke-linejoin: round; }
.die-shape .inner { fill: none; stroke-width: 2.5; stroke-opacity: .35; }
