:root {
  --font-sans: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  --text-base: 18px;
  --text-min: 14px;
  --text-small: 15px;
  --text-h1: clamp(2.25rem, 1.5rem + 3.5vw, 3.75rem);
  --text-h2: clamp(1.625rem, 1.25rem + 1.5vw, 2.25rem);
  --text-h3: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  --leading-body: 1.65;
  --leading-heading: 1.2;
  --leading-title: 1.1;
  --leading-tight: 1.35;
  --measure: 62ch;
  --tracking-title: -0.02em;
  --tracking-label: 0.04em;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  --space-9: 56px;
  --space-10: 80px;
  --space-gutter: 16px;
  --space-target: 44px;
  --space-navTarget: 48px;
  --space-page: 1120px;
  --radius-card: 20px;
  --radius-callout: 16px;
  --radius-button: 12px;
  --radius-chip: 999px;
  --radius-focus: 6px;
  --motion-press: 150ms;
  --motion-ease: cubic-bezier(0.2, 0, 0, 1);
  --focus-ring: 3px;
  --kind-actor: var(--k-actor);
  --kind-action: var(--k-action);
  --kind-place: var(--k-place);
  --kind-thing: var(--k-thing);
  --kind-concept: var(--k-concept);
  --kind-game: var(--k-game);
  --kind-rule: var(--k-rule);
  --c-bg: #0B0C10;
  --c-surface: #15171E;
  --c-surface2: #1F222B;
  --c-fg: #F4F5F7;
  --c-muted: #A9AEBB;
  --c-line: #5C6475;
  --c-accent: #C8FF3D;
  --c-accentFg: #0B0C10;
  --c-focus: #8BC4FF;
  --k-actor: #E8704A;
  --k-action: #8FB8FF;
  --k-place: #5FF59A;
  --k-thing: #F2628C;
  --k-concept: #8A86FF;
  --k-game: #F5A01A;
  --k-rule: #BCC8DA;
  color-scheme: dark;
  --d-added: #6EE7A8;
  --d-dropped: #E8504A;
  --e-0: #FFD84D;
  --e-1: #FF7A59;
  --e-2: #4CC9F0;
  --e-3: #C77DFF;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --c-bg: #F7F8FA;
    --c-surface: #FFFFFF;
    --c-surface2: #EDEFF3;
    --c-fg: #0B0C10;
    --c-muted: #5A6070;
    --c-line: #848B9A;
    --c-accent: #2E6B00;
    --c-accentFg: #FFFFFF;
    --c-focus: #1D4ED8;
    --k-actor: #C20500;
    --k-action: #0A3F7C;
    --k-place: #20724E;
    --k-thing: #4E1835;
    --k-concept: #763EE8;
    --k-game: #332402;
    --k-rule: #59617B;
    color-scheme: light;
    --d-added: #0E6E4A;
    --d-dropped: #C2410C;
    --e-0: #996600;
    --e-1: #7A1414;
    --e-2: #0B66C2;
    --e-3: #3D1A78;
  }
}
:root[data-theme="dark"] {
  --c-bg: #0B0C10;
  --c-surface: #15171E;
  --c-surface2: #1F222B;
  --c-fg: #F4F5F7;
  --c-muted: #A9AEBB;
  --c-line: #5C6475;
  --c-accent: #C8FF3D;
  --c-accentFg: #0B0C10;
  --c-focus: #8BC4FF;
  --k-actor: #E8704A;
  --k-action: #8FB8FF;
  --k-place: #5FF59A;
  --k-thing: #F2628C;
  --k-concept: #8A86FF;
  --k-game: #F5A01A;
  --k-rule: #BCC8DA;
  color-scheme: dark;
  --d-added: #6EE7A8;
  --d-dropped: #E8504A;
  --e-0: #FFD84D;
  --e-1: #FF7A59;
  --e-2: #4CC9F0;
  --e-3: #C77DFF;
}
:root[data-theme="light"] {
  --c-bg: #F7F8FA;
  --c-surface: #FFFFFF;
  --c-surface2: #EDEFF3;
  --c-fg: #0B0C10;
  --c-muted: #5A6070;
  --c-line: #848B9A;
  --c-accent: #2E6B00;
  --c-accentFg: #FFFFFF;
  --c-focus: #1D4ED8;
  --k-actor: #C20500;
  --k-action: #0A3F7C;
  --k-place: #20724E;
  --k-thing: #4E1835;
  --k-concept: #763EE8;
  --k-game: #332402;
  --k-rule: #59617B;
  color-scheme: light;
  --d-added: #0E6E4A;
  --d-dropped: #C2410C;
  --e-0: #996600;
  --e-1: #7A1414;
  --e-2: #0B66C2;
  --e-3: #3D1A78;
}
[data-kind="actor"] { --kc: var(--kind-actor); }
[data-kind="action"] { --kc: var(--kind-action); }
[data-kind="place"] { --kc: var(--kind-place); }
[data-kind="thing"] { --kc: var(--kind-thing); }
[data-kind="concept"] { --kc: var(--kind-concept); }
[data-kind="game"] { --kc: var(--kind-game); }
[data-kind="rule"] { --kc: var(--kind-rule); }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-fg);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  hyphens: none;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}
img, svg, canvas, video { max-width: 100%; }

/* Type */
h1, h2, h3, h4 { color: var(--c-fg); margin: 0 0 var(--space-3); overflow-wrap: anywhere; }
h1 { font-size: var(--text-h1); font-weight: 800; line-height: var(--leading-title); letter-spacing: var(--tracking-title); }
h2 { font-size: var(--text-h2); font-weight: 800; line-height: var(--leading-heading); margin-top: var(--space-7); }
h3 { font-size: var(--text-h3); font-weight: 700; line-height: var(--leading-heading); }
h4 { font-size: var(--text-base); font-weight: 700; line-height: var(--leading-heading); }
.card > h2:first-child, .card > h3:first-child, .card > .label + h2, .card > .label + h3 { margin-top: 0; }
p, ul, ol, dl, blockquote { margin: 0 0 var(--space-4); }
main p, main li, main dd, main blockquote, .prose { max-width: var(--measure); }
strong, b { font-weight: 700; }
a { color: var(--c-accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 3px; }
small, .muted, .mut, .meta { color: var(--c-muted); font-size: var(--text-small); line-height: var(--leading-tight); }
code, kbd, .mono { font-family: var(--font-mono); font-size: var(--text-small); background: var(--c-surface2); border-radius: var(--radius-focus); padding: 0 var(--space-1); }
.lede { font-size: var(--text-h3); font-weight: 500; line-height: var(--leading-tight); max-width: var(--measure); }
.label, .eyebrow {
  display: block;
  font-size: var(--text-small);
  font-weight: 700;
  line-height: var(--leading-tight);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--c-muted);
  margin: 0 0 var(--space-3);
}
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* Focus: never removed, always replaced by the ring */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: 2px;
  border-radius: var(--radius-focus);
}

/* Skip link: first focusable element, shown as a primary button on focus */
.skip {
  position: absolute;
  left: var(--space-4);
  top: calc(-1 * var(--space-10));
  z-index: 100;
  display: inline-flex;
  align-items: center;
  min-height: var(--space-target);
  padding: 0 var(--space-5);
  border-radius: var(--radius-button);
  background: var(--c-accent);
  color: var(--c-accentFg);
  font-weight: 700;
  text-decoration: none;
}
.skip:focus, .skip:focus-visible { top: var(--space-4); }

/* Page frame */
.wrap {
  width: 100%;
  max-width: var(--space-page);
  margin: 0 auto;
  padding-left: var(--space-gutter);
  padding-right: var(--space-gutter);
}
.site-header { border-bottom: 1px solid var(--c-line); background: var(--c-bg); }
.site-header .bar { display: flex; align-items: center; gap: var(--space-4); min-height: var(--space-9); }
.brand {
  display: inline-flex; align-items: center; min-height: var(--space-target);
  font-size: var(--text-h3); font-weight: 800; letter-spacing: var(--tracking-title);
  color: var(--c-fg); text-decoration: none;
}
.brand .dot { color: var(--c-accent); }
.theme-toggle { margin-left: auto; }
main { display: block; padding-top: var(--space-6); padding-bottom: var(--space-9); }
main:focus { outline: none; }
.site-footer {
  border-top: 1px solid var(--c-line);
  color: var(--c-muted);
  font-size: var(--text-small);
  line-height: var(--leading-tight);
  padding-top: var(--space-6);
  padding-bottom: var(--space-7);
}
.site-footer p { margin: 0 0 var(--space-2); max-width: var(--measure); }

/* Nav: shared. The top items are links or the Learn disclosure button; the panel's own links are styled below. */
.nav > ul { list-style: none; margin: 0; padding: 0; display: flex; }
.nav > ul > li > a, .nav .learn-btn {
  display: flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--space-target); color: var(--c-fg); text-decoration: none; font-weight: 700;
}
.nav .learn-btn { width: 100%; border: 0; background: none; font-family: inherit; font-size: inherit; font-weight: 700; cursor: pointer; }
.nav [aria-current] { color: var(--c-accent); }
.nav > ul > li > a svg, .nav .learn-btn svg { width: 22px; height: 22px; flex: none; }
.nav .learn-btn { display: none; }
.js .nav .learn-btn { display: flex; }
.js .nav .learn-link { display: none; }
.learn-panel {
  position: absolute; z-index: 60; left: 0; right: 0;
  max-height: calc(100dvh - var(--space-10) - var(--space-4)); overflow-y: auto; overscroll-behavior: contain;
  background: var(--c-surface); border: 1px solid var(--c-line); padding: var(--space-3) var(--space-4);
  color: var(--c-fg); text-align: left;
}
.learn-panel[hidden] { display: none; }
.learn-panel h2 { font-size: var(--text-small); text-transform: uppercase; letter-spacing: 0.06em; color: var(--c-muted); margin: var(--space-3) 0 var(--space-1); }
.learn-panel ul { list-style: none; margin: 0; padding: 0; }
.learn-panel a { display: flex; align-items: center; min-height: var(--space-target); color: var(--c-fg); text-decoration: none; font-weight: 600; }
.learn-panel a:hover { text-decoration: underline; }
.learn-all { margin: var(--space-2) 0 0; border-top: 1px solid var(--c-line); }

/* Nav: phones, a fixed bottom bar in the thumb zone; the Learn panel opens above it, full width */
@media (max-width: 719.98px) {
  .nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    background: var(--c-surface);
    border-top: 1px solid var(--c-line);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .nav > ul > li { flex: 1 1 0; min-width: 0; }
  .nav > ul > li > a, .nav .learn-btn {
    flex-direction: column;
    gap: 2px;
    min-height: var(--space-navTarget);
    padding: var(--space-1) 0;
    font-size: var(--text-min);
    line-height: var(--leading-tight);
  }
  .nav > ul > li > a[aria-current="page"], .nav .learn-btn[aria-current="page"], .nav .learn-btn[aria-expanded="true"] { box-shadow: inset 0 3px 0 var(--c-accent); }
  .nav .learn-panel { bottom: 100%; border-width: 1px 0 0; }
  body { padding-bottom: calc(var(--space-10) + env(safe-area-inset-bottom, 0px)); }
  /* Keyboard focus never lands behind the fixed bar (WCAG 2.4.11) */
  html:not(.immersive) { scroll-padding-bottom: calc(var(--space-10) + env(safe-area-inset-bottom, 0px) + var(--space-3)); }
}

/* Nav: desktop, a top bar; the panel drops below it */
@media (min-width: 720px) {
  .nav { position: relative; }
  .nav > ul { gap: var(--space-1); }
  .nav > ul > li > a, .nav .learn-btn { padding: 0 var(--space-3); border-radius: var(--radius-button); }
  .nav > ul > li > a:hover, .nav .learn-btn:hover { background: var(--c-surface2); }
  .nav svg { display: none; }
  .nav > ul > li > a[aria-current="page"], .nav .learn-btn[aria-current="page"], .nav .learn-btn[aria-expanded="true"] { box-shadow: inset 0 -3px 0 var(--c-accent); border-radius: 0; }
  .learn-panel {
    top: 100%; left: 0; right: auto; width: min(44rem, calc(100vw - 2 * var(--space-gutter)));
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--space-6);
    border-radius: var(--radius-callout); border-width: 1px;
  }
  .learn-panel[hidden] { display: none; }
  .learn-all { grid-column: 1 / -1; }
}

/* Bento grid and cards */
.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-3); margin: 0 0 var(--space-3); }
.grid > * { min-width: 0; margin: 0; }
.stack > * + * { margin-top: var(--space-3); }
header.stack { margin-bottom: var(--space-4); }
@media (min-width: 720px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); margin-bottom: var(--space-4); }
  .grid > .wide { grid-column: 1 / -1; }
  .stack > * + * { margin-top: var(--space-4); }
}
@media (min-width: 1024px) {
  .grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.card {
  display: block;
  background: var(--c-surface);
  color: var(--c-fg);
  border: 1px solid var(--c-line);
  border-radius: var(--radius-card);
  padding: var(--space-5);
  min-width: 0;
}
@media (min-width: 720px) { .card { padding: var(--space-6); } }
.card[data-kind] { border-top: 4px solid var(--kc); }
.card > :last-child { margin-bottom: 0; }
a.card { text-decoration: none; }
a.card:hover { border-color: var(--c-accent); }
a.card .card-title { color: var(--c-fg); }
ul.grid { list-style: none; padding: 0; }
a.card > .card-title, a.card > .muted { display: block; }
.card-title { font-size: var(--text-h3); font-weight: 700; line-height: var(--leading-heading); margin: 0 0 var(--space-2); }

/* Chips and pills: tappable relations */
.chips { list-style: none; margin: 0 0 var(--space-4); padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chips > li { margin: 0; max-width: 100%; }
.chip, .pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--space-target);
  max-width: 100%;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-chip);
  background: var(--c-surface2);
  border: 1px solid var(--kc, var(--c-line));
  color: var(--kc, var(--c-fg));
  font-size: var(--text-small);
  font-weight: 500;
  line-height: var(--leading-tight);
  text-decoration: none;
}
a.chip:hover, a.pill:hover { border-color: var(--c-accent); }
.chip[aria-current="true"], .chip.selected { border-color: var(--c-accent); color: var(--c-accent); }
.chip svg, .pill svg { width: 16px; height: 16px; flex: none; }

/* Kind badge: colour plus icon plus the kind word, never colour alone */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-chip);
  border: 1px solid var(--kc, var(--c-line));
  color: var(--kc, var(--c-fg));
  background: var(--c-surface2);
  font-size: var(--text-small);
  font-weight: 700;
  line-height: var(--leading-tight);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  margin: 0 0 var(--space-3);
}
.badge svg { width: 16px; height: 16px; flex: none; }

/* Callouts: definition (accent bar), interpretation, GAA */
.callout, blockquote {
  background: var(--c-surface2);
  border-left: 4px solid var(--c-accent);
  border-radius: var(--radius-callout);
  padding: var(--space-4) var(--space-5);
  margin: 0 0 var(--space-4);
}
.callout > :last-child, blockquote > :last-child { margin-bottom: 0; }
.callout.interp { border-left-color: var(--k-rule); }
.callout.gaa { border-left-color: var(--c-muted); }
.callout cite, blockquote cite { display: block; font-style: normal; color: var(--c-muted); font-size: var(--text-small); margin-top: var(--space-2); }

/* Step list: large numbers */
ol.steps { list-style: none; counter-reset: step; padding: 0; margin: 0 0 var(--space-4); }
ol.steps > li {
  counter-increment: step;
  position: relative;
  padding-left: calc(var(--space-8) + var(--space-4));
  min-height: var(--space-8);
  margin: 0 0 var(--space-4);
}
ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  min-width: var(--space-8);
  min-height: var(--space-8);
  display: grid;
  place-items: center;
  border-radius: var(--radius-chip);
  background: var(--c-surface2);
  color: var(--c-fg);
  font-size: var(--text-base);
  font-weight: 800;
  line-height: 1;
}
ol.steps > li .chip { margin-top: var(--space-2); }

/* Rule text: big sub-rule letter */
.sub-head { display: flex; align-items: center; gap: var(--space-4); margin: 0 0 var(--space-4); }
.sub-head > h2, .sub-head > h3 { margin: 0; }
.letter {
  display: inline-grid;
  place-items: center;
  flex: none;
  min-width: var(--space-9);
  min-height: var(--space-9);
  padding: 0 var(--space-2);
  border-radius: var(--radius-callout);
  background: var(--c-surface2);
  color: var(--c-fg);
  font-size: var(--text-h2);
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}
.rule-text p { max-width: var(--measure); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--space-target);
  min-width: var(--space-target);
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-button);
  border: 1px solid var(--c-line);
  background: var(--c-surface2);
  color: var(--c-fg);
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: 700;
  line-height: var(--leading-tight);
  text-decoration: none;
  cursor: pointer;
}
.copy-link { margin-bottom: var(--space-3); }
.btn:hover { border-color: var(--c-accent); }
.btn.primary { background: var(--c-accent); border-color: var(--c-accent); color: var(--c-accentFg); }
.btn svg { width: 18px; height: 18px; flex: none; }
.pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); margin: var(--space-6) 0; }
.pager .btn { width: 100%; }
.pager .prev { justify-content: flex-start; }
.pager .next { justify-content: flex-end; grid-column: 2; text-align: right; }
.pager .full { grid-column: 1 / -1; }

/* Breadcrumbs and the corrections block (History section) */
.crumbs { margin: 0 0 var(--space-3); }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-2); font-size: var(--text-small); color: var(--c-muted); }
.crumbs li { display: inline-flex; align-items: center; }
.crumbs li + li::before { content: "/"; margin-right: var(--space-2); }
/* History (H28 + X37): breadcrumbs, stand-alone list links, related-question ids and the correction link are 44px targets */
.crumbs a, .crumbs ~ .stack > li > a:not(.card), .crumbs ~ * .stack > li > a:not(.card), .oq p.muted a, .corrections a {
  display: inline-flex; align-items: center; min-height: var(--space-target); overflow-wrap: anywhere;
}
.crumbs a, .oq p.muted a, .corrections a { justify-content: center; min-width: var(--space-target); }
.corrections { border-top: 1px solid var(--c-line); margin-top: var(--space-7); padding-top: var(--space-3); }

/* Details: tap rows */
details {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--radius-callout);
  margin: 0 0 var(--space-3);
}
details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: var(--space-target);
  padding: var(--space-2) var(--space-4);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  border-radius: var(--radius-callout);
}
details > summary::-webkit-details-marker { display: none; }
details > summary::after {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-right: var(--space-1);
}
details[open] > summary::after { transform: rotate(-135deg); }
details > :not(summary) { margin-left: var(--space-4); margin-right: var(--space-4); }
details > :last-child:not(summary) { margin-bottom: var(--space-4); }
.card details { background: var(--c-surface2); }

/* Lists */
ul.cols { columns: 2 240px; column-gap: var(--space-7); padding-left: var(--space-5); }
ul.cols > li { break-inside: avoid; margin: 0 0 var(--space-2); }
.history-chart { width: 100%; max-width: 32rem; height: auto; display: block; }
.history-chart .hc-bar { fill: var(--c-accent); }
.history-chart text { fill: var(--c-fg); font-family: var(--font-sans); font-size: 14px; }
.history-chart .hc-count { font-weight: 700; }
.history-figure { margin: 0 0 var(--space-4); }
.timeline { list-style: none; padding: 0; }
.timeline > li { padding: var(--space-3) 0; border-bottom: 1px solid var(--c-line); margin: 0; }
.timeline > li:last-child { border-bottom: 0; }
.history-rules dt { font-weight: 700; }
.history-rules dd { margin: 0 0 var(--space-3); }
ul.hits { list-style: none; padding: 0; }
ul.hits > li { padding: var(--space-3) 0; border-bottom: 1px solid var(--c-line); margin: 0; }
ul.hits > li:last-child { border-bottom: 0; }
/* Links that stand alone in lists, meta lines, cites and the footer are tap targets, so they get the full 44px */
ul.cols a, ul.hits > li > a, .more a, .meta a, .eyebrow a, cite a, .site-footer a {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--space-target); min-width: var(--space-target);
}
/* Rulebooks: current vs historical (/browse/, /rules/<book>/, /rulebooks/<edition>/). The status is
   always an icon plus a word; the current section is framed in the accent, historical is muted and dashed. */
.rb-status {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-1) var(--space-3); margin: 0 var(--space-2) var(--space-2) 0;
  border-radius: var(--radius-chip); border: 2px solid var(--c-line); background: var(--c-surface2);
  color: var(--c-fg); font-size: var(--text-small); font-weight: 700; line-height: var(--leading-tight);
  text-transform: uppercase; letter-spacing: var(--tracking-label); white-space: nowrap;
}
.rb-status svg { width: 16px; height: 16px; flex: none; }
.rb-status[data-status="current"] { border-color: var(--c-accent); color: var(--c-accent); }
.rb-status[data-status="historical"] { border-style: dashed; border-color: var(--c-muted); color: var(--c-muted); }
.rb-current-sec { border: 3px solid var(--c-accent); border-radius: var(--radius-card); padding: var(--space-5); margin: var(--space-6) 0; background: var(--c-surface); }
.rb-current-sec > h2 { margin-top: 0; }
ul.rb-cards { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-4); }
.rb-card { background: var(--c-surface2); border-radius: var(--radius-card); border-left: 6px solid var(--c-accent); padding: var(--space-4) var(--space-5); margin: 0; }
.rb-card h3 { margin: var(--space-1) 0 var(--space-2); }
.rb-card h3 a { display: inline-flex; align-items: center; min-height: var(--space-target); }
.rb-asof { font-size: var(--text-h3); font-weight: 800; line-height: var(--leading-tight); margin: 0 0 var(--space-2); }
.rb-card-meta { font-weight: 500; margin-bottom: var(--space-2); }
.rb-tree { margin-top: var(--space-3); }
.rb-hist-sec, .rb-known-sec { margin-top: var(--space-8); }
ul.rb-rows, ul.rb-known { list-style: none; padding: 0; margin: 0 0 var(--space-5); }
.rb-row, .rb-known > li { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--space-3); padding: var(--space-2) 0; margin: 0; border-top: 1px dashed var(--c-line); }
.rb-row .rb-status { margin: 0; }
.rb-row-date { font-weight: 700; font-variant-numeric: tabular-nums; }
.rb-row-name, .rb-row-meta, .rb-reason { flex: 1 1 100%; }
.rb-row-name a { display: inline-flex; align-items: center; min-height: var(--space-target); }
.rb-row-meta, .rb-reason { color: var(--c-muted); font-size: var(--text-small); }
@media (min-width: 720px) {
  .rb-row { display: grid; grid-template-columns: 10rem 9.5rem minmax(0, 1fr); }
  .rb-row-meta { grid-column: 3; }
}
.rb-banner { border: 2px dashed var(--c-muted); border-radius: var(--radius-callout); background: var(--c-surface2); padding: var(--space-3) var(--space-4); margin: 0 0 var(--space-5); }
.rb-banner p { margin: 0; }
.rb-banner a { font-weight: 700; display: inline-flex; align-items: center; min-height: var(--space-target); }
.rb-dates { border: 1px solid var(--c-line); border-radius: var(--radius-card); padding: var(--space-4) var(--space-5); margin: 0 0 var(--space-5); background: var(--c-surface); }
.rb-dates[data-status="current"] { border: 3px solid var(--c-accent); }
.rb-dates[data-status="historical"] { border-style: dashed; border-color: var(--c-muted); }
.rb-facts { display: grid; gap: var(--space-1); margin: 0; }
.rb-facts > div { display: grid; grid-template-columns: minmax(6.5rem, max-content) minmax(0, 1fr); gap: var(--space-3); }
.rb-facts dt { font-weight: 700; }
.rb-facts dd { margin: 0; }
/* /credits/: one entry per historical edition, stacked label/value lines that wrap at 360px */
ul.cr-list { list-style: none; padding: 0; margin: 0 0 var(--space-5); }
.cr-row { padding: var(--space-3) 0; margin: 0; border-top: 1px dashed var(--c-line); }
.cr-name { margin: 0 0 var(--space-1); font-weight: 700; }
.cr-name a { display: inline-flex; align-items: center; min-height: var(--space-target); }
.cr-facts { display: grid; gap: var(--space-1); margin: 0; font-size: var(--text-small); }
.cr-facts > div { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.cr-facts dt { font-weight: 700; color: var(--c-muted); }
.cr-facts dd { margin: 0; overflow-wrap: anywhere; }
@media (min-width: 720px) {
  .cr-facts > div { grid-template-columns: 9rem minmax(0, 1fr); gap: var(--space-3); }
}
.credit { margin: 0 0 var(--space-3); color: var(--c-muted); font-size: var(--text-small); line-height: var(--leading-tight); max-width: var(--measure); }
.rb-dateline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); margin: 0 0 var(--space-3); font-weight: 500; }
.rb-dateline .rb-status { margin: 0; }
.rb-dateline a { display: inline-flex; align-items: center; min-height: var(--space-target); }
.rb-howto { border-left: 4px solid var(--c-accent); padding: var(--space-2) var(--space-4); margin: 0 0 var(--space-5); }
.rb-howto ul { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-2); }
.rb-howto li { margin: 0; }
.rb-howto li > strong { display: inline-block; min-width: 5.5rem; }
.rb-summary, .rb-delta, .rb-about { margin-bottom: var(--space-5); }
.rb-terms { margin-top: var(--space-6); }
.rb-terms ul a { display: inline-flex; align-items: center; min-height: var(--space-target); }
a.term { text-decoration-style: dotted; }
/* Sub-rule letters sit together on one wrapping row instead of drifting apart on separate lines */
.meta { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0 var(--space-1); }
/* A result card that is one big link underlines only its title, not the grey excerpt */
ul.hits > li > a:has(.excerpt) { text-decoration: none; }
ul.hits > li > a:has(.excerpt) strong { text-decoration: underline; }
mark { background: transparent; color: var(--c-accent); font-weight: 800; text-decoration: underline; }
.excerpt { display: block; color: var(--c-muted); font-size: var(--text-small); line-height: var(--leading-tight); margin-top: var(--space-1); }

/* /compare/: the table scrolls inside its own container, never the page */
.cmp-scroll { overflow-x: auto; max-width: 100%; margin: 0 0 var(--space-5); border: 1px solid var(--c-line); border-radius: var(--radius-card); }
.cmp { border-collapse: collapse; width: 100%; min-width: 64rem; font-size: var(--text-small); }
.cmp caption { text-align: left; padding: var(--space-3); color: var(--c-muted); }
.cmp th, .cmp td { border-top: 1px solid var(--c-line); padding: var(--space-3); text-align: left; vertical-align: top; min-width: 11rem; }
.cmp thead th { background: var(--c-surface2); color: var(--c-fg); }
.cmp tbody th { background: var(--c-surface); font-weight: 700; position: sticky; left: 0; }
.cmp .cmp-no, .cmp .cmp-none { color: var(--c-muted); }
.cmp .cmp-yes { background: var(--c-surface); }
.cmp-picker .chip { margin: 0 var(--space-1) var(--space-1) 0; }

/* /guide/angles/: drawn figures (inline SVG, colours only from tokens) and the summary table */
.fig { margin: 0 0 var(--space-5); }
.fig svg { display: block; width: 100%; max-width: 36rem; height: auto; background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius-card); }
.fig figcaption { margin-top: var(--space-2); max-width: var(--measure); color: var(--c-muted); font-size: var(--text-small); line-height: var(--leading-tight); }
.fig text { fill: var(--c-fg); font-family: var(--font-sans); font-size: 14px; }
.fig text.t-mut { fill: var(--c-muted); }
.fig .area { fill: var(--c-surface2); }
.fig .surf { stroke: var(--c-fg); stroke-width: 4; stroke-linecap: round; }
.fig .gl { stroke: var(--c-line); stroke-width: 1; }
.fig .ball { fill: var(--c-surface2); stroke: var(--c-fg); stroke-width: 2; }
.fig .ln { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.fig .l-fg { stroke: var(--c-fg); }
.fig .l-acc { stroke: var(--c-accent); stroke-width: 3; }
.fig .l-mut { stroke: var(--c-muted); stroke-dasharray: 8 6; }
.fig .l-a { stroke: var(--k-actor); stroke-dasharray: 2 5; stroke-width: 3; }
.fig .l-b { stroke: var(--k-action); stroke-dasharray: 12 5 3 5; }
.fig .l-spin { stroke: var(--k-concept); }
.fig .f-fg { fill: var(--c-fg); }
.fig .f-acc { fill: var(--c-accent); }
.fig .f-mut { fill: var(--c-muted); }
.fig .f-a { fill: var(--k-actor); }
.fig .f-b { fill: var(--k-action); }
.fig .f-spin { fill: var(--k-concept); }
/* Player guide diagrams (pages/guideFigures.ts): court lines, players, areas, and optional motion */
.fig .cl { stroke: var(--c-fg); stroke-width: 1.5; }
.fig .cl-dash { stroke-dasharray: 6 5; }
.fig .lead { stroke: var(--c-muted); stroke-width: 1; }
.fig .zone { fill: var(--c-accent); fill-opacity: 0.18; stroke: var(--c-accent); stroke-width: 1.5; stroke-dasharray: 5 4; }
.fig .zone-mut { fill: var(--c-muted); fill-opacity: 0.16; stroke: var(--c-muted); stroke-width: 1; stroke-dasharray: 2 4; }
.fig .mk-you { fill: var(--c-accent); stroke: var(--c-fg); stroke-width: 1.5; }
.fig .mk-pal { fill: var(--k-actor); stroke: var(--c-fg); stroke-width: 1.5; }
.fig .mk-opp { fill: var(--c-surface); stroke: var(--c-muted); stroke-width: 3; }
.fig .mk-ghost { fill: none; stroke: var(--c-muted); stroke-width: 2; stroke-dasharray: 4 3; }
.gsteps { list-style: none; padding-left: 0; }
.gsteps > li + li { border-top: 1px solid var(--c-line); padding-top: var(--space-4); }
.gfig text { font-size: 16px; }
.gstep > p { margin: 0 0 var(--space-2); }
.gstep .fig { margin: 0 0 var(--space-4); }
.gstep .fig svg { max-width: 26rem; }
.fig-ref { white-space: nowrap; }
.fig-play { margin-left: var(--space-2); min-height: 36px; padding: 0 var(--space-3); vertical-align: middle; }
/* Motion: the drawing at rest is the end state. Parts move only while the page script has set
   data-anim="play" (never by itself under prefers-reduced-motion; the reader can still press Play,
   which is why these rules carry !important over the reduced-motion reset). Each part moves once. */
.mv-draw { stroke-dasharray: 1 1; }
.gfig[data-anim="play"] .mv, .gfig[data-anim="paused"] .mv {
  animation-duration: 0.9s !important;
  animation-timing-function: ease-in-out !important;
  animation-fill-mode: both !important;
  animation-iteration-count: 1 !important;
  animation-play-state: running !important;
}
.gfig[data-anim="play"] .mv-draw, .gfig[data-anim="paused"] .mv-draw { animation-name: gf-draw !important; }
.gfig[data-anim="play"] .mv-step, .gfig[data-anim="paused"] .mv-step { animation-name: gf-step !important; }
.gfig[data-anim="paused"] .mv { animation-play-state: paused !important; }
.gfig[data-anim] .d1 { animation-delay: 0.9s !important; }
.gfig[data-anim] .d2 { animation-delay: 1.8s !important; }
.gfig[data-anim] .d3 { animation-delay: 2.7s !important; }
@keyframes gf-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes gf-step { from { transform: translate(var(--dx), var(--dy)); } to { transform: none; } }
.sum { border-collapse: collapse; width: 100%; margin: 0 0 var(--space-5); font-size: var(--text-small); line-height: var(--leading-tight); }
.sum caption { text-align: left; color: var(--c-muted); padding: 0 0 var(--space-2); }
.sum th, .sum td { border-top: 1px solid var(--c-line); padding: var(--space-3); text-align: left; vertical-align: top; }
.sum thead th { background: var(--c-surface2); color: var(--c-fg); }
.sum tbody th { font-weight: 700; }
@media (max-width: 599.98px) {
  .sum thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); }
  .sum tr { display: block; border-top: 1px solid var(--c-line); padding: var(--space-3) 0; }
  .sum th, .sum td { display: block; border: 0; padding: var(--space-1) 0; }
  .sum th::before, .sum td::before { content: attr(data-label); display: block; color: var(--c-muted); font-weight: 700; }
}
.cmp-picker select { min-height: var(--space-target); }
/* /balls/: cards, lists, tables and the bounce chart; every colour is a token */
.b-cards { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1fr); margin: 0 0 var(--space-5); }
@media (min-width: 720px) { .b-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ball-card { border: 1px solid var(--c-line); border-radius: var(--radius-card); background: var(--c-surface); padding: var(--space-3) var(--space-4); min-width: 0; }
.ball-card h3 { margin: 0 0 var(--space-2); }
.ball-card dl { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: var(--space-1) var(--space-2); margin: 0; font-size: var(--text-small); }
.ball-card dt { font-weight: 700; color: var(--c-muted); }
.ball-card dd { margin: 0; overflow-wrap: anywhere; }
ul.b-list { list-style: none; padding: 0; margin: 0 0 var(--space-5); }
ul.b-list > li { padding: var(--space-3) 0; margin: 0; border-top: 1px dashed var(--c-line); overflow-wrap: anywhere; }
.b-yr { display: inline-block; min-width: 3.4rem; font-weight: 800; color: var(--c-accent); }
.b-fig, .b-src { font-size: var(--text-small); color: var(--c-muted); }
.b-scroll { overflow-x: auto; max-width: 100%; margin: 0 0 var(--space-5); border: 1px solid var(--c-line); border-radius: var(--radius-card); }
.b-tbl { border-collapse: collapse; width: 100%; min-width: 28rem; font-size: var(--text-small); }
.b-tbl caption { text-align: left; padding: var(--space-3); color: var(--c-muted); }
.b-tbl th, .b-tbl td { border-top: 1px solid var(--c-line); padding: var(--space-2) var(--space-3); text-align: left; vertical-align: top; }
.b-tbl thead th { background: var(--c-surface2); }
/* History results tables fit the column instead of scrolling: cells wrap, so no column is cut off */
.fit .b-tbl { min-width: 0; }
@media (max-width: 599.98px) { .fit .b-tbl th, .fit .b-tbl td { padding: var(--space-2) var(--space-1); } }
.b-chart { display: block; width: 100%; height: auto; margin: 0 0 var(--space-4); }
.b-chart text { font-family: var(--font-sans); font-size: 14px; fill: var(--c-fg); }
.b-chart .b-g { font-weight: 800; }
.b-chart .b-ax, .b-chart .b-v { fill: var(--c-muted); }
.b-chart .b-lo { fill: var(--c-surface2); stroke: var(--c-line); stroke-width: 1; }
.b-chart .b-hi { fill: var(--c-accent); }
.b-chart .b-grid { fill: none; stroke: var(--c-line); stroke-width: 1; stroke-dasharray: 2 4; }
a[target="_blank"]::after { content: " ↗"; content: " ↗" / " (opens in a new tab)"; }

/* /rulebooks/: the family-tree map scrolls inside its own box; every colour is a token */
.ft-scroll { overflow-x: auto; max-width: 100%; background: var(--c-bg); border: 1px solid var(--c-line); border-radius: var(--radius-card); }
.ft-figure { margin: 0 0 var(--space-6); }
.ft-figure figcaption { margin-top: var(--space-2); }
.ft-map { display: block; max-width: none; height: auto; }
.ft-map text { font-family: var(--font-sans); font-size: 14px; fill: var(--c-fg); }
.ft-map .ft-axis, .ft-map .ft-range { fill: var(--c-muted); }
.ft-map .ft-lane { font-weight: 700; }
.ft-map .ft-lane-side { font-style: italic; }
.ft-map .ft-grid { stroke: var(--c-line); stroke-width: 1; stroke-dasharray: 2 6; }
.ft-map .ft-sep { stroke: var(--c-line); stroke-width: 1; }
.ft-e { fill: none; stroke-width: 2; }
.ft-e-line, .ft-e-fork, .ft-e-merge { stroke: var(--c-muted); }
.ft-e-text, .ft-e-base { stroke: var(--c-accent); stroke-dasharray: 7 5; }
.ft-e-game { stroke: var(--c-fg); stroke-width: 3; stroke-dasharray: 0.5 6; stroke-linecap: round; }
.ft-arr { fill: var(--c-muted); }
.ft-arr-a { fill: var(--c-accent); }
.ft-full { fill: var(--c-accent); stroke: var(--c-fg); stroke-width: 2; }
.ft-meta { fill: var(--c-bg); stroke: var(--c-fg); stroke-width: 2.5; }
.ft-cite { fill: var(--c-bg); stroke: var(--c-fg); stroke-width: 2.5; }
.ft-gap { fill: url(#ft-hatch); stroke: var(--c-muted); stroke-width: 1.5; }
.ft-gap.ft-open { stroke-dasharray: 4 4; }
.ft-merge .ft-gap { stroke: var(--c-fg); stroke-width: 2.5; }
.ft-hatch-bg { fill: var(--c-bg); }
.ft-hatch-line { stroke: var(--c-muted); stroke-width: 2; }
.ft-hit { fill: transparent; }
.ft-ring { fill: none; stroke: var(--c-focus); stroke-width: 3; visibility: hidden; }
a.ft-link:focus { outline: none; }
a.ft-link:focus-visible .ft-ring { visibility: visible; }
.ft-map a.ft-link .ft-label { fill: var(--c-accent); text-decoration: underline; font-weight: 700; }

.ft-poster .ft-label { font-size: 20px; }
.ft-poster .ft-lane { font-size: 22px; }
.ft-poster .ft-axis { font-size: 20px; }
.ft-poster .ft-range { font-size: 17px; }
.ft-poster .ft-e { stroke-width: 2.5; }
/* /rulebooks/poster/: the whole tree scaled to the page width (no scroll box); print is one landscape sheet */
main.wrap:has(.pt-poster) { max-width: none; }
.pt-poster .ft-figure { margin-bottom: var(--space-5); }
.pt-poster .ft-map { width: 100%; max-width: 100%; height: auto; background: var(--c-bg); border: 1px solid var(--c-line); border-radius: var(--radius-card); }
.pt-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: 0 0 var(--space-4); }
.pt-actions .btn { text-decoration: none; }
.pt-poster .ft-legend ul { grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.pt-printfoot { display: none; }
@page poster { size: A3 landscape; margin: 10mm; }
@media print {
  .skip, .site-header, .site-footer, .pt-noprint, .theme-toggle { display: none !important; }
  html, body { background: var(--c-surface) !important; color: var(--c-fg) !important; }
  body { padding: 0; }
  main.wrap, main.wrap:has(.pt-poster) { max-width: none; padding: 0; margin: 0; }
  .pt-poster { page: poster; --c-bg: #F7F8FA;
--c-surface: #FFFFFF;
--c-surface2: #EDEFF3;
--c-fg: #0B0C10;
--c-muted: #5A6070;
--c-line: #848B9A;
--c-accent: #2E6B00;
--c-accentFg: #FFFFFF;
--c-focus: #1D4ED8;
--k-actor: #C20500;
--k-action: #0A3F7C;
--k-place: #20724E;
--k-thing: #4E1835;
--k-concept: #763EE8;
--k-game: #332402;
--k-rule: #59617B;
color-scheme: light; }
  .pt-poster h1 { font-size: 28px; margin-bottom: 2mm; }
  .pt-poster .lede { font-size: 16px; max-width: none; margin: 0 0 2mm; }
  .pt-poster p { max-width: none; font-size: 14px; margin: 0 0 2mm; }
  .pt-poster .ft-legend h2 { display: none; }
  .pt-poster .ft-legend ul { display: flex; flex-wrap: wrap; gap: 1mm 8mm; margin-bottom: 3mm; font-size: 14px; }
  .pt-poster .ft-map { border: 0; border-radius: 0; width: 100%; height: auto; break-inside: avoid; }
  .pt-poster .ft-figure figcaption { display: none; }
  .pt-printfoot { display: flex; justify-content: space-between; gap: 8mm; border-top: 0.5mm solid var(--c-fg); padding-top: 2mm; font-size: 14px; }
  a { color: inherit; text-decoration: none; }
}
.ft-legend ul { list-style: none; padding: 0; margin: 0 0 var(--space-5); display: grid; gap: var(--space-2); }
.ft-legend li { display: flex; align-items: center; gap: var(--space-3); margin: 0; }
.ft-swatch { flex: none; }
.ft-key-link { flex: none; min-width: 28px; color: var(--c-accent); font-weight: 700; text-decoration: underline; font-size: var(--text-small); }
.ft-codes { list-style: none; padding: 0; }
.ft-codes > li { margin: 0 0 var(--space-6); }
.ft-list { padding-left: var(--space-5); }
.ft-list > li { margin: 0 0 var(--space-4); }
.ft-list > li > strong > a { display: inline-block; min-height: var(--space-target); padding-block: 10px; box-sizing: border-box; }
.ft-facts { margin: var(--space-1) 0 0; padding-left: var(--space-5); }
.ft-facts > li { margin: 0; }
.ft-k { color: var(--c-muted); }

/* Forms and the graph */
.asof-hide { display: none; }
.asof-card .asof-flag { color: var(--c-muted); font-size: var(--text-small); font-weight: 700; margin: 0 0 var(--space-2); }
.asof-ui select { min-height: var(--space-target); }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin: 0 0 var(--space-4); }
.controls label { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--space-target); }
input, select, textarea, button { font-family: inherit; font-size: inherit; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  min-height: var(--space-target);
  max-width: 100%;
  padding: var(--space-2) var(--space-3);
  background: var(--c-surface);
  color: var(--c-fg);
  border: 1px solid var(--c-line);
  border-radius: var(--radius-button);
}
input[type="search"] { width: 100%; }
input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; accent-color: var(--c-accent); }
canvas {
  display: block;
  width: 100%;
  height: min(70vh, 560px);
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--radius-card);
  touch-action: manipulation;
}

/* Tactile motion: 150ms press and hover, nothing else */
.btn, .chip, .pill, a.card, .nav a, .nav .learn-btn, details > summary {
  transition: transform var(--motion-press) var(--motion-ease),
    border-color var(--motion-press) var(--motion-ease),
    background-color var(--motion-press) var(--motion-ease);
}
.btn:active, .chip:active, .pill:active, a.card:active { transform: scale(0.98); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
  .btn:active, .chip:active, .pill:active, a.card:active { transform: none; }
}
