/* THE RACE — midnight chalkboard grand prix */

:root {
  --board: #0d1613;          /* deep blackboard green */
  --board-2: #101b17;
  --panel: #13201b;
  --line: #24352e;
  --chalk: #e9e4d6;          /* warm chalk white */
  --chalk-dim: #9daa9f;
  --gold: #d8b45a;
  --red: #e26d5a;
  --grok: #aeb9c6;
  --gpt: #4fc08d;
  --claude: #e0865a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background:
    /* faint graph-paper grid */
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% 56px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 56px 100%,
    radial-gradient(1200px 600px at 70% -10%, #16241e 0%, var(--board) 60%);
  background-blend-mode: soft-light, soft-light, normal;
  color: var(--chalk);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
}

::selection { background: var(--gold); color: var(--board); }

/* ---------- chalk scribbles ---------- */
.chalk { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.chalk span {
  position: absolute;
  font-family: "Fraunces", Georgia, serif;
  font-style: italic;
  font-size: clamp(16px, 2.2vw, 26px);
  color: var(--chalk);
  opacity: 0.07;
  white-space: nowrap;
}

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 28px;
  padding: 14px 4vw;
  background: color-mix(in srgb, var(--board) 88%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.wordmark {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 800; font-size: 22px; letter-spacing: 0.04em;
  color: var(--chalk); text-decoration: none;
  display: flex; flex-direction: column; line-height: 1.1;
}
.wordmark-sub {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 400; font-size: 9px; letter-spacing: 0.18em;
  color: var(--chalk-dim); text-transform: uppercase;
}
.topbar nav { display: flex; gap: 22px; margin-left: auto; }
.topbar nav a {
  color: var(--chalk-dim); text-decoration: none;
  font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
}
.topbar nav a:hover { color: var(--gold); }
.live-pill {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--chalk);
  border: 1px solid var(--line); border-radius: 99px;
  padding: 5px 13px; background: var(--panel);
}
.live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.35; } }

/* ---------- layout ---------- */
main { position: relative; z-index: 1; max-width: 1060px; margin: 0 auto; padding: 0 4vw 80px; }

section { margin-top: 96px; }

h2 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600; font-size: clamp(28px, 4vw, 40px);
  margin-bottom: 10px;
}
.h2-no {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px; color: var(--gold);
  vertical-align: super; margin-right: 14px; letter-spacing: 0.1em;
}
.section-note { color: var(--chalk-dim); font-size: 13px; margin-bottom: 26px; max-width: 60ch; }

/* ---------- hero ---------- */
.hero { padding-top: 90px; }
.kicker {
  font-size: 11px; letter-spacing: 0.22em; color: var(--gold);
  margin-bottom: 26px;
}
.hero h1 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 800;
  font-size: clamp(38px, 6.5vw, 72px);
  line-height: 1.06;
  letter-spacing: -0.01em;
  max-width: 20ch;
}
.hero h1 em {
  font-style: italic; font-weight: 600; color: var(--gold);
}
.hero .sub {
  margin-top: 28px; max-width: 62ch; color: var(--chalk-dim); font-size: 15px;
}
.stat-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  margin-top: 48px;
  background: var(--line); border: 1px solid var(--line);
}
.stat { background: var(--panel); padding: 18px 20px; }
.stat b {
  display: block;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(20px, 2.6vw, 30px); font-weight: 600; color: var(--chalk);
}
.stat span { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--chalk-dim); }

/* ---------- standings ---------- */
#racers { display: flex; flex-direction: column; gap: 18px; }

.racer {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), var(--board-2));
  padding: 20px 24px;
  position: relative;
}
.racer::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--ac);
}
.racer-top { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.pos {
  font-family: "Fraunces", Georgia, serif; font-weight: 800;
  font-size: 22px; color: var(--gold); min-width: 44px;
}
.racer-top h3 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 24px; font-weight: 600; letter-spacing: 0.02em; color: var(--ac);
}
.odo { margin-left: auto; font-size: 13px; color: var(--chalk-dim); }
.odo b { color: var(--chalk); font-size: 16px; }

.lane {
  margin-top: 16px; height: 30px; position: relative;
  border-bottom: 1px dashed var(--line);
  background: repeating-linear-gradient(90deg, transparent 0 118px, var(--line) 118px 119px);
}
.lane-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0%;
  transition: width 0.7s cubic-bezier(.3,.9,.4,1);
}
.lane-fill::after {              /* the runner marker */
  content: ""; position: absolute; right: -7px; top: 50%;
  width: 14px; height: 14px; border-radius: 50%;
  transform: translateY(-50%);
  background: var(--ac);
  box-shadow: 0 0 12px var(--ac);
}
.lane-fill::before {             /* trailing streak */
  content: ""; position: absolute; inset: 45% 0;
  background: linear-gradient(90deg, transparent, var(--ac));
  opacity: 0.5;
}
.lane-finish {
  position: absolute; right: 0; top: -4px; bottom: -4px; width: 10px;
  background: repeating-conic-gradient(var(--chalk) 0% 25%, var(--board) 0% 50%) 0 0 / 5px 5px;
  opacity: 0.55;
}
.racer-meta { margin-top: 12px; font-size: 12.5px; color: var(--chalk-dim); }
.racer-meta b { color: var(--chalk); font-weight: 500; }
.racer-meta .working::after { content: ""; animation: dots 1.5s steps(4) infinite; }
@keyframes dots { 0%{content:""} 25%{content:"."} 50%{content:".."} 75%{content:"..."} }

/* ---------- the wire ---------- */
.feed {
  border: 1px solid var(--line);
  background: #0a110e;
  padding: 18px 20px;
  height: min(360px, 48vh); overflow-y: auto;
  font-size: 13px; line-height: 1.75;
  overflow-wrap: anywhere;
}
.feed p { border-bottom: 1px dotted #1a2620; padding: 3px 0; }
.feed .t { color: #55695e; }
.feed .ai-grok { color: var(--grok); font-weight: 600; }
.feed .ai-gpt { color: var(--gpt); font-weight: 600; }
.feed .ai-claude { color: var(--claude); font-weight: 600; }
.feed .fail { color: #e0796a; }
.feed .partial { color: var(--gold); }
.feed-note { margin-top: 10px; font-size: 11.5px; color: var(--chalk-dim); }
.feed-note code { color: var(--chalk); background: var(--panel); padding: 0 5px; }

/* ---------- the board ---------- */
.problem-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
}
.problem {
  border: 1px solid var(--line); background: var(--panel);
  padding: 22px 22px 18px; display: flex; flex-direction: column; gap: 8px;
}
.problem h3 { font-family: "Fraunces", Georgia, serif; font-size: 21px; font-weight: 600; }
.pyear { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }
.problem p:not(.pyear) { font-size: 13px; color: var(--chalk-dim); flex: 1; }
.ptag {
  align-self: flex-start; margin-top: 8px;
  font-size: 10.5px; letter-spacing: 0.14em; padding: 3px 10px;
  border: 1px solid;
}
.ptag.open { color: var(--red); border-color: var(--red); }
.ptag.solved { color: var(--gpt); border-color: var(--gpt); }
.solved-card { background: linear-gradient(180deg, var(--panel), #12241c); }

/* ---------- manifesto ---------- */
.manifesto-body {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(17px, 2vw, 21px); line-height: 1.65;
  max-width: 64ch;
}
.manifesto-body p + p { margin-top: 20px; }
.manifesto-body em { color: var(--gold); }
.manifesto-body .fine {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12.5px; color: var(--chalk-dim);
  border-top: 1px solid var(--line); padding-top: 20px; margin-top: 34px;
}

/* ---------- footer ---------- */
footer { margin-top: 110px; border-top: 1px solid var(--line); padding-top: 40px; }
.ca-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border: 1px solid var(--gold); background: var(--panel);
  padding: 12px 16px; margin-bottom: 22px;
}
.ca-label {
  font-size: 11px; letter-spacing: 0.18em; color: var(--gold); font-weight: 600;
}
.ca-bar code {
  font-size: 12.5px; color: var(--chalk); overflow-wrap: anywhere;
}
.ca-copy {
  margin-left: auto; font-family: "IBM Plex Mono", monospace; font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase;
  background: none; border: 1px solid var(--line); color: var(--chalk-dim);
  padding: 5px 12px; cursor: pointer;
}
.ca-copy:hover { color: var(--gold); border-color: var(--gold); }
.btnrow { display: flex; flex-wrap: wrap; gap: 14px; }
.btn {
  font-family: "IBM Plex Mono", monospace; font-size: 13px; letter-spacing: 0.06em;
  color: var(--board); background: var(--chalk);
  border: none; padding: 12px 26px; cursor: pointer; text-decoration: none;
  transition: transform .15s ease, background .15s ease;
}
.btn:hover { background: var(--gold); transform: translateY(-2px); }
.honesty { margin-top: 36px; max-width: 74ch; }
.honesty p { font-size: 11.5px; color: var(--chalk-dim); line-height: 1.7; }
.honesty p + p { margin-top: 10px; }

/* ---------- mobile ---------- */
@media (max-width: 760px) {
  .topbar { gap: 14px; flex-wrap: wrap; }
  .topbar nav { display: none; }
  .live-pill { margin-left: auto; }
  .hero { padding-top: 56px; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .racer-top { gap: 10px; }
  .odo { margin-left: 0; width: 100%; }
  section { margin-top: 64px; }
}
