.next-token-page {
  margin: 0;
  background: var(--demo-bg);
}

.next-token-main {
  max-width: 1056px;
  margin-inline: auto;
  padding: calc(var(--demo-header-height) + 12px) clamp(16px, 4vw, 36px) 40px;
}

.next-token-intro { margin-bottom: clamp(20px, 3vw, 32px); }
.next-token-intro h1 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.next-token-intro p {
  max-width: 70ch;
  margin: 12px 0 0;
  color: var(--demo-muted);
  line-height: 1.55;
}

.next-selectors {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.next-selectors .segmented { flex: 1 0 auto; }
.next-token-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: clamp(24px, 5vw, 64px);
  align-items: start;
}
.next-prompt-section, .next-results { min-width: 0; }
.next-results h2 { font-size: 1.25rem; line-height: 1.2; }
.next-rank-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
}
.next-rank-head h2 { margin: 0; }
.next-depth { margin: 0; font-variant-numeric: tabular-nums; }
.next-results h2:focus-visible {
  outline: 2px solid var(--demo-accent);
  outline-offset: 4px;
}
.next-prompt {
  margin: clamp(16px, 4vw, 48px) 0 16px;
  font-size: clamp(1.75rem, 4.4vw, 3.3rem);
  line-height: 1.12;
  letter-spacing: -0.025em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.next-lead {
  display: block;
  margin-bottom: 10px;
  color: var(--demo-muted);
  font-size: 0.56em;
  letter-spacing: -0.01em;
}
.next-ending { font-weight: 650; }
#next-added mark {
  background: color-mix(in oklab, var(--demo-accent) 12%, transparent);
  color: var(--demo-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.12em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
#next-added mark[data-label]::before {
  content: attr(data-label);
  font-size: 0.55em;
  letter-spacing: 0;
}
.next-cursor {
  display: inline-block;
  width: 2px;
  height: 0.86em;
  margin-inline-start: 0.15em;
  background: var(--demo-accent);
  vertical-align: -0.055em;
}
.next-trail { margin: 0 0 12px; }
.next-trail p { margin: 0 0 4px; color: var(--demo-muted); font-size: 0.875rem; }
.next-trail ol {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.next-trail li { display: flex; align-items: center; gap: 8px; }
.next-trail li + li::before {
  content: '';
  width: 5px;
  height: 5px;
  border-block-start: 1px solid var(--demo-muted);
  border-inline-end: 1px solid var(--demo-muted);
  transform: rotate(45deg);
}
.next-trail .next-trail-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-sizing: border-box;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: var(--demo-panel);
  color: var(--demo-text);
  font: 600 0.875rem/1.2 var(--demo-font, system-ui, sans-serif);
}
.next-trail button:hover { text-decoration: underline; }
.next-trail-chip[aria-current] { color: var(--demo-accent); }
.next-trail-odds { color: var(--demo-muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.next-history, .next-roll { padding: 0; }
.next-history button, .next-roll button, .next-token-page .segmented > button { min-height: 44px; }
.next-token-page .segmented > button { font-size: 0.875rem; }
.next-depth, .next-hint, .next-remainder, .next-source, #next-roll-note {
  color: var(--demo-muted);
  font-size: 0.875rem;
  line-height: 1.45;
}
.next-flow {
  --next-lane-height: 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(142px, 0.75fr);
  align-items: stretch;
  gap: 6px;
  margin-block: 10px;
}
.next-flow-art {
  display: block;
  width: 100%;
  height: calc(var(--next-lane-height) * 5);
  overflow: visible;
}
.next-flow-art path { fill: var(--demo-accent); }
.next-flow-art path:last-child { fill: var(--demo-line); }
.next-ribbon-choice { cursor: pointer; }
.next-flow:has(.next-ribbon-choice:is(:hover, .is-focused)) .next-ribbon-choice:not(:hover, .is-focused) {
  opacity: 0.44;
}
.next-rank { margin: 0; padding: 0; list-style: none; }
.next-rank .next-rank-row, .next-remainder {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  box-sizing: border-box;
  height: var(--next-lane-height);
}
.demo-ui .next-rank button.next-rank-row {
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: start;
}
.demo-ui .next-rank button.next-rank-row:is(:hover, :focus-visible) { background: var(--demo-panel); }
.next-token-label { font-size: 1.125rem; font-weight: 650; overflow-wrap: anywhere; }
.next-probability { font-size: 0.875rem; text-align: end; font-variant-numeric: tabular-nums; }
.next-remainder { margin: 0; }
.next-hint { margin: 8px 0 0; }
.next-roll { align-items: center; }
.next-token-page .demo-guide[open] { right: max(24px, env(safe-area-inset-right)); max-width: calc(100vw - 48px); }
.next-token-page .demo-guide:not([open]),
.next-token-page.demo-ui .segmented > button[aria-pressed="true"] { box-shadow: none; } /* taste-skill-ignore: removes inherited shadows */
.next-token-page .demo-guide:not([open]) .demo-guide-copy { display: none; }
.next-source { margin: 16px 0 0; }
.next-source a { color: var(--demo-accent); text-underline-offset: 3px; }
.next-application {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: clamp(16px, 5vw, 64px);
  margin-top: clamp(24px, 5vw, 48px);
  padding: clamp(16px, 3vw, 24px);
  background: var(--demo-panel);
  border-radius: var(--demo-panel-radius);
  line-height: 1.55;
}
.next-application h2 { margin: 0 0 8px; font-size: 1.25rem; line-height: 1.2; }
.next-application p { margin: 0; }
.next-example p + p { margin-top: 8px; }
.next-example p:last-child { color: var(--demo-muted); }
.next-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 660px) {
  .next-token-main { padding-top: calc(var(--demo-header-height) + 4px); }
  .next-token-intro { margin-bottom: 16px; }
  .next-token-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .next-flow { grid-template-columns: minmax(0, 1fr) minmax(126px, 0.9fr); }
  .next-application { grid-template-columns: minmax(0, 1fr); }
  .next-history { gap: 6px; }
}
