

.chapter { padding: 6rem 0; border-top: 1px solid var(--border-2); }
.ch-head { max-width: 46rem; margin-bottom: 2.6rem; }
.ch-head .lede { margin-top: 1.2rem; max-width: 60ch; }
.fine { color: var(--fg-dimmer); font-size: .88rem; line-height: 1.7; margin: 1.2rem 0 0; max-width: 66ch; }
.fine code, .kv code, .check code, .cmp code { font-family: var(--mono); font-size: .85em; color: var(--accent); }
.center-fine { margin-left: auto; margin-right: auto; text-align: center; }

.spec { align-items: start; gap: 2rem; }
.spec > * { min-width: 0; }
.spec .session { margin: 0; max-width: none; }
.session .k { color: #a5b4fc; }
.session .str { color: var(--accent); }
.session .num { color: var(--green); }
.session .kw { color: #c084fc; }
.session .h { color: var(--accent); }
.session .ln.ok { color: var(--green); }

.kv { width: 100%; border-collapse: collapse; font-size: .92rem; }
.kv th, .kv td { padding: .65rem .2rem; border-top: 1px solid var(--border-2); vertical-align: top; text-align: left; }
.kv tr:first-child th, .kv tr:first-child td { border-top: 0; }
.kv th { font-family: var(--mono); font-weight: 500; font-size: .82rem; color: var(--accent); width: 7.5rem; padding-right: 1rem; }
.kv td { color: var(--fg-dim); }

.edges { margin-top: 2.4rem; padding: 1.3rem 1.4rem; border: 1px solid var(--border-2); border-radius: var(--radius); background: var(--bg-1); }
.e-head { font-family: var(--mono); font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-dimmer); margin-bottom: .9rem; }
.e-row { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin-top: .55rem; }
.e-kind { font-family: var(--mono); font-size: .74rem; color: var(--fg-dimmer); width: 6.5rem; }
.e-row code, .snapshot code { font-family: var(--mono); font-size: .78rem; padding: .3rem .6rem; border-radius: 6px;
  color: var(--accent); border: 1px solid rgba(var(--accent-rgb), .25); background: rgba(var(--accent-rgb), .05); }

.flow { list-style: none; margin: 0 0 2.4rem; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: .6rem; }
.flow li { position: relative; display: flex; flex-direction: column; gap: .3rem; padding: 1rem .95rem;
  border: 1px solid var(--border-2); border-radius: var(--radius); background: var(--bg-1); min-width: 0; }
.flow li:not(:last-child)::after { content: "→"; position: absolute; right: -.55rem; top: 50%; transform: translateY(-50%);
  color: var(--accent); font-size: .8rem; z-index: 1; }
.flow b { font-family: var(--mono); font-weight: 600; font-size: .86rem; color: var(--fg); }
.flow span { color: var(--fg-dim); font-size: .8rem; line-height: 1.5; }
.flow li.fork b + span { margin-bottom: .4rem; }
@media (max-width: 960px) { .flow { grid-template-columns: repeat(2, 1fr); } .flow li::after { display: none; } }
@media (max-width: 520px) { .flow { grid-template-columns: 1fr; } }
.cmp.patterns td { text-align: left; }
.cmp.patterns tbody th { font-family: var(--mono); font-weight: 500; color: var(--accent); width: 7rem; }
.cmp.patterns code { color: var(--fg); }

.budget { margin: 2.4rem 0 0; }
.b-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: 1rem; }
.b-top figcaption { color: var(--fg-dim); font-size: .95rem; }
.b-win { display: flex; gap: .3rem; padding: .2rem; border: 1px solid var(--border); border-radius: 999px; }
.b-win button { font: 600 .82rem var(--mono); color: var(--fg-dim); background: none; border: 0; border-radius: 999px;
  padding: .35rem .8rem; cursor: pointer; }
.b-win button[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent); }
.b-bar { display: flex; gap: 4px; min-height: 7.5rem; }
.b-seg { flex: 1 1 0; min-width: 8.6rem; display: flex; flex-direction: column; justify-content: flex-end; gap: .25rem;
  padding: .9rem .85rem; border: 1px solid transparent; border-radius: 10px; cursor: pointer; text-align: left;
  font: inherit; color: var(--fg); transition: flex-grow .5s cubic-bezier(.2,.7,.2,1), border-color .2s, transform .2s; }
.b-seg em { font: 500 .8rem var(--mono); font-style: normal; color: rgba(255,255,255,.75); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-seg b { font: 800 1.35rem var(--sans); letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.b-seg:hover, .b-seg:focus-visible { transform: translateY(-2px); }
.b-seg[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 10px 40px rgba(var(--accent-rgb), .18); }
.b-seg:focus-visible, .b-win button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.b-i { background: rgba(var(--accent-rgb), .55); }
.b-c { background: rgba(var(--accent-rgb), .40); }
.b-k { background: rgba(var(--accent-rgb), .27); }
.b-t { background: rgba(var(--accent-rgb), .15); }
.b-u { background: var(--bg-2); }
.b-u em, .b-u b { color: var(--fg-dim); }
.b-o { background: rgba(134, 239, 172, .2); }
.b-detail { margin-top: 1rem; padding: 1.2rem 1.4rem; border: 1px solid var(--border-2); border-radius: var(--radius); background: var(--bg-1); }
.b-name { font: 700 1.05rem var(--sans); }
.b-rule { font: 500 .82rem var(--mono); color: var(--accent); margin: .3rem 0 .6rem; }
.budget .b-what, .budget .fine { margin: 0; color: var(--fg-dim); font-size: .95rem; line-height: 1.6; max-width: 72ch; }
.budget .fine { margin-top: 1rem; color: var(--fg-dimmer); font-size: .88rem; }
@media (max-width: 760px) { .b-bar { flex-direction: column; min-height: 0; } .b-seg { min-width: 0; flex: none !important;
  flex-direction: row; justify-content: space-between; align-items: baseline; } }
@media (prefers-reduced-motion: reduce) { .b-seg { transition: none; } }

.footnote { margin: 1.4rem 0 0; color: var(--fg-dimmer); font-size: .76rem; text-align: right; }
.stat sup { font-size: .45em; color: var(--fg-dimmer); margin-left: .1em; vertical-align: super; }
.session.prompt { max-width: none; margin: 0; }

.checks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; margin-bottom: 2.2rem; }
@media (max-width: 860px) { .checks { grid-template-columns: 1fr; } }
.check { display: flex; flex-direction: column; gap: .7rem; padding: 1.4rem; border: 1px solid var(--border-2);
  border-radius: var(--radius); background: var(--bg-1); min-width: 0; }
.c-name { font-weight: 700; font-size: 1.05rem; }
.c-rule { display: block; font-family: var(--mono); font-size: .8rem; color: var(--accent); padding: .45rem .65rem;
  border-radius: 8px; background: #000; border: 1px solid rgba(var(--accent-rgb), .22); overflow-x: auto; white-space: nowrap; }
.check p { margin: 0; color: var(--fg-dim); font-size: .9rem; line-height: 1.6; }
.session.trace .ln.dim { color: #b5b9c0; }

.snapshot { display: flex; flex-wrap: wrap; gap: .5rem; }

#training .stat .n { font-size: clamp(1.5rem, 3.4vw, 2.2rem); font-variant-numeric: tabular-nums; }

.cmp.plans td { font-variant-numeric: tabular-nums; }
.cmp.plans tbody th { width: 14rem; }

.modules { display: grid; grid-template-columns: repeat(5, 1fr); gap: .8rem; }
@media (max-width: 1000px) { .modules { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .modules { grid-template-columns: 1fr; } }
.module { padding: 1.3rem 1.2rem; border: 1px solid var(--border-2); border-radius: var(--radius); background: var(--bg-1); min-width: 0; }
.module:first-child { border-color: rgba(var(--accent-rgb), .35); background: linear-gradient(180deg, rgba(var(--accent-rgb), .07), transparent 70%), var(--bg-1); }
.m-name { font-weight: 700; margin-bottom: .5rem; }
.module:first-child .m-name { color: var(--accent); }
.module p { margin: 0; color: var(--fg-dim); font-size: .88rem; line-height: 1.6; }
.session .dim { color: #7e838d; }
