/* Layout: single centered column (920px) after the reference site; figure sections widen to 1080px.
   Black 1px rules, square corners, one green accent; figure colors follow the paper. */
:root {
  --bg: #ffffff;
  --fg: #000000;
  --muted: #555a58;
  --rule: #000000;
  --soft-rule: #dddddd;
  --hl: #e8e8e4;
  --code-bg: #f3f3f0;
  --accent: #2e7368;
  --accent-fg: #ffffff;
  --grid: #e6e6e3;
  --baseline: #b0b0b0;

  /* paper figure colors */
  --mech-naive: #7e9e94;
  --mech-checked: #0ad1ae;
  --mech-backfire: #8e8aff;
  --mech-repvote: #ffc61a;
  --mech-escrepvote: #ff5c5f;
  --env-social: #edafb8;
  --env-chatbot: #7faddc;
  --env-fishing: #84a98c;
  --report-accurate: #84a98c;
  --report-false: #edafb8;
  --arrow-action: #555555;
  --arrow-reward: #76a881;
  --arrow-message: #76a6d7;
  --arrow-report: #e6a5af;
  --arrow-user: #a6a6a6;
  --agent-bad: #fae9dd;
  --agent-good: #eef1f4;
  --doc-bad: #fae9dd;
  --doc-good: #ffffff;
  --users-bg: #f2f2f2;
  --lake: #dcebf7;

  --font-sans: Archivo, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101413; --fg: #eceeed; --muted: #a2aaa7; --rule: #eceeed; --soft-rule: #333937;
    --hl: #2a302e; --code-bg: #1a1f1d; --accent: #5fb0a3; --accent-fg: #101413; --grid: #262c2a; --baseline: #6b716f;
    --arrow-action: #b8bdbb; --arrow-user: #7c8280; --agent-bad: #4a3a31; --agent-good: #2b3238;
    --doc-bad: #4a3a31; --doc-good: #1a1f1d; --users-bg: #1f2523; --lake: #1f3342;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101413; --fg: #eceeed; --muted: #a2aaa7; --rule: #eceeed; --soft-rule: #333937;
  --hl: #2a302e; --code-bg: #1a1f1d; --accent: #5fb0a3; --accent-fg: #101413; --grid: #262c2a; --baseline: #6b716f;
  --arrow-action: #b8bdbb; --arrow-user: #7c8280; --agent-bad: #4a3a31; --agent-good: #2b3238;
  --doc-bad: #4a3a31; --doc-good: #1a1f1d; --users-bg: #1f2523; --lake: #1f3342;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.5;
}
a { color: var(--fg); }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { text-wrap: balance; font-weight: 500; }

.wrap {
  max-width: 920px;
  margin: 0 auto;
  padding-left: max(32px, env(safe-area-inset-left, 0px));
  padding-right: max(32px, env(safe-area-inset-right, 0px));
}
.wrap.wide { max-width: 1080px; }
@media (max-width: 600px) {
  .wrap { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
}

/* header */
.site-header { border-bottom: 1px solid var(--rule); }
.site-header .wrap {
  max-width: none;
  padding-block: 14px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 14px; font-size: 15px; }
.brand a { text-decoration: none; }
.site-nav { display: flex; flex-wrap: wrap; gap: 20px; font-size: 15px; }

/* hero */
.hero { padding-block: 112px 72px; }
.hero h1 { margin: 0; font-size: clamp(38px, 6vw, 64px); line-height: 1.12; letter-spacing: -0.02em; }
@media (min-width: 900px) { .hero h1 { white-space: nowrap; } }
.tilt {
  display: inline-block; background: var(--accent); color: var(--accent-fg);
  padding: 0.02em 0.22em; transform: rotate(-1.5deg); white-space: nowrap;
}
.hero .lede { margin: 36px 0 0; font-size: clamp(19px, 2.4vw, 22px); line-height: 1.45; max-width: 760px; }
.mark { background: var(--hl); padding: 0 0.2em; }
.authors { margin: 24px 0 0; font-size: 15px; color: var(--muted); }
.honors { list-style: none; margin: 8px 0 0; padding: 0; font-size: 15px; line-height: 1.6; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.btn {
  text-decoration: none; border: 1px solid var(--rule); padding: 13px 20px; font-weight: 500;
  min-height: 44px; display: inline-flex; align-items: center; font: inherit; font-weight: 500;
  background: transparent; color: var(--fg); cursor: pointer;
}
.btn.solid { background: var(--fg); color: var(--bg); }
.btn.solid:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }

/* sections */
.section { padding-block: 56px; }
.section.band { border-top: 1px solid var(--rule); }
.section h2 { margin: 0 0 8px; font-size: 32px; letter-spacing: -0.01em; }
.section .sub { margin: 0 0 28px; max-width: 680px; }

/* problem strip */
.loop { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border: 1px solid var(--rule); }
.loop > div { padding: 16px; min-width: 0; border-left: 1px solid var(--rule); }
.loop > div:first-child { border-left: 0; }
.loop .k { font-family: var(--font-mono); font-size: 12px; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.loop .v { margin-top: 6px; font-size: 16px; }
.loop > div.twist { background: var(--accent); color: var(--accent-fg); }
.loop > div.twist .k { color: inherit; opacity: 0.8; }
@media (max-width: 700px) {
  .loop { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .loop > div:nth-child(3) { border-left: 0; }
  .loop > div:nth-child(n+3) { border-top: 1px solid var(--rule); }
}

/* pills */
.controls { display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: center; margin-bottom: 20px; }
.pill-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pill-group .lbl { font-size: 14px; color: var(--muted); margin-right: 4px; }
.pill {
  font: inherit; font-size: 15px; border: 1px solid var(--rule); background: var(--bg); color: var(--fg);
  padding: 8px 14px; min-height: 40px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
}
.pill:hover { border-color: var(--accent); }
.pill[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.pill .sw { width: 10px; height: 10px; display: inline-block; }

/* figure frames */
.figure { border: 1px solid var(--rule); padding: 20px; }
.figure svg { display: block; width: 100%; height: auto; }
.fig-scroll { overflow-x: auto; }
.fig-scroll > svg { min-width: 640px; }
.fig-note { font-size: 14px; color: var(--muted); margin-top: 12px; }
svg text { fill: var(--fg); font-family: var(--font-sans); }
svg .t-muted { fill: var(--muted); }
svg .t-mono { font-family: var(--font-mono); }

.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--rule); border-top: 0; }
.facts > div { padding: 12px 16px; border-left: 1px solid var(--rule); min-width: 0; font-size: 15px; }
.facts > div:first-child { border-left: 0; }
.facts .k { font-size: 13px; color: var(--muted); }
/* about the numbers: a standalone two-row facts grid */
#data-facts { border-top: 1px solid var(--rule); }
#data-facts > div:nth-child(3n+1) { border-left: 0; }
#data-facts > div:nth-child(n+4) { border-top: 1px solid var(--rule); }
@media (max-width: 640px) {
  .facts { grid-template-columns: minmax(0, 1fr); }
  .facts > div { border-left: 0; border-top: 1px solid var(--rule); }
  .facts > div:first-child { border-top: 0; }
}

/* abuse */
.two-up { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 24px; }
@media (max-width: 760px) { .two-up { grid-template-columns: minmax(0, 1fr); } }
.chart-title { font-weight: 500; font-size: 15px; margin-bottom: 8px; }
.quote {
  margin-top: 24px; border: 1px solid var(--rule); padding: 16px 20px;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.6;
}
.quote .tag { display: inline-block; background: var(--fg); color: var(--bg); padding: 2px 8px; font-family: var(--font-sans); font-size: 13px; margin-bottom: 10px; }
.quote .hl { background: var(--hl); }

/* mechanisms */
.roc-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 820px) { .roc-layout { grid-template-columns: minmax(0, 1fr); } }
.legend { display: flex; flex-direction: column; gap: 8px; }
.chip {
  font: inherit; font-size: 15px; display: flex; align-items: center; gap: 10px; width: 100%;
  border: 1px solid var(--rule); background: var(--bg); color: var(--fg); padding: 10px 12px; min-height: 44px;
  cursor: pointer; text-align: left;
}
.chip .sw { width: 14px; height: 14px; flex: none; }
.chip .medal { font-size: 15px; }
.chip .end { margin-left: auto; font-family: var(--font-mono); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="false"] { color: var(--muted); border-color: var(--soft-rule); }
.chip[aria-pressed="false"] .sw { opacity: 0.25; }
.chip:hover { border-color: var(--accent); }
.legend-hint { font-size: 13px; color: var(--muted); }

.details-toggle { margin-top: 20px; }
.mech-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; border: 1px solid var(--rule); margin-top: 16px; }
.mech-card { padding: 16px; border-left: 1px solid var(--rule); min-width: 0; font-size: 14px; display: flex; flex-direction: column; gap: 10px; }
.mech-card:first-child { border-left: 0; }
.mech-card .name { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.mech-card .name .sw { width: 12px; height: 12px; }
.mech-card .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.mech-card .rule { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.5; }
.mech-card.active { background: var(--code-bg); }
@media (max-width: 900px) {
  .mech-cards { grid-template-columns: minmax(0, 1fr); }
  .mech-card { border-left: 0; border-top: 1px solid var(--rule); }
  .mech-card:first-child { border-top: 0; }
}
.rep-panel { border: 1px solid var(--rule); border-top: 0; padding: 20px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 24px; align-items: center; }
@media (max-width: 760px) { .rep-panel { grid-template-columns: minmax(0, 1fr); } }
.rep-panel p { margin: 0 0 12px; font-size: 15px; }
.slider-row { display: flex; align-items: center; gap: 12px; font-size: 15px; }
.slider-row input { flex: 1; accent-color: var(--accent); }
.slider-row output { font-family: var(--font-mono); font-size: 13px; min-width: 3.5em; font-variant-numeric: tabular-nums; }

/* table */
.table-scroll { overflow-x: auto; border: 1px solid var(--rule); }
table.results { border-collapse: collapse; width: 100%; min-width: 760px; font-size: 14px; font-variant-numeric: tabular-nums; }
table.results th, table.results td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--soft-rule); }
table.results th:first-child, table.results td:first-child { text-align: left; white-space: nowrap; }
table.results thead th { font-weight: 500; border-bottom: 1px solid var(--rule); }
table.results .env-head th { text-align: center; border-bottom: 1px solid var(--soft-rule); }
table.results .env-start { border-left: 1px solid var(--rule); }
table.results .block th { text-align: left; font-weight: 500; font-size: 13px; color: var(--muted); background: var(--code-bg); border-bottom: 1px solid var(--soft-rule); }
table.results .best { font-weight: 700; }
table.results .second { text-decoration: underline; text-underline-offset: 3px; }
table.results .col-btn { font: inherit; background: none; border: 0; color: inherit; cursor: pointer; padding: 2px 4px; text-decoration: underline dotted; text-underline-offset: 3px; }
table.results .col-btn:hover { color: var(--accent); }
table.results .mname { display: inline-flex; align-items: center; gap: 8px; }
table.results .mname .sw { width: 10px; height: 10px; }

/* footer */
.paper { border-top: 1px solid var(--rule); }
.paper .wrap { padding-block: 48px 64px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; }
@media (max-width: 700px) { .paper .wrap { grid-template-columns: minmax(0, 1fr); } }
.paper .h { font-weight: 500; margin-bottom: 8px; }
.paper p { margin: 0 0 12px; font-size: 15px; }
.paper .links { display: flex; flex-wrap: wrap; gap: 20px; font-size: 15px; }
pre.bib { margin: 0; font-family: var(--font-mono); font-size: 12px; line-height: 1.5; background: var(--code-bg); padding: 14px; white-space: pre-wrap; word-break: break-word; }
.copy { margin-top: 8px; font: inherit; font-size: 14px; border: 1px solid var(--rule); background: var(--bg); color: var(--fg); padding: 6px 12px; cursor: pointer; min-height: 36px; }

/* tooltip */
.tip {
  position: fixed; z-index: 20; pointer-events: none; max-width: 300px;
  background: var(--fg); color: var(--bg); font-size: 13px; line-height: 1.45; padding: 8px 10px;
}
.tip .mono { font-family: var(--font-mono); font-size: 12px; }

[data-tip] { cursor: help; }
@media (prefers-reduced-motion: no-preference) {
  .curve { transition: opacity 0.15s ease, stroke-width 0.15s ease; }
}
