/* Tail Recursion — site styles.
 *
 * Everything here is written against the game's own look: a dark terminal,
 * hard 1px borders, no rounded corners, a 5x7 pixel font for display type and
 * a monospace stack for everything else. Colours are lifted from the running
 * game — block header colours in particular are the same per category.
 */

:root {
  --bg:          #070a0e;
  --bg-2:        #0a0f15;
  --panel:       #0e141c;
  --panel-2:     #121a23;
  --panel-3:     #16202b;
  --line:        #1c2833;
  --line-2:      #27363f;

  --text:        #b8c7d1;
  --text-bright: #e6eef3;
  --text-dim:    #64757f;
  --text-faint:  #3c4a54;

  --green:       #6ee7a0;
  --green-dim:   #2f6b4c;
  --red:         #e2565f;
  --red-dim:     #7a2f36;
  --amber:       #f2c14e;
  --blue:        #58a6e8;
  --cyan:        #4fd6c8;
  --violet:      #9b7fd4;
  --gold:        #d9a441;

  --mono: ui-monospace, "Cascadia Mono", "Cascadia Code", Consolas,
          "DejaVu Sans Mono", "Liberation Mono", Menlo, monospace;

  --measure: 1180px;
  --gut: 24px;
}

/* ------------------------------------------------------------------ reset */

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 76px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: var(--green); text-decoration: none; }
a:hover { color: var(--text-bright); }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

/* The faint grid the game draws behind its editor canvas. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(to right,  rgba(120, 180, 200, .028) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(120, 180, 200, .028) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* Scanlines + vignette. Subtle enough to read through. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 900;
  background:
    repeating-linear-gradient(to bottom,
      rgba(0, 0, 0, .16) 0px, rgba(0, 0, 0, .16) 1px,
      transparent 1px, transparent 3px),
    radial-gradient(ellipse at 50% 40%, transparent 45%, rgba(0, 0, 0, .55) 100%);
  opacity: .55;
}

.wrap {
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--gut);
  position: relative;
  z-index: 1;
}

.skip {
  position: absolute; left: -9999px;
  background: var(--amber); color: #000; padding: 8px 14px; z-index: 1000;
}
.skip:focus { left: 12px; top: 12px; }

/* ------------------------------------------------------------------- type */

h1, h2, h3, h4 {
  font-weight: 400;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-bright);
  margin: 0;
}

h1 { font-size: 22px; }
h2 { font-size: 20px; }
h3 { font-size: 15px; letter-spacing: .1em; }

/* Readable by a screen reader and a crawler, invisible on screen. Used for the
 * page's real <h1> where the visible heading is a drawn wordmark. */
.vh {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

.lede { font-size: 17px; line-height: 1.75; color: var(--text); }
.dim  { color: var(--text-dim); }
.hl   { color: var(--text-bright); }
.green { color: var(--green); }
.red   { color: var(--red); }
.amber { color: var(--amber); }

code, .kbd {
  font-family: var(--mono);
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  padding: 1px 5px;
  color: var(--green);
  font-size: .92em;
}
.kbd { color: var(--amber); }

/* Section label, drawn like a panel title in the game's HUD. */
.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 14px;
}
.eyebrow::before {
  content: "";
  width: 9px; height: 9px;
  background: var(--green);
  flex: none;
  box-shadow: 0 0 10px rgba(110, 231, 160, .6);
}
.eyebrow::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--line-2), transparent);
}

/* ----------------------------------------------------------------- header */

.top {
  position: sticky;
  top: 0;
  z-index: 500;
  background: rgba(7, 10, 14, .92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}

.top .wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 60px;
}

.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand svg { height: 15px; width: auto; }
.brand .tag {
  font-size: 10px; letter-spacing: .22em; color: var(--text-faint);
  border-left: 1px solid var(--line-2); padding-left: 10px;
}

.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav a {
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  padding: 6px 10px;
  border: 1px solid transparent;
}
.nav a:hover { color: var(--text-bright); border-color: var(--line-2); background: var(--panel); }
.nav a[aria-current="page"] { color: var(--amber); border-color: var(--line-2); }

.menu-btn {
  display: none;
  margin-left: auto;
  background: var(--panel);
  border: 1px solid var(--line-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .14em;
  padding: 7px 12px;
  cursor: pointer;
}

/* ----------------------------------------------------------------- panels */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  position: relative;
}

/* The bracket corners the game draws on level tiles. */
.panel--bracket::before,
.panel--bracket::after {
  content: "";
  position: absolute;
  width: 12px; height: 12px;
  border: 1px solid var(--green-dim);
  pointer-events: none;
}
.panel--bracket::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.panel--bracket::after  { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.panel__body { padding: 18px; }

section { padding: 74px 0; position: relative; }
section + section { border-top: 1px solid var(--line); }

/* ------------------------------------------------------------------- hero */

.hero {
  padding: 64px 0 78px;
  border-bottom: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}

.hero__glow {
  position: absolute;
  top: -180px; left: 50%;
  width: 900px; height: 520px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse, rgba(226, 86, 95, .10), transparent 68%);
  pointer-events: none;
}

.wordmark { width: 100%; max-width: 660px; margin: 0 auto 26px; display: block; }
.wordmark .t { fill: var(--green); }
.wordmark .r { fill: var(--red); }

.hero__tag {
  text-align: center;
  font-size: 13px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 34px;
}
.hero__tag .hl { color: var(--amber); }

.hero__grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 34px;
  align-items: start;
}

.hero__pitch p { margin-bottom: 1.1em; }
.hero__pitch .lede:first-child { color: var(--text-bright); }

/* Attract-mode menu, echoing the title screen. */
.attract { padding: 18px 20px; }
.attract li {
  list-style: none;
  font-size: 13px;
  letter-spacing: .2em;
  color: var(--text-dim);
  padding: 5px 0 5px 22px;
  position: relative;
}
.attract li[data-on] { color: var(--amber); }
.attract li[data-on]::before {
  content: "";
  position: absolute; left: 0; top: 50%;
  width: 8px; height: 8px;
  margin-top: -4px;
  background: var(--amber);
}
.attract ul { margin: 0; padding: 0; }
.attract__hint {
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 11px; letter-spacing: .12em; color: var(--text-faint);
}

/* ---------------------------------------------------------------- buttons */

.cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line-2);
  background: var(--panel);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  padding: 11px 17px;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--panel-3); border-color: var(--text-dim); color: var(--text-bright); }
.btn__dot { width: 8px; height: 8px; background: currentColor; flex: none; }

.btn--yt { border-color: var(--red-dim); color: var(--red); }
.btn--yt:hover { background: rgba(226, 86, 95, .1); border-color: var(--red); color: #ff8189; }

.btn--soon {
  color: var(--text-faint);
  border-style: dashed;
  cursor: default;
}
.btn--soon:hover { background: var(--panel); border-color: var(--line-2); color: var(--text-faint); }
.btn--soon .btn__dot { background: var(--text-faint); }
.btn--soon::after {
  content: "SOON";
  font-size: 9px;
  letter-spacing: .12em;
  border: 1px solid var(--line-2);
  padding: 1px 4px;
  color: var(--text-faint);
}

/* ------------------------------------------------------------------ cards */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.card { background: var(--panel); padding: 24px; }
.card h3 { margin-bottom: 10px; color: var(--text-bright); }
.card p { color: var(--text-dim); font-size: 14px; }
.card__n {
  font-size: 11px; letter-spacing: .2em; color: var(--text-faint);
  display: block; margin-bottom: 12px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin-top: 28px;
}
.stat { background: var(--panel); padding: 18px 20px; }
.stat b {
  display: block;
  font-size: 26px;
  font-weight: 400;
  color: var(--green);
  letter-spacing: .05em;
  line-height: 1.2;
}
.stat span { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--text-dim); }

/* ------------------------------------------------------------------- demo */

/* Map above, block canvas below — the same split the game window uses. */
.demo {
  display: grid;
  /* minmax(0,1fr), not 1fr: a grid track defaults to min-width auto, which the
   * 660px node canvas would prise open instead of scrolling inside itself. */
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.demo__stage { background: #060a0d; padding: 20px; min-width: 0; }
.demo__side  { background: var(--panel); padding: 0; min-width: 0; }

.demo__side .eyebrow {
  margin: 0;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}

.board {
  display: grid;
  gap: 2px;
  margin: 0 auto;
  width: 100%;
  max-width: 720px;
  aspect-ratio: 14 / 7;
}
.cell { background: #0b1a15; border: 1px solid transparent; }
.cell[data-k="wall"]  { background: #16232c; border-color: #1e2f3a; }
.cell[data-k="body"]  { background: #3fae7a; }
.cell[data-k="head"]  { background: #9df5c0; box-shadow: 0 0 8px rgba(110, 231, 160, .5); }
.cell[data-k="apple"] { background: #e2565f; }

.demo__bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--text-dim);
}
.demo__bar b { color: var(--green); font-weight: 400; }
.demo__ctrl { display: flex; gap: 6px; margin-left: auto; }
.demo__ctrl .btn { padding: 6px 11px; font-size: 11px; }

/* The node canvas, drawn to match the in-game editor. Every colour here is
 * lifted from src/editor.cpp rather than picked by eye. */
:root {
  --ed-canvas:   #101219;   /* kCanvas    */
  --ed-grid:     #161922;   /* kGrid      */
  --ed-grid-maj: #252c3c;   /* kGridMajor */
  --ed-fill:     #1b212e;   /* kNodeFill  */
  --ed-edge:     #425169;   /* kNodeEdge  */
  --ed-entry:    #e8994a;   /* kEntry — the orange ring on the entry node */
  --ed-running:  #8be5aa;   /* kRunning   */
  --ed-wire:     #60bf80;   /* kExecWire  */
  --ed-wire-hot: #a9f2bd;   /* kExecWireHot */
  --ed-label:    #c7d4e6;   /* kLabel     */
  --ed-dim:      #66748b;   /* kDim       */
  --ed-badge:    #fbca4f;   /* kSelected, which is also the step badge */

  /* category_color() */
  --cat-sensing:   #609ce1;
  --cat-source:    #8bc47e;
  --cat-condition: #d8b465;
  --cat-memory:    #b38cd8;
  --cat-action:    #e67979;
}

.graph-scroll { overflow-x: auto; overflow-y: hidden; min-width: 0; }

.graph {
  position: relative;
  width: 740px;
  height: 250px;
  background-color: var(--ed-canvas);
  background-image:
    linear-gradient(to right,  var(--ed-grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--ed-grid) 1px, transparent 1px),
    linear-gradient(to right,  var(--ed-grid-maj) 1px, transparent 1px),
    linear-gradient(to bottom, var(--ed-grid-maj) 1px, transparent 1px);
  background-size: 22px 22px, 22px 22px, 110px 110px, 110px 110px;
}

.graph__wires { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.graph__wires path {
  fill: none;
  stroke: var(--ed-wire);
  stroke-width: 1.5;
  transition: stroke .12s;
}
.graph__wires path.hot { stroke: var(--ed-wire-hot); stroke-width: 2; }

.gnode {
  position: absolute;
  width: 170px;
  /* Tall enough that a second exec port still lands inside the node, the way
   * the editor grows a node by a row per port. */
  min-height: 76px;
  background: var(--ed-fill);
  border: 1px solid var(--ed-edge);
  transition: border-color .12s, box-shadow .12s;
}
.gnode--entry { border-color: var(--ed-entry); }
.gnode[data-live] {
  border-color: var(--ed-running);
  box-shadow: 0 0 14px rgba(139, 229, 170, .22);
}

.gnode__head {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 6px;
  background: var(--ed-edge);
  color: #0d1119;
  font-size: 11.5px;
  letter-spacing: .04em;
}
.gnode__name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* The editor's info button: a recessed chip, not a coloured one. */
.gnode__i {
  flex: none;
  background: #33415c;
  color: var(--ed-label);
  font-size: 10px;
  line-height: 1;
  padding: 2px 5px;
}
.gnode__cost { flex: none; font-size: 10.5px; opacity: .85; }

.gnode__body {
  padding: 8px 7px 20px;
  font-size: 11.5px;
  color: var(--ed-dim);
  letter-spacing: .03em;
}

/* Step index in the exec chain, bottom-right, exactly where the editor puts it. */
.gnode__num {
  position: absolute;
  right: 3px;
  bottom: 3px;
  min-width: 13px;
  height: 13px;
  background: var(--ed-badge);
  color: #14100a;
  font-size: 10px;
  line-height: 13px;
  text-align: center;
  padding: 0 2px;
}

.gnode--sensing   .gnode__head { background: var(--cat-sensing); }
.gnode--source    .gnode__head { background: var(--cat-source); }
.gnode--condition .gnode__head { background: var(--cat-condition); }
.gnode--memory    .gnode__head { background: var(--cat-memory); }
.gnode--action    .gnode__head { background: var(--cat-action); }
/* flow and event fall through to kNodeEdge, as they do in the editor. */

/* Ports sit centred on the node's edge, labels outside it. */
.gport {
  position: absolute;
  width: 9px;
  height: 9px;
  background: var(--ed-wire);
  transition: background .12s, box-shadow .12s;
}
.gport--in  { left: -5px; }
.gport--out { right: -5px; }
.gport[data-taken] {
  background: var(--ed-wire-hot);
  box-shadow: 0 0 8px rgba(169, 242, 189, .55);
}

/* Sits just above the wire rather than centred on it, so the label and the
 * horizontal run of the wire never occupy the same pixels. */
.gport__label {
  position: absolute;
  left: calc(100% + 8px);
  font-size: 11px;
  line-height: 1;
  color: var(--ed-dim);
  white-space: nowrap;
  transform: translateY(-100%);
  margin-top: -3px;
}
.gport__label[data-taken] { color: var(--ed-wire-hot); }

/* ------------------------------------------------------------ screenshots */

.shots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
}
.shot { border: 1px solid var(--line); background: var(--panel); }
.shot__frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #05080b;
  overflow: hidden;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 0;
  margin: 0;
  width: 100%;
  display: block;
  font: inherit;
  color: inherit;
  cursor: default;
}
/* Enabled only once the PNG actually decodes — a placeholder has nothing to
 * open. */
.shot__frame:not(:disabled) { cursor: zoom-in; }
.shot__frame:not(:disabled):hover img { transform: scale(1.03); }
.shot__frame img { transition: transform .18s ease; }
@media (prefers-reduced-motion: reduce) {
  .shot__frame img { transition: none; }
  .shot__frame:not(:disabled):hover img { transform: none; }
}
.shot__frame img { width: 100%; height: 100%; object-fit: cover; object-position: center; }
.shot__cap { padding: 13px 15px; }
.shot__cap b {
  display: block; font-weight: 400; font-size: 12px;
  letter-spacing: .18em; text-transform: uppercase; color: var(--amber); margin-bottom: 5px;
}
.shot__cap span { font-size: 13px; color: var(--text-dim); line-height: 1.55; }

/* Shown when the PNG is not there yet. */
.shot__miss {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
  color: var(--text-faint);
  font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  background-image:
    linear-gradient(to right,  rgba(120, 180, 200, .05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(120, 180, 200, .05) 1px, transparent 1px);
  background-size: 18px 18px;
  text-align: center; padding: 16px;
}
.shot__miss code { background: transparent; border: 0; color: var(--green-dim); padding: 0; }

/* -------------------------------------------------------------- lightbox */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(4, 6, 9, .95);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.lightbox[hidden] { display: none; }

.lightbox__frame {
  display: flex;
  flex-direction: column;
  max-width: min(1600px, 96vw);
  max-height: 94vh;
  border: 1px solid var(--line-2);
  background: var(--panel);
}

.lightbox__img {
  display: block;
  max-width: 100%;
  max-height: calc(94vh - 104px);
  width: auto;
  object-fit: contain;
  background: #05080b;
  image-rendering: pixelated;   /* it is pixel art; do not smooth it */
}

.lightbox__bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 11px 15px;
  border-top: 1px solid var(--line);
  background: var(--panel-2);
}
.lightbox__title {
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--amber);
  flex: none;
}
.lightbox__cap { font-size: 13px; color: var(--text-dim); flex: 1 1 260px; min-width: 0; }
.lightbox__ctrl { display: flex; gap: 6px; margin-left: auto; flex: none; }
.lightbox__ctrl .btn { padding: 6px 11px; font-size: 11px; }
.lightbox__ctrl .btn[disabled] { opacity: .35; cursor: default; }
.lightbox__hint {
  width: 100%;
  font-size: 10px;
  letter-spacing: .14em;
  color: var(--text-faint);
  text-transform: uppercase;
}

/* ------------------------------------------------------------ leaderboard */

.board-wrap { display: grid; grid-template-columns: 1fr 320px; gap: 26px; align-items: start; }

table.lb { width: 100%; border-collapse: collapse; font-size: 13px; }
table.lb th {
  text-align: left;
  font-weight: 400;
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--text-faint);
  border-bottom: 1px solid var(--line-2);
  padding: 0 10px 8px;
}
table.lb td { padding: 8px 10px; border-bottom: 1px solid var(--line); color: var(--text); }
table.lb tr:hover td { background: var(--panel-2); }
table.lb .rank { color: var(--text-dim); width: 56px; }
table.lb tr:nth-child(1) .rank { color: var(--amber); }
table.lb tr:nth-child(2) .rank { color: #c9d4da; }
table.lb tr:nth-child(3) .rank { color: #b3763c; }
table.lb .score { text-align: right; color: var(--green); }

.lb-empty {
  border: 1px dashed var(--line-2);
  padding: 34px 24px;
  text-align: center;
  color: var(--text-dim);
}
.lb-empty b {
  display: block;
  font-weight: 400;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 10px;
}
.lb-empty span { font-size: 13px; }

.blink { animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .blink { animation: none; } }

/* ------------------------------------------------------------------- wiki */

.wiki { display: grid; grid-template-columns: 232px 1fr; gap: 28px; align-items: start; }

.wiki__side { position: sticky; top: 76px; }
.wiki__side .panel__body { padding: 12px; }

.filter {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  color: var(--text-bright);
  font-family: var(--mono);
  font-size: 13px;
  padding: 9px 11px;
  margin-bottom: 12px;
}
.filter::placeholder { color: var(--text-faint); }

.catlist { list-style: none; margin: 0; padding: 0; }
.catlist button {
  width: 100%;
  display: flex; align-items: center; gap: 9px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 7px 9px;
  cursor: pointer;
  text-align: left;
}
.catlist button:hover { background: var(--panel-2); color: var(--text-bright); }
.catlist button[aria-pressed="true"] { border-color: var(--line-2); background: var(--panel-2); color: var(--text-bright); }
.catlist .swatch { width: 9px; height: 9px; flex: none; background: var(--text-dim); }
.catlist .n { margin-left: auto; color: var(--text-faint); font-size: 11px; }

.swatch--red { background: var(--red); }
.swatch--cyan { background: var(--cyan); }
.swatch--blue { background: var(--blue); }
.swatch--violet { background: var(--violet); }
.swatch--gold { background: var(--gold); }
.swatch--green { background: var(--green); }
.swatch--amber { background: var(--amber); }

.blocklist { display: grid; gap: 14px; }

.bk { border: 1px solid var(--line); background: var(--panel); }
.bk__head {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 13px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.bk__name { color: var(--text-bright); letter-spacing: .1em; font-size: 14px; }
.bk__id { color: var(--text-faint); font-size: 11px; }
.bk__tags { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }

.tag {
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  border: 1px solid var(--line-2);
  padding: 1px 7px;
  color: var(--text-dim);
  white-space: nowrap;
}
.tag--cost { color: var(--amber); border-color: rgba(242, 193, 78, .35); }
.tag--free { color: var(--green); border-color: var(--green-dim); }
.tag--mod  { color: var(--violet); border-color: rgba(155, 127, 212, .4); }
.tag--sensor { color: var(--cyan); border-color: rgba(79, 214, 200, .35); }
.tag--terminal { color: var(--red); border-color: var(--red-dim); }

.bk__stripe { height: 3px; background: var(--text-dim); }
.bk__body { padding: 15px 16px; }
.bk__desc { color: var(--text); font-size: 14px; margin-bottom: 0; }

.bk__note {
  margin-top: 13px;
  border-left: 2px solid var(--line-2);
  padding: 2px 0 2px 12px;
  color: var(--text-dim);
  font-size: 13px;
}

.ports { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-top: 15px; }
.ports h4 {
  font-size: 10px; letter-spacing: .2em; color: var(--text-faint); margin-bottom: 7px;
}
.ports ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.ports li { font-size: 12px; color: var(--text-dim); display: flex; gap: 7px; align-items: baseline; }
.ports li b { font-weight: 400; color: var(--text); }
.ports li i { font-style: normal; color: var(--text-faint); }
.ports li::before { content: "·"; color: var(--text-faint); }

.no-hits { padding: 40px; text-align: center; color: var(--text-dim); border: 1px dashed var(--line-2); }

/* ------------------------------------------------------------------ code */

pre.code {
  margin: 16px 0;
  padding: 14px 16px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-left: 2px solid var(--green-dim);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text);
  /* Wide samples scroll inside their own box; the page never does. */
  overflow-x: auto;
  white-space: pre;
  tab-size: 2;
}
pre.code b { font-weight: 400; }

.tok-comment { color: var(--text-faint); font-style: italic; }
.tok-string  { color: var(--amber); }
.tok-keyword { color: var(--green); }
.tok-number  { color: var(--cyan); }
.tok-key     { color: var(--blue); }

.code-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 22px 0 -8px;
}

/* ------------------------------------------------------------------- api */

.api-wrap { overflow-x: auto; margin: 16px 0; }

table.api {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 13px;
}
table.api th {
  text-align: left;
  font-weight: 400;
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--text-faint);
  border-bottom: 1px solid var(--line-2);
  padding: 0 12px 8px;
  white-space: nowrap;
}
table.api td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text-dim);
  vertical-align: top;
}
table.api tr:hover td { background: var(--panel-2); }
table.api td:first-child {
  color: var(--green);
  white-space: nowrap;
  font-size: 12.5px;
}
table.api td.t { color: var(--cyan); white-space: nowrap; font-size: 12px; }
table.api td b { color: var(--text-bright); font-weight: 400; }

/* A callout for the traps that cost an evening. */
.warn {
  border: 1px solid var(--line-2);
  border-left: 2px solid var(--amber);
  background: var(--panel);
  padding: 14px 16px;
  margin: 18px 0;
  font-size: 13.5px;
  color: var(--text-dim);
}
.warn b {
  display: block;
  font-weight: 400;
  color: var(--amber);
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: 11px;
  margin-bottom: 6px;
}

/* Step headings down the authoring page. */
.step { display: flex; align-items: baseline; gap: 12px; margin: 44px 0 4px; }
.step:first-of-type { margin-top: 0; }
.step__n {
  font-size: 11px;
  letter-spacing: .2em;
  color: var(--green-dim);
  border: 1px solid var(--line-2);
  padding: 2px 8px;
  flex: none;
}

/* ------------------------------------------------------------------ misc */

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }

.rows { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.row { background: var(--panel); padding: 14px 18px; display: grid; grid-template-columns: 200px 1fr; gap: 18px; }

/* A rows list already inside a panel. The panel supplies the border and the
 * padding, so the separator fill has to go — left on, it paints a lighter
 * block flush against the term column and the labels lose their inset. */
.rows--plain { background: transparent; border: 0; gap: 0; }
.rows--plain .row { background: transparent; padding: 12px 0; }
.rows--plain .row + .row { border-top: 1px solid var(--line); }
.row dt { color: var(--amber); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
.row dd { margin: 0; color: var(--text-dim); font-size: 14px; }

.links { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.linkcard { background: var(--panel); padding: 22px; display: block; color: inherit; }
.linkcard:hover { background: var(--panel-2); }
.linkcard b { display: block; font-weight: 400; letter-spacing: .18em; text-transform: uppercase; font-size: 13px; margin-bottom: 7px; color: var(--text-bright); }
.linkcard span { font-size: 13px; color: var(--text-dim); }
.linkcard[data-soon] { cursor: default; }
.linkcard[data-soon]:hover { background: var(--panel); }
.linkcard[data-soon] b { color: var(--text-dim); }

footer {
  border-top: 1px solid var(--line);
  padding: 34px 0 44px;
  color: var(--text-faint);
  font-size: 12px;
}
footer .wrap { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
footer a { color: var(--text-dim); }

/* ------------------------------------------------------------ responsive */

@media (max-width: 960px) {
  /* .demo is a single-column row grid already — leaving it out keeps its
   * minmax(0,1fr) track, which is what lets the node canvas scroll. */
  .hero__grid, .board-wrap, .wiki, .two { grid-template-columns: 1fr; }
  .wiki__side { position: static; }
  .row { grid-template-columns: 1fr; gap: 4px; }
}

@media (max-width: 720px) {
  :root { --gut: 16px; }
  section { padding: 52px 0; }
  .hero { padding: 42px 0 56px; }
  .menu-btn { display: block; }
  .nav {
    display: none;
    position: absolute; top: 60px; left: 0; right: 0;
    flex-direction: column;
    background: var(--bg-2);
    border-bottom: 1px solid var(--line);
    padding: 10px var(--gut) 16px;
    gap: 2px;
  }
  .nav[data-open] { display: flex; }
  .brand .tag { display: none; }
  .demo__ctrl { margin-left: 0; width: 100%; }
}
