/* Tokens. Dark is the default; the light theme follows the reader's system setting. */
:root {
  color-scheme: dark;
  --bg: #0e1014;
  --surface: #151821;
  --raised: #1d212c;
  --line: #272c38;
  --line-strong: #3a4152;
  --field-line: #6b7385;
  --text: #e7e9ee;
  --muted: #9ba3b4;
  --link: #8fb8ff;
  --gold: #e8b339;
  --on-gold: #1a1400;
  --danger: #ff8177;
  --danger-bg: #2a1517;
  --ok: #57d08f;
  --done: #6cb2ff;
  --warn: #f0b860;
  --ironclad: #ff7a70;
  --silent: #57d08f;
  --defect: #6cb2ff;
  --watcher: #c09bff;
  --accent: var(--gold);
  --shadow: 0 12px 32px rgb(0 0 0 / 45%);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f6f5f1;
    --surface: #ffffff;
    --raised: #efede7;
    --line: #dddad1;
    --line-strong: #bdb9ad;
    --field-line: #827e70;
    --text: #1b1d22;
    --muted: #575d6b;
    --link: #1650b8;
    --gold: #8a5b00;
    --on-gold: #ffffff;
    --danger: #b3261e;
    --danger-bg: #fdecea;
    --ok: #17703f;
    --done: #1a5fc0;
    --warn: #8a5b00;
    --ironclad: #b3261e;
    --silent: #17703f;
    --defect: #1a5fc0;
    --watcher: #6b3fc2;
    --shadow: 0 12px 32px rgb(40 36 20 / 14%);
  }
}

.tone-ironclad {
  --accent: var(--ironclad);
}

.tone-silent {
  --accent: var(--silent);
}

.tone-defect {
  --accent: var(--defect);
}

.tone-watcher {
  --accent: var(--watcher);
}

/* Base */
* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--sans);
}

a {
  color: var(--link);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

h1,
h2,
h3 {
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2rem);
  font-weight: 700;
}

h2 {
  margin: 2.25rem 0 0.75rem;
  font-size: 1.2rem;
}

h3 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1rem;
}

p,
ul,
ol {
  margin: 0 0 1rem;
}

code,
pre {
  font-family: var(--mono);
  font-size: 0.9em;
}

code {
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--raised);
  overflow-wrap: anywhere;
}

pre {
  margin: 0 0 1rem;
  padding: 14px 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  line-height: 1.5;
}

pre code {
  padding: 0;
  background: none;
  overflow-wrap: normal;
}

.muted {
  color: var(--muted);
}

.skip {
  position: absolute;
  top: 8px;
  left: -999px;
  z-index: 10;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--surface);
}

.skip:focus {
  left: 8px;
}

/* Header and footer */
.bar,
main {
  width: 100%;
  max-width: 46rem;
  margin: 0 auto;
  padding: 0 16px;
}

.wide .bar,
.wide main {
  max-width: 72rem;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.site-header .bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 24px;
  min-height: 56px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.wordmark strong {
  font-weight: 700;
}

.mark {
  flex: none;
  fill: var(--gold);
}

.site-header nav {
  display: flex;
  flex: 1;
  gap: 4px;
  align-self: stretch;
}

.site-header nav a {
  display: flex;
  align-items: center;
  padding: 0 10px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
}

.site-header nav a:hover {
  color: var(--text);
}

.site-header nav a[aria-current="page"] {
  border-bottom-color: var(--accent);
  color: var(--text);
}

.signed-in {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 0.95rem;
}

.signed-in span {
  max-width: 14rem;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer .bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding-top: 20px;
  padding-bottom: 28px;
}

.site-footer p {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin: 0;
}

.site-footer .mark {
  width: 16px;
  height: 16px;
}

.site-footer .footer-links {
  gap: 4px 18px;
}

.site-footer a {
  color: var(--muted);
}

.site-footer a:hover {
  color: var(--text);
}

main {
  padding-top: 32px;
  padding-bottom: 64px;
}

/* Buttons, links drawn as buttons, form fields */
button,
.button,
.sign-in {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--raised);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

button:hover,
.button:hover,
.sign-in:hover {
  border-color: var(--muted);
}

.button.primary {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--on-gold);
}

.button.primary:hover {
  filter: brightness(1.08);
}

button.danger {
  border-color: var(--danger);
  background: transparent;
  color: var(--danger);
}

button.danger:hover {
  border-color: var(--danger);
  background: var(--danger-bg);
}

.signed-in button,
.sign-in {
  min-height: 32px;
  padding: 4px 12px;
  background: transparent;
  font-size: 0.9rem;
}

label {
  font-size: 0.9rem;
  font-weight: 600;
}

input[type="text"] {
  width: 22rem;
  max-width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--field-line);
  border-radius: 8px;
  background: var(--bg);
  color: inherit;
  font: inherit;
}

input[type="text"]:focus-visible {
  border-color: var(--accent);
  outline-offset: 0;
  border-radius: 8px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin: 12px 0;
}

.actions form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin: 0;
}

/* Messages */
.notice,
.refusal,
.shown-once {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--warn);
  border-radius: 8px;
  background: var(--surface);
}

/* An operator's reason keeps the lines it was written in. */
.reason {
  white-space: pre-line;
}

.refusal {
  border-color: var(--danger);
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 500;
}

.shown-once {
  border-color: var(--gold);
  border-left-width: 1px;
  font-weight: 600;
}

.shown-once code {
  display: block;
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  background: var(--bg);
  font-size: 1rem;
  font-weight: 400;
  user-select: all;
}

/* Board pages */
.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow a {
  color: inherit;
}

.lede {
  max-width: 44rem;
  color: var(--muted);
  font-size: 1.1rem;
}

.board-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
  margin-top: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.tabs {
  display: flex;
  gap: 2px;
  max-width: 100%;
  overflow-x: auto;
}

.tabs a {
  padding: 8px 16px;
  border-bottom: 3px solid transparent;
  border-radius: 8px 8px 0 0;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.tabs a[href$="/ironclad"] {
  --tab: var(--ironclad);
}

.tabs a[href$="/silent"] {
  --tab: var(--silent);
}

.tabs a[href$="/defect"] {
  --tab: var(--defect);
}

.tabs a[href$="/watcher"] {
  --tab: var(--watcher);
}

.tabs a::before {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--tab, var(--muted));
  content: "";
}

.tabs a:hover {
  color: var(--text);
}

.tabs a[aria-current="page"] {
  border-bottom-color: var(--tab, var(--accent));
  background: color-mix(in srgb, var(--tab, var(--accent)) 12%, transparent);
  color: var(--text);
}

.season-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding-bottom: 8px;
  font-size: 0.95rem;
}

.seasons {
  position: relative;
}

.seasons summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 4px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--raised);
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}

.seasons summary::-webkit-details-marker {
  display: none;
}

.seasons summary::after {
  width: 7px;
  height: 7px;
  margin-top: -4px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  content: "";
}

.seasons[open] summary::after {
  margin-top: 4px;
  transform: rotate(225deg);
}

.seasons ul {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 5;
  min-width: 12rem;
  max-height: 18rem;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  list-style: none;
}

.seasons li a {
  display: block;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}

.seasons li a:hover {
  background: var(--raised);
}

.seasons li a[aria-current="page"] {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  font-weight: 700;
}

.seasons li:first-child {
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.season-state {
  margin: 16px 0;
}

.season-state p {
  margin: 0 0 12px;
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.pill::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  content: "";
}

.phase-open::before {
  background: var(--ok);
}

.phase-closing::before {
  background: var(--warn);
}

.phase-upcoming::before {
  background: var(--accent);
}

.phase-voided {
  border-color: var(--danger);
  color: var(--danger);
}

.phase-voided::before {
  background: var(--danger);
}

.phase-all-time::before {
  background: var(--accent);
}

/* Tables */
.table-scroll,
.tabs,
.site-header nav,
pre {
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

thead th {
  background: var(--raised);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

th.num,
td.num {
  text-align: right;
}

.board th,
.board td {
  padding-right: 9px;
  padding-left: 9px;
}

.board thead th {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
}

.board td:nth-child(2) {
  min-width: 13rem;
  font-weight: 600;
  white-space: normal;
}

.board .project,
.board .project .marks {
  display: block;
}

.board td:nth-child(2) .muted,
.project a {
  white-space: nowrap;
}

.board td:nth-child(2) .muted {
  font-weight: 400;
}

.board td.agent {
  min-width: 5rem;
  max-width: 9rem;
  white-space: normal;
  overflow-wrap: break-word;
}

.board td a {
  text-decoration: none;
}

.board td a:hover {
  text-decoration: underline;
}

th.rank,
td.rank {
  width: 3.5rem;
  min-width: 3.25rem;
  padding-right: 4px;
  text-align: center;
}

td.rank {
  color: var(--muted);
  font-weight: 700;
}

.rank-1,
.rank-2,
.rank-3 {
  position: relative;
  z-index: 0;
  color: #1a1400;
}

td.rank-1,
td.rank-2,
td.rank-3 {
  color: #17130a;
}

.rank-1::before,
.rank-2::before,
.rank-3::before {
  position: absolute;
  top: 50%;
  left: calc(50% + 5px);
  z-index: -1;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e8b339;
  transform: translate(-50%, -50%);
  content: "";
}

.rank-2::before {
  background: #c5cbd6;
}

.rank-3::before {
  background: #d19560;
}

.rate strong {
  font-size: 1.02em;
}

.interval {
  color: var(--muted);
}

.interval,
.range {
  white-space: nowrap;
}

.interval-bar {
  display: inline-block;
  margin-left: 10px;
  vertical-align: middle;
}

.interval-bar .track {
  fill: var(--line-strong);
}

.interval-bar .band {
  fill: var(--accent);
  opacity: 0.45;
}

.interval-bar .tick {
  fill: var(--accent);
}

.tier {
  display: inline-block;
  margin-left: 2px;
  padding: 1px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.5;
  vertical-align: 0.1em;
  white-space: nowrap;
}

.tier-verified {
  border-color: var(--ok);
  color: var(--ok);
}

.tier-verified::before {
  margin-right: 4px;
  content: "✓";
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.status::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  content: "";
}

.status-running {
  color: var(--text);
}

.status-running::before {
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent);
}

.status-complete {
  color: var(--text);
}

.status-complete::before {
  background: var(--done);
}

.status-incomplete::before {
  border: 1.5px solid var(--muted);
  background: transparent;
}

.status-voided {
  color: var(--danger);
}

.status-voided::before {
  background: var(--danger);
}

.unranked td {
  color: var(--muted);
}

.unranked .interval-bar {
  opacity: 0.5;
}

.provisional strong {
  font-weight: 400;
  font-style: italic;
}

.voided td:nth-child(2),
.voided .agent {
  text-decoration: line-through;
  text-decoration-color: var(--danger);
}

.result {
  font-weight: 600;
}

.result.win {
  color: var(--ok);
}

.result.loss {
  color: var(--muted);
}

.legend {
  margin: 10px 2px 0;
  font-size: 0.85rem;
}

/* Open parts: one icon per part an account says is open, the legend that names them, the filter. */
.marks {
  white-space: nowrap;
}

.parts {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 4px;
  vertical-align: middle;
}

.part {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
}

.part-icon {
  flex: none;
  width: 16px;
  height: 16px;
}

a.part {
  padding: 3px;
  border-radius: 6px;
  text-decoration: none;
}

a.part:hover {
  background: var(--raised);
  color: var(--text);
}

.part-code {
  color: var(--defect);
}

.part-weights {
  color: var(--gold);
}

.part-training {
  color: var(--watcher);
}

.part-data {
  color: var(--silent);
}

.parts-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  margin-top: 6px;
}

.parts-legend .part {
  white-space: nowrap;
}

.filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 14px 0 10px;
  font-size: 0.9rem;
}

.filter::before {
  margin-right: 4px;
  color: var(--muted);
  content: "Show";
}

.filter a {
  padding: 3px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.filter a:hover {
  border-color: var(--muted);
  color: var(--text);
}

.filter a[aria-current="page"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--text);
}

.filter-count {
  margin: 0 2px 10px;
  font-size: 0.85rem;
}

.project-links ul {
  margin: 0.5rem 0;
  padding-left: 1.2rem;
}

.project-links li {
  margin: 4px 0;
  overflow-wrap: anywhere;
}

/* The developers page's project links: one boxed group per link. */
.link-fields {
  min-width: 0;
  margin: 12px 0;
  padding: 10px 14px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.link-fields legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.link-fields input[type="text"] {
  width: 100%;
  max-width: 30rem;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 10px 0 0;
}

.checks label,
label.remove {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 400;
  white-space: nowrap;
}

label.remove {
  margin-top: 10px;
  color: var(--danger);
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--gold);
}

.parts-key {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 2px 12px;
  margin: 12px 0;
  font-size: 0.85rem;
}

.parts-key dt {
  font-weight: 600;
}

.parts-key dd {
  margin: 0;
}

.empty {
  padding: 40px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

.empty p:last-child {
  margin-bottom: 0;
}

.empty-season {
  margin: 28px 0;
  padding: 48px 24px;
  background: var(--surface);
}

.empty-season .mark {
  width: 44px;
  height: 44px;
}

.empty-season h2 {
  margin: 8px 0;
  color: var(--text);
  font-size: 1.4rem;
}

.empty-season p {
  max-width: 34rem;
  margin-right: auto;
  margin-left: auto;
}

.empty-season .actions {
  justify-content: center;
  margin-top: 20px;
}

.pillars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pillars li {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.pillars h3 {
  margin: 0 0 6px;
}

.pillars p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.season-facts {
  margin-top: 2.5rem;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 0.9rem;
}

.season-facts h2 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.season-facts p {
  max-width: 60rem;
  margin: 0 0 8px;
}

.season-facts p:last-child {
  margin-bottom: 0;
}

.season-facts span {
  white-space: nowrap;
}

.season-facts code {
  white-space: normal;
}

/* Entry page */
/* Only an entry page's eyebrow is a link back to its board; its title is an account line. */
.eyebrow:has(a) + h1 {
  font-size: clamp(1.25rem, 1.1rem + 0.8vw, 1.6rem);
  text-wrap: wrap;
}

.eyebrow:has(a) + h1 .tier {
  vertical-align: 0.25em;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.facts div {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.facts dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.facts dd {
  margin: 2px 0 0;
  font-size: 1.05rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.pager {
  display: flex;
  align-items: center;
  gap: 8px 16px;
  margin-top: 16px;
  font-variant-numeric: tabular-nums;
}

/* Developers */
main > section {
  margin-top: 2rem;
}

main > section > h2:first-child {
  margin-top: 0;
}

.sign-in-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.sign-in-card p:last-child {
  margin-bottom: 0;
}

.key-state code {
  font-size: 1rem;
}

.steps {
  padding-left: 1.4rem;
}

.steps li {
  margin-bottom: 6px;
  padding-left: 4px;
}

.steps li::marker {
  color: var(--accent);
  font-weight: 700;
}

/* Long-form pages */
article {
  font-size: 1.03rem;
  line-height: 1.7;
}

article h1 {
  margin-bottom: 1.25rem;
}

article h2 {
  margin-top: 2.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 1.3rem;
}

article li {
  margin-bottom: 0.4rem;
}

article ul,
article ol {
  padding-left: 1.4rem;
}

article li::marker {
  color: var(--muted);
}

article blockquote {
  margin: 0 0 1rem;
  padding: 2px 16px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

article hr {
  margin: 2rem 0;
  border: 0;
  border-top: 1px solid var(--line);
}

article table {
  display: block;
  width: max-content;
  max-width: 100%;
  margin: 0 0 1rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.95rem;
}

article img {
  max-width: 100%;
}

.source-note {
  margin-top: 3rem;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 0.88rem;
}

/* 404, 429, 500 */
.status-page {
  padding: 48px 0;
}

.status-code {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.1em;
}

/* Phones: a board row becomes a card; nothing scrolls sideways but a table that must. */
@media (max-width: 640px) {
  main {
    padding-top: 24px;
  }

  .site-header .bar {
    justify-content: space-between;
  }

  .site-header nav {
    flex: none;
    order: 3;
    width: calc(100% + 16px);
    margin: 0 -8px;
    gap: 0;
    overflow-x: auto;
  }

  .site-header nav a {
    min-height: 40px;
    padding: 0 8px;
    font-size: 0.92rem;
  }

  .board-bar {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .tabs {
    gap: 0;
  }

  .tabs a {
    flex: 1;
    padding: 8px 4px;
    font-size: 0.95rem;
    text-align: center;
  }

  .tabs a::before {
    width: 6px;
    height: 6px;
    margin-right: 5px;
    vertical-align: 0.12em;
  }

  input[type="text"] {
    width: 100%;
  }

  .board,
  .board tbody {
    display: block;
  }

  .board thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .board tr {
    display: grid;
    grid-template-columns: 2.5rem repeat(5, minmax(0, 1fr));
    gap: 4px 8px;
    padding: 14px 14px 14px 8px;
    border-bottom: 1px solid var(--line);
  }

  .board tbody tr:last-child {
    border-bottom: 0;
  }

  .board td {
    padding: 0;
    border: 0;
    text-align: left;
  }

  .board td.rank {
    grid-row: 1 / span 2;
    grid-column: 1;
    width: auto;
    min-width: 0;
    padding-top: 1px;
    text-align: center;
  }

  .rank-1::before,
  .rank-2::before,
  .rank-3::before {
    top: 14px;
    left: 50%;
  }

  .board td:nth-child(2) {
    grid-row: 1;
    grid-column: 2 / span 5;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .board .project,
  h1 .project {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 6px;
    font-weight: 400;
  }

  h1 .project {
    margin: 2px 0;
    font-size: 1rem;
  }

  .project a {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .project .marks {
    flex: none;
  }

  .board td.agent {
    grid-row: 2;
    grid-column: 2 / span 3;
    min-width: 0;
    max-width: none;
    font-size: 0.9rem;
    overflow-wrap: anywhere;
  }

  .board td.state {
    grid-row: 2;
    grid-column: 5 / span 2;
    justify-self: end;
  }

  .board td.rate {
    grid-row: 3;
    grid-column: 2 / span 5;
    padding: 2px 0 4px;
  }

  .board td.rate strong {
    font-size: 1.2rem;
  }

  .board td.rate::before {
    display: block;
  }

  .board td.counts {
    grid-row: 4;
    grid-column: 2 / span 2;
  }

  .board td:nth-last-child(3) {
    grid-area: 4 / 4;
  }

  .board td:nth-last-child(2) {
    grid-area: 4 / 5;
  }

  .board td:nth-last-child(1) {
    grid-area: 4 / 6;
  }

  .board td[data-label]:not(.rate, .state) {
    display: flex;
    flex-direction: column;
    font-size: 0.9rem;
  }

  .board td.rate::before,
  .board td[data-label]:not(.rate, .state)::before {
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
    content: attr(data-label);
  }

  .all-time-board td.rate {
    grid-area: 2 / 2 / auto / span 5;
  }

  .all-time-board td.counts {
    grid-row: 3;
    grid-column: 2 / span 3;
  }

  .all-time-board td:nth-last-child(2) {
    grid-area: 3 / 5 / auto / span 2;
  }

  .board.all-time-board td.best {
    display: block;
    grid-area: 4 / 2 / auto / span 5;
    white-space: normal;
  }

  .board.all-time-board td.best::before {
    display: block;
  }

  .facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  th,
  td {
    padding: 8px 10px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  a,
  button,
  .button {
    transition:
      border-color 0.12s,
      background-color 0.12s,
      color 0.12s;
  }
}
