:root {
  /* Colours taken from the game */
  --snake: #ff6699;
  --food: #4e82ff;
  --lime: #a6ff75;
  --human: #00aa66;
  --ai: #4e82ff;
  --deep-blue: #000066;

  --bg: #fbfbf8;
  --ink: #14143a;
  --muted: #55587a;
  --line: #d9dae3;
  --tint: #f0f1f6;
  --code-bg: #14143a;
  --code-ink: #e8ecff;
  --link: #2f5fd0;
  --sev-high: #c81e5a;
  --sev-mid: #9a6300;

  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --pixel: 'Silkscreen', var(--mono);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101126;
    --ink: #ecedf7;
    --muted: #a3a6c2;
    --line: #2c2e4d;
    --tint: #181a35;
    --code-bg: #07081a;
    --link: #8fb0ff;
    --sev-high: #ff8fb4;
    --sev-mid: #ffd166;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 var(--font);
}

a {
  color: var(--link);
  text-underline-offset: 3px;
}

code {
  font-family: var(--mono);
  font-size: 0.88em;
}

.wrap {
  max-width: 1040px;
  margin-inline: auto;
  padding-inline: 20px;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: clamp(2.1rem, 4.6vw, 3.3rem);
  font-weight: 800;
  letter-spacing: -0.025em;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.015em;
}

h3 {
  font-size: 1.1rem;
}

/* ==== HERO ==== */
.hero {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 56px;
  align-items: center;
  padding-block: 72px 48px;
}

.lede {
  margin: 20px 0 28px;
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 33em;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
}

.btn {
  display: inline-flex;
  flex-direction: column;
  white-space: nowrap;
  padding: 10px 20px;
  border-radius: 4px;
  background: var(--deep-blue);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}
.btn:hover,
.btn:focus-visible {
  background: var(--food);
}
@media (prefers-color-scheme: dark) {
  .btn {
    background: var(--food);
  }
  .btn:hover,
  .btn:focus-visible {
    background: #6f9bff;
  }
}

/* Two-line label: "Play Version 1" over "Hand-built" */
.btn__title {
  line-height: 1.3;
}
.btn__sub {
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.3;
  opacity: 0.85;
}

.btn--secondary {
  padding: 8px 18px;
  border: 2px solid var(--deep-blue);
  background: transparent;
  color: var(--deep-blue);
}
.btn--secondary:hover,
.btn--secondary:focus-visible {
  border-color: var(--food);
  background: var(--tint);
  color: var(--deep-blue);
}
@media (prefers-color-scheme: dark) {
  .btn--secondary {
    border-color: var(--food);
    background: transparent;
    color: var(--ink);
  }
  .btn--secondary:hover,
  .btn--secondary:focus-visible {
    border-color: #8fb0ff;
    background: var(--tint);
    color: var(--ink);
  }
}

.hero__visual {
  margin: 0;
}

/* Framed like the real game: white cells on its blue-to-lime background */
.demo-window {
  padding: 14px;
  background: radial-gradient(var(--food), var(--lime));
}

.demo-grid {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 2px;
}

.demo-cell {
  aspect-ratio: 1;
  background: #fff;
}
.demo-cell.is-obstacle {
  opacity: 0.5;
}
.demo-cell.is-snake {
  background: var(--snake);
}
.demo-cell.is-head {
  background: #e8467d;
}
.demo-cell.is-food {
  background: var(--food);
}

/* ==== SECTIONS ==== */
.section {
  padding-block: 48px;
  border-top: 1px solid var(--line);
}

.intro {
  max-width: 42em;
  margin: 14px 0 32px;
  color: var(--muted);
  font-size: 1.08rem;
}

/* Running text, e.g. the "almost right" section */
.prose {
  max-width: 42em;
  margin-top: 14px;
  font-size: 1.08rem;
}
.prose p {
  margin: 0 0 16px;
  color: var(--muted);
}
.prose p:last-child {
  margin-bottom: 0;
}
.prose strong {
  color: var(--ink);
}

/* Steps: a plain numbered timeline; the coloured rule shows who did each step */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 24px;
  counter-reset: step;
}

.step {
  counter-increment: step;
  padding-top: 14px;
  border-top: 3px solid var(--human);
}
.step--ai {
  border-top-color: var(--ai);
}
.step h3::before {
  content: counter(step) '. ';
  color: var(--muted);
  font-weight: 400;
}
.step p {
  margin: 6px 0 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.who {
  margin-left: 4px;
  font: 400 0.7rem/1 var(--pixel);
  color: var(--human);
  vertical-align: 2px;
}
.step--ai .who {
  color: var(--ai);
}

/* Findings: a numbered list split by rules, problem on the left and fix on the right */
.findings {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: finding;
}

.finding {
  counter-increment: finding;
  position: relative;
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 12px 40px;
  padding: 26px 0 26px 56px;
  border-top: 1px solid var(--line);
}
.finding:last-child {
  border-bottom: 1px solid var(--line);
}
.finding::before {
  content: counter(finding, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 26px;
  font: 400 1.1rem/1 var(--pixel);
  color: var(--snake);
}
.finding h3 {
  margin: 2px 0 6px;
}
.finding p {
  margin: 0;
  color: var(--muted);
  font-size: 0.97rem;
}

.finding .severity {
  font-size: 0.8rem;
  font-weight: 700;
}
.finding .severity--high {
  color: var(--sev-high);
}
.finding .severity--mid {
  color: var(--sev-mid);
}

.finding .fix {
  align-self: start;
  margin-top: 22px;
  padding-left: 14px;
  border-left: 3px solid var(--human);
  color: var(--ink);
}
.fix::before {
  content: 'Fixed: ';
  font-weight: 700;
  color: var(--human);
}

details {
  margin-top: 10px;
}
summary {
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--link);
}
pre {
  margin: 10px 0 0;
  padding: 14px 16px;
  background: var(--code-bg);
  color: var(--code-ink);
  font-size: 0.82rem;
  line-height: 1.55;
  overflow-x: auto;
}
pre .c {
  color: #8f9bd0;
}

.aside {
  max-width: 42em;
  margin: 28px 0 0;
  color: var(--muted);
}
.aside strong {
  color: var(--ink);
}

/* Stats: numbers in a row, no boxes. The label comes first in the HTML, so flip it visually. */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin: 24px 0 0;
}
.stat {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
}
.stat dd {
  margin: 0 0 4px;
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.stat dt {
  color: var(--muted);
  font-size: 0.95rem;
}

/* Choice */
.choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 20px;
  margin-top: 24px;
}

.choice {
  display: flex;
  flex-direction: column;
  padding: 26px 28px;
  border: 2px solid var(--ai);
  color: inherit;
  text-decoration: none;
}
.choice--human {
  border: 2px dashed var(--human);
}
.choice:hover,
.choice:focus-visible {
  background: var(--tint);
}
.choice h3 {
  margin: 10px 0 8px;
  font-size: 1.6rem;
  font-weight: 800;
}
.choice p {
  margin: 0 0 22px;
  color: var(--muted);
}

.choice__label {
  font: 400 0.78rem/1.2 var(--pixel);
  color: var(--ai);
}
.choice--human .choice__label {
  color: var(--human);
}

.choice__cta {
  margin-top: auto;
  font-weight: 700;
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.note {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.takeaway {
  margin: 0;
  padding-left: 24px;
  border-left: 6px solid var(--snake);
}
.takeaway p {
  margin: 0;
  max-width: 28em;
  font-size: clamp(1.35rem, 2.6vw, 1.8rem);
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.footer {
  padding-block: 28px 44px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.95rem;
}
.footer p {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 0;
}
.footer a {
  color: var(--ink);
  font-weight: 600;
}
.footer a:hover,
.footer a:focus-visible {
  color: var(--link);
}

/* ==== RESPONSIVE ==== */
@media (max-width: 900px) {
  .steps {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 760px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 36px;
    padding-block: 44px 32px;
  }
  .finding {
    grid-template-columns: 1fr;
    padding-left: 44px;
  }
  .finding .fix {
    margin-top: 4px;
  }
}

/* Version colour dot: green = Version 1 (hand-built), blue = Version 2 (AI-reviewed).
   The white ring keeps it visible on a button of the same colour. */
.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 7px;
  border-radius: 50%;
  box-shadow: 0 0 0 1.5px #fff;
  vertical-align: 1px;
}
.dot--human {
  background: var(--human);
}
.dot--ai {
  background: var(--ai);
}
