/* ==========================================================================
   Imperial Battlecode design system, v7 "Neon mono"
   Near-black canvas, one neon pink accent, IBM Plex Mono everywhere, hairline rules and small
   techy readouts. Dark by default; js/theme.js switches <html data-theme> to "light" and
   remembers it. Team A stays blue and team B amber, as in the replay viewer; red is for errors.
   Plain CSS, no build step. Class names are the same as v1 to v5, so pages keep working;
   the v1 neon helpers (.glow-*, .rgb, .cursor, .crt, .horizon, .hero-sun) are quiet no-ops.

   Font (self-hosted, SIL Open Font License 1.1, see ../assets/fonts/OFL.txt):
     IBM Plex Mono  400, 500, 600: headings, body, nav, buttons, forms, tables, code

   Sections
     1  Fonts            9  Badges, pills     17 Timeline, steps
     2  Tokens          10  Cards, panels     18 Stats, meters, stars
     3  Base            11  Tables            19 Versus (match header)
     4  Typography      12  Forms, dropzone   20 Toasts
     5  Layout          13  Tabs              21 Misc (avatar, empty, loader...)
     6  Shell, sidebar  14  Code, kbd         22 Dashboard grid, labels, sparkline
     7  Footer          15  Callouts          23 Utilities
     8  Buttons         16  Hero              24 Reduced motion, print
                                              25 v7 techy layer (theme switch, readouts)
   ========================================================================== */

/* 1. Fonts ---------------------------------------------------------------- */
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../assets/fonts/IBMPlexMono-Regular-Latin1.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../assets/fonts/IBMPlexMono-Medium-Latin1.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../assets/fonts/IBMPlexMono-SemiBold-Latin1.woff2") format("woff2");
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
}

/* 2. Tokens --------------------------------------------------------------- */
:root, [data-theme="dark"] {
  color-scheme: dark;

  /* base: near-black with a faint plum cast */
  --bg: #0b0a0d;        /* page */
  --bg-2: #100d12;      /* sidebar, wells, map frames */
  --bg-3: #08070a;      /* code blocks */
  --surface: #120e14;   /* panels, cards, inputs */
  --surface-2: #1a141c; /* hover fill, chips, skeletons */
  --surface-3: #231a25; /* raised */
  --line: #2a1d28;      /* hairline */
  --line-2: #3d2638;
  --line-3: #6e4a66;    /* input borders, strong rules (>=3:1 on panels) */

  /* text */
  --heading: #f7eaf3;
  --text: #ebdce6;
  --text-dim: #cdbcc8;
  --muted: #9a8a9d;     /* 5.9:1 on --bg, 5.4:1 on --surface */
  --on-accent: #0b0a0d; /* text on bright chips (pink, green, gold) */

  /* the one accent: neon pink */
  --accent: #f50db4;
  --accent-2: #ff4fcb;  /* hover, pressed */
  --accent-3: #33102a;  /* tint fill (selected segment, own row) */
  --accent-tint: rgba(245, 13, 180, 0.10);
  --accent-line: rgba(245, 13, 180, 0.45);
  --primary: #f50db4;   /* primary button fill */
  --primary-2: #ff2fc0; /* primary button hover */
  --on-primary: #ffffff;
  --glow: rgba(245, 13, 180, 0.55);
  --soft: rgba(245, 13, 180, 0.14);
  --rule: rgba(245, 13, 180, 0.28);
  --scan: rgba(247, 234, 243, 0.07);

  /* v1 and v2 names, mapped onto the v7 palette */
  --sage: var(--accent);
  --sage-2: var(--accent-2);
  --sage-3: var(--accent-3);
  --sage-tint: var(--accent-tint);
  --cyan: var(--accent);
  --cyan-2: #a10a78;
  --cyan-3: var(--accent-3);
  --magenta: var(--accent);
  --magenta-2: #a10a78;
  --magenta-text: var(--accent);

  /* teams: as in the replay viewer, A is blue and B is amber */
  --team-a: #4fa3e3;
  --team-a-2: #2c6aa0;  /* edges, reference lines */
  --team-a-text: #7bbef0;
  --team-a-tint: #0f2233;
  --team-b: #e0a53c;
  --team-b-2: #9c7324;
  --team-b-text: #e8bd6a;
  --team-b-tint: #2a1f0d;

  /* status */
  --green: #46c07a;
  --amber: #e0a53c;
  --red: #ff5a5f;       /* errors and destructive actions */
  --red-2: #8a2a2f;
  --red-tint: #2a1014;
  --violet: #b59ac4;
  --gold: #e0b64a;
  --silver: #cfc4cb;
  --bronze: #c68a5a;
  --star: #e0b64a;

  /* map previews (js/mapdraw.js reads these); boards stay dark in both themes */
  --map-ground: #141016;
  --map-ground-2: #18131b;
  --map-deploy: #2e1027;
  --map-deploy-2: #3d1434;
  --map-deploy-edge: rgba(245, 13, 180, 0.6);
  --map-rock: #5a4d5c;
  --map-rock-hi: #776878;
  --map-rock-lo: #3a313b;
  --map-rock-speck: #4a3f4c;
  --map-grid: rgba(255, 255, 255, 0.06);
  --map-axis: rgba(245, 13, 180, 0.7);

  /* chart series, in rank order (pink, blue, white, amber, grey) */
  --series-1: #f50db4;
  --series-2: #4fa3e3;
  --series-3: #f7eaf3;
  --series-4: #e0a53c;
  --series-5: #9a8a9d;

  /* type: one family. Plex Mono ships 400, 500 and 600, so nothing is faux-bolded. */
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  --font-body: var(--font-mono);
  --font-heading: var(--font-mono);
  --font-sans: var(--font-mono);     /* v1 name: body text, buttons, forms */
  --font-serif: var(--font-mono);    /* v2 name */
  --font-label: var(--font-mono);    /* small uppercase labels and kickers */
  --font-display: var(--font-mono);
  --font-term: var(--font-mono);
  --fs-xs: 0.78125rem;  /* 12.5px */
  --fs-sm: 0.84375rem;  /* 13.5px */
  --fs-md: 0.90625rem;  /* 14.5px, body */
  --fs-lg: 1.0625rem;   /* 17px */
  --lh: 1.6;
  --tracking-label: 0.12em;

  /* spacing */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;

  /* layout */
  --container: 1200px;
  --container-narrow: 820px;
  --gutter: clamp(20px, 4vw, 48px);
  --header-h: 56px;
  --sidebar-w: 256px;
  --sidebar-w-collapsed: 72px;
  --radius: 3px;
  --shadow-sm: none;
  --shadow: 0 0 0 1px var(--line-2), 0 18px 40px rgba(0, 0, 0, 0.55);
  --ring: 0 0 0 3px rgba(245, 13, 180, 0.30);

  /* v1 leftovers kept as harmless values */
  --px: 0px;
  --notch: 0px;
  --glow-cyan: none;
  --glow-magenta: none;

  /* layers */
  --z-header: 100;
  --z-toast: 1000;
  --z-crt: 2000;
}

/* light theme: white paper, the same pink (a shade deeper where it is text) */
[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --bg-2: #fff6fc;
  --bg-3: #fbf1f8;
  --surface: #ffffff;
  --surface-2: #fff0f9;
  --surface-3: #ffe3f4;
  --line: #f0dde9;
  --line-2: #e4c4d8;
  --line-3: #b58aa6;
  --heading: #17101a;
  --text: #2a1f2c;
  --text-dim: #4d4049;
  --muted: #74656f;     /* 5.6:1 on white */
  --on-accent: #ffffff;
  --accent: #d1069b;    /* 4.8:1 on white, for links and active text */
  --accent-2: #a8057d;
  --accent-3: #ffe0f3;
  --accent-tint: rgba(245, 13, 180, 0.08);
  --accent-line: rgba(209, 6, 155, 0.40);
  --primary: #f50db4;
  --primary-2: #d1069b;
  --glow: rgba(245, 13, 180, 0.35);
  --soft: rgba(245, 13, 180, 0.10);
  --rule: rgba(245, 13, 180, 0.30);
  --scan: rgba(23, 16, 26, 0.06);
  --team-a: #1f6fc0;
  --team-a-2: #7fb0e0;
  --team-a-text: #1a5fa6;
  --team-a-tint: #e6f0fa;
  --team-b: #c0801a;
  --team-b-2: #e2b56a;
  --team-b-text: #8f5c0c;
  --team-b-tint: #fbf0dd;
  --green: #17824a;
  --amber: #a8670c;
  --red: #c9302c;
  --red-2: #f0b4b2;
  --red-tint: #fdecec;
  --violet: #7a5a8c;
  --gold: #a87a0a;
  --silver: #7d7680;
  --bronze: #9a5f30;
  --star: #b8860b;
  --series-1: #e00aa5;
  --series-2: #1f6fc0;
  --series-3: #17101a;
  --series-4: #c0801a;
  --series-5: #8b7d87;
  --shadow: 0 0 0 1px var(--line-2), 0 18px 40px rgba(200, 0, 140, 0.10);
  --ring: 0 0 0 3px rgba(245, 13, 180, 0.22);
}

/* 3. Base ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
  font-synthesis-weight: none;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: var(--fs-md);
  font-weight: 400;
  font-variant-numeric: lining-nums;
  line-height: var(--lh);
  color: var(--text);
  background: transparent; /* the page colour is on html */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main, .page { flex: 1 0 auto; }

img, svg, video, canvas { max-width: 100%; height: auto; }
img { display: inline-block; }

a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--accent-line);
  transition: color 120ms, text-decoration-color 120ms;
}
a:hover { color: var(--accent); text-decoration-color: var(--accent); }

::selection { background: var(--accent); color: #ffffff; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

hr {
  border: 0;
  height: 1px;
  margin: var(--s-6) 0;
  background: var(--line);
}
hr.neon { background: var(--line-2); }

html { scrollbar-color: var(--line-3) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border: 3px solid var(--bg); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--line-3); }

/* 4. Typography ----------------------------------------------------------- */
h1, h2, h3, .h1, .h2, .h3 {
  font-family: var(--font-heading);
  font-weight: 500;
  color: var(--heading);
  margin: 0 0 var(--s-4);
  text-wrap: balance;
}
h1, .h1 { font-size: clamp(30px, 3.6vw, 48px); line-height: 1.08; letter-spacing: -0.035em; }
h2, .h2 { font-size: clamp(20px, 2vw, 26px); line-height: 1.2; letter-spacing: -0.02em; }
h3, .h3 { font-size: 15px; line-height: 1.35; letter-spacing: -0.005em; }
h4, .h4, h5, h6 {
  font-family: var(--font-label);
  font-weight: 500;
  font-size: 11.5px;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--muted);
  margin: 0 0 var(--s-3);
}
/* accent word in a title: <h1>Ladder <em>standings</em></h1>. Same face, pink, upright. */
:is(h1, h2, h3, .h1, .h2, .h3) em, .title-serif {
  font-family: inherit;
  font-style: normal;
  font-weight: inherit;
  letter-spacing: inherit;
  color: var(--accent);
}
p { margin: 0 0 var(--s-4); }
ul, ol { margin: 0 0 var(--s-4); padding-left: 1.4em; }
li + li { margin-top: 0.35em; }
strong, b { font-weight: 600; color: var(--heading); }
em, i { font-style: italic; }
small, .small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }

.lead { font-size: var(--fs-lg); line-height: 1.55; color: var(--text-dim); max-width: 60ch; }

/* small label above a heading: <p class="kicker">Season 1</p> */
.kicker {
  display: inline-block;
  font-family: var(--font-label);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--muted);
  margin: 0 0 var(--s-4);
}

.display { font-family: var(--font-heading); font-weight: 500; letter-spacing: -0.03em; }
.term { font-family: var(--font-mono); font-size: 0.86em; letter-spacing: 0.02em; }
.mono { font-family: var(--font-mono); }

/* v1 neon text helpers: now quiet */
.glow { text-shadow: none; }
.glow-cyan { color: inherit; text-shadow: none; }
.glow-magenta { color: inherit; text-shadow: none; }
.rgb { text-shadow: none; }
.cursor::after { content: none; }
.cursor.cursor-loop::after { content: none; }

/* command line: <p class="prompt">cargo build --release</p> */
.prompt { font-family: var(--font-mono); font-size: 13.5px; color: var(--text); }
.prompt::before { content: "$ "; color: var(--muted); }
.prompt.prompt-arrow::before { content: "> "; color: var(--muted); }

/* long-form text (rules, docs) */
.prose { max-width: 70ch; }
.prose h2 { margin-top: var(--s-7); }
.prose h3 { margin-top: var(--s-6); }
.prose h4 { margin-top: var(--s-5); }
.prose :is(h2, h3, h4):first-child { margin-top: 0; }
.prose p, .prose li { color: var(--text); }
.prose a { color: var(--accent); }
.prose a:hover { color: var(--accent-2); }
.prose ul { list-style: none; padding-left: 1.2em; }
.prose ul > li { position: relative; }
.prose ul > li::before {
  content: "";
  position: absolute;
  left: -1.05em;
  top: 0.78em;
  width: 7px;
  height: 1px;
  background: var(--muted);
}
.prose ol > li::marker { font-weight: 600; color: var(--muted); }
.prose blockquote {
  margin: 0 0 var(--s-4);
  padding: 2px 0 2px var(--s-4);
  border-left: 2px solid var(--line-2);
  color: var(--text-dim);
}
.prose img { image-rendering: pixelated; }
.prose .table-wrap { margin-bottom: var(--s-5); }

/* text colours */
.text-cyan, .text-magenta, .text-accent { color: var(--accent); }
.text-a { color: var(--team-a-text); }
.text-b { color: var(--team-b-text); }
.text-green { color: var(--green); }
.text-amber { color: var(--amber); }
.text-red { color: var(--red); }
.text-gold { color: var(--gold); }
.muted { color: var(--muted); }
.dim { color: var(--text-dim); }

/* 5. Layout --------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container-narrow { max-width: calc(var(--container-narrow) + 2 * var(--gutter)); }

.section { padding-block: var(--s-8); }
.section-sm { padding-block: var(--s-6); }
.section + .section { border-top: 1px solid var(--line); }

/* page heading block at the top of every inner page */
.page-head {
  padding: clamp(40px, 6vw, 72px) 0 var(--s-6);
  margin-bottom: var(--s-7);
  border-bottom: 1px solid var(--line);
}
.page-head h1 { margin-bottom: var(--s-4); }
.page-head .lead { margin-bottom: 0; }
.page-head-row { display: flex; flex-wrap: wrap; gap: var(--s-4) var(--s-5); align-items: flex-end; justify-content: space-between; }

/* section heading with optional right-side link */
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2) var(--s-4);
  margin-bottom: var(--s-5);
}
.section-head > :is(h2, h3) { margin: 0; }
.section-head a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-dim);
  text-decoration: none;
}
.section-head a:hover { color: var(--heading); }
.section-head a::after {
  content: "";
  width: 0.75em;
  height: 0.75em;
  background: currentColor;
  -webkit-mask: var(--icon-arrow-ne) center / contain no-repeat;
  mask: var(--icon-arrow-ne) center / contain no-repeat;
}

/* vertical rhythm: children get space between them */
.stack > * { margin-top: 0; margin-bottom: 0; }
.stack > * + * { margin-top: var(--stack, var(--s-4)); }
.stack-sm { --stack: var(--s-2); }
.stack-lg { --stack: var(--s-6); }

/* horizontal group that wraps */
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cluster, var(--s-3)); }
.cluster-between { justify-content: space-between; }
.cluster-end { justify-content: flex-end; }

/* grids */
.grid { display: grid; gap: var(--grid-gap, var(--s-6)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--min, 260px)), 1fr)); }
@media (max-width: 960px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
}

/* main column + sidebar */
.with-sidebar { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--s-7); align-items: start; }
.with-sidebar.sidebar-left { grid-template-columns: 220px minmax(0, 1fr); }
@media (max-width: 1180px) {
  .with-sidebar { gap: var(--s-6); grid-template-columns: minmax(0, 1fr) 280px; }
}
@media (max-width: 960px) {
  .with-sidebar, .with-sidebar.sidebar-left { grid-template-columns: minmax(0, 1fr); }
}
.sticky { position: sticky; top: calc(var(--header-h) + var(--s-5)); }

/* in-page table of contents (rules page sidebar) */
.toc { list-style: none; padding: 0; margin: 0; border-left: 1px solid var(--line); }
.toc li { margin: 0; }
.toc a {
  display: block;
  padding: 5px 0 5px 14px;
  margin-left: -1px;
  border-left: 1px solid transparent;
  color: var(--muted);
  text-decoration: none;
  font-size: var(--fs-sm);
}
.toc a:hover { color: var(--text); }
.toc a[aria-current="true"], .toc a.is-active { color: var(--accent); border-left: 2px solid var(--accent); padding-left: 13px; margin-left: -1px; }

/* local "screen" box (v1 CRT), now a plain well */
.crt {
  position: relative;
  background: var(--bg-2);
  box-shadow: inset 0 0 0 1px var(--line);
  overflow: hidden;
}
.crt::after { content: none; }
body.no-crt::before, body.no-crt::after { content: none; }

/* 6. Shell, sidebar ------------------------------------------------------- */
/* chrome.js fills #cc-header with the sidebar and adds body.cc-shell. Wide screens: fixed
   sidebar on the left, collapsible to an icon rail (body.cc-collapsed, remembered).
   Up to 1023px: a slim top bar with a menu button, and the sidebar slides in over the page
   (body.cc-nav-open). */
.skip-link {
  position: absolute;
  left: var(--s-4);
  top: -100px;
  z-index: calc(var(--z-header) + 10);
  padding: var(--s-2) var(--s-4);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius);
}
.skip-link:focus { top: var(--s-2); color: var(--on-accent); }

/* inline SVG line icons */
.icon { width: 18px; height: 18px; flex: none; display: block; }

.cc-sidebar {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  overflow: hidden;
}
.cc-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  min-height: 80px;
  padding: var(--s-5) var(--s-3) var(--s-4) 22px;
}
.cc-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: var(--heading);
  text-decoration: none;
}
.cc-brand:hover { color: var(--heading); }
.cc-brand img { display: block; width: 48px; height: 48px; flex: none; }
.cc-brand { gap: 10px; }
.cc-icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
}
.cc-icon-btn:hover { color: var(--heading); background: var(--surface-3); }
.cc-collapse .icon { transition: transform 160ms; }

.cc-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 var(--s-3) var(--s-4);
  scrollbar-width: thin;
}
.cc-nav ul { list-style: none; margin: 0; padding: 0; }
.cc-nav li { margin: 0; }
.cc-nav li + li { margin-top: 2px; }
.cc-nav-group {
  margin: var(--s-5) 0 var(--s-2);
  padding: 0 12px;
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--muted);
  white-space: nowrap;
}
.cc-nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  color: var(--text-dim);
  text-decoration: none;
  white-space: nowrap;
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
}
.cc-nav-link .icon { color: var(--muted); }
.cc-nav-link:hover { color: var(--heading); background: var(--surface-3); }
.cc-nav-link:hover .icon { color: var(--text-dim); }
/* active page: accent text and an accent marker, no fill */
.cc-nav-link[aria-current="page"] { color: var(--accent); background: transparent; font-weight: 600; }
.cc-nav-link[aria-current="page"] .icon { color: var(--accent); }
.cc-nav-link[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 2px;
  background: var(--accent);
}
.cc-nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cc-nav-count {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 6px;
  font-size: 14px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  color: var(--on-accent);
  background: var(--accent);
  border-radius: 10px;
}

.cc-side-foot {
  padding: var(--s-3) var(--s-3) var(--s-4);
  border-top: 1px solid var(--line);
}
.cc-side-foot:empty { min-height: 96px; }
.cc-user {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 4px 10px;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius);
}
.cc-user:hover { color: var(--heading); background: var(--surface-3); }
.cc-user-text { display: grid; min-width: 0; line-height: 1.3; }
.cc-user-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-user-team { font-size: var(--fs-xs); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* top bar: only below 1024px */
.cc-topbar {
  display: none;
  align-items: center;
  gap: var(--s-3);
  height: var(--header-h);
  padding: 0 var(--gutter) 0 calc(var(--gutter) - 8px);
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.cc-topbar .cc-brand img { width: 40px; height: 40px; }
.cc-scrim { display: none; }

/* layout before chrome.js runs (keeps the page from jumping); .cc-shell takes over after */
@media (min-width: 1024px) {
  body:has(> #cc-header) { padding-left: var(--sidebar-w); }
  body:has(> #cc-header) > #cc-header { position: fixed; top: 0; bottom: 0; left: 0; width: var(--sidebar-w); background: var(--bg-2); border-right: 1px solid var(--line); }
}
@media (min-width: 1024px) {
  .cc-shell { padding-left: var(--sidebar-w); --header-h: 0px; }
  .cc-shell.cc-collapsed { --sidebar-w: var(--sidebar-w-collapsed); }
  .cc-shell #cc-header {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: var(--z-header);
    width: var(--sidebar-w);
  }
  .cc-shell.cc-animating #cc-header, .cc-shell.cc-animating { transition: width 160ms ease, padding-left 160ms ease; }

  /* collapsed rail: icons only */
  .cc-collapsed .cc-side-head { flex-direction: column; justify-content: flex-start; gap: var(--s-4); padding: var(--s-5) 0 var(--s-3); }
  .cc-collapsed .cc-brand img { width: 40px; height: 40px; }
  .cc-collapsed .cc-brand .wordmark,
  .cc-collapsed .cc-nav-label,
  .cc-collapsed .cc-user-text,
  .cc-collapsed .cc-nav-count { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .cc-collapsed .cc-collapse .icon { transform: rotate(180deg); }
  .cc-collapsed .cc-nav { padding-inline: 14px; }
  .cc-collapsed .cc-nav-group { height: 1px; margin: var(--s-4) 6px; padding: 0; overflow: hidden; color: transparent; background: var(--line); }
  .cc-collapsed .cc-nav-link, .cc-collapsed .cc-user { justify-content: center; padding: 0; gap: 0; }
  .cc-collapsed .cc-side-foot { padding-inline: 14px; }
}
@media (max-width: 1023px) {
  .cc-shell #cc-header {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    height: var(--header-h);
  }
  .cc-topbar { display: flex; }
  .cc-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: calc(var(--z-header) + 2);
    box-shadow: var(--shadow);
    width: min(288px, 86vw);
    height: auto;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 200ms ease, visibility 0s linear 200ms;
  }
  .cc-nav-open .cc-sidebar { transform: none; visibility: visible; transition: transform 200ms ease; }
  .cc-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-header) + 1);
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    visibility: hidden;
    transition: opacity 200ms, visibility 0s linear 200ms;
  }
  .cc-nav-open .cc-scrim { opacity: 1; visibility: visible; transition: opacity 200ms; }
  body.cc-nav-open { overflow: hidden; }
}

/* v1 top header: still used by the replay viewer's own bar (paper bar over the viewer's dark canvas) */
.site-header {
  position: relative;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; flex: none; text-decoration: none; }
.brand img { display: block; height: 40px; width: auto; }

/* 7. Footer --------------------------------------------------------------- */
.site-footer {
  margin-top: var(--s-9);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--fs-xs);
}
.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2) var(--s-5);
  padding-block: var(--s-5) var(--s-6);
}
.footer-links { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }

/* 8. Buttons -------------------------------------------------------------- */
:root {
  --icon-arrow-ne: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 11.5l7-7M5.5 4.5h6v6' fill='none' stroke='%23000' stroke-width='1.5'/%3E%3C/svg%3E");
  --icon-arrow-r: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 8h11M9 3.5L13.5 8 9 12.5' fill='none' stroke='%23000' stroke-width='1.5'/%3E%3C/svg%3E");
  --icon-trophy: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M7.5 3.5h9v5a4.5 4.5 0 0 1-9 0z'/%3E%3Cpath d='M7.5 5.5h-3v1a3.5 3.5 0 0 0 3.2 3.5M16.5 5.5h3v1a3.5 3.5 0 0 1-3.2 3.5M12 13v4M8.5 20.5h7M9.5 17h5v3.5h-5z'/%3E%3C/svg%3E");
}
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  --btn-edge: var(--line-2);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  margin: 0;
  padding: 10px 18px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 1px solid var(--btn-edge);
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  transition: background-color 120ms, border-color 120ms, color 120ms;
}
.btn:hover { --btn-bg: var(--surface-2); --btn-edge: var(--line-3); color: var(--btn-fg); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn[disabled], .btn.is-disabled, .btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
  pointer-events: none;
}
.btn > svg, .btn > img { width: 16px; height: 16px; flex: none; }

/* primary: deep Imperial-blue fill, white text. Links get a small north-east arrow. */
.btn-primary, .btn-sage { --btn-bg: var(--primary); --btn-fg: var(--on-primary, #ffffff); --btn-edge: var(--primary); box-shadow: var(--shadow-sm); }
.btn-primary:hover, .btn-sage:hover { --btn-bg: var(--primary-2); --btn-edge: var(--primary-2); }
.btn-secondary { --btn-bg: var(--surface); --btn-fg: var(--heading); --btn-edge: var(--line-3); }
.btn-secondary:hover { --btn-bg: var(--surface); --btn-edge: var(--heading); }
/* outline: external links, quiet actions */
.btn-ghost { --btn-bg: transparent; --btn-fg: var(--text); --btn-edge: var(--line-2); }
.btn-ghost:hover { --btn-bg: var(--surface); --btn-edge: var(--line-3); --btn-fg: var(--heading); }
.btn-danger { --btn-bg: transparent; --btn-fg: var(--red); --btn-edge: color-mix(in srgb, var(--red) 45%, transparent); }
.btn-danger:hover { --btn-bg: var(--red-tint); --btn-edge: var(--red); }
.btn-team-a { --btn-bg: var(--team-a); --btn-fg: var(--on-accent); --btn-edge: var(--team-a); }
.btn-team-a:hover { --btn-bg: var(--accent-2); --btn-edge: var(--accent-2); }
.btn-team-b { --btn-bg: var(--team-b); --btn-fg: var(--on-accent); --btn-edge: var(--team-b); }
.btn-team-b:hover { --btn-bg: var(--team-b-text); --btn-edge: var(--team-b-text); }
/* text link with an arrow */
.btn-link { --btn-bg: transparent; --btn-edge: transparent; --btn-fg: var(--text); padding-inline: 4px; gap: 6px; box-shadow: none; }
.btn-link:hover { --btn-bg: transparent; --btn-edge: transparent; --btn-fg: var(--accent); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 4px; }

a.btn-primary:not(.no-arrow, .is-busy)::after,
a.btn-sage:not(.no-arrow, .is-busy)::after,
.btn-arrow:not(.is-busy)::after,
a.btn-link:not(.no-arrow, .is-busy)::after,
a.btn[target="_blank"]:not(.no-arrow, .is-busy)::after {
  content: "";
  width: 12px;
  height: 12px;
  flex: none;
  background: currentColor;
  -webkit-mask: var(--icon-arrow-ne) center / contain no-repeat;
  mask: var(--icon-arrow-ne) center / contain no-repeat;
}
.btn-link::after { width: 10px; height: 10px; }

.btn-sm { min-height: 34px; padding: 5px 12px; font-size: 13.5px; gap: 8px; }
.btn-lg { min-height: 52px; padding: 13px 24px; font-size: 16px; }
.btn-block { display: flex; width: 100%; }
.btn-icon { padding-inline: 10px; }

/* spinner inside a busy button: <button class="btn btn-primary is-busy"> */
.btn.is-busy { pointer-events: none; }
.btn.is-busy::after {
  content: "";
  width: 12px;
  height: 12px;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: cc-spin 0.8s linear infinite;
}

.btn-group { display: inline-flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; }

/* 9. Badges, pills -------------------------------------------------------- */
/* a small mono label with a status dot; only the dot carries colour */
.badge {
  --b-c: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 2px 0;
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  white-space: nowrap;
  color: var(--text-dim);
  vertical-align: middle;
}
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--b-c);
}
.badge.no-dot::before, .badge-plain::before { display: none; }
.badge.no-dot { color: var(--muted); }
.badge-queued { --b-c: var(--star); }
.badge-pending { --b-c: var(--star); }
.badge-validating { --b-c: var(--violet); }
.badge-validating::before { animation: cc-breathe 1.6s ease-in-out infinite; }
.badge-running { --b-c: var(--accent); }
.badge-running::before { animation: cc-breathe 1.6s ease-in-out infinite; }
.badge-done { --b-c: var(--green); }
.badge-ok { --b-c: var(--green); }
.badge-accepted { --b-c: var(--green); }
.badge-error { --b-c: var(--red); }
.badge-rejected { --b-c: var(--red); }
.badge-declined, .badge-cancelled { --b-c: var(--line-3); }
.badge-active { --b-c: var(--accent); }
.badge-team-a { --b-c: var(--team-a); }
.badge-team-b { --b-c: var(--team-b); }
.badge-win { --b-c: var(--green); }
.badge-loss { --b-c: var(--red); }
.badge-draw { --b-c: var(--silver); }
.badge-ranked { --b-c: var(--star); }
.badge-scrimmage { --b-c: var(--violet); }
.badge-test { --b-c: var(--muted); }
.badge-admin { --b-c: var(--accent); }
.badge-solid { padding: 2px 8px; color: var(--on-accent); background: var(--b-c); border-radius: 999px; }
.badge-solid::before { display: none; }

/* pill: <span class="pill pill-you">You</span> */
.pill {
  display: inline-block;
  padding: 1px 7px;
  font-family: var(--font-label);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.5;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--on-accent);
  background: var(--accent);
  border-radius: 999px;
  vertical-align: middle;
  white-space: nowrap;
}

/* 10. Cards, panels ------------------------------------------------------- */
/* .card: a white box with a hairline edge on the paper */
.card {
  --card-edge: var(--line);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  margin: 0;
  padding: var(--s-5);
  background: var(--surface);
  border: 1px solid var(--card-edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color 120ms, box-shadow 120ms;
}
.card > * { margin: 0; }
a.card, .card-link { color: inherit; text-decoration: none; }
a.card:hover, .card-link:hover, .card.is-hoverable:hover { --card-edge: var(--accent-line); color: inherit; box-shadow: var(--shadow); }
a.card:hover .card-title, .card-link:hover .card-title { color: var(--accent); }
.card-title { font-family: var(--font-heading); font-size: 14px; font-weight: 500; line-height: 1.3; letter-spacing: 0; color: var(--heading); overflow-wrap: anywhere; }
.card-meta { font-family: var(--font-label); font-size: 11px; font-weight: 600; line-height: 1.4; text-transform: uppercase; letter-spacing: var(--tracking-label); color: var(--muted); }
.card-body { color: var(--text-dim); font-size: var(--fs-sm); }
.card-footer { margin-top: auto; padding-top: var(--s-3); display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; justify-content: space-between; }
.card-media { margin: 0 0 var(--s-2); background: var(--bg-2); }
.card-media img { display: block; width: 100%; image-rendering: pixelated; }
.card-a { box-shadow: inset 0 3px 0 var(--team-a), var(--shadow-sm); }
.card-b { box-shadow: inset 0 3px 0 var(--team-b), var(--shadow-sm); }
.card-accent { box-shadow: inset 0 3px 0 var(--accent), var(--shadow-sm); }
.card-compact { padding: var(--s-4); gap: var(--s-2); }
.card-compact .card-title { font-size: 13px; }
/* a card that starts with media: the picture runs to the card's edges, a hairline under it */
.card:has(> .card-media:first-child) { padding-top: 0; overflow: hidden; }
.card:has(> .card-media:first-child) > .card-media { margin: 0 calc(-1 * var(--s-5)) var(--s-2); border-bottom: 1px solid var(--line); }
.card-compact:has(> .card-media:first-child) > .card-media { margin-inline: calc(-1 * var(--s-4)); }

/* small icon square used in feature cards */
.icon-tile {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent);
  background: var(--accent-3);
  box-shadow: none;
  border-radius: var(--radius);
}
.icon-tile.is-magenta { color: var(--team-b-text); background: var(--team-b-tint); }

/* .panel: a white block with a hairline edge */
.panel {
  --panel-c: var(--line-3);
  position: relative;
  padding: var(--s-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.panel::before { content: none; }
.panel > :last-child { margin-bottom: 0; }
.panel-a { --panel-c: var(--team-a); box-shadow: inset 0 3px 0 var(--team-a), var(--shadow-sm); }
.panel-b { --panel-c: var(--team-b); box-shadow: inset 0 3px 0 var(--team-b), var(--shadow-sm); }
.panel-magenta { --panel-c: var(--accent); box-shadow: inset 0 3px 0 var(--accent), var(--shadow-sm); }
.panel-quiet { background: transparent; padding: 0; border: 0; box-shadow: none; }
.panel-flush { padding: 0; }
.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2) var(--s-4);
  margin: 0 0 var(--s-5);
  padding: 0 0 var(--s-3);
  border-bottom: 1px solid var(--line);
}
.panel-flush .panel-head { margin: 0; padding: var(--s-4) var(--s-5) var(--s-3); }
.panel-title {
  margin: 0;
  font-family: var(--font-label);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--muted);
}
.panel-a .panel-title { color: var(--team-a-text); }
.panel-b .panel-title { color: var(--team-b-text); }
.panel-title::before, .panel-title::after { content: none; }

/* 11. Tables -------------------------------------------------------------- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  font-variant-numeric: lining-nums tabular-nums;
}
.table th {
  padding: 10px 12px;
  text-align: left;
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--muted);
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
}
.table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table :is(th, td):first-child { padding-left: 4px; }
.table :is(th, td):last-child { padding-right: 4px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color 100ms; }
.table tbody tr:hover { background: var(--accent-tint); }
.table .num, .table th.num { text-align: right; white-space: nowrap; }
.table .center { text-align: center; }
.table .nowrap { white-space: nowrap; }
.table a { text-decoration: none; }
.table a:hover { color: var(--accent); text-decoration: underline; text-decoration-color: var(--accent); }
.table tr.is-own td { font-weight: 600; color: var(--heading); background: var(--accent-tint); }
.table tr.is-own .team-cell::after { content: "You"; flex: none; padding: 1px 7px; font-family: var(--font-label); font-size: 10.5px; font-weight: 600; line-height: 1.5; text-transform: uppercase; letter-spacing: 0.06em; color: var(--on-accent); background: var(--accent); border-radius: 999px; }
.table-compact td { padding-block: 9px; }
.table-compact th { padding-block: 8px; }
.table-striped tbody tr:nth-child(even) { background: var(--bg-2); }

/* ranked leaderboard: <table class="table leaderboard"> with tr.rank-1, .rank-2, .rank-3 (trophy) */
.leaderboard td { padding-block: 14px; }
.leaderboard .rank { width: 64px; }
.rank-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 24px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}
.leaderboard tr:is(.rank-1, .rank-2, .rank-3) .rank-chip,
.rank-chip.rank-top { color: var(--heading); }
.leaderboard tr:is(.rank-1, .rank-2, .rank-3) .rank-chip::after,
.rank-chip.rank-top::after {
  content: "";
  width: 14px;
  height: 14px;
  background: var(--star);
  -webkit-mask: var(--icon-trophy) center / contain no-repeat;
  mask: var(--icon-trophy) center / contain no-repeat;
}
.leaderboard tr.rank-1 .team-name { color: var(--heading); }
.rating { font-size: 15px; font-weight: 600; letter-spacing: 0; color: var(--heading); font-variant-numeric: lining-nums tabular-nums; }
.rating-dev { color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; }
.wld { white-space: nowrap; font-variant-numeric: lining-nums tabular-nums; }
.wld .w { color: var(--green); }
.wld .l { color: var(--red); }
.wld .d { color: var(--muted); }
.wld .sep { color: var(--line-3); margin: 0 3px; }
.trend-up { color: var(--green); }
.trend-up::before { content: "\2191 "; }
.trend-down { color: var(--red); }
.trend-down::before { content: "\2193 "; }

/* team name cell with avatar */
.team-cell { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.team-cell .team-name { color: var(--heading); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-cell a.team-name:hover { color: var(--heading); }
.team-cell .team-sub { display: block; color: var(--muted); font-size: var(--fs-xs); font-weight: 500; }

/* definition list as a key/value table */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px var(--s-5); margin: 0; }
.kv dt { font-family: var(--font-label); font-size: 11px; font-weight: 600; line-height: 2; text-transform: uppercase; letter-spacing: var(--tracking-label); color: var(--muted); }
.kv dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }

/* 12. Forms, dropzone ----------------------------------------------------- */
.form { max-width: 520px; }
.field { display: grid; gap: 8px; margin-bottom: var(--s-5); }
.field > label:not(.check, .dropzone), .label {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--heading);
}
.field .req { color: var(--muted); }
.hint { margin: 0; color: var(--muted); font-size: var(--fs-xs); }

input:not([type="checkbox"], [type="radio"], [type="file"], [type="range"], [type="color"], [type="submit"], [type="button"], [type="reset"], [type="hidden"]),
select,
textarea,
.input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  font: inherit;
  font-size: var(--fs-md);
  line-height: 1.25;
  color: var(--heading);
  background: var(--surface);
  border: 1px solid var(--line-3);
  border-radius: var(--radius);
  box-shadow: none;
  transition: border-color 100ms, box-shadow 100ms;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; }
input:hover:not(:focus), select:hover:not(:focus), textarea:hover:not(:focus), .input:hover:not(:focus) { border-color: var(--line-3); }
input:focus, select:focus, textarea:focus, .input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}
input:disabled, select:disabled, textarea:disabled { opacity: 0.5; cursor: not-allowed; }
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%239a9a9a' stroke-width='1.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 11px 7px;
}
select option { background: var(--surface); color: var(--text); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.check { display: inline-flex; align-items: center; gap: var(--s-2); cursor: pointer; color: var(--text-dim); }

/* errors: add aria-invalid="true" to the control and a .field-error message */
.field.has-error > label:not(.check, .dropzone) { color: var(--red); }
[aria-invalid="true"], .is-invalid { border-color: var(--red) !important; }
[aria-invalid="true"]:focus, .is-invalid:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 25%, transparent) !important; }
.field-error {
  margin: 0;
  color: var(--red);
  font-size: var(--fs-xs);
  font-weight: 500;
}

/* input with an attached button */
.input-group { display: flex; gap: var(--s-2); align-items: stretch; }
.input-group > input, .input-group > select { flex: 1; min-width: 0; }

/* file drop zone: <label class="dropzone"><input type="file"> ... </label> */
.dropzone {
  --dz-c: var(--line-3);
  position: relative;
  display: grid;
  justify-items: center;
  gap: var(--s-2);
  padding: var(--s-6) var(--s-5);
  text-align: center;
  color: var(--text-dim);
  cursor: pointer;
  border: 1px dashed var(--dz-c);
  border-radius: var(--radius);
  background: var(--surface);
  transition: background-color 120ms, border-color 120ms;
}
.dropzone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}
.dropzone:hover, .dropzone:focus-within { --dz-c: var(--accent); }
.dropzone:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.dropzone.is-dragover { --dz-c: var(--accent); background-color: var(--accent-3); }
.dropzone.has-file { --dz-c: var(--green); }
.dropzone.is-invalid { --dz-c: var(--red); }
.dropzone-icon {
  width: 28px;
  height: 28px;
  background: currentColor;
  color: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.5'%3E%3Cpath d='M12 15V4M7.5 8.5L12 4l4.5 4.5M4 14v5.5h16V14'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.5'%3E%3Cpath d='M12 15V4M7.5 8.5L12 4l4.5 4.5M4 14v5.5h16V14'/%3E%3C/svg%3E") center / contain no-repeat;
}
.dropzone.has-file .dropzone-icon { color: var(--green); }
.dropzone-title { font-size: 15px; font-weight: 600; line-height: 1.4; color: var(--heading); }
.dropzone-title u { color: var(--accent); text-decoration-color: var(--accent-line); text-decoration-thickness: 1px; text-underline-offset: 4px; }
.dropzone-hint { font-size: var(--fs-xs); color: var(--muted); }
.dropzone-file { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.4; color: var(--green); overflow-wrap: anywhere; }
.dropzone-file:empty { display: none; }

/* 13. Tabs ---------------------------------------------------------------- */
.tabs {
  display: flex;
  gap: var(--s-5);
  margin-bottom: var(--s-5);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none;
  margin-bottom: -1px;
  padding: 10px 0 11px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--muted);
  text-decoration: none;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"], .tab[aria-current="page"], .tab.is-active {
  color: var(--accent);
  font-weight: 600;
  border-bottom-color: var(--accent);
}
.tab .count { margin-left: 6px; font-size: 14px; color: var(--muted); font-variant-numeric: lining-nums tabular-nums; }
.tab-panel[hidden] { display: none; }

/* segmented toggle (filters): <div class="segmented"><button aria-pressed="true"> */
.segmented { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: calc(var(--radius) + 2px); }
.segmented > * {
  padding: 6px 12px;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
}
.segmented > *:hover { color: var(--text); }
.segmented > [aria-pressed="true"], .segmented > .is-active, .segmented > [aria-current="page"] { color: var(--accent); background: var(--surface); box-shadow: 0 0 0 1px var(--line-2), var(--shadow-sm); }

/* 14. Code, kbd ----------------------------------------------------------- */
code, kbd, samp, pre { font-family: var(--font-mono); }
:not(pre) > code {
  padding: 1px 5px;
  font-size: 0.78em;
  color: var(--heading);
  background: var(--surface-2);
  border-radius: var(--radius);
  overflow-wrap: anywhere;
}
pre {
  margin: 0 0 var(--s-4);
  padding: var(--s-4) var(--s-5);
  overflow: auto;
  font-size: 13px;
  line-height: 1.65;
  tab-size: 4;
  color: var(--text);
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.code {
  position: relative;
  margin: 0 0 var(--s-4);
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.code > pre { margin: 0; border: 0; background: transparent; }
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 6px 8px 6px var(--s-5);
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: var(--radius) var(--radius) 0 0;
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--muted);
}
.code-head .lang { color: var(--text-dim); }
.copy-btn {
  padding: 4px 8px;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
}
.copy-btn:hover { color: var(--heading); background: var(--surface-3); }
.copy-btn.is-done { color: var(--green); }
/* token colours for hand-highlighted code, per theme (all 4.5:1 or more on the code background) */
:root, [data-theme="dark"] { --tok-kw: #ff5ccc; --tok-ty: #e8bd6a; --tok-fn: #ffffff; --tok-str: #6fd3a0; --tok-num: #e0b64a; --tok-com: #9a8a9d; --tok-mac: #7bbef0; --tok-op: #cdbcc8; }
[data-theme="light"] { --tok-kw: #b8058a; --tok-ty: #8f5c0c; --tok-fn: #17101a; --tok-str: #17824a; --tok-num: #8a6408; --tok-com: #74656f; --tok-mac: #1a5fa6; --tok-op: #4d4049; }
.tok-kw { color: var(--tok-kw); }
.tok-ty { color: var(--tok-ty); }
.tok-fn { color: var(--tok-fn); font-weight: 500; }
.tok-str { color: var(--tok-str); }
.tok-num { color: var(--tok-num); }
.tok-com { color: var(--tok-com); font-style: italic; }
.tok-mac { color: var(--tok-mac); }
.tok-op { color: var(--tok-op); }

kbd {
  display: inline-block;
  min-width: 1.8em;
  padding: 1px 6px;
  font-size: 0.8em;
  line-height: 1.4;
  text-align: center;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: var(--radius);
}

/* 15. Callouts ------------------------------------------------------------ */
/* a note on a faint tint with a status-coloured bar; the title carries the status colour */
.callout {
  --co-c: var(--accent);
  position: relative;
  margin: 0 0 var(--s-4);
  padding: var(--s-3) var(--s-4);
  border-left: 3px solid var(--co-c);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: color-mix(in srgb, var(--co-c) 6%, var(--surface));
}
.callout::before { content: none; }
.callout > :last-child { margin-bottom: 0; }
.callout-title {
  display: block;
  margin: 0 0 4px;
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--co-c);
}
.callout-info { --co-c: var(--accent); }
.callout-tip { --co-c: var(--green); }
.callout-warn { --co-c: var(--amber); }
.callout-danger { --co-c: var(--red); }
.callout-magenta { --co-c: var(--accent); }

/* 16. Hero ---------------------------------------------------------------- */
/* <section class="hero"> ...content... </section>; .horizon and .hero-sun are v1 leftovers, now hidden */
.hero {
  position: relative;
  padding: clamp(56px, 8vw, 112px) 0 clamp(48px, 6vw, 80px);
  border-bottom: 1px solid var(--line);
}
.hero > .container { position: relative; }
.hero h1 { font-size: clamp(36px, 5vw, 62px); line-height: 1.04; }
.hero .lead { margin-inline: 0; }
.hero-center { text-align: center; }
.hero-center .lead { margin-inline: auto; }
.hero-center .cluster { justify-content: center; }
.hero-logo { display: block; width: min(468px, 90%); height: auto; margin: 0 0 var(--s-6); }
.hero-center .hero-logo { margin-inline: auto; }
.horizon, .hero-sun { display: none; }
.hero-sm { padding-top: var(--s-7); padding-bottom: var(--s-6); }

/* 17. Timeline, steps ----------------------------------------------------- */
.timeline { position: relative; list-style: none; margin: 0; padding: 0; }
.timeline::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 10px;
  bottom: 10px;
  width: 1px;
  background: var(--line-2);
}
.timeline-item { position: relative; margin: 0; padding: 0 0 var(--s-5) 28px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--line-3);
}
.timeline-item.is-done::before { background: var(--text-dim); box-shadow: none; }
.timeline-item.is-current::before { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-tint); }
.timeline-date { display: block; font-size: 13px; font-weight: 600; line-height: 1.6; letter-spacing: 0.02em; color: var(--text-dim); font-variant-numeric: lining-nums tabular-nums; }
.timeline-item.is-current .timeline-date { color: var(--accent); }
.timeline-item:not(.is-done, .is-current) .timeline-date { color: var(--muted); }
.timeline-title { display: block; margin: 2px 0; font-weight: 600; color: var(--heading); }
.timeline-body { margin: 0; color: var(--text-dim); font-size: var(--fs-sm); }

/* numbered steps: <ol class="steps"><li><h3>..</h3><p>..</p></li></ol> */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; display: grid; gap: 0; align-content: start; }
.steps > li { position: relative; margin: 0; padding: var(--s-4) 0 var(--s-4) 56px; counter-increment: step; border-top: 1px solid var(--line); }
.steps > li:first-child { border-top: 0; padding-top: 0; }
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: calc(var(--s-4) - 1px);
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-3);
  border-radius: 50%;
}
.steps > li:first-child::before { top: -3px; }
.steps > li > :is(h3, h4) { margin: 0 0 var(--s-2); }
.steps > li > :last-child { margin-bottom: 0; }
.steps > li.is-done::before { content: "\2713"; color: var(--on-accent); background: var(--green); font-size: 13px; }

/* 18. Stats, meters, stars ------------------------------------------------ */
/* label, big number, note; each stat sits after a thin vertical rule */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: var(--s-5) var(--s-5); }
.stat {
  --stat-c: var(--heading);
  position: relative;
  margin: 0;
  padding: 2px 0 2px var(--s-4);
  border-left: 1px solid var(--line-2);
}
.stat::before { content: none; }
.stat-label { display: block; font-family: var(--font-label); font-size: 11px; font-weight: 600; line-height: 1.4; text-transform: uppercase; letter-spacing: var(--tracking-label); color: var(--muted); }
.stat-value {
  display: block;
  margin: 8px 0 4px;
  font-family: var(--font-heading);
  font-size: clamp(22px, 2.2vw, 28px);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--stat-c);
  font-variant-numeric: lining-nums tabular-nums;
  overflow-wrap: anywhere;
}
.stat-value small { font-family: var(--font-body); font-size: 0.62em; font-weight: 600; letter-spacing: 0; color: var(--muted); }
.stat-meta { display: block; font-size: var(--fs-xs); color: var(--muted); }
.stat-a { --stat-c: var(--team-a-text); }
.stat-b { --stat-c: var(--team-b-text); }
.stat-magenta, .stat-gold, .stat-green { --stat-c: var(--heading); }

/* thin meter: <div class="meter meter-a" style="--value: 62%" role="meter" aria-valuenow="62" ...></div> */
.meter {
  --meter-c: var(--accent);
  position: relative;
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}
.meter::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--value, 0%);
  background: var(--meter-c);
  border-radius: 2px;
}
.meter-a { --meter-c: var(--team-a); }
.meter-b { --meter-c: var(--team-b); }
.meter-magenta { --meter-c: var(--accent); }
.meter-gold { --meter-c: var(--star); }
.meter-lg { height: 6px; }
.meter-label { display: flex; justify-content: space-between; gap: var(--s-2); margin-bottom: 8px; font-family: var(--font-label); font-size: 11px; font-weight: 600; line-height: 1.4; text-transform: uppercase; letter-spacing: var(--tracking-label); color: var(--muted); }

/* stars: <span class="stars" aria-label="2 of 3 stars"><i class="on"></i><i class="on"></i><i></i></span> */
.stars { display: inline-flex; gap: 3px; vertical-align: middle; }
.stars > i {
  display: block;
  width: 14px;
  height: 14px;
  background: var(--line-2);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5l2.9 6.2 6.6.7-5 4.5 1.4 6.6L12 17.2l-5.9 3.3 1.4-6.6-5-4.5 6.6-.7z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5l2.9 6.2 6.6.7-5 4.5 1.4 6.6L12 17.2l-5.9 3.3 1.4-6.6-5-4.5 6.6-.7z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.stars > i.on { background: var(--star); }
.stars-lg > i { width: 22px; height: 22px; }

/* 19. Versus (match header) ----------------------------------------------- */
/* <div class="versus"><div class="side side-a is-winner">..</div><div class="vs">VS</div><div class="side side-b">..</div></div> */
.versus {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: stretch;
  gap: 0;
  border-block: 1px solid var(--line);
}
.versus .side { position: relative; display: grid; gap: 8px; align-content: center; padding: var(--s-6) var(--s-5); min-width: 0; }
.versus .side-a { text-align: right; justify-items: end; }
.versus .side-b { text-align: left; justify-items: start; }
.side-label { font-family: var(--font-label); font-size: 11px; font-weight: 600; line-height: 1.4; text-transform: uppercase; letter-spacing: var(--tracking-label); color: var(--muted); }
.side-a .side-label { color: var(--team-a-text); }
.side-b .side-label { color: var(--team-b-text); }
.side-name { font-family: var(--font-heading); font-size: clamp(20px, 2.2vw, 28px); font-weight: 500; line-height: 1.15; letter-spacing: -0.01em; color: var(--heading); overflow-wrap: anywhere; }
.side-a .side-name, .side-b .side-name { color: var(--heading); }
.side-score { font-size: var(--fs-sm); line-height: 1.4; color: var(--text-dim); }
.side.is-winner .side-label::after { content: " \00b7  winner"; color: var(--heading); }
.versus .vs {
  display: grid;
  place-items: center;
  padding: 0 var(--s-5);
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.02em;
  color: var(--muted);
  border-inline: 1px solid var(--line);
}
@media (max-width: 560px) {
  .versus { grid-template-columns: minmax(0, 1fr); }
  .versus .side { padding: var(--s-5) 0; }
  .versus .side-a, .versus .side-b { text-align: left; justify-items: start; }
  .versus .vs { padding: 0; border-inline: 0; border-block: 1px solid var(--line); font-size: 15px; justify-content: start; }
}

/* compact inline matchup for table cells: <span class="matchup"><span class="a">x</span> vs <span class="b">y</span></span> */
.matchup { white-space: nowrap; }
.matchup .a, .matchup .b { color: var(--heading); font-weight: 600; }
.matchup .a::before, .matchup .b::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; vertical-align: 0.12em; }
.matchup .a::before { background: var(--team-a); }
.matchup .b::before { background: var(--team-b); }
.matchup .vs { color: var(--muted); margin: 0 8px; font-size: var(--fs-xs); }
.matchup .is-winner::after { content: " \2713"; color: var(--text-dim); font-weight: 500; }
@media (max-width: 640px) {
  .matchup { display: inline-flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; white-space: normal; }
  .matchup .a { flex-basis: 100%; }
  .matchup .vs { margin: 0; }
}

/* 20. Toasts -------------------------------------------------------------- */
.toast-region {
  position: fixed;
  right: var(--s-4);
  bottom: var(--s-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  width: min(380px, calc(100vw - 2 * var(--s-4)));
  pointer-events: none;
}
.toast {
  --toast-c: var(--accent);
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-3) var(--s-3) var(--s-4);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: var(--fs-sm);
  pointer-events: auto;
  animation: cc-toast-in 200ms ease-out;
}
.toast.is-leaving { animation: cc-toast-out 160ms ease-in forwards; }
.toast-icon {
  flex: none;
  width: 7px;
  height: 7px;
  margin-top: 7px;
  overflow: hidden;
  font-size: 0;
  color: transparent;
  border-radius: 50%;
  background: var(--toast-c);
}
.toast-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-title { display: block; font-weight: 600; color: var(--heading); }
.toast-close { flex: none; padding: 0 4px; font-family: var(--font-mono); font-size: 14px; line-height: 1.4; color: var(--muted); background: none; border: 0; cursor: pointer; }
.toast-close:hover { color: var(--text); }
.toast-ok { --toast-c: var(--green); }
.toast-warn { --toast-c: var(--star); }
.toast-error { --toast-c: var(--red); }
/* a toast shown in page flow (styleguide, inline notices) */
.toast.is-static { animation: none; box-shadow: var(--shadow-sm); }

/* 21. Misc ---------------------------------------------------------------- */
/* avatar with initials; set the colour with style="--hue: 210" */
.avatar {
  --hue: 190;
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.04em;
  color: var(--heading);
  text-transform: uppercase;
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px var(--line-2);
  border-radius: 50%;
  overflow: hidden;
}
.avatar-sm { width: 24px; height: 24px; font-size: 9.5px; }
.avatar-lg { width: 64px; height: 64px; font-size: 17px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }

/* empty state */
.empty {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: var(--s-2);
  padding: var(--s-7) var(--s-5);
  text-align: center;
  color: var(--muted);
}
.empty-title { font-size: 16px; font-weight: 600; line-height: 1.4; color: var(--text); }
.empty > p { margin: 0; max-width: 46ch; }

/* loader: <div class="loader" role="status">Loading</div> */
.loader {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--muted);
}
.loader::after {
  content: "";
  width: 22px;
  height: 4px;
  color: var(--accent);
  background:
    radial-gradient(circle, currentColor 1.6px, transparent 2px) 0 0 / 7px 4px repeat-x;
  animation: cc-breathe 1.2s ease-in-out infinite;
}

/* skeleton placeholder bars */
.skeleton {
  display: block;
  height: 12px;
  background: var(--surface-3);
  border-radius: 3px;
  animation: cc-breathe 1.6s ease-in-out infinite;
}
.skeleton + .skeleton { margin-top: 10px; }
.skeleton.w-60 { width: 60%; }
.skeleton.w-80 { width: 80%; }
.skeleton.w-40 { width: 40%; }

/* pager: <nav class="pager"><a class="btn btn-ghost btn-sm">Prev</a> <span>Page 2</span> ...</nav> */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--s-3); margin-top: var(--s-5); font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: lining-nums tabular-nums; }

/* breadcrumb */
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 var(--s-4); padding: 0; list-style: none; font-family: var(--font-label); font-size: 11.5px; font-weight: 600; line-height: 1.4; text-transform: uppercase; letter-spacing: var(--tracking-label); color: var(--muted); }
.crumbs li { margin: 0; }
.crumbs li + li::before { content: "/ "; color: var(--line-3); }
.crumbs a { color: var(--text-dim); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }

/* pixel image / map thumbnail */
.thumb { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; image-rendering: pixelated; background: var(--bg-2); }
.pixelated { image-rendering: pixelated; }
/* placeholder when there is no preview image: <div class="thumb thumb-empty" data-label="56 x 56"></div> */
.thumb-empty {
  position: relative;
  display: grid;
  place-items: center;
  background: var(--bg-2);
}
.thumb-empty::after {
  content: attr(data-label);
  font-family: var(--font-label);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.thumb-empty:not([data-label])::after { content: "No preview"; }

/* chip / tag */
.tag {
  display: inline-block;
  padding: 1px 7px;
  font-size: var(--fs-xs);
  line-height: 1.6;
  color: var(--text-dim);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-2);
  border-radius: 999px;
}

/* 22. Dashboard grid, labels, sparkline ----------------------------------- */
/* Hairline-divided grid of cells, lines only between cells:
   <div class="dash-grid" style="--cols: 3"><section class="cell">..</section> ... </div>
   Spans: .cell-2 .cell-3 .cell-full .cell-row-2. Two columns up to 960px (set --cols-md), one on phones. */
.dash-grid {
  --pad: var(--s-6);
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
  margin-inline: calc(-1 * var(--pad));
  border-top: 1px solid var(--line);
  clip-path: inset(0 var(--pad));
}
.cell {
  min-width: 0;
  padding: var(--pad);
  box-shadow: -1px 0 0 var(--line), 0 -1px 0 var(--line);
}
.cell > :last-child { margin-bottom: 0; }
.cell-2 { grid-column: span 2; }
.cell-3 { grid-column: span 3; }
.cell-full { grid-column: 1 / -1; }
.cell-row-2 { grid-row: span 2; }
@media (max-width: 1100px) {
  .dash-grid { --pad: var(--s-5); }
}
@media (max-width: 960px) {
  .dash-grid { grid-template-columns: repeat(var(--cols-md, 2), minmax(0, 1fr)); }
  .dash-grid .cell-3 { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); margin-inline: 0; clip-path: none; }
  .dash-grid .cell { padding: var(--s-5) 0; box-shadow: 0 -1px 0 var(--line); }
  .dash-grid .cell:first-child { box-shadow: none; }
  .dash-grid :is(.cell-2, .cell-3) { grid-column: auto; }
  .dash-grid .cell-row-2 { grid-row: auto; }
}

/* small uppercase label for a section: <p class="section-label">Account</p>
   two parts: <p class="section-label"><span>Event dates</span><span>Nov 2026</span></p> */
.section-label {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px var(--s-4);
  margin: 0 0 var(--s-3);
  font-family: var(--font-label);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--muted);
}

/* text link with an arrow: <a class="link-arrow" href="..">My profile</a> */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
}
.link-arrow::after {
  content: "";
  width: 0.72em;
  height: 0.72em;
  flex: none;
  background: currentColor;
  -webkit-mask: var(--icon-arrow-ne) center / contain no-repeat;
  mask: var(--icon-arrow-ne) center / contain no-repeat;
}
.link-arrow:hover { color: var(--accent); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 4px; }
.link-arrow.is-right::after { -webkit-mask-image: var(--icon-arrow-r); mask-image: var(--icon-arrow-r); }

/* sparkline: <svg class="sparkline" viewBox="0 0 160 40"><path class="spark-area" d=".."/><path class="spark-line" d=".."/></svg> */
.sparkline { display: block; width: 100%; max-width: 180px; height: 40px; overflow: visible; }
.sparkline .spark-line, .sparkline polyline { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.sparkline .spark-area { fill: var(--accent-tint); stroke: none; }
.sparkline .spark-dot { fill: var(--accent); }

/* big number with a small unit: <span class="figure">2,458 <small>Elo</small></span> */
.figure { font-family: var(--font-heading); font-size: clamp(32px, 3.4vw, 42px); font-weight: 500; line-height: 1; letter-spacing: -0.01em; color: var(--heading); font-variant-numeric: lining-nums tabular-nums; }
.figure small { font-family: var(--font-body); font-size: 0.42em; font-weight: 600; letter-spacing: 0; color: var(--muted); }

/* plain list with hairlines between rows: <ul class="rule-list"><li>..</li></ul> */
.rule-list { list-style: none; margin: 0; padding: 0; }
.rule-list > li { display: flex; align-items: baseline; gap: var(--s-4); margin: 0; padding: 12px 0; border-top: 1px solid var(--line); }
.rule-list > li:first-child { border-top: 0; }

/* 23. Utilities ----------------------------------------------------------- */
.sr-only, .visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
[hidden] { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: lining-nums tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.full { width: 100%; }
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mt-2 { margin-top: var(--s-2); }
.mt-4 { margin-top: var(--s-4); }
.mt-6 { margin-top: var(--s-6); }
.mb-2 { margin-bottom: var(--s-2); }
.mb-4 { margin-bottom: var(--s-4); }
.mb-6 { margin-bottom: var(--s-6); }
@media (max-width: 640px) { .hide-sm { display: none !important; } }
@media (max-width: 960px) { .hide-md { display: none !important; } }
@media (min-width: 641px) { .show-sm { display: none !important; } }

/* Keyframes (cc-blink, cc-pulse, cc-grid, cc-dots, cc-shimmer kept for page styles that name them) */
@keyframes cc-blink { 50% { opacity: 0.35; } }
@keyframes cc-pulse { 50% { opacity: 0.6; } }
@keyframes cc-breathe { 50% { opacity: 0.4; } }
@keyframes cc-spin { to { transform: rotate(360deg); } }
@keyframes cc-grid { from { opacity: 1; } to { opacity: 1; } }
@keyframes cc-dots { 50% { opacity: 0.4; } }
@keyframes cc-shimmer { 50% { opacity: 0.5; } }
@keyframes cc-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes cc-toast-out { to { opacity: 0; transform: translateY(8px); } }

/* 24. Reduced motion, print ----------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .badge-running::before, .badge-validating::before, .skeleton, .loader::after { animation: none; opacity: 1; }
  .btn:active { transform: none; }
}

@media print {
  html, body { background: #fff; color: #000; }
  .card, .panel { box-shadow: none; }
  body { padding-left: 0 !important; }
  body::before, #cc-header, #cc-footer, .toast-region { display: none !important; }
}

/* Mode banner (js/api.js): demo data, or a server that did not answer. Slim and plain, above <main>. */
.mode-banner {
  padding: 6px var(--gutter, 16px);
  font: 500 var(--fs-xs)/1.45 var(--font-body);
  color: var(--amber);
  background: color-mix(in srgb, var(--amber) 8%, var(--bg));
  border-bottom: 1px solid color-mix(in srgb, var(--amber) 30%, transparent);
  letter-spacing: 0.02em;
  text-align: center;
}
.mode-banner.mode-error { color: var(--red); background: var(--red-tint); border-bottom-color: var(--red-2); }
.mode-retry { padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: inherit; text-decoration: underline; cursor: pointer; }
.mode-retry:disabled { cursor: default; opacity: .7; }

/* 25. v7 techy layer ------------------------------------------------------ */
/* Faint scan lines behind every page, the dark/light switch, pill buttons, corner ticks on
   panels and cards, and the sidebar in the v7 language. Later rules here win over 1 to 24. */
html { transition: background-color 0.4s; }
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, var(--scan) 0 1px, transparent 1px 4px);
  opacity: 0.35;
}
body.no-backdrop::before { content: none; }
a { text-decoration-color: var(--accent-line); }
.prose a, .lead a { color: var(--accent); }

/* labels: a glowing dot, then caps */
.kicker, .section-label {
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--text-dim);
}
.kicker { display: inline-flex; align-items: center; gap: 10px; }
.kicker::before, .section-label:not(:has(> span))::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--glow);
}
.section-label:not(:has(> span)) { justify-content: flex-start; align-items: center; gap: 10px; }
.page-head {
  border-bottom: 0;
  background: linear-gradient(90deg, var(--rule), var(--rule) 40%, transparent) left bottom / 100% 1px no-repeat;
}
.page-head h1 { font-size: clamp(32px, 4vw, 52px); }
.lead { font-size: var(--fs-md); line-height: 1.7; }
.prose { max-width: 76ch; }
.prose ul > li::before { background: var(--accent); }
h1 em, .h1 em { text-shadow: 0 0 40px var(--soft); }

/* theme switch: <button class="theme-toggle" data-theme-toggle><span class="t-dark">Dark</span><span class="t-light">Light</span></button> */
.theme-toggle {
  display: inline-flex;
  flex: none;
  gap: 2px;
  padding: 3px;
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  background: none;
  border: 1px solid var(--rule);
  border-radius: 999px;
  cursor: pointer;
}
.theme-toggle span { padding: 5px 10px; border-radius: 999px; transition: background-color 0.25s, color 0.25s; }
.theme-toggle:hover { color: var(--text); border-color: var(--accent-line); }
:root:not([data-theme="light"]) .theme-toggle .t-dark,
[data-theme="light"] .theme-toggle .t-light { color: #ffffff; background: var(--primary); }

/* buttons: pills in caps; primary is a pink fill, the rest are pink or quiet outlines */
.btn {
  min-height: 44px;
  padding: 10px 22px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 999px;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.3s, transform 0.3s;
}
.btn:hover { box-shadow: 0 0 0 1px var(--btn-edge), 0 0 22px var(--soft); }
.btn-primary, .btn-sage { --btn-fg: #ffffff; }
.btn-primary:hover, .btn-sage:hover { box-shadow: 0 0 0 1px var(--accent), 0 0 28px var(--glow); transform: translateY(-1px); }
.btn-secondary { --btn-bg: transparent; --btn-fg: var(--accent); --btn-edge: var(--accent); }
.btn-secondary:hover { --btn-bg: var(--accent-tint); --btn-edge: var(--accent); }
.btn-ghost { --btn-bg: transparent; --btn-fg: var(--text-dim); --btn-edge: var(--line-2); }
.btn-ghost:hover { --btn-bg: transparent; --btn-fg: var(--accent); --btn-edge: var(--accent-line); }
.btn-link { text-transform: none; letter-spacing: 0; font-size: var(--fs-sm); }
.btn-link:hover { box-shadow: none; }
.btn-sm { min-height: 34px; padding: 5px 14px; font-size: 11.5px; }
.btn-lg { min-height: 50px; padding: 13px 28px; font-size: 13px; }
.btn-team-a, .btn-team-b { --btn-fg: #0b0a0d; }

/* cards and panels: hairline boxes with a small pink tick in the top-left corner */
.card, .panel {
  background-color: var(--surface);
  background-image: linear-gradient(var(--accent), var(--accent)), linear-gradient(var(--accent), var(--accent));
  background-size: 12px 1px, 1px 12px;
  background-position: -1px -1px, -1px -1px;
  background-repeat: no-repeat;
  background-origin: border-box;
}
.panel-quiet, .card.no-tick, .panel.no-tick { background-image: none; }
.panel-quiet { background-color: transparent; }
a.card:hover, .card-link:hover, .card.is-hoverable:hover { box-shadow: 0 0 0 1px var(--accent-line), 0 0 28px var(--soft); }
.card-title { font-weight: 500; }
.panel-title, .card-meta, .code-head, .table th, .stat-label, .side-label, .crumbs { font-weight: 500; letter-spacing: 0.12em; }

/* tables: caps headers, a pink rule under them */
.table th { color: var(--muted); border-bottom-color: var(--rule); }
.table td { border-bottom-color: var(--line); }
.table tr.is-own td { background: var(--accent-tint); }
.rating { color: var(--accent); font-weight: 500; }
.leaderboard tr.rank-1 .rating { text-shadow: 0 0 18px var(--glow); }

/* forms */
.field > label:not(.check, .dropzone), .label {
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}
input:not([type="checkbox"], [type="radio"], [type="file"], [type="range"], [type="color"], [type="submit"], [type="button"], [type="reset"], [type="hidden"]),
select, textarea, .input {
  font-size: var(--fs-md);
  background-color: var(--bg-2);
  border-color: var(--line-2);
}
input:hover:not(:focus), select:hover:not(:focus), textarea:hover:not(:focus), .input:hover:not(:focus) { border-color: var(--line-3); }
input:focus, select:focus, textarea:focus, .input:focus { background-color: var(--bg); }
.dropzone { background: var(--bg-2); border-color: var(--line-3); }
.dropzone-title { font-size: 14px; font-weight: 500; }

/* tabs and segmented filters */
.tab { font-size: 12px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; }
.tab[aria-selected="true"], .tab[aria-current="page"], .tab.is-active { font-weight: 500; text-shadow: 0 0 14px var(--soft); }
.segmented { border-radius: 999px; background: transparent; border-color: var(--rule); }
.segmented > * { font-size: 11.5px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; border-radius: 999px; padding: 6px 14px; }
.segmented > [aria-pressed="true"], .segmented > .is-active, .segmented > [aria-current="page"] { color: #ffffff; background: var(--primary); box-shadow: none; }

/* code */
pre, .code { background: var(--bg-3); }
.code-head { background: transparent; border-bottom-color: var(--line); }

/* stats and big numbers */
.stat { border-left-color: var(--rule); }
.stat-value, .figure { letter-spacing: -0.03em; }
.versus { border-block-color: var(--rule); }
.versus .vs { color: var(--accent); border-inline-color: var(--line); }
.steps > li::before { font-weight: 500; }
.lp-step-n, .steps > li::before { box-shadow: 0 0 0 1px var(--accent-line); }

/* sidebar */
.cc-sidebar { background: var(--bg); border-right: 0; box-shadow: inset -1px 0 0 var(--line); }
@media (min-width: 1024px) {
  body:has(> #cc-header) > #cc-header { background: var(--bg); border-right-color: var(--line); }
}
.cc-sidebar::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 1px;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, var(--rule) 25%, var(--rule) 75%, transparent);
}
.cc-side-head { min-height: 76px; padding-left: 20px; }
.cc-brand img { width: 28px; height: 28px; }
.cc-sidebar .cc-brand .wordmark { flex-direction: column; gap: 1px; font-size: 12.5px; }
.cc-brand { gap: 12px; }
.cc-nav-group { font-size: 10.5px; font-weight: 500; letter-spacing: 0.14em; }
.cc-nav-group::before { content: "// "; color: var(--accent); opacity: 0.8; }
.cc-nav-link {
  min-height: 36px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  border-radius: 999px;
}
.cc-nav-link .icon { width: 16px; height: 16px; }
.cc-nav-link:hover { color: var(--accent); background: var(--accent-tint); }
.cc-nav-link:hover .icon { color: var(--accent); }
.cc-nav-link[aria-current="page"] { color: var(--accent); background: var(--accent-tint); font-weight: 500; text-shadow: 0 0 12px var(--soft); }
.cc-nav-link[aria-current="page"]::before {
  left: auto;
  right: 12px;
  top: 50%;
  bottom: auto;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  box-shadow: 0 0 10px var(--glow);
}
.cc-side-tools { padding: var(--s-3) var(--s-4) var(--s-2) 20px; }
.cc-side-foot { border-top-color: var(--line); }
.cc-user { border-radius: 999px; }
.cc-user:hover { background: var(--accent-tint); }
.cc-user-name { font-weight: 500; }
.cc-icon-btn { border-radius: 999px; }
.cc-icon-btn:hover { color: var(--accent); background: var(--accent-tint); }
.cc-topbar { background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom-color: var(--line); }
.cc-topbar .cc-brand img { width: 26px; height: 26px; }
.cc-topbar .theme-toggle { margin-left: auto; }
@media (max-width: 420px) { .cc-topbar .wordmark { font-size: 11.5px; } }
.cc-scrim { background: rgba(0, 0, 0, 0.6); }
@media (min-width: 1024px) {
  .cc-collapsed .cc-brand img { width: 28px; height: 28px; }
  .cc-collapsed .cc-side-tools { padding-inline: 10px; display: flex; justify-content: center; }
  .cc-collapsed .theme-toggle span { padding: 5px 6px; font-size: 9px; letter-spacing: 0.04em; }
  .cc-collapsed .cc-nav-link[aria-current="page"]::before { right: 4px; }
  .cc-collapsed .cc-nav-group::before { content: none; }
}

/* footer */
.site-footer { position: relative; border-top: 0; font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; }
.site-footer::before {
  content: "";
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--rule), transparent);
}
.site-footer a { color: var(--accent); opacity: 0.85; }
.site-footer a:hover { opacity: 1; text-shadow: 0 0 12px var(--glow); }

/* status colours on badges stay; the pill "You" chip reads on pink */
.pill, .table tr.is-own .team-cell::after { color: #ffffff; background: var(--primary); font-weight: 500; }
.badge { font-weight: 500; }

/* mode banner: a thin readout strip */
.mode-banner { font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; }

@media (prefers-reduced-motion: reduce) {
  .btn:hover, .btn-primary:hover { transform: none; }
  html { transition: none; }
}
@media print {
  body::before { content: none; }
}
