:root {
  --fg: #1a1a1a;
  --fg-muted: #5a5a5a;
  --bg: #ffffff;
  --bg-alt: #f6f6f4;
  --border: #d9d7d2;
  --green: #1a6b3c;
  --red: #a3271b;
  --amber: #8a5a00;
  --link: #14508c;
  --max-width: 960px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
}

a { color: var(--link); }
a:visited { color: var(--link); }

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.25rem;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.25rem 1rem 1rem;
  border-bottom: 1px solid var(--border);
}

.site-header .brand {
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  color: var(--fg);
  margin-right: auto;
}

.site-header nav a {
  margin-right: 1rem;
  text-decoration: none;
  color: var(--fg-muted);
  font-size: 0.95rem;
}

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

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

h1 { font-size: 1.6rem; margin: 0 0 0.25rem; }
h2 { font-size: 1.2rem; margin: 2rem 0 0.75rem; }
h3 { font-size: 1.05rem; margin: 1.5rem 0 0.5rem; }

.subtitle { color: var(--fg-muted); margin: 0 0 1.5rem; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  margin-bottom: 2rem;
}

.stat-tile {
  background: var(--bg);
  padding: 1rem;
}

.stat-tile .label {
  font-size: 0.8rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.35rem;
}

.stat-tile .value {
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-tile .value.pos { color: var(--green); }
.stat-tile .value.neg { color: var(--red); }

.stat-tile .n {
  font-size: 0.8rem;
  color: var(--fg-muted);
  margin-top: 0.2rem;
}

.empty-state {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--fg-muted);
  background: var(--bg-alt);
  border: 1px dashed var(--border);
  border-radius: 4px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

caption { text-align: left; color: var(--fg-muted); margin-bottom: 0.5rem; font-size: 0.9rem; }

th, td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

thead th {
  position: sticky;
  top: 0;
  background: var(--bg);
  border-bottom: 2px solid var(--border);
  cursor: pointer;
  user-select: none;
}

thead th[data-sort]::after {
  content: " \21C5";
  color: var(--fg-muted);
  font-size: 0.75em;
}

tbody tr:hover { background: var(--bg-alt); }

.table-scroll { overflow-x: auto; margin-bottom: 1rem; }

.pill {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.pill-won { background: #e3f3e9; color: var(--green); }
.pill-lost { background: #f6e5e2; color: var(--red); }
.pill-pending { background: #eee; color: var(--fg-muted); }

.pnl-pos { color: var(--green); font-weight: 600; }
.pnl-neg { color: var(--red); font-weight: 600; }

.annotation-postkickoff {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.4rem;
  border-radius: 3px;
  background: #fdf1d8;
  color: var(--amber);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.filter-bar label { font-size: 0.9rem; color: var(--fg-muted); }
.filter-bar select, .filter-bar input {
  font: inherit;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
}

.no-js-note { display: none; }
.no-js .no-js-note { display: block; font-size: 0.85rem; color: var(--fg-muted); margin-bottom: 0.75rem; }
.no-js .filter-bar { display: none; }

.insufficient { color: var(--fg-muted); font-style: italic; }

.prose { max-width: 70ch; }
.prose h1:first-child { margin-top: 0; }
.prose h2 { border-top: 1px solid var(--border); padding-top: 1.25rem; }
.prose blockquote {
  margin: 0 0 1.25rem;
  padding: 0.6rem 1rem;
  border-left: 3px solid var(--amber);
  background: var(--bg-alt);
  color: var(--fg-muted);
}
.prose code { background: var(--bg-alt); padding: 0.1rem 0.3rem; border-radius: 3px; font-size: 0.9em; }

.signup-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.5rem 0;
  padding: 1rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.signup-form input[type="email"] {
  flex: 1 1 220px;
  font: inherit;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.signup-form button {
  font: inherit;
  padding: 0.45rem 1rem;
  border: 1px solid var(--fg);
  background: var(--fg);
  color: var(--bg);
  border-radius: 4px;
  cursor: pointer;
}

.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1rem 2.5rem;
  border-top: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 0.85rem;
}

.site-footer p { margin: 0.3rem 0; }
.site-footer a { color: var(--fg-muted); }

@media (max-width: 600px) {
  .site-header { padding: 1rem 0.75rem 0.75rem; }
  main { padding: 1rem 0.75rem 2rem; }
  table { font-size: 0.85rem; }
  th, td { padding: 0.4rem 0.45rem; }
}

/* ── Reference pages ───────────────────────────────────────────────── */
/* Base-rate pages carry more explanatory prose than the ledger does, because
   a rate without its definition is not checkable. These styles exist to keep
   that prose legible without letting it compete with the tables. */

.section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  padding: 0.75rem 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.note {
  max-width: 70ch;
  color: var(--fg-muted);
  font-size: 0.92rem;
  margin: 0 0 1rem;
}

.note strong { color: var(--fg); }

/* Sample sizes sit beside every rate. Muted and smaller so they inform without
   crowding the figure, but never hidden - a rate without its n is not a claim
   a reader can weigh. */
.sample {
  color: var(--fg-muted);
  font-size: 0.85em;
  white-space: nowrap;
}

.provenance {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}

.provenance dl { margin: 0; }
.provenance dt {
  font-weight: 600;
  margin-top: 0.85rem;
  font-size: 0.92rem;
}
.provenance dt:first-child { margin-top: 0; }
.provenance dd {
  margin: 0.2rem 0 0;
  color: var(--fg-muted);
  font-size: 0.92rem;
  max-width: 75ch;
}
.provenance .note { margin: 1rem 0 0; }
.provenance code {
  background: var(--bg);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.9em;
}

/* An unratified parameter that every figure on the page depends on. Marked
   visually because burying it would be the dishonest choice. */
.caveat {
  border-left: 3px solid var(--amber);
  background: var(--bg-alt);
  padding: 0.85rem 1.25rem;
  margin: 1.5rem 0;
  max-width: 75ch;
}
.caveat p { font-size: 0.92rem; margin: 0 0 0.75rem; }
.caveat p:last-child { margin-bottom: 0; }
.caveat blockquote {
  margin: 0 0 0.75rem;
  padding-left: 1rem;
  border-left: 2px solid var(--border);
  color: var(--fg-muted);
  font-size: 0.9rem;
}

/* Grouped column headers on the streak tables. */
thead tr:first-child th[colspan] {
  text-align: center;
  border-bottom: 1px solid var(--border);
}

/* ── Arm landing cards (home page, Stats landing) ──────────────────── */
.card-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.card {
  border: 1px solid var(--border);
  background: var(--bg-alt);
  border-radius: 4px;
  padding: 1.1rem 1.2rem;
}
.card h3 { margin: 0 0 0.5rem; font-size: 1.05rem; }
.card h3 a { text-decoration: none; }
.card h3 a:hover { text-decoration: underline; }
.card p { margin: 0 0 0.6rem; font-size: 0.92rem; }
.card p:last-child { margin-bottom: 0; }
.card .note { margin-top: 0.6rem; }

/* ── Posted combinations ───────────────────────────────────────────── */
.combo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  margin: 0.5rem 0 0.9rem;
  font-size: 0.88rem;
  color: var(--fg-muted);
}
.combo-meta strong { color: var(--fg); }
.combo-meta .pos strong { color: var(--green, #1a7f37); }
.combo-meta .neg strong { color: var(--red, #b3261e); }

.result-won { color: var(--green, #1a7f37); }
.result-lost { color: var(--red, #b3261e); }
.result-void,
.result-pending { color: var(--fg-muted); }

/* The empty state on the combinations page carries real explanation, so it
   needs to read as prose rather than as a one-line "nothing here" stub. */
.empty-state p { margin: 0 0 0.6rem; }
.empty-state p:last-child { margin-bottom: 0; }
