:root {
  color-scheme: light;
  --bg: #f6f5f1;
  --ink: #191a17;
  --muted: #74766f;
  --line: #e0ddd6;
  --card: #ffffff;
  --accent: #b8772e;
  --yes: #256f54;
  --no: #a23d35;
  --shadow: 0 22px 70px rgba(25, 26, 23, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  max-width: 820px;
  margin: 0 auto;
  padding: 24px 24px 64px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
}

.brand {
  font-weight: 850;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--ink);
}

.nav { display: flex; gap: 18px; }
.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}
.nav a:hover { color: var(--ink); }

/* Intro */
.intro { display: flex; flex-direction: column; gap: 18px; }
.intro h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.1rem);
  font-weight: 880;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.lede {
  margin: 0;
  font-size: clamp(1.02rem, 2.4vw, 1.18rem);
  line-height: 1.6;
  color: #3a3b37;
  max-width: 64ch;
}
.lede em { font-style: italic; color: var(--accent); }

/* Vote */
.vote-section { display: flex; flex-direction: column; gap: 14px; scroll-margin-top: 20px; }

.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
  padding: clamp(26px, 6vw, 56px);
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  transition: opacity 140ms ease;
}
.card.loading { opacity: 0.6; }

.text {
  margin: 0;
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  font-size: clamp(1.4rem, 4.2vw, 2.4rem);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.joke-markdown :where(p, blockquote, pre, .joke-table-frame, ul, ol) {
  margin: 0 0 0.75rem;
}
.joke-markdown :where(p:last-child, blockquote:last-child, pre:last-child, .joke-table-frame:last-child, ul:last-child, ol:last-child) {
  margin-bottom: 0;
}
.joke-markdown :where(h1, h2, h3, h4, h5, h6) {
  font-size: 1em;
  font-weight: 900;
  line-height: 1.2;
  margin: 0.9rem 0 0.45rem;
}
.joke-markdown :where(h1:first-child, h2:first-child, h3:first-child, h4:first-child, h5:first-child, h6:first-child) {
  margin-top: 0;
}
.joke-markdown :where(ul, ol) {
  padding-left: 1.25rem;
}
.joke-markdown ul {
  list-style: disc;
}
.joke-markdown ol {
  list-style: decimal;
}
.joke-markdown :where(blockquote) {
  border-left: 0.2rem solid currentColor;
  opacity: 0.85;
  padding-left: 0.75rem;
}
.joke-markdown :where(a) {
  color: inherit;
  font-weight: 900;
  text-decoration: underline;
}
.joke-markdown :where(strong, b) {
  font-weight: 900;
}
.joke-markdown :where(em, i) {
  font-style: italic;
}
.joke-markdown :where(code) {
  background: #f1efe9;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.78em;
  padding: 0.05rem 0.25rem;
}
.joke-markdown :where(pre) {
  background: #f1efe9;
  overflow-x: auto;
  padding: 0.75rem;
}
.joke-markdown :where(pre code) {
  background: transparent;
  padding: 0;
}
.joke-markdown :where(img) {
  display: block;
  height: auto;
  max-width: 100%;
}
.joke-table-frame {
  border: 1px solid currentColor;
  max-width: 100%;
  overflow-x: auto;
}
.joke-table-frame table {
  border-collapse: collapse;
  margin: 0;
  min-width: 100%;
  width: max-content;
}
.joke-markdown :where(th, td) {
  border: 1px solid currentColor;
  padding: 0.3rem 0.45rem;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.model {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--accent);
  overflow-wrap: anywhere;
  transition: opacity 160ms ease;
}
.model.hidden { opacity: 0; height: 0; margin: 0; overflow: hidden; }

.vote { display: flex; gap: 12px; }
.reveal-hint { margin: 0; color: var(--muted); font-size: 0.85rem; min-height: 1.2em; }

.btn {
  flex: 1;
  min-height: 60px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  transition: border-color 140ms ease, color 140ms ease, transform 140ms ease, background 140ms ease;
}
.btn:disabled { opacity: 0.5; cursor: default; }
.btn:not(:disabled):hover { transform: translateY(-2px); }
.btn:not(:disabled):active { transform: translateY(0); }
.yes:not(:disabled):hover { border-color: var(--yes); color: var(--yes); }
.no:not(:disabled):hover { border-color: var(--no); color: var(--no); }

/* Leaderboard */
.leaderboard { scroll-margin-top: 20px; display: flex; flex-direction: column; gap: 18px; }
.section-head h2 {
  margin: 0 0 4px;
  font-size: 1.5rem;
  font-weight: 820;
  letter-spacing: -0.02em;
}
.section-sub { margin: 0; color: var(--muted); font-size: 0.9rem; }

.chart { display: flex; flex-direction: column; gap: 8px; }
.bar-row {
  display: grid;
  grid-template-columns: 130px 1fr 46px;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
}
.bar-label { color: var(--muted); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--line); border-radius: 999px; height: 10px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar-val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--card);
}
.ranks { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.ranks th, .ranks td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.ranks thead th {
  background: #f1efe9;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
}
.ranks tbody tr:last-child td { border-bottom: none; }
.ranks tbody tr:hover { background: #faf9f6; }
.ranks .r { text-align: right; font-variant-numeric: tabular-nums; }
.ranks td:nth-child(2) { font-weight: 600; overflow-wrap: anywhere; }

.method {
  border-top: 1px solid var(--line);
  padding-top: 24px;
  scroll-margin-top: 20px;
}
.method p {
  margin: 0;
  color: #3a3b37;
  font-size: 0.96rem;
  line-height: 1.65;
}
.method em { color: var(--accent); }

.foot { color: var(--muted); font-size: 0.82rem; text-align: center; margin-top: 8px; }
.foot a { color: inherit; font-weight: 700; }

@media (max-width: 560px) {
  .stage { padding: 18px; gap: 30px; }
  .vote { flex-direction: column; align-items: stretch; }
  .bar-row { grid-template-columns: 96px 1fr 40px; }
  .nav { gap: 14px; }
}
