/* Pastel token palette — cycles across the token stream. */
.token-stream {
  --tok-0: #ffd6e0;
  --tok-1: #ffe9c7;
  --tok-2: #fff5ba;
  --tok-3: #d6f5d6;
  --tok-4: #cdeffd;
  --tok-5: #e4d6fb;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 1.6rem;
  line-height: 2.1;
  letter-spacing: 0.01em;
}

.tok {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85em;
  padding: 0.12em 0.4em;
  margin: 0 0.08em;
  border-radius: 0.35em;
  white-space: pre;
  color: #333;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* Inside the schematics the container already sets the size; 0.85em is for prose. */
.token-stream .tok {
  font-size: 1em;
}

.token-stream .tok.c0 {
  background: var(--tok-0);
}

.token-stream .tok.c1 {
  background: var(--tok-1);
}

.token-stream .tok.c2 {
  background: var(--tok-2);
}

.token-stream .tok.c3 {
  background: var(--tok-3);
}

.token-stream .tok.c4 {
  background: var(--tok-4);
}

.token-stream .tok.c5 {
  background: var(--tok-5);
}

/* Split the already-generated context (column 1) from the drafter's guesses (column 2).
   A grid pins every guessed continuation to one column, so alternative continuations
   fork from the shared prefix and line up with each other. */
.token-stream.fork {
  display: grid;
  grid-template-columns: max-content 1fr;
  align-items: baseline;
  row-gap: 0.15em;
  column-gap: 0.35em;
}

.token-stream .ctx {
  grid-column: 1;
  grid-row: 1;
}

.token-stream .guess {
  grid-column: 2;
}

/* Verify outcome (intro schematic): accepted prefix, first reject, discarded tail. */
.tok.acc {
  background: #b9e6b9;
}

.tok.rej {
  background: #ffb8b8;
}

.tok.dis {
  background: #ececec;
  color: #999;
}

.token-stream .ell {
  color: #b7b3ac;
  padding: 0 0.15em;
  letter-spacing: 0.12em;
}

/* Draft tree (DDTree section): a third column acts as the branch rail.
   A branch row ends with a bare .sub ellipsis at the rail; each sub-branch
   is a .sub row whose leading ellipsis aligns exactly under it. */
.token-stream.tree {
  grid-template-columns: max-content max-content 1fr;
}

.token-stream .sub {
  grid-column: 3;
}

/* Token-flow table (intro schematic): one row per model call, one column per
   drafted position. Overrides the site's default table zebra/full-width rules. */
.token-flow {
  width: auto;
  max-width: 100%;
  margin: 1.6em auto;
  border-collapse: collapse;
  line-height: 1.6;
}

.token-flow tr:nth-child(even) {
  background: none;
}

.token-flow td,
.token-flow th {
  padding: 0.3em 0.45em;
  text-align: center;
  vertical-align: middle;
  font-weight: normal;
  white-space: nowrap;
}

.token-flow .hdr {
  font-size: 0.8rem;
  color: #8a8a8a;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-bottom: 0;
}

.token-flow .step {
  text-align: right;
  color: #555;
  padding-right: 0.8em;
}

.token-flow .ctx,
.token-flow .note {
  color: #8a8a8a;
}

.token-flow .note {
  text-align: left;
  font-size: 0.85rem;
  padding-left: 0.8em;
  white-space: normal;
}

.token-flow .blue {
  color: #2b6cb0;
}

.token-flow .verdict td {
  padding-top: 0;
  font-size: 0.85rem;
}

.token-flow .ok {
  color: #2f855a;
}

.token-flow .no {
  color: #c53030;
}

.token-flow .na {
  color: #c9c9c9;
}

.token-flow .rate td,
.token-flow .rate .step {
  font-size: 0.8rem;
  color: #8a8a8a;
  padding-top: 0;
}

/* Drafted-but-unverified tokens; and the token the target substitutes in. */
.tok.draft {
  background: #ece9f7;
}

.tok.tgt {
  background: #c7dcf5;
}

/* Inline chips naming the two halves of the accept/resample rule (appendix). */
.chip {
  padding: 0.05em 0.35em;
  border-radius: 0.3em;
  white-space: nowrap;
}

.chip.acc {
  background: #b9e6b9;
}

.chip.res {
  background: #dce9f7;
}

.agr-res-fig img {
  display: block;
  max-width: 100%;
  margin: 1.6em auto;
}