/* ---------- Motion on scroll ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
    transform: translateY(26px);
    transition:
      opacity 0.9s var(--ease),
      transform 0.9s var(--ease);
  }
  .js .reveal.seen {
    opacity: 1;
    transform: none;
  }
}

/* A single-column grid sizes its column to its widest unbreakable child (a code block, a table) unless told not to,
   which on a phone widens the whole page. Every figure grid starts as one column that may shrink. */
.split-grid,
.dlog,
.ties,
.ties-stage,
.ties-answers,
.battery,
.twin,
.kchart,
.witness,
.witness-body,
.parse,
.parse-controls,
.parse-body,
.gate,
.flow,
.store {
  grid-template-columns: minmax(0, 1fr);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: clip;
  background: var(--ink);
}
.field {
  position: relative;
  order: 2;
  aspect-ratio: 1.05;
  margin-top: -0.5rem;
}
.field canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: pan-y;
  cursor: crosshair;
}
.field::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, var(--ink) 1%, transparent 16%),
    linear-gradient(to top, var(--ink) 0%, transparent 16%);
}
.tip {
  position: absolute;
  z-index: 5;
  display: grid;
  gap: 0.1rem;
  width: max-content;
  max-width: 16rem;
  padding: 0.55rem 0.8rem 0.6rem;
  border: 1px solid var(--line-2);
  border-radius: 0.8rem;
  background: rgb(5 10 18 / 0.92);
  backdrop-filter: blur(12px);
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--soft);
  pointer-events: none;
  box-shadow: 0 18px 44px -18px #000;
}
.tip b {
  font: 600 0.8rem/1.4 var(--mono);
  color: #fff;
}
@media (max-width: 999px) {
  .hero {
    padding-top: clamp(5.4rem, 12vh, 8rem);
  }
  .hero-copy {
    display: contents;
  }
  .hero-copy > * {
    position: relative;
    z-index: 2;
    order: 1;
    margin-inline: var(--gutter);
  }
  .hero-copy > .pill {
    align-self: flex-start;
  }
  .hero .hero-copy > .lede {
    margin-top: 1.1rem;
  }
  .hero .hero-copy > .cta {
    margin-top: 1.4rem;
  }
}
@media (max-width: 479px) {
  .hero .hero-copy > .lede {
    font-size: 1.04rem;
    line-height: 1.55;
  }
  .hero .install {
    width: 100%;
    justify-content: space-between;
    font-size: 0.84rem;
    white-space: nowrap;
  }
  .hero .cta .btn {
    width: 100%;
  }
}
.hero .d1 {
  width: fit-content;
  font-size: clamp(2.6rem, 12vw, 4.8rem);
  margin-top: 1.4rem;
}
.hero .d1 > span {
  display: block;
}
@media (min-width: 1000px) {
  .hero .d1 {
    font-size: clamp(4rem, 6vw, 6rem);
  }
}
.hero .lede {
  max-width: 34rem;
  margin-top: 1.5rem;
}
.pill {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.65rem;
  padding: 0.5rem 0.95rem;
  border: 1px solid rgb(92 200 255 / 0.24);
  border-radius: 99rem;
  background: rgb(6 14 26 / 0.72);
  font: 500 0.6875rem/1.3 var(--mono);
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--soft);
}
.pill i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--faint);
}
.console-wrap {
  position: relative;
  z-index: 3;
  order: 3;
  padding-bottom: 1.3rem;
}
.console {
  position: relative;
  display: grid;
  gap: 1.2rem;
  padding: 1.15rem 1.25rem 1.3rem;
  border: 1px solid var(--line-2);
  border-radius: 1.4rem;
  background: linear-gradient(180deg, rgb(12 22 38 / 0.84), rgb(5 10 18 / 0.9));
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.06),
    0 30px 80px -30px #000;
}
.console .micro {
  margin-bottom: 0.6rem;
}
.console-algo .seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: 100%;
}
.console-dials {
  display: flex;
  align-items: end;
  gap: 1rem;
}
.console-dials .range {
  flex: 1;
  min-width: 9rem;
}
.console-dials .btn {
  flex: none;
}
.tally {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.92rem;
  color: var(--soft);
}
.tally b {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--life);
}
.console-what {
  margin-top: 0.45rem;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--soft);
}
.console-receipt {
  margin-top: 0.35rem;
  font: 500 0.72rem/1.5 var(--mono);
  color: var(--muted);
  overflow-wrap: anywhere;
}
.console-receipt b {
  font-weight: 500;
  color: var(--gold);
}
.console-pause {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid transparent;
  border-radius: 0.85rem;
  background: none;
  color: var(--muted);
}
.console-pause:hover {
  border-color: var(--line-2);
  color: #fff;
}
.console-pause svg {
  width: 1.05rem;
  height: 1.05rem;
}
.console-note {
  margin-top: 0.9rem;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--muted);
}
[aria-pressed="false"] > .off,
[aria-pressed="true"] > .on {
  display: none;
}
@media (min-width: 640px) {
  .console-algo .seg {
    display: inline-flex;
    width: auto;
  }
}
@media (min-width: 1000px) {
  .hero {
    min-height: max(46rem, min(100svh, 66rem));
  }
  .field {
    position: absolute;
    inset: 0;
    margin: 0;
    aspect-ratio: auto;
  }
  .field::after {
    background:
      linear-gradient(90deg, var(--ink) 0%, rgb(4 7 13 / 0.95) 26%, rgb(4 7 13 / 0.55) 40%, rgb(4 7 13 / 0.08) 54%, transparent 62%),
      linear-gradient(to bottom, rgb(4 7 13 / 0.85), transparent 16%),
      linear-gradient(to top, var(--ink) 3%, rgb(4 7 13 / 0.6) 16%, transparent 32%);
  }
  .hero-copy {
    position: relative;
    z-index: 2;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding-block: 5.6rem 1.2rem;
    pointer-events: none;
  }
  .hero-copy > * {
    pointer-events: auto;
  }
  /* Controls on the left, two rows; the readout on the right. */
  .console {
    grid-template-columns: minmax(0, 1fr) minmax(19rem, 24rem);
    gap: 1rem 2.4rem;
    align-items: center;
    padding: 1.1rem 4.2rem 1.15rem 1.3rem;
  }
  .console-algo .seg {
    flex-wrap: nowrap;
  }
  .console-algo .seg button {
    padding-inline: 0.8rem;
  }
  .console-dials {
    grid-column: 1;
    max-width: 34rem;
  }
  .console-out {
    grid-column: 2;
    grid-row: 1 / span 2;
    padding-left: 2rem;
    border-left: 1px solid var(--line);
  }
  .console-pause {
    top: 50%;
    right: 1rem;
    translate: 0 -50%;
  }
}
@media (min-width: 1000px) and (max-width: 1239px) {
  .console-algo .seg {
    flex-wrap: wrap;
  }
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: 0.6rem;
  padding: 1rem 0 clamp(3rem, 7vw, 5rem);
}
.stats a {
  display: grid;
  gap: 0.2rem;
  height: 100%;
  padding: 1.05rem 1.15rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  background: linear-gradient(160deg, rgb(255 255 255 / 0.025), transparent);
  transition:
    border-color 0.25s,
    transform 0.4s var(--ease);
}
.stats a:hover {
  border-color: rgb(92 200 255 / 0.45);
  transform: translateY(-2px);
}
.stats b {
  font-size: clamp(1.6rem, 2.4vw, 2.05rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  color: #fff;
}
.stats strong {
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--life-2);
}
.stats span {
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--muted);
}
/* Phones: two to a row, so the five stats take half a screen instead of a whole one. */
@media (max-width: 639px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stats li:last-child {
    grid-column: 1 / -1;
  }
  .stats a {
    padding: 0.85rem 0.9rem 0.95rem;
  }
  .stats span {
    font-size: 0.76rem;
  }
}

/* ---------- Chapters and sections ---------- */
.chapter {
  position: relative;
  border-top: 1px solid var(--line);
}
.opener {
  position: relative;
  overflow: clip;
  background: radial-gradient(70rem 34rem at 12% 0%, color-mix(in srgb, var(--chapter) 9%, transparent), transparent 70%);
}
.opener > .wrap {
  position: relative;
  padding-block: clamp(5rem, 11vw, 9.5rem) clamp(3rem, 6vw, 5rem);
  scroll-margin-top: 2rem;
}
/* The chapter's motif: a small network whose shortest route draws itself in the chapter's colour. */
.motif {
  position: absolute;
  right: var(--gutter);
  top: 50%;
  width: min(34vw, 32rem);
  translate: 0 -46%;
  pointer-events: none;
  mask-image: radial-gradient(closest-side, #000 62%, transparent);
  -webkit-mask-image: radial-gradient(closest-side, #000 62%, transparent);
}
.motif .e {
  fill: none;
  stroke: color-mix(in srgb, var(--chapter) 22%, rgb(180 210 255 / 0.35));
  stroke-width: 1;
  opacity: 0.55;
}
.motif .v {
  fill: color-mix(in srgb, var(--chapter) 30%, #8fa4c4);
  opacity: 0.65;
}
.motif .v.on {
  fill: var(--chapter);
  opacity: 1;
}
.motif .route {
  fill: none;
  stroke: var(--chapter);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--chapter) 70%, transparent));
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .js .motif .route {
    stroke-dashoffset: 1;
    transition: stroke-dashoffset 2.4s var(--ease) 0.35s;
  }
  .js .motif.seen .route {
    stroke-dashoffset: 0;
  }
}
@media (max-width: 1099px) {
  .motif {
    display: none;
  }
}
.opener .lede {
  max-width: 45rem;
  margin-top: 1.5rem;
}
.kick.small {
  margin-bottom: 0.9rem;
  color: var(--muted);
}
.chapter em.g {
  color: var(--chapter);
}
.opener-index {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 2.1rem;
}
.opener-index a {
  display: block;
  padding: 0.5rem 1rem;
  border: 1px solid color-mix(in srgb, var(--chapter) 26%, transparent);
  border-radius: 99rem;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: color-mix(in srgb, var(--chapter) 30%, #fff);
  transition:
    border-color 0.2s,
    background-color 0.2s;
}
.opener-index a:hover {
  border-color: var(--chapter);
  background: color-mix(in srgb, var(--chapter) 10%, transparent);
}
@media (max-width: 899px) {
  .opener-index {
    display: none;
  }
}
.sec {
  position: relative;
  padding-block: clamp(3rem, 5.6vw, 5.2rem);
  border-top: 1px solid var(--line);
  scroll-margin-top: -1.8rem;
}
.sec-head.wide {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 0.9rem 3rem;
  margin-bottom: clamp(1.6rem, 3vw, 2.6rem);
}
.sec-head.wide > div {
  flex: 1 1 34rem;
  min-width: 0;
}
.sec-head.wide .kicker {
  margin-top: 1rem;
}
.sec-head.wide .more {
  flex: none;
  margin: 0;
}
.kicker {
  max-width: 48rem;
  font-size: clamp(1.04rem, 1.35vw, 1.22rem);
  line-height: 1.58;
  letter-spacing: -0.011em;
  color: var(--soft);
  text-wrap: pretty;
}
.kicker code,
.panel-note code,
.fig-foot code {
  overflow-wrap: anywhere;
  padding: 0.08em 0.34em;
  border-radius: 0.35em;
  background: rgb(163 223 255 / 0.08);
  color: #d9eefc;
  font-size: 0.86em;
}
.split-grid {
  display: grid;
  gap: 2rem clamp(2.4rem, 6vw, 6rem);
}
.split .kicker {
  margin-top: 1.1rem;
}
@media (min-width: 1000px) {
  .split-grid {
    grid-template-columns: minmax(0, 4.4fr) minmax(0, 7.6fr);
  }
  .split .sec-head {
    position: sticky;
    top: 7.5rem;
    align-self: start;
  }
}
.sec-body {
  min-width: 0;
}
.sec-body > * + * {
  margin-top: 1.6rem;
}
.more {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 1rem;
  padding: 0.25rem 0;
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: color-mix(in srgb, var(--chapter) 62%, #fff);
  transition: color 0.2s;
}
.more svg {
  width: 1rem;
  height: 1rem;
  transition: transform 0.35s var(--ease);
}
.more:hover {
  color: #fff;
}
.more:hover svg {
  transform: translateX(0.25rem);
}

/* ---------- Figures ---------- */
.sec .fig {
  position: relative;
  border: 1px solid var(--line-2);
  border-radius: 1.4rem;
  background: linear-gradient(180deg, rgb(255 255 255 / 0.022), transparent 14rem), rgb(6 11 20 / 0.86);
  overflow: clip;
}
/* Corner brackets: the frame of an instrument. */
.sec .fig::before,
.sec .fig::after {
  content: "";
  position: absolute;
  top: 0.65rem;
  width: 0.6rem;
  height: 0.6rem;
  border: solid var(--line-3);
  border-width: 1px 0 0 1px;
  pointer-events: none;
}
.sec .fig::before {
  left: 0.65rem;
}
.sec .fig::after {
  right: 0.65rem;
  transform: scaleX(-1);
}
.fig-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem 1.4rem;
  padding: clamp(1.2rem, 2.4vw, 1.9rem) var(--inset) 0;
}
.todo {
  font-size: clamp(1rem, 1.3vw, 1.14rem);
  font-weight: 650;
  letter-spacing: -0.02em;
  color: #fff;
}
.tagged {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.34rem 0.75rem;
  border: 1px solid color-mix(in srgb, var(--chapter) 30%, transparent);
  border-radius: 99rem;
  background: color-mix(in srgb, var(--chapter) 8%, transparent);
  font-size: 0.78rem;
  font-weight: 600;
  color: color-mix(in srgb, var(--chapter) 55%, #fff);
}
.tagged.live::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--chapter);
  box-shadow: 0 0 10px var(--chapter);
}
.tagged:is(.example, .recorded, .measured) {
  border-color: var(--line-2);
  background: none;
  color: var(--soft);
}
.fig-body {
  padding: clamp(1.2rem, 2.4vw, 1.9rem) var(--inset);
  min-width: 0;
}
.js .fig:not([data-ready]) > .fig-body {
  min-height: var(--hp, auto);
}
@media (min-width: 640px) {
  .js .fig:not([data-ready]) > .fig-body {
    min-height: var(--ht, auto);
  }
}
@media (min-width: 1000px) {
  .js .fig:not([data-ready]) > .fig-body {
    min-height: var(--hd, auto);
  }
}
.fig-foot {
  padding: 0.95rem var(--inset) 1.05rem;
  border-top: 1px solid var(--line);
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--muted);
}
.failed {
  margin: 0 var(--inset) 1.2rem;
  padding: 0.8rem 1rem;
  border: 1px solid rgb(255 122 138 / 0.4);
  border-radius: 0.9rem;
  color: #ffc2ca;
  font-size: 0.88rem;
}

/* ---------- Controls ---------- */
.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  max-width: 100%;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgb(0 0 0 / 0.28);
}
.seg button {
  min-height: 2.5rem;
  padding: 0.3rem 0.95rem;
  border: 0;
  border-radius: 0.78rem;
  background: none;
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--muted);
  transition:
    background-color 0.2s,
    color 0.2s;
}
.seg button:hover {
  color: #fff;
}
.seg button[aria-pressed="true"] {
  background: color-mix(in srgb, var(--chapter) 17%, transparent);
  color: #fff;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--chapter) 42%, transparent);
}
@media (max-width: 640px) {
  .seg {
    display: flex;
  }
  .seg button {
    flex: 1 1 auto;
    min-height: 2.75rem;
    padding-inline: 0.65rem;
  }
}
.range {
  display: block;
}
.range > span {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-size: 0.86rem;
  color: var(--soft);
}
.range b {
  font-weight: 600;
}
.range output {
  font: 500 0.86rem/1.3 var(--mono);
  font-variant-numeric: tabular-nums;
  color: #fff;
  white-space: nowrap;
}
input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 2.2rem;
  margin: 0;
  background: none;
  cursor: pointer;
  touch-action: pan-y;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 9px;
  background: linear-gradient(90deg, var(--chapter) var(--p, 50%), rgb(180 210 255 / 0.15) var(--p, 50%));
}
input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 9px;
  background: linear-gradient(90deg, var(--chapter) var(--p, 50%), rgb(180 210 255 / 0.15) var(--p, 50%));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: calc(-0.625rem + 2px);
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1.5px var(--chapter);
  transition: transform 0.2s;
}
input[type="range"]::-moz-range-thumb {
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1.5px var(--chapter);
}
input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.15);
}
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.6rem;
  padding: 0.3rem 0.95rem 0.3rem 0.75rem;
  border: 1px solid var(--line-2);
  border-radius: 99rem;
  background: none;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--soft);
  transition:
    border-color 0.2s,
    background-color 0.2s;
}
.toggle i {
  position: relative;
  width: 1.9rem;
  height: 1.1rem;
  border-radius: 99rem;
  background: rgb(180 210 255 / 0.16);
  transition: background-color 0.2s;
}
.toggle i::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(1.1rem - 4px);
  height: calc(1.1rem - 4px);
  border-radius: 50%;
  background: #fff;
  transition: transform 0.25s var(--ease);
}
.toggle[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--chapter) 55%, transparent);
  background: color-mix(in srgb, var(--chapter) 9%, transparent);
  color: #fff;
}
.toggle[aria-pressed="true"] i {
  background: var(--chapter);
}
.toggle[aria-pressed="true"] i::after {
  transform: translateX(0.8rem);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.55rem;
  border: 1px solid;
  border-radius: 99rem;
  font: 600 0.72rem/1.3 var(--mono);
  white-space: nowrap;
}
.chip svg {
  width: 0.85rem;
  height: 0.85rem;
}
.chip.same {
  color: #8ff0d8;
  border-color: rgb(79 227 193 / 0.4);
  background: rgb(79 227 193 / 0.08);
}
.chip.diff {
  color: #ffb0ba;
  border-color: rgb(255 122 138 / 0.45);
  background: rgb(255 122 138 / 0.1);
}
.chip.wait {
  color: var(--faint);
  border-color: var(--line-2);
}
.chip.run {
  color: var(--gold);
  border-color: rgb(242 201 76 / 0.4);
}

/* ---------- Tabs ---------- */
.tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 1.1rem;
}
.tablist [role="tab"] {
  min-height: 2.5rem;
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: none;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--muted);
  transition:
    color 0.2s,
    border-color 0.2s,
    background-color 0.2s;
}
.tablist [role="tab"]:hover {
  color: #fff;
  border-color: var(--line-2);
}
.tablist [role="tab"][aria-selected="true"] {
  color: #fff;
  border-color: color-mix(in srgb, var(--chapter) 50%, transparent);
  background: color-mix(in srgb, var(--chapter) 12%, transparent);
}
/* Phones: a tab row is one strip you swipe, faded at the edge so the rest is clearly there. */
@media (max-width: 699px) {
  .tablist {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin-inline: calc(-1 * var(--inset));
    padding-inline: var(--inset);
    scroll-padding-inline: var(--inset);
    mask-image: linear-gradient(90deg, transparent, #000 var(--inset), #000 calc(100% - 2.4rem), transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--inset), #000 calc(100% - 2.4rem), transparent);
  }
  .tablist::-webkit-scrollbar {
    display: none;
  }
  .tablist [role="tab"] {
    flex: none;
  }
  .fig-head {
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: 0.55rem;
  }
  .tagged {
    padding: 0.22rem 0.6rem;
    font-size: 0.72rem;
  }
}
@media (max-width: 479px) {
  .console-algo .seg button {
    padding-inline: 0.35rem;
    font-size: 0.8rem;
    white-space: nowrap;
  }
}
.tabpanel .code + .panel-note,
.tabpanel .twin + .panel-note {
  margin-top: 1rem;
}
.panel-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.8rem;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--soft);
}
.fig pre.block {
  font-size: 0.84rem;
}

/* Dispatch: the calls on one side, NetworkX's log on the other. */
.dlog {
  display: grid;
  gap: 1rem 1.6rem;
}
@media (min-width: 1000px) {
  .dlog {
    grid-template-columns: minmax(0, 21rem) minmax(0, 1fr);
  }
}
.dlog .tablist {
  flex-direction: column;
  flex-wrap: nowrap;
  margin: 0;
}
.dlog .tablist [role="tab"] {
  text-align: left;
  padding: 0.55rem 0.85rem;
}
.dlog .tablist code {
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}
@media (max-width: 999px) {
  .dlog .tablist {
    flex-direction: row;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 0.2rem;
  }
  .dlog .tablist [role="tab"] {
    flex: none;
    max-width: 17rem;
  }
}
.logline {
  margin-bottom: 0.6rem;
}
.loglines {
  display: grid;
  gap: 0.4rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #050a12;
}
.loglines li {
  display: grid;
  grid-template-columns: 5.6rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
}
.loglines .what {
  padding: 0.12rem 0.45rem;
  border-radius: 0.45rem;
  font: 600 0.66rem/1.5 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  color: var(--muted);
  background: rgb(255 255 255 / 0.04);
}
.loglines code {
  font-size: 0.76rem;
  line-height: 1.55;
  color: #c9d6e6;
  overflow-wrap: anywhere;
}
.loglines .convert .what {
  color: #ffd27f;
  background: rgb(242 201 76 / 0.1);
}
.loglines .cache .what {
  color: #8ff0d8;
  background: rgb(79 227 193 / 0.1);
}
.loglines .fnx .what {
  color: var(--rust-2);
  background: rgb(255 143 87 / 0.12);
}
.loglines .fnx code {
  color: #fff;
}
.loglines .fallback .what,
.loglines .silent .what {
  color: var(--nx);
  background: rgb(143 157 179 / 0.12);
}
@media (max-width: 599px) {
  .loglines li {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
  .loglines .what {
    justify-self: start;
  }
}

/* ---------- Tie-breaks ---------- */
.ties {
  display: grid;
  gap: 1.6rem 2.4rem;
}
@media (min-width: 1000px) {
  .ties {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    align-items: start;
  }
}
.ties-stage {
  display: grid;
  gap: 1rem;
}
svg.grid {
  width: 100%;
  max-width: 30rem;
  margin-inline: auto;
  overflow: visible;
}
.grid .lines line {
  stroke: rgb(180 210 255 / 0.22);
  stroke-width: 2;
}
.grid .badge {
  fill: var(--ink);
  stroke: rgb(180 210 255 / 0.25);
}
.grid .edge text,
.grid .node text {
  font: 600 11px/1 var(--mono);
  text-anchor: middle;
  dominant-baseline: central;
  fill: var(--muted);
}
.grid .edge.first .badge {
  stroke: var(--gold);
}
.grid .edge.first text {
  fill: var(--gold);
}
.grid .node circle {
  fill: #0a1220;
  stroke: rgb(180 210 255 / 0.4);
  stroke-width: 1.5;
}
.grid .node text {
  font-size: 13px;
  fill: #fff;
}
.grid .node.src circle,
.grid .node.dst circle {
  stroke: var(--chapter);
  stroke-width: 2.2;
}
.grid .route {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
  transition: d 0.5s var(--ease);
}
.grid .route.nx {
  stroke: var(--nx);
  stroke-width: 12;
  opacity: 0.35;
}
.grid .route.fnx {
  stroke: var(--chapter);
  stroke-width: 4;
  filter: drop-shadow(0 0 6px rgb(79 227 193 / 0.6));
}
.ties-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}
.ties-order {
  display: grid;
  gap: 0.3rem;
  justify-items: center;
  text-align: center;
  font: 500 0.78rem/1.5 var(--mono);
  color: var(--soft);
}
.ties-answers {
  display: grid;
  gap: 0.7rem;
}
.answer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.3rem 1rem;
  align-items: center;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgb(0 0 0 / 0.2);
}
.answer .who {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.55rem;
  font-weight: 650;
  font-size: 0.92rem;
  color: #fff;
}
.answer .who small {
  font-weight: 500;
  font-size: 0.76rem;
  color: var(--faint);
}
.answer .dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  align-self: center;
}
.answer .said {
  font: 600 1.05rem/1.2 var(--mono);
  letter-spacing: 0.04em;
  color: #fff;
  white-space: nowrap;
}
.answer .wline {
  grid-column: 1 / -1;
  font: 500 0.72rem/1.5 var(--mono);
  color: var(--muted);
  overflow-wrap: anywhere;
}
.answer.nx .dot {
  background: var(--nx);
}
.answer.fnx {
  border-color: rgb(79 227 193 / 0.35);
  background: rgb(79 227 193 / 0.05);
}
.answer.fnx .dot {
  background: var(--chapter);
  box-shadow: 0 0 10px var(--chapter);
}
.answer.lex .dot {
  background: var(--gold);
}
.answer.hashmap .dot {
  background: var(--coral);
}
.answer[data-match="no"] .said {
  color: #ffb0ba;
  text-decoration: line-through;
  text-decoration-color: rgb(255 122 138 / 0.6);
}
.answer[data-match="yes"] .said::after {
  content: " ✓";
  color: var(--chapter);
}
.verdictline {
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--soft);
}
.dlog .loglines + .panel-note {
  margin-top: 0.9rem;
}
table.jobs {
  table-layout: fixed;
}
table.jobs col.job {
  width: 34%;
}
.tally-row {
  display: grid;
  gap: 0.25rem;
  padding: 0.8rem 0.2rem 0;
  font-size: 0.84rem;
  color: var(--muted);
}
.tally-row b {
  font-family: var(--mono);
  font-weight: 600;
  color: #fff;
}

/* ---------- Tables ---------- */
.tablescroll {
  overflow-x: auto;
  overscroll-behavior-x: contain;
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  line-height: 1.5;
}
table.data th,
table.data td {
  padding: 0.7rem 0.85rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
table.data th {
  font: 600 0.68rem/1.4 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  white-space: nowrap;
}
table.data tbody tr:last-child td {
  border-bottom: 0;
}
table.data td code {
  font-size: 0.8rem;
  color: #e6f0fb;
}
.battery {
  display: grid;
  gap: 1rem;
}
.battery table {
  min-width: 46rem;
}
.battery-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem 1.2rem;
}
.battery-sum {
  font-size: 0.9rem;
  color: var(--soft);
}
.battery-sum b {
  color: #fff;
}
.battery .rule {
  color: var(--muted);
}
.battery .detail {
  color: var(--soft);
}
.battery .us {
  text-align: right;
  white-space: nowrap;
  color: var(--muted);
}
.battery tr.done td {
  animation: flash 1.2s var(--ease);
}
@keyframes flash {
  from {
    background: rgb(79 227 193 / 0.12);
  }
}

/* ---------- Contract ---------- */
.twin {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}
@media (min-width: 760px) {
  .twin {
    grid-template-columns: 1fr 1fr;
  }
}
.twin .side {
  display: grid;
  gap: 0.4rem;
}
pre.out {
  margin: 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: #050a12;
  font: 500 0.8rem/1.55 var(--mono);
  color: #e7f0fb;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
pre.out.error {
  color: #ffc4cc;
  border-color: rgb(255 122 138 / 0.3);
}

/* ---------- Evidence ---------- */
.evidence {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
}
.evidence li {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.2rem 1.25rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, color-mix(in srgb, var(--chapter) 6%, transparent), transparent 60%);
}
.evidence b {
  font-size: clamp(1.8rem, 2.8vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.05;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.evidence strong {
  font-weight: 650;
  color: color-mix(in srgb, var(--chapter) 55%, #fff);
}
.evidence p {
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--muted);
}
.src {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.6rem;
  font: 500 0.74rem/1.3 var(--mono);
  color: var(--life-2);
}
.src svg {
  width: 0.85rem;
  height: 0.85rem;
}
.src:hover {
  color: #fff;
}

/* ---------- Kernel chart ---------- */
.kchart {
  display: grid;
  gap: 1rem;
}
.kchart-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}
.kchart .axis,
.kchart .track {
  position: relative;
}
.kchart .axis {
  height: 2.4rem;
  margin-left: var(--namew);
  border-bottom: 1px solid var(--line-2);
  font: 500 0.66rem/1 var(--mono);
  color: var(--faint);
}
.kchart .axis span {
  position: absolute;
  bottom: 0.4rem;
  translate: -50% 0;
}
.kchart .axis span.one {
  color: #fff;
}
.kchart .axis .lab {
  bottom: auto;
  top: 0;
  translate: none;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.kchart .axis .lose {
  left: 0;
  color: var(--coral);
}
.kchart .axis .win {
  right: 0;
  color: var(--rust-2);
}
.kchart {
  --namew: min(38%, 17rem);
}
.bars {
  display: grid;
  gap: 2px;
}
.bars li {
  display: grid;
  grid-template-columns: var(--namew) minmax(0, 1fr);
  align-items: center;
  min-height: 1.75rem;
  border-radius: 0.5rem;
  transition: background-color 0.2s;
}
.bars li:hover {
  background: rgb(255 255 255 / 0.03);
}
.bars .name {
  padding-right: 0.8rem;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bars .name code {
  font-size: 0.74rem;
  color: var(--soft);
}
.bars .track {
  height: 1.75rem;
  background:
    linear-gradient(90deg, transparent calc(var(--one) - 0.5px), rgb(255 255 255 / 0.35) calc(var(--one) - 0.5px), rgb(255 255 255 / 0.35) calc(var(--one) + 0.5px), transparent calc(var(--one) + 0.5px));
}
.bars .track i {
  position: absolute;
  top: 0.4rem;
  bottom: 0.4rem;
  border-radius: 0.3rem;
  background: linear-gradient(90deg, rgb(255 143 87 / 0.5), var(--rust));
  transform-origin: left;
}
.bars .track b {
  position: absolute;
  top: 50%;
  translate: 0.45rem -50%;
  font: 600 0.72rem/1 var(--mono);
  color: #fff;
  white-space: nowrap;
}
.bars li.inside .track b {
  translate: calc(-100% - 0.45rem) -50%;
  color: #2a1206;
}
.bars li.loss .track i {
  background: linear-gradient(90deg, var(--coral), rgb(255 122 138 / 0.45));
  transform-origin: right;
}
.bars li.loss .track b {
  translate: calc(-100% - 0.45rem) -50%;
  color: #ffc2ca;
}
.bars .note {
  grid-column: 2;
  display: none;
  padding: 0 0 0.5rem;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--muted);
}
.bars li:is(:hover, :focus-within, .open) .note {
  display: block;
}
.bars li.loss {
  display: none;
}
.kchart.losses .bars li.loss {
  display: grid;
}
.bars li[hidden] {
  display: none !important;
}
@media (prefers-reduced-motion: no-preference) {
  .js .kchart .bars .track i {
    transform: scaleX(0);
    transition: transform 1.1s var(--ease);
  }
  .js .fig.seen .kchart .bars .track i {
    transform: none;
  }
}
@media (max-width: 699px) {
  .kchart {
    --namew: 100%;
  }
  .kchart .axis {
    margin-left: 0;
  }
  .bars li {
    grid-template-columns: 1fr;
    padding-top: 0.3rem;
  }
  .bars .name {
    text-align: left;
  }
  .bars .note {
    grid-column: 1;
  }
}

/* ---------- Whole jobs ---------- */
table.jobs {
  width: 100%;
  min-width: 40rem;
  border-collapse: separate;
  border-spacing: 4px;
}
table.jobs thead th {
  padding: 0.3rem 0.6rem 0.6rem;
  font-size: 0.84rem;
  font-weight: 650;
  text-align: left;
  color: #fff;
}
table.jobs thead th small,
table.jobs tbody th small {
  display: block;
  font-weight: 500;
  font-size: 0.74rem;
  line-height: 1.4;
  color: var(--faint);
}
table.jobs tbody th {
  padding: 0.6rem 0.8rem 0.6rem 0;
  text-align: left;
  vertical-align: middle;
  max-width: 19rem;
}
table.jobs tbody th strong {
  font-size: 0.92rem;
  color: #fff;
}
.cell {
  padding: 0.8rem 0.9rem;
  border-radius: 0.8rem;
  background: color-mix(in srgb, var(--rust) calc(var(--t) * 46%), rgb(255 255 255 / 0.03));
  vertical-align: middle;
}
.cell b {
  display: block;
  font: 700 1.2rem/1.2 var(--mono);
  color: #fff;
}
.cell span {
  font-size: 0.74rem;
  color: rgb(255 255 255 / 0.72);
}
.cell.und {
  background: repeating-linear-gradient(135deg, rgb(255 255 255 / 0.03) 0 8px, rgb(255 255 255 / 0.06) 8px 16px);
}
.cell.und b {
  font: 600 0.82rem/1.3 var(--sans);
  color: var(--soft);
}

/* ---------- Method ---------- */
.method {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}
.method li {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  gap: 1rem;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--line);
}
.method .num {
  font-size: 0.86rem;
  color: var(--chapter);
}
.method strong {
  font-size: 1.04rem;
  letter-spacing: -0.015em;
  color: #fff;
}
.method p {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.6;
}
table.slow {
  min-width: 44rem;
}
table.slow td:nth-child(3) {
  color: var(--muted);
}
.lossv {
  color: #ffc2ca;
  white-space: nowrap;
}

/* ---------- Witness ---------- */
.witness {
  display: grid;
  gap: 1.4rem;
}
.witness-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.6rem;
}
.witness-body {
  display: grid;
  gap: 1.2rem 1.6rem;
}
@media (min-width: 1000px) {
  .witness-body {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  }
}
.receipt {
  display: grid;
  gap: 1rem;
  padding: 1.2rem 1.3rem;
  border: 1px dashed rgb(242 201 76 / 0.45);
  border-radius: 1rem;
  background:
    radial-gradient(30rem 12rem at 0% 0%, rgb(242 201 76 / 0.06), transparent),
    #070b13;
}
.receipt-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.stamp {
  font: 700 0.7rem/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.35rem 0.6rem;
  border: 1.5px solid currentColor;
  border-radius: 0.4rem;
  color: var(--faint);
}
.stamp.ok {
  color: var(--mint);
}
.stamp.new {
  color: var(--gold);
}
.receipt dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
  gap: 0.8rem 1.2rem;
  margin: 0;
}
.receipt dt {
  font: 500 0.66rem/1.4 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}
.receipt dd {
  margin: 0.15rem 0 0;
  font: 600 0.92rem/1.35 var(--mono);
  color: #fff;
  overflow-wrap: anywhere;
}
.boundbar {
  position: relative;
  height: 1.7rem;
  border-radius: 0.5rem;
  background: rgb(255 255 255 / 0.05);
  overflow: hidden;
}
.boundbar i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(90deg, rgb(242 201 76 / 0.35), var(--gold));
  transition: width 0.7s var(--ease);
}
.boundbar span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 0.7rem;
  font: 500 0.72rem/1 var(--mono);
  color: var(--soft);
}
.hashline {
  display: grid;
  gap: 0.3rem;
}
.hashline code {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--gold);
  overflow-wrap: anywhere;
  letter-spacing: 0.02em;
}
.hashline code .chg {
  color: #fff;
  background: rgb(255 122 138 / 0.28);
  border-radius: 0.15rem;
}
.seedline {
  font-size: 0.82rem;
  color: var(--muted);
}
.seedline b {
  color: var(--mint);
  font-weight: 600;
}
.runs {
  display: grid;
  gap: 1rem;
  align-content: start;
}
.runlog {
  display: grid;
  gap: 0.35rem;
}
.runlog li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: center;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  font: 500 0.74rem/1.3 var(--mono);
  color: var(--soft);
}
.runlog li code {
  color: var(--gold);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.runlog .n {
  color: var(--faint);
}

/* ---------- Registry ---------- */
.registry code.pol {
  color: var(--gold);
}
.registry small {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.registry {
  min-width: 42rem;
}

/* ---------- Parser ---------- */
.parse {
  display: grid;
  gap: 1.3rem;
}
.parse-controls {
  display: grid;
  gap: 1rem 1.6rem;
}
@media (min-width: 1000px) {
  .parse-controls {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }
}
.parse-body {
  display: grid;
  gap: 1rem 1.4rem;
}
@media (min-width: 1000px) {
  .parse-body {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}
.editor {
  display: grid;
  gap: 0.5rem;
}
.editor textarea {
  width: 100%;
  min-height: 17rem;
  resize: vertical;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line-2);
  border-radius: 0.9rem;
  background: #050a12;
  font: 400 0.78rem/1.6 var(--mono);
  color: #dbe6f3;
  tab-size: 2;
}
.editor textarea:focus {
  outline: none;
  border-color: var(--chapter);
}
.verdict-panel {
  display: grid;
  gap: 1rem;
  align-content: start;
}
.outcome {
  display: grid;
  gap: 0.4rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
}
.outcome .big {
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.4;
  color: #fff;
}
.outcome.refused {
  border-color: rgb(255 122 138 / 0.5);
  background: rgb(255 122 138 / 0.07);
}
.outcome.refused .big {
  color: #ffc2ca;
}
.outcome.recovered {
  border-color: rgb(242 201 76 / 0.45);
  background: rgb(242 201 76 / 0.06);
}
.outcome.clean {
  border-color: rgb(79 227 193 / 0.4);
  background: rgb(79 227 193 / 0.06);
}
.outcome code {
  font-size: 0.8rem;
  color: var(--soft);
  overflow-wrap: anywhere;
}
.outcome .edges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.2rem;
}
.outcome .edges span {
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--line-2);
  border-radius: 0.45rem;
  font: 500 0.74rem/1.4 var(--mono);
  color: #e6f0fb;
}
.records ol {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.records li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.3rem 0.7rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  font-size: 0.8rem;
  color: var(--soft);
}
.records li .act {
  font: 600 0.68rem/1.6 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.records .allow {
  color: var(--mint);
}
.records .full_validate {
  color: var(--gold);
}
.records .fail_closed {
  color: var(--coral);
}
.records li p {
  grid-column: 2;
  font-size: 0.78rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.records li small {
  font: 500 0.7rem/1.5 var(--mono);
  color: var(--faint);
}
.seg.wrap {
  display: flex;
}

/* ---------- Decision rule ---------- */
.gate {
  display: grid;
  gap: 1.2rem;
}
.gate-controls {
  display: grid;
  gap: 1rem;
}
.gate-chart svg {
  width: 100%;
  overflow: visible;
}
.gate-chart .axis {
  stroke: var(--line-2);
}
.gate-chart text {
  font: 500 11px/1 var(--mono);
  fill: var(--faint);
}
.gate-chart .l-allow {
  stroke: var(--mint);
}
.gate-chart .l-validate {
  stroke: var(--gold);
}
.gate-chart .l-refuse {
  stroke: var(--coral);
}
.gate-chart .ln {
  fill: none;
  stroke-width: 2.5;
}
.gate-chart .zone {
  opacity: 0.09;
}
.gate-chart .cursor {
  stroke: #fff;
  stroke-width: 1;
  stroke-dasharray: 3 4;
}
.gate-chart .mark {
  fill: var(--ink);
  stroke: #fff;
  stroke-width: 1.5;
}
.gate-out {
  display: grid;
  gap: 0.25rem;
}
.gate-out .action {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.gate-out .action.allow {
  color: var(--mint);
}
.gate-out .action.full_validate {
  color: var(--gold);
}
.gate-out .action.fail_closed {
  color: var(--coral);
}
.gate-out p:last-child {
  font: 500 0.8rem/1.6 var(--mono);
  color: var(--muted);
}

/* ---------- Hardening ---------- */
.hardlist {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
}
.hardlist li {
  padding: 1.1rem 1.2rem;
  border-top: 2px solid color-mix(in srgb, var(--chapter) 55%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--chapter) 5%, transparent), transparent);
  border-radius: 0 0 1rem 1rem;
}
.hardlist strong {
  font-size: 1.02rem;
  letter-spacing: -0.015em;
  color: #fff;
}
.hardlist p {
  margin-top: 0.35rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--muted);
}
.hardlist code {
  font-size: 0.82em;
  color: #e6f0fb;
}

/* ---------- One call ---------- */
.flow {
  display: grid;
  gap: 1.4rem 2.4rem;
}
@media (min-width: 1000px) {
  .flow {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: start;
  }
  .flow .stack {
    position: sticky;
    top: 7rem;
  }
}
.stack {
  position: relative;
  display: grid;
  gap: 0.5rem;
}
.layer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  min-height: 3.6rem;
  padding: 0.6rem 1rem;
  border: 1px solid var(--line-2);
  border-radius: 0.9rem;
  background: rgb(255 255 255 / 0.02);
  font: 600 0.84rem/1.3 var(--mono);
  color: var(--muted);
  transition:
    border-color 0.35s,
    background-color 0.35s,
    color 0.35s;
}
.layer:nth-child(4) {
  border-color: rgb(255 143 87 / 0.35);
}
.layer.on {
  border-color: var(--chapter);
  background: color-mix(in srgb, var(--chapter) 12%, transparent);
  color: #fff;
}
.layer:nth-child(4).on {
  border-color: var(--rust);
  background: rgb(255 143 87 / 0.12);
}
.gil {
  font: 600 0.64rem/1 var(--mono);
  font-style: normal;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.45rem;
  border-radius: 0.35rem;
  color: var(--mint);
  background: rgb(79 227 193 / 0.1);
}
.steps {
  display: grid;
  gap: 0.4rem;
  counter-reset: none;
}
.steps li {
  border: 1px solid var(--line);
  border-radius: 1rem;
  transition:
    border-color 0.3s,
    background-color 0.3s;
}
.steps li[aria-current] {
  border-color: color-mix(in srgb, var(--chapter) 55%, transparent);
  background: color-mix(in srgb, var(--chapter) 6%, transparent);
}
.steps button {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  padding: 0.8rem 1rem;
  border: 0;
  background: none;
  text-align: left;
}
.steps button .num {
  display: grid;
  place-items: center;
  flex: none;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  font-size: 0.8rem;
  color: var(--soft);
}
.steps li[aria-current] .num {
  border-color: var(--chapter);
  background: var(--chapter);
  color: var(--ink);
}
.steps button > span:last-child {
  display: grid;
  gap: 0.1rem;
}
.steps strong {
  font-size: 0.98rem;
  letter-spacing: -0.015em;
  color: #fff;
}
.steps button code {
  font-size: 0.72rem;
  color: var(--faint);
}
.steps li p {
  padding: 0 1rem 0.95rem 3.75rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--soft);
}
.js .flow[data-live] .steps li:not([aria-current]) p {
  display: none;
}

/* ---------- Storage ---------- */
.store {
  display: grid;
  gap: 1.2rem;
}
.storefacts {
  display: grid;
  gap: 0.8rem;
}
.storefacts li {
  padding-left: 1.1rem;
  border-left: 2px solid color-mix(in srgb, var(--chapter) 50%, transparent);
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--soft);
}
.storefacts b {
  color: #fff;
  font-weight: 650;
}
.storefacts code {
  font-size: 0.86em;
  color: #e6f0fb;
}

/* ---------- Crates ---------- */
.crates {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
}
.crates a {
  display: grid;
  gap: 0.25rem;
  height: 100%;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  transition:
    border-color 0.25s,
    transform 0.4s var(--ease);
}
.crates a:hover {
  border-color: color-mix(in srgb, var(--chapter) 55%, transparent);
  transform: translateY(-2px);
}
.crates code {
  font-size: 0.82rem;
  color: var(--chapter);
}
.crates strong {
  font-size: 0.98rem;
  color: #fff;
}
.crates p {
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--muted);
}

/* ---------- Start ---------- */
.start {
  position: relative;
  overflow: clip;
  padding: clamp(5rem, 11vw, 9rem) 0 clamp(4rem, 8vw, 6rem);
  border-top: 1px solid var(--line);
  background: radial-gradient(60rem 30rem at 85% 0%, rgb(92 200 255 / 0.08), transparent 70%);
}
.start-head .lede {
  max-width: 44rem;
  margin-top: 1.4rem;
}
.startsteps {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 21rem), 1fr));
  margin-top: clamp(2.4rem, 5vw, 3.6rem);
}
.startsteps li {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgb(255 255 255 / 0.015);
}
.startsteps h3 {
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: #fff;
}
.startsteps li > p:not(.micro) {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.55;
}
.startsteps .code {
  margin-top: auto;
}
.startsteps pre.block {
  font-size: 0.78rem;
}
.fit {
  display: grid;
  gap: 1rem 2.4rem;
  margin-top: clamp(2.4rem, 5vw, 3.6rem);
}
@media (min-width: 900px) {
  .fit {
    grid-template-columns: 1fr 1fr;
  }
}
.fit h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  color: #fff;
}
.fit h3 svg {
  width: 1.15rem;
  height: 1.15rem;
}
.fit > div:first-child h3 svg {
  color: var(--mint);
}
.fit > div:last-child h3 svg {
  color: var(--coral);
}
.fit ul {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.8rem;
}
.fit li {
  padding-left: 1rem;
  border-left: 1px solid var(--line-2);
  font-size: 0.94rem;
  line-height: 1.55;
  color: var(--soft);
}
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.6rem;
  margin-top: 2.6rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--line);
}
.links a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--life-2);
}
.links a:hover {
  color: #fff;
}
.links svg {
  width: 1.05rem;
  height: 1.05rem;
}
