/* =========================================================================
   Self-Attention - The Gaze
   Dark cosmic theme. Inter for text, JetBrains Mono for numbers.
   ========================================================================= */

:root {
  --bg-deep: #000000;
  --bg: #09090b;
  --bg-card: #18181b;
  --bg-card-2: #27272a;
  --bg-elev: #27272a;
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.2);
  --border-soft: rgba(255, 255, 255, 0.05);

  --ink: #fafafa;
  --ink-soft: #a1a1aa;
  --ink-mute: #71717a;
  --ink-faint: #3f3f46;

  --violet: #8b5cf6;
  --violet-soft: #a78bfa;
  --cyan: #0ea5e9;
  --cyan-soft: #38bdf8;
  --rose: #ec4899;
  --amber: #f59e0b;
  --mint: #10b981;

  --grad-cool: linear-gradient(135deg, #8b5cf6 0%, #0ea5e9 100%);
  --grad-warm: linear-gradient(135deg, #ec4899 0%, #f59e0b 100%);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 24px;

  --shadow-soft: 0 4px 24px -8px rgba(0, 0, 0, 0.5);
  --shadow-hard: 0 12px 36px -16px rgba(0, 0, 0, 0.8);

  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans:
    "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
}

* {
  box-sizing: border-box;
}

/* The HTML [hidden] attribute MUST win over any display rules. */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg-deep);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  position: relative;
  overflow-x: hidden;
}

/* ----- cosmic backdrop ----- */
.cosmos {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--bg-deep);
  background-image:
    radial-gradient(
      ellipse at 50% 0%,
      rgba(139, 92, 246, 0.15) 0%,
      transparent 70%
    ),
    radial-gradient(
      ellipse at 80% 50%,
      rgba(14, 165, 233, 0.1) 0%,
      transparent 50%
    );
}
.cosmos::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 0) 100%
  );
  -webkit-mask-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 0) 100%
  );
}

/* ----- header ----- */
.topbar {
  position: relative;
  z-index: 1;
  padding: 56px 48px 24px;
  max-width: 1280px;
  margin: 0 auto;
}

.brand-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-soft);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  width: max-content;
}

.brand-eye {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.18);
  color: var(--violet-soft);
  box-shadow: 0 0 24px -6px rgba(139, 92, 246, 0.7);
}
.brand-eye svg {
  width: 18px;
  height: 18px;
}

.brand-name {
  color: var(--ink);
  font-weight: 600;
  letter-spacing: 0.14em;
}

.brand-sub {
  color: var(--ink-mute);
}

@keyframes live-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.55);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(14, 165, 233, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(14, 165, 233, 0);
  }
}

.hero-line {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.12;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
  max-width: 880px;
}
.hero-flash {
  background: var(--grad-cool);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 28px rgba(139, 92, 246, 0.45));
}
.hero-line-soft {
  display: block;
  font-size: clamp(15px, 1.6vw, 18px);
  font-weight: 400;
  color: var(--ink-soft);
  margin-top: 14px;
  letter-spacing: 0;
  max-width: 740px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.hero-meta-chip {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-soft);
}

/* ----- stage ----- */
.stage {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 8px 48px 80px;
  display: flex;
  flex-direction: column;
  gap: 56px;
}

.stage > section {
  animation: section-rise 0.55s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}
.stage > section:nth-child(1) {
  animation-delay: 0.05s;
}
.stage > section:nth-child(2) {
  animation-delay: 0.15s;
}
.stage > section:nth-child(3) {
  animation-delay: 0.25s;
}
.stage > section:nth-child(4) {
  animation-delay: 0.35s;
}
.stage > section:nth-child(5) {
  animation-delay: 0.45s;
}
.stage > section:nth-child(6) {
  animation-delay: 0.55s;
}
.stage > section:nth-child(7) {
  animation-delay: 0.65s;
}
@keyframes section-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.topbar > .brand-stack {
  animation: section-rise 0.6s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

@keyframes focus-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.55);
  }
  60% {
    box-shadow: 0 0 0 14px rgba(14, 165, 233, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(14, 165, 233, 0);
  }
}
.token-chip.is-pulsing {
  animation: focus-pulse 0.7s ease-out;
}

.act-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg-deep);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 14px;
  border: none;
}

.step-label {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.step-soft {
  color: var(--ink-mute);
  font-weight: 400;
  font-size: 14px;
}

/* ---- sub-section header (no step number, used for the heatmap continuation) ---- */
.sub-act-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 28px 0 12px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-soft);
}

.sub-act-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.sub-act-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.005em;
}

/* ============================================================
   ACT 1 - Compose
   ============================================================ */

/* ============================================================
   ACT 2 - Token stream
   ============================================================ */
.tokens-shell {
  position: relative;
  padding: 28px 22px 22px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  overflow: hidden;
}

.arc-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.arc-layer path {
  fill: none;
  stroke-linecap: round;
  transition:
    opacity 0.25s ease,
    stroke-width 0.25s ease;
}

.tokens-row {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  z-index: 1;
}

.token-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--ink-soft);
  font-family: var(--sans);
  font-weight: 500;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.token-chip:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-strong);
  color: var(--ink);
}
.token-chip .chip-idx {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
}
.token-chip.is-focused {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg-deep);
  box-shadow: 0 0 24px rgba(255, 255, 255, 0.2);
}
.token-chip.is-focused .chip-idx {
  color: rgba(0, 0, 0, 0.5);
}
.token-chip.is-target-strong {
  border-color: var(--cyan);
  box-shadow:
    0 0 0 1px rgba(14, 165, 233, 0.3),
    0 0 28px -6px rgba(14, 165, 233, 0.4);
}
.token-chip.is-target-mid {
  border-color: rgba(139, 92, 246, 0.55);
}
.token-chip.is-target-weak {
  opacity: 0.55;
}

.tokens-foot {
  margin: 18px 0 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--ink-mute);
  flex-wrap: wrap;
}
.legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid var(--border-soft);
}
.legend-strong {
  background: var(--cyan);
  box-shadow: 0 0 12px -2px var(--cyan);
}
.legend-mid {
  background: var(--violet);
}
.legend-weak {
  background: var(--bg-elev);
}
.legend-divider {
  color: var(--ink-faint);
}

/* ============================================================
   ACT 3 - The Gaze
   ============================================================ */
.follow-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.follow-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.22),
    rgba(14, 165, 233, 0.16)
  );
  border: 1px solid var(--border-strong);
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
}
.follow-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.follow-name {
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 700;
  color: #fff;
}
.follow-arrow {
  color: var(--ink-faint);
}
.follow-target {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--cyan-soft);
  font-weight: 600;
}
.follow-weight {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--cyan-soft);
  background: rgba(0, 0, 0, 0.2);
  padding: 2px 8px;
  border-radius: 6px;
}
.follow-hint {
  margin: 0;
  font-size: 12px;
  color: var(--ink-mute);
}

.gaze-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 22px;
  align-items: stretch;
}

.gaze-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: var(--shadow-soft);
  min-width: 0;
}

.gaze-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  flex-wrap: wrap;
}
.gaze-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.gaze-eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
}
.gaze-stage-label {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}

#stage-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--bg-elev);
  border-radius: 4px;
  outline: none;
}
#stage-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--grad-cool);
  border: 2px solid var(--bg);
  cursor: pointer;
  box-shadow: 0 0 12px -2px var(--violet);
}
#stage-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--violet);
  border: 2px solid var(--bg);
  cursor: pointer;
}

.gaze-grid-wrap {
  overflow-x: auto;
  padding-bottom: 4px;
}

.gaze-grid {
  display: grid;
  gap: 4px;
  min-width: max-content;
}
.gaze-cell {
  width: var(--cell, 44px);
  height: var(--cell, 44px);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  transition:
    transform 0.12s ease,
    box-shadow 0.18s ease,
    outline-color 0.18s ease,
    background-color 0.4s ease,
    opacity 0.3s ease;
  outline: 2px solid transparent;
  outline-offset: 1px;
}
.gaze-cell:hover {
  transform: scale(1.06);
  outline-color: rgba(255, 255, 255, 0.45);
  z-index: 2;
}
.gaze-row-head,
.gaze-col-head {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.03em;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition:
    color 0.18s,
    background 0.18s;
  white-space: nowrap;
}
.gaze-row-head {
  justify-content: flex-end;
  padding-right: 10px;
  min-width: 64px;
}
.gaze-col-head {
  height: 28px;
}
.gaze-row-head:hover,
.gaze-col-head:hover {
  color: var(--ink);
  background: rgba(139, 92, 246, 0.1);
}
.gaze-row-head.is-focused,
.gaze-col-head.is-focused {
  color: var(--cyan-soft);
  background: rgba(14, 165, 233, 0.12);
}
.gaze-corner {
  width: 100%;
  height: 28px;
}

.gaze-grid.dim-others .gaze-cell:not(.is-focus-row):not(.is-focus-col) {
  opacity: 0.34;
}
.gaze-cell.is-focus-row {
  outline-color: rgba(139, 92, 246, 0.7);
}
.gaze-cell.is-focus-col {
  outline-color: rgba(14, 165, 233, 0.55);
}
.gaze-cell.is-row-max {
  box-shadow:
    0 0 0 1px rgba(14, 165, 233, 0.7),
    0 0 18px -4px rgba(14, 165, 233, 0.8);
}

.gaze-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
}
.gaze-scale {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.scale-bar {
  display: inline-block;
  width: 160px;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    rgba(139, 92, 246, 0.05),
    rgba(139, 92, 246, 0.6),
    rgba(14, 165, 233, 0.95)
  );
  border: 1px solid var(--border-soft);
}
.scale-min,
.scale-max {
  font-feature-settings: "tnum";
  color: var(--ink-soft);
}

/* ----- gaze side panel ----- */
.gaze-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.side-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.side-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.side-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--violet-soft);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.side-body {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.5;
}

.stat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.stat-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border-soft);
}
.stat-list li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}
.stat-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.stat-pair {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.stat-value {
  font-family: var(--mono);
  font-size: 17px;
  color: var(--cyan-soft);
  font-feature-settings: "tnum";
  transition: color 0.3s ease;
}
.stat-value.is-hot {
  color: var(--rose);
}
.stat-sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-mute);
}
.stat-meter {
  position: relative;
  display: inline-block;
  width: 84px;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
  border: 1px solid var(--border-soft);
}
.stat-meter-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: var(--grad-cool);
  transition:
    width 0.4s ease,
    background 0.3s ease;
  border-radius: 4px;
}
.stat-meter-fill.is-hot {
  background: linear-gradient(90deg, var(--amber), var(--rose));
}

.shape-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.shape-list li {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-soft);
}
.shape-list code {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink);
  background: rgba(139, 92, 246, 0.12);
  padding: 1px 8px;
  border-radius: 4px;
}

/* ============================================================
   ACT 4 - Embedding shift
   ============================================================ */
.focus-name-inline {
  font-family: var(--mono);
  color: var(--cyan-soft);
  background: rgba(14, 165, 233, 0.1);
  padding: 1px 8px;
  border-radius: 6px;
  font-size: 0.95em;
}

.shift-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 18px;
  align-items: stretch;
}

.shift-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.shift-card-after {
  background: linear-gradient(
    180deg,
    rgba(139, 92, 246, 0.12) 0%,
    rgba(14, 165, 233, 0.08) 100%
  );
  border-color: var(--border-strong);
  box-shadow: 0 18px 48px -24px rgba(139, 92, 246, 0.55);
}
.shift-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.shift-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.shift-name {
  font-family: var(--mono);
  font-size: 18px;
  color: var(--ink);
  font-feature-settings: "tnum";
}
.shift-foot {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-mute);
}

.shift-bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bar-row {
  display: grid;
  grid-template-columns: 32px 1fr 62px;
  align-items: center;
  gap: 10px;
}
.bar-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-mute);
  text-align: right;
}
.bar-track {
  position: relative;
  height: 18px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}
.bar-zero {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border-strong);
}
.bar-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--violet);
  border-radius: 3px;
  transition:
    width 0.36s cubic-bezier(0.2, 0.9, 0.2, 1),
    left 0.36s cubic-bezier(0.2, 0.9, 0.2, 1);
}
.shift-card-after .bar-fill {
  background: var(--grad-cool);
}
.bar-value {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  text-align: right;
  font-feature-settings: "tnum";
}

.shift-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 64px;
  color: var(--ink-mute);
}
.shift-arrow-line {
  width: 2px;
  flex: 1;
  background: linear-gradient(
    180deg,
    transparent,
    var(--violet-soft) 30%,
    var(--cyan) 70%,
    transparent
  );
}
.shift-arrow-head {
  font-size: 22px;
  color: var(--cyan-soft);
}
.shift-arrow-caption {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.recipe-card {
  margin-top: 22px;
  padding: 22px 24px;
  background: linear-gradient(
    180deg,
    rgba(139, 92, 246, 0.08) 0%,
    rgba(14, 165, 233, 0.04) 100%
  );
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}
.recipe-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}
.recipe-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--violet-soft);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.recipe-title {
  font-family: var(--mono);
  font-size: 20px;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.recipe-eq {
  color: var(--ink-mute);
}
.recipe-sub {
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--ink-mute);
}

.recipe-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  counter-reset: recipe;
}
.recipe-row {
  display: grid;
  grid-template-columns: 24px 64px minmax(0, 1fr) 110px;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  transition:
    transform 0.32s cubic-bezier(0.2, 0.9, 0.2, 1),
    background 0.22s ease,
    border-color 0.22s ease;
}
.recipe-row.is-top {
  background: rgba(14, 165, 233, 0.07);
  border-color: rgba(14, 165, 233, 0.32);
  box-shadow: 0 12px 32px -20px rgba(14, 165, 233, 0.55);
}
.recipe-row.is-top-1 {
  background: rgba(14, 165, 233, 0.13);
  border-color: rgba(14, 165, 233, 0.55);
}
.recipe-rank {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
  text-align: right;
}
.recipe-row.is-top .recipe-rank {
  color: var(--cyan-soft);
}
.recipe-weight {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--violet-soft);
  font-feature-settings: "tnum";
  text-align: right;
}
.recipe-row.is-top .recipe-weight {
  color: var(--cyan-soft);
}
.recipe-bar {
  position: relative;
  height: 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  overflow: hidden;
}
.recipe-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--violet);
  border-radius: 6px;
  transition: width 0.36s cubic-bezier(0.2, 0.9, 0.2, 1);
}
.recipe-row.is-top .recipe-bar-fill {
  background: var(--grad-cool);
}
.recipe-word {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recipe-word .word-prefix {
  color: var(--ink-mute);
  margin-right: 2px;
}

.recipe-foot {
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px dashed var(--border-soft);
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.55;
}
.recipe-foot strong {
  font-family: var(--mono);
  color: var(--cyan-soft);
  background: rgba(14, 165, 233, 0.12);
  padding: 1px 8px;
  border-radius: 6px;
  font-weight: 600;
}

/* ============================================================
   ACT 5 - Behind the gaze
   ============================================================ */
.behind {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 0;
}
.behind > summary {
  list-style: none;
  cursor: pointer;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: var(--radius-lg);
  transition: background 0.18s;
}
.behind > summary::-webkit-details-marker {
  display: none;
}
.behind > summary:hover {
  background: rgba(139, 92, 246, 0.06);
}
.behind-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--violet-soft);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.behind-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}
.behind-hint {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-mute);
}
.behind[open] > summary .behind-hint::after {
  content: " (hide)";
}

.behind-grid {
  padding: 0 24px 24px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.lens-card {
  background: var(--bg-card-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.lens-card header {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lens-eyebrow {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--cyan-soft);
  letter-spacing: 0.04em;
}
.lens-name {
  font-size: 12.5px;
  color: var(--ink-mute);
}
.lens-grid {
  display: grid;
  gap: 3px;
  overflow-x: auto;
}
.lens-cell {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.8);
}


.recipe-list {
  margin: 12px 0 0;
  padding-left: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.recipe-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.02);
}
.recipe-item.is-top {
  border-color: rgba(14, 165, 233, 0.5);
  background: rgba(14, 165, 233, 0.08);
}
.recipe-term {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-soft);
}
.recipe-contrib {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--cyan-soft);
}
.recipe-foot {
  margin: 12px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
}

/* ============================================================
   ACT 4 - Bridge: "shapes the question" = RAG + ICL
   Same chip/eyebrow language as the rest of the demo.
   ============================================================ */
.bridge-section {
  position: relative;
}

.bridge-intro {
  margin-bottom: 22px;
}

.bridge-intro em {
  font-style: normal;
  color: var(--cyan-soft);
}

.bridge-intro strong {
  color: var(--ink);
}

.bridge-stack {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  counter-reset: bridge;
}

.bridge-card {
  position: relative;
  padding: 22px 24px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px 28px;
  overflow: hidden;
}

.bridge-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.07) 0%,
    transparent 45%
  );
}

.bridge-card[data-scale="prompt"]::before {
  background: linear-gradient(
    135deg,
    rgba(14, 165, 233, 0.07) 0%,
    transparent 45%
  );
}

.bridge-card[data-scale="retrieval"]::before {
  background: linear-gradient(
    135deg,
    rgba(236, 72, 153, 0.07) 0%,
    transparent 45%
  );
}

.bridge-card-head {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 18px;
  border-right: 1px solid var(--border-soft);
}

.bridge-card-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-mute);
}

.bridge-card-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.015em;
}

.bridge-card[data-scale="sentence"] .bridge-card-title {
  color: var(--violet-soft);
}
.bridge-card[data-scale="prompt"] .bridge-card-title {
  color: var(--cyan-soft);
}
.bridge-card[data-scale="retrieval"] .bridge-card-title {
  color: var(--rose);
}

.bridge-card-scale {
  display: inline-block;
  margin-top: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-soft);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  width: fit-content;
}

.bridge-card-body {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.bridge-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.bridge-row-label {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-mute);
  min-width: 56px;
}

.bridge-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
  max-width: 100%;
}

.bridge-chip.is-focus {
  background: var(--ink);
  color: var(--bg-deep);
  border-color: var(--ink);
  font-weight: 600;
  box-shadow: 0 0 24px rgba(255, 255, 255, 0.18);
}

.bridge-card[data-scale="sentence"] .bridge-chip.is-focus {
  background: var(--violet-soft);
  border-color: var(--violet-soft);
  color: var(--bg-deep);
  box-shadow: 0 0 24px rgba(167, 139, 250, 0.35);
}
.bridge-card[data-scale="prompt"] .bridge-chip.is-focus {
  background: var(--cyan-soft);
  border-color: var(--cyan-soft);
  color: var(--bg-deep);
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.35);
}
.bridge-card[data-scale="retrieval"] .bridge-chip.is-focus {
  background: var(--rose);
  border-color: var(--rose);
  color: var(--bg-deep);
  box-shadow: 0 0 24px rgba(236, 72, 153, 0.35);
}

.bridge-card-takeaway {
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.bridge-card-takeaway em {
  font-style: normal;
  color: var(--ink);
}

.bridge-card-takeaway code {
  font-family: var(--mono);
  font-size: 12px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-soft);
  color: var(--ink);
}

.bridge-punchline {
  position: relative;
  padding: 22px 24px;
  border-radius: var(--radius-lg);
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.12) 0%,
    rgba(14, 165, 233, 0.1) 50%,
    rgba(236, 72, 153, 0.1) 100%
  );
  border: 1px solid var(--border-strong);
  overflow: hidden;
}

.bridge-punchline-eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
  margin-bottom: 10px;
}

.bridge-punchline p {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
}

.bridge-punchline p:last-child {
  margin-bottom: 0;
}

.bridge-punchline strong {
  color: var(--ink);
}

.bridge-punchline em {
  font-style: normal;
  color: var(--cyan-soft);
}

.bridge-punchline-tag {
  font-size: 13px !important;
  color: var(--ink-soft) !important;
}

.bridge-punchline-tag code {
  font-family: var(--mono);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-soft);
  color: var(--ink);
  margin-right: 4px;
}

.bridge-punchline-tag strong {
  color: var(--cyan-soft);
}

@media (max-width: 760px) {
  .bridge-card {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 18px 18px;
  }
  .bridge-card-head {
    border-right: none;
    padding-right: 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-soft);
  }
  .bridge-row-label {
    min-width: auto;
    width: 100%;
  }
  .bridge-punchline {
    padding: 18px 18px;
  }
}

/* ============================================================
   "What's simplified" section
   ============================================================ */
.simplified-body {
  padding: 0 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.simplified-intro {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.6;
}

.simplified-intro em {
  font-style: normal;
  color: var(--cyan-soft);
}

.simplified-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.simplified-list li {
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--bg-card-2);
  border: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.simplified-item-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.simplified-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.18);
  color: var(--violet-soft);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.simplified-list li strong {
  font-size: 14px;
  color: var(--ink);
  letter-spacing: -0.005em;
}

.simplified-list li p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-soft);
}

.simplified-list li p em {
  font-style: normal;
  color: var(--cyan-soft);
}

.simplified-takeaway {
  margin: 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(14, 165, 233, 0.06);
  border-left: 3px solid rgba(14, 165, 233, 0.6);
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.6;
}

.simplified-takeaway strong {
  color: var(--ink);
}

.simplified-takeaway em {
  font-style: normal;
  color: var(--cyan-soft);
}

@media (max-width: 700px) {
  .simplified-list {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 28px 24px 56px;
  font-size: 13px;
  color: var(--ink-mute);
}
.footer code {
  font-family: var(--mono);
  font-size: 12px;
  background: rgba(139, 92, 246, 0.12);
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--ink-soft);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 980px) {
  .topbar,
  .stage {
    padding-left: 24px;
    padding-right: 24px;
  }
  .compose-form {
    grid-template-columns: 1fr 1fr;
  }
  .compose-form .compose-field-sentence,
  .compose-form .rewire-cta {
    grid-column: 1 / -1;
  }
  .gaze-shell {
    grid-template-columns: 1fr;
  }
  .shift-grid {
    grid-template-columns: 1fr;
  }
  .shift-arrow {
    flex-direction: row;
    min-height: 40px;
  }
  .shift-arrow-line {
    width: auto;
    height: 2px;
    flex: 1;
    background: linear-gradient(
      90deg,
      transparent,
      var(--violet-soft) 30%,
      var(--cyan) 70%,
      transparent
    );
  }
  .behind-grid {
    grid-template-columns: 1fr;
  }
  .stepper {
    flex-wrap: wrap;
  }
  .step-rail {
    display: none;
  }
}

@media (max-width: 600px) {
  .topbar {
    padding-top: 36px;
  }
  .topbar,
  .stage {
    padding-left: 14px;
    padding-right: 14px;
  }
  .stage {
    gap: 36px;
  }
  .hero-line {
    font-size: 26px;
  }
  .hero-line-soft {
    font-size: 15px;
  }
  .act-head {
    align-items: flex-start;
  }
  .step-label {
    font-size: 15px;
  }
  .compose-form {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 10px;
  }
  .rewire-cta {
    justify-content: center;
    min-height: 46px;
  }
  .tokens-shell,
  .gaze-card,
  .pipeline-card,
  .shift-card {
    padding: 14px;
    border-radius: 14px;
  }
  .token-chip {
    padding: 9px 12px;
    font-size: 14px;
  }
  .gaze-row-head {
    min-width: 52px;
    font-size: 10px;
    padding-right: 6px;
  }
  .play-btn {
    width: 100%;
    justify-content: center;
  }
  .follow-pill {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    border-radius: 12px;
  }
}

/* =========================================================================
   ACT 5 — Language-modeling head
   ========================================================================= */
.lmhead-section {
  margin-top: 36px;
}
.lm-card {
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  padding: 24px 28px;
}
.lm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.lm-eyebrow {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-soft);
}
.lm-eyebrow #lm-focus-idx {
  color: var(--cyan);
}
.lm-prediction {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 999px;
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.18),
    rgba(14, 165, 233, 0.14)
  );
  border: 1px solid rgba(139, 92, 246, 0.42);
}
.lm-pred-label {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.lm-pred-token {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--cyan-soft);
}
.lm-pred-prob {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink-soft);
}
.lm-rows {
  list-style: none;
  margin: 0 0 16px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lm-row {
  display: grid;
  grid-template-columns: 32px 1fr 2fr 70px 80px;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: rgba(238, 240, 255, 0.03);
  border: 1px solid var(--border-soft);
  transition: background 160ms ease;
}
.lm-row.is-top {
  background: linear-gradient(
    90deg,
    rgba(139, 92, 246, 0.18),
    rgba(14, 165, 233, 0.06)
  );
  border-color: rgba(139, 92, 246, 0.55);
}
.lm-row.is-target {
  outline: 1px dashed rgba(255, 178, 74, 0.55);
  outline-offset: -1px;
}
.lm-rank {
  font-family: var(--mono);
  color: var(--ink-mute);
  font-size: 12px;
}
.lm-word {
  font-weight: 600;
  color: var(--ink);
}
.lm-bar {
  height: 8px;
  background: rgba(238, 240, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}
.lm-bar-fill {
  display: block;
  height: 100%;
  background: var(--grad-cool);
  border-radius: 999px;
  transition: width 280ms ease;
}
.lm-row.is-top .lm-bar-fill {
  background: linear-gradient(90deg, var(--violet) 0%, var(--cyan) 100%);
  box-shadow: 0 0 14px rgba(14, 165, 233, 0.45);
}
.lm-logit {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-mute);
  text-align: right;
}
.lm-prob {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  text-align: right;
}
.lm-amplify {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: rgba(14, 165, 233, 0.06);
  border: 1px dashed rgba(14, 165, 233, 0.35);
}
.lm-amplify-eyebrow {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan);
  display: block;
  margin-bottom: 4px;
}
.lm-amplify p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.5;
}
.lm-amplify p strong {
  color: var(--cyan-soft);
  font-family: var(--mono);
}

/* ----- responsive collapse for the new sections ----- */
@media (max-width: 900px) {
  .lm-row {
    grid-template-columns: 28px 1fr 1.5fr 60px 64px;
    gap: 8px;
    padding: 7px 10px;
  }
  .lm-logit {
    display: none;
  }
}

/* =========================================================================
   UX cleanup overrides (calmer + clearer flow)
   ========================================================================= */
.hero-line {
  max-width: 760px;
}

.hero-line-soft {
  max-width: 660px;
  line-height: 1.5;
}

.hero-meta {
  margin-top: 2px;
}

.hero-meta-chip {
  font-size: 10px;
  letter-spacing: 0.05em;
  color: rgba(238, 240, 255, 0.8);
  background: rgba(255, 255, 255, 0.02);
}

.stage {
  gap: 44px;
}

.act-head {
  margin-bottom: 12px;
}

.step-label {
  font-size: 18px;
}

.step-soft {
  display: block;
  margin-top: 3px;
  line-height: 1.4;
}

.compose-form,
.tokens-shell,
.gaze-card,
.recipe-card,
.lm-card,
.behind {
  box-shadow: 0 10px 28px -20px rgba(0, 0, 0, 0.62);
}

.compose-form,
.gaze-card,
.recipe-card,
.lm-card {
  border-color: rgba(255, 255, 255, 0.09);
}


.compose {
  margin-bottom: 26px;
  padding: 20px 22px;
  background: linear-gradient(
    180deg,
    rgba(139, 92, 246, 0.08),
    rgba(14, 165, 233, 0.04)
  );
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 14px 36px -24px rgba(0, 0, 0, 0.7);
}

.compose-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.compose-help-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-strong);
  background: rgba(14, 165, 233, 0.1);
  color: var(--cyan-soft);
  border-radius: 999px;
  padding: 7px 14px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.18s ease;
}

.compose-help-btn svg {
  opacity: 0.8;
}

.compose-help-btn:hover {
  background: rgba(14, 165, 233, 0.18);
  border-color: var(--cyan);
  color: #fff;
  transform: translateY(-1px);
}

#compose-data-btn {
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.22),
    rgba(14, 165, 233, 0.16)
  );
  border-color: rgba(139, 92, 246, 0.4);
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 12px;
  padding: 8px 16px;
  font-family: var(--sans);
  font-weight: 600;
  box-shadow: 0 6px 18px -10px rgba(139, 92, 246, 0.5);
}

#compose-data-btn:hover {
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.32),
    rgba(14, 165, 233, 0.24)
  );
  border-color: var(--violet);
  box-shadow: 0 10px 28px -12px rgba(139, 92, 246, 0.7);
}

.compose-note {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.5;
  margin: 14px 0 0;
  max-width: 720px;
}

.compose-note strong {
  color: var(--ink);
  font-weight: 600;
}

.compose-note em {
  font-style: normal;
  color: var(--violet-soft);
}

.sentence-selector {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.sentence-btn {
  text-align: left;
  padding: 13px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  color: var(--ink-soft);
  font-family: var(--sans);
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  transition:
    transform 0.16s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

.sentence-btn:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background: var(--bg-card-2);
}

.sentence-btn.is-active {
  background: linear-gradient(
    180deg,
    rgba(14, 165, 233, 0.14),
    rgba(139, 92, 246, 0.16)
  );
  border-color: rgba(14, 165, 233, 0.55);
  color: var(--ink);
  box-shadow: 0 12px 28px -18px rgba(14, 165, 233, 0.75);
  animation: profile-glow 1.3s ease;
}

.sentence-btn-title {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.sentence-btn-sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
}

.sentence-btn.is-active .sentence-btn-sub {
  color: var(--cyan-soft);
}

@keyframes profile-glow {
  0% {
    box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.5);
  }
  100% {
    box-shadow: 0 12px 28px -18px rgba(14, 165, 233, 0.75);
  }
}

/* ---- intuition blurbs (the "why this matters" sentence under each act) -- */
.intuition {
  margin: 0 0 14px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(139, 92, 246, 0.06);
  border-left: 3px solid rgba(139, 92, 246, 0.7);
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.6;
  max-width: 900px;
}

.intuition em {
  font-style: normal;
  color: var(--cyan-soft);
}

.intuition strong {
  color: var(--ink);
  font-weight: 600;
}

.intuition-cta {
  display: block;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(139, 92, 246, 0.25);
  font-size: 13px;
  color: var(--ink-mute);
}

/* ---- hover tooltips: any element with data-tip gets an explainer ------- */
[data-tip] {
  position: relative;
  cursor: help;
  border-bottom: 1px dotted rgba(139, 92, 246, 0.55);
  text-decoration: none;
}

[data-tip]:hover,
[data-tip]:focus-visible {
  color: var(--cyan-soft);
  border-bottom-color: var(--cyan);
  outline: none;
}

[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translate(-50%, 6px);
  width: max-content;
  max-width: 280px;
  padding: 9px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  white-space: normal;
  text-align: left;
  z-index: 200;
  box-shadow: 0 14px 36px -12px rgba(0, 0, 0, 0.75);
  pointer-events: none;
  opacity: 0;
  transition:
    opacity 0.16s ease,
    transform 0.16s ease;
}

[data-tip]::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translate(-50%, 6px);
  width: 10px;
  height: 10px;
  background: var(--bg-elev);
  border-right: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border-strong);
  rotate: 45deg;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  transition:
    opacity 0.16s ease,
    transform 0.16s ease;
}

[data-tip]:hover::after,
[data-tip]:focus-visible::after,
[data-tip]:hover::before,
[data-tip]:focus-visible::before {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---- prediction hero removed ---- */

.help-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 20, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 500;
  display: grid;
  place-items: center;
  padding: 20px;
  animation: backdrop-fade 0.18s ease;
}

@keyframes backdrop-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.help-modal {
  width: min(720px, 100%);
  max-height: min(86vh, 720px);
  overflow-y: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  box-shadow:
    0 24px 80px -32px rgba(0, 0, 0, 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  padding: 36px 36px 32px;
  padding-right: 64px;
  position: relative;
  animation: modal-rise 0.24s var(--ease-out-expo, ease);
}

.help-modal h2 {
  margin: 0 0 22px;
  font-size: 24px;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.help-intro {
  margin: 0 0 18px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.28);
  color: var(--ink-soft);
  line-height: 1.6;
  font-size: 14px;
}

.help-intro strong {
  color: var(--ink);
}

.help-intro em {
  color: var(--violet-soft);
  font-style: normal;
}

.help-steps {
  margin: 0;
  padding-left: 24px;
  display: grid;
  gap: 16px;
  color: var(--ink-soft);
  line-height: 1.6;
  font-size: 15px;
}

.help-steps strong {
  color: var(--ink);
}

.help-steps strong.is-target {
  color: var(--mint, #34d399);
}

.help-steps strong.is-penalty {
  color: var(--rose, #fb7185);
}

.help-close {
  position: absolute;
  right: 16px;
  top: 16px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-soft);
  font-size: 22px;
  font-weight: 500;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition:
    color 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s var(--ease-spring, ease);
}

.help-close:hover,
.help-close:focus-visible {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-strong);
  transform: scale(1.06);
  outline: none;
}

.help-close:active {
  transform: scale(0.94);
}

.help-modal-hint {
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px dashed var(--border-soft);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  text-align: right;
}
.help-modal-hint kbd {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 10px;
  margin: 0 2px;
}

@keyframes modal-rise {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

body.modal-open {
  overflow: hidden;
}

/* =========================================================================
   Edit Training Data modal
   ========================================================================= */
.data-modal {
  width: min(640px, 100%);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.data-modal-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.data-modal-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--violet-soft);
}

.data-modal h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--ink);
}

#data-modal-profile {
  background: linear-gradient(135deg, var(--violet-soft), var(--cyan-soft));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.data-modal-sub {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-soft);
}

.data-modal-sub strong {
  color: var(--ink);
}

.data-modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.data-modal-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.data-modal-count {
  color: var(--violet-soft);
  letter-spacing: 0.08em;
}

.data-chips {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed var(--border-soft);
  background: rgba(255, 255, 255, 0.02);
}

.data-chip {
  --idx: 0;
  display: grid;
  grid-template-columns: 1fr 110px auto auto auto auto;
  grid-template-areas: "line meter count minus plus remove";
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 12px;
  border-radius: 12px;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.32);
  color: var(--ink);
  animation: chip-pop 0.32s var(--ease-out-expo, ease) both;
  animation-delay: calc(var(--idx) * 30ms);
  transition:
    transform 0.18s var(--ease-out-expo, ease),
    background 0.2s ease,
    border-color 0.2s ease;
}

.data-chip:hover {
  transform: translateY(-1px);
  background: rgba(139, 92, 246, 0.18);
  border-color: var(--violet);
}

.data-chip-line {
  grid-area: line;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  font-family: var(--mono);
  font-size: 12.5px;
  min-width: 0;
}

.data-chip-prefix {
  color: var(--ink-mute);
  letter-spacing: 0.01em;
}

.data-chip-prefix::before {
  content: "\201C";
}

.data-chip-word {
  color: var(--violet-soft);
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: lowercase;
}

.data-chip-word::after {
  content: "\201D";
  color: var(--ink-mute);
  font-weight: 400;
  margin-left: 1px;
}

.data-chip-meter {
  grid-area: meter;
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.data-chip-meter-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--violet), #38bdf8);
  transition: width 0.3s var(--ease-out-expo, ease);
}

.data-chip-count {
  grid-area: count;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--violet-soft);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  min-width: 64px;
  text-align: right;
}

.data-chip-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid rgba(139, 92, 246, 0.4);
  background: rgba(139, 92, 246, 0.16);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  padding: 0;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease;
}

.data-chip-step.is-minus {
  grid-area: minus;
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-strong);
  color: var(--ink-soft);
}

.data-chip-step.is-plus {
  grid-area: plus;
}

.data-chip-step:hover {
  transform: translateY(-1px);
  background: rgba(139, 92, 246, 0.32);
  border-color: var(--violet);
}

.data-chip-step:active {
  transform: scale(0.94);
}

.data-chip-x {
  grid-area: remove;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-mute);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

.data-chip-x:hover {
  background: rgba(248, 113, 113, 0.25);
  color: #fff;
  transform: scale(1.1);
}

.data-chip-x:active {
  transform: scale(0.92);
}

@media (max-width: 640px) {
  .data-chip {
    grid-template-columns: 1fr auto auto auto auto;
    grid-template-areas:
      "line line line line line"
      "meter count minus plus remove";
    gap: 6px 8px;
  }

  .data-chip-meter {
    width: auto;
  }
}

@keyframes chip-pop {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.data-add-row {
  display: flex;
  gap: 8px;
}

.data-modal-note {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-mute);
  line-height: 1.5;
}

.data-modal-note code {
  font-family: var(--mono);
  font-size: 12px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(139, 92, 246, 0.14);
  color: var(--violet-soft);
}

.data-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-soft);
}

.data-modal-secondary,
.data-modal-primary {
  border-radius: 999px;
  padding: 10px 18px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition:
    transform 0.18s var(--ease-out-expo, ease),
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.3s ease;
}

.data-modal-secondary {
  background: transparent;
  border: 1px solid var(--border-soft);
  color: var(--ink-mute);
}

.data-modal-secondary:hover {
  color: var(--ink-soft);
  border-color: var(--border-strong);
}

.data-modal-primary {
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.55),
    rgba(14, 165, 233, 0.45)
  );
  border: 1px solid rgba(139, 92, 246, 0.6);
  color: #fff;
  letter-spacing: 0.02em;
  text-transform: none;
  font-family: var(--sans);
  font-size: 13px;
  padding: 10px 22px;
  box-shadow: 0 12px 32px -16px rgba(139, 92, 246, 0.7);
}

.data-modal-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 38px -18px rgba(139, 92, 246, 0.9);
}

.data-modal-primary:active {
  transform: scale(0.97);
}

@media (max-width: 540px) {
  .data-add-row {
    flex-direction: column;
  }
  .data-modal-foot {
    flex-direction: column-reverse;
    align-items: stretch;
  }
}

@media (max-width: 700px) {
  .compose-tools {
    flex-direction: column;
    align-items: flex-start;
  }

  .sentence-selector {
    grid-template-columns: 1fr;
  }
}

/* ---- bar charts with a header row + dim-labelled rows ------------------ */
.bar-row-head {
  display: grid;
  grid-template-columns: 32px 1fr 62px;
  align-items: center;
  gap: 10px;
  padding-bottom: 6px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
  margin-bottom: 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.bar-head-axis {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--ink-faint);
  font-size: 9px;
}

/* ---- restyled "Recipe" (section 5) with percentages -------------------- */
.recipe-formula {
  margin: 0 0 12px;
  padding: 12px 16px;
  background: rgba(7, 9, 26, 0.55);
  border: 1px solid rgba(14, 165, 233, 0.25);
  border-radius: 12px;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-soft);
}

.recipe-formula .rf-out {
  color: var(--cyan-soft);
  font-weight: 600;
}

.recipe-formula .rf-term {
  color: var(--violet-soft);
}

.recipe-formula .rf-plus {
  color: var(--ink-faint);
  margin: 0 4px;
}

.recipe-explain {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--ink-mute);
  line-height: 1.55;
}

.shift-card .shift-head .shift-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

@media (max-width: 700px) {
  .compose-form {
    grid-template-columns: 1fr;
  }

  .compute-pill {
    align-self: stretch;
    width: 100%;
  }

  .compose-field-sentence input {
    font-size: 18px;
  }

  .intuition {
    font-size: 13.5px;
    padding: 10px 14px;
  }
}

/* =========================================================================
   Reusable input + button used by the data-editor modal
   ========================================================================= */
.custom-vocab-input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(7, 9, 26, 0.7);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  outline: none;
  transition: border-color 0.18s;
}

.custom-vocab-input:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}

.custom-vocab-input::placeholder {
  color: var(--ink-mute);
}

.custom-vocab-btn {
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid rgba(139, 92, 246, 0.5);
  background: rgba(139, 92, 246, 0.16);
  color: var(--violet-soft);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.custom-vocab-btn:hover {
  background: rgba(139, 92, 246, 0.28);
  border-color: var(--violet);
  transform: translateY(-1px);
  color: #fff;
}

/* =========================================================================
   RLHF Section
   ========================================================================= */
.rlhf-section {
  scroll-margin-top: 40px;
}

.rlhf-card {
  padding: 22px 24px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.rlhf-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rlhf-eyebrow {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--cyan-soft);
  letter-spacing: 0.02em;
}

.rlhf-formula-note {
  font-size: 13px;
  color: var(--ink-mute);
}

.rlhf-reward-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rlhf-reward-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.rlhf-reward-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rlhf-reward-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 12px;
  border: 1px solid var(--border-soft);
  background: rgba(238, 240, 255, 0.03);
}

.rlhf-reward-chip.is-positive {
  border-color: rgba(110, 240, 192, 0.4);
  background: rgba(110, 240, 192, 0.08);
  color: var(--mint);
}

.rlhf-reward-chip.is-negative {
  border-color: rgba(236, 72, 153, 0.4);
  background: rgba(236, 72, 153, 0.08);
  color: var(--rose);
}

.rlhf-reward-chip.is-neutral {
  color: var(--ink-mute);
}

.rlhf-reward-chip .reward-word {
  font-weight: 500;
  color: var(--ink);
}

.rlhf-reward-chip.is-positive .reward-word {
  color: var(--mint);
}

.rlhf-reward-chip.is-negative .reward-word {
  color: var(--rose);
}

.rlhf-sweep {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rlhf-sweep-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.rlhf-sweep-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.rlhf-sweep-sub {
  font-size: 12px;
  color: var(--ink-faint);
}

.rlhf-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rlhf-row {
  display: grid;
  grid-template-columns: 70px 80px minmax(150px, auto) 1fr 80px;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: rgba(238, 240, 255, 0.03);
  border: 1px solid var(--border-soft);
  transition:
    background 0.2s,
    border-color 0.2s;
}

.rlhf-row.is-flipped {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.35);
}

.rlhf-row-beta {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  font-feature-settings: "tnum";
}

.rlhf-row-leash {
  font-size: 11px;
  color: var(--ink-mute);
  font-family: var(--mono);
  letter-spacing: 0.04em;
}

.rlhf-row-top {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--cyan-soft);
}

.rlhf-row-top-word {
  font-family: var(--mono);
  font-weight: 600;
}

.rlhf-row-verdict-tag {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid currentColor;
  text-transform: uppercase;
  line-height: 1;
}

.rlhf-row.is-held .rlhf-row-verdict-tag {
  color: var(--ink-mute);
  border-color: var(--border-strong);
}

.rlhf-row.is-flipped .rlhf-row-verdict-tag {
  color: var(--violet);
  background: rgba(139, 92, 246, 0.12);
}

.rlhf-narrate {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px dashed var(--border-soft);
  background: rgba(139, 92, 246, 0.06);
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.55;
}

.rlhf-narrate strong.is-target {
  color: var(--mint);
}

.rlhf-narrate strong.is-penalty {
  color: var(--rose);
}

.rlhf-row-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(238, 240, 255, 0.06);
  overflow: hidden;
}

.rlhf-row-bar-fill {
  display: block;
  height: 100%;
  background: var(--grad-cool);
  border-radius: 999px;
  transition: width 250ms ease;
}

.rlhf-row.is-flipped .rlhf-row-bar-fill {
  background: linear-gradient(90deg, var(--violet), var(--rose));
}

.rlhf-row-kl {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-mute);
  text-align: right;
}

.rlhf-insight {
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(139, 92, 246, 0.06);
  border-left: 3px solid rgba(139, 92, 246, 0.7);
}

.rlhf-insight p {
  margin: 0;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.6;
}

.rlhf-insight strong {
  color: var(--ink);
}

.rlhf-insight code {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--cyan-soft);
  background: rgba(14, 165, 233, 0.08);
  padding: 2px 5px;
  border-radius: 4px;
}

@media (max-width: 700px) {
  .custom-vocab-input-row {
    flex-direction: column;
  }

  .rlhf-row {
    grid-template-columns: 56px minmax(64px, auto) 1fr;
    grid-template-areas:
      "beta leash top"
      "bar  bar   bar";
    gap: 6px 10px;
  }

  .rlhf-row > .rlhf-row-beta {
    grid-area: beta;
  }

  .rlhf-row > .rlhf-row-leash {
    grid-area: leash;
  }

  .rlhf-row > .rlhf-row-top {
    grid-area: top;
    justify-content: flex-end;
  }

  .rlhf-row > .rlhf-row-bar {
    grid-area: bar;
    width: 100%;
  }

  .rlhf-row-kl {
    display: none;
  }
}

/* =========================================================================
   POLISH LAYER — masterful microtransitions & engaging motion
   This block sits last so it owns final visual cadence across the demo.
   ========================================================================= */

:root {
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.22, 0.61, 0.36, 1);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---- silky scroll + selection accents -------------------------------- */
html {
  scroll-behavior: smooth;
}
::selection {
  background: rgba(139, 92, 246, 0.35);
  color: var(--ink);
}

/* ---- aurora drift in the cosmic backdrop ----------------------------- */
@keyframes aurora-drift {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(2%, -1%, 0) scale(1.05);
  }
}
.cosmos {
  animation: aurora-drift 24s ease-in-out infinite;
  will-change: transform;
}

/* ---- hero: gradient sheen on "It shapes the question." --------------- */
@keyframes flash-shimmer {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}
.hero-flash {
  background: linear-gradient(
    100deg,
    var(--violet) 0%,
    var(--cyan) 35%,
    var(--violet-soft) 65%,
    var(--cyan) 100%
  );
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 28px rgba(139, 92, 246, 0.45));
  animation: flash-shimmer 8s ease-in-out infinite;
}

/* ---- meta chips: subtle progressive reveal --------------------------- */
.hero-meta-chip {
  transition:
    transform 0.25s var(--ease-out-expo),
    border-color 0.25s ease,
    background 0.25s ease,
    color 0.25s ease;
}
.hero-meta-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(139, 92, 246, 0.45);
  background: rgba(139, 92, 246, 0.06);
  color: var(--ink-soft);
}

/* ---- step number: living index with breathing ring ------------------ */
.step-number {
  position: relative;
  background: var(--ink);
  color: var(--bg-deep);
  transition:
    transform 0.25s var(--ease-spring),
    box-shadow 0.25s var(--ease-out-expo);
  box-shadow:
    0 8px 24px -10px rgba(255, 255, 255, 0.4),
    inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.step-number::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  opacity: 0;
  transition:
    opacity 0.3s ease,
    transform 0.5s var(--ease-out-expo);
  pointer-events: none;
}
.act-head:hover .step-number {
  transform: scale(1.06);
}
.act-head:hover .step-number::after {
  opacity: 1;
  transform: scale(1.1);
}

/* ---- profile / sentence buttons: rich hover with sliding wash ------ */
.sentence-btn {
  position: relative;
  overflow: hidden;
  transition:
    transform 0.25s var(--ease-out-expo),
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.3s var(--ease-out-expo);
}
.sentence-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    transparent,
    rgba(139, 92, 246, 0.08),
    rgba(14, 165, 233, 0.08),
    transparent
  );
  transform: translateX(-100%);
  transition: transform 0.6s var(--ease-out-expo);
  pointer-events: none;
}
.sentence-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 36px -22px rgba(0, 0, 0, 0.7);
}
.sentence-btn:hover::before {
  transform: translateX(100%);
}
.sentence-btn:active {
  transform: translateY(0) scale(0.99);
}

/* ---- token chips: tactile click feedback + smoother focus state ---- */
.token-chip {
  transition:
    transform 0.25s var(--ease-spring),
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.25s var(--ease-out-expo);
}
.token-chip:hover {
  transform: translateY(-2px);
}
.token-chip:active {
  transform: translateY(0) scale(0.97);
}
.token-chip.is-focused {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg-deep);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.4),
    0 16px 40px -16px rgba(255, 255, 255, 0.45);
  animation: focus-ring 1.4s var(--ease-out-expo) infinite;
}
@keyframes focus-ring {
  0%,
  100% {
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.4),
      0 16px 40px -16px rgba(255, 255, 255, 0.45),
      0 0 0 0 rgba(14, 165, 233, 0.45);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.5),
      0 16px 40px -16px rgba(255, 255, 255, 0.55),
      0 0 0 8px rgba(14, 165, 233, 0);
  }
}

/* ---- gaze grid: cell hover scale + spotlight ------------------------ */
.gaze-grid > div[data-row][data-col],
.gaze-grid > .gaze-cell {
  transition:
    transform 0.18s var(--ease-out-expo),
    box-shadow 0.18s var(--ease-out-expo),
    filter 0.18s ease;
}
.gaze-grid > div[data-row][data-col]:hover,
.gaze-grid > .gaze-cell:hover {
  transform: scale(1.08);
  z-index: 5;
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.4),
    0 14px 28px -10px rgba(0, 0, 0, 0.6);
  filter: brightness(1.15);
}
.gaze-row-head,
.gaze-col-head {
  transition:
    color 0.18s ease,
    transform 0.2s var(--ease-out-expo);
  cursor: pointer;
}
.gaze-row-head:hover,
.gaze-col-head:hover {
  color: var(--cyan-soft);
  transform: scale(1.05);
}

/* ---- shift bars: smooth value reveal on update --------------------- */
.shift-bars {
  transition: opacity 0.3s ease;
}
.shift-bars .bar-row .bar-fill {
  transition:
    width 0.45s var(--ease-out-expo),
    background 0.3s ease;
}

/* ---- recipe list: each row staggers in ----------------------------- */
.recipe-list li {
  animation: recipe-rise 0.5s var(--ease-out-expo) both;
  animation-delay: calc(var(--idx, 0) * 70ms);
  transition:
    transform 0.25s var(--ease-out-expo),
    background 0.2s ease;
}
.recipe-list li:hover {
  transform: translateX(4px);
  background: rgba(255, 255, 255, 0.03);
}
@keyframes recipe-rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- LM head rows: same velvet-staircase reveal -------------------- */
.lm-row {
  animation: recipe-rise 0.45s var(--ease-out-expo) both;
  animation-delay: calc(var(--idx, 0) * 50ms);
  transition:
    transform 0.25s var(--ease-out-expo),
    background 0.2s ease,
    border-color 0.2s ease;
}
.lm-row:hover {
  transform: translateX(4px);
  background: rgba(255, 255, 255, 0.03);
}

/* ---- RLHF rows: reward-flip glow on row.is-flipped ----------------- */
.rlhf-row {
  animation: recipe-rise 0.45s var(--ease-out-expo) both;
  animation-delay: calc(var(--idx, 0) * 60ms);
  transition:
    transform 0.3s var(--ease-out-expo),
    background 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.3s var(--ease-out-expo);
}
.rlhf-row:hover {
  transform: translateX(3px);
}
.rlhf-row.is-flipped {
  box-shadow:
    inset 0 0 0 1px rgba(139, 92, 246, 0.2),
    0 12px 28px -18px rgba(139, 92, 246, 0.55);
}
.rlhf-reward-chip {
  transition:
    transform 0.2s var(--ease-out-expo),
    background 0.2s ease,
    border-color 0.2s ease;
}
.rlhf-reward-chip:hover {
  transform: translateY(-1px) scale(1.04);
}

/* ---- tooltips: lift on activation with spring ---------------------- */
[data-tip]:hover::after,
[data-tip]:focus-visible::after {
  transform: translate(-50%, -2px);
}

/* ---- footer + behind: subtle entrance ------------------------------ */
.footer {
  animation: section-rise 0.7s var(--ease-out-expo) both;
  animation-delay: 0.65s;
}
.behind summary {
  transition:
    color 0.2s ease,
    background 0.2s ease;
  cursor: pointer;
}
.behind summary:hover {
  color: var(--cyan-soft);
}

/* ---- generic interactive scale-up for rounded "compute" pills ------ */
.compose-help-btn,
.custom-vocab-btn {
  transition:
    transform 0.2s var(--ease-out-expo),
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.3s var(--ease-out-expo);
}
.compose-help-btn:active,
.custom-vocab-btn:active {
  transform: scale(0.96);
}

/* ---- arc layer paths: gentle pulse on focus change ----------------- */
@keyframes arc-emerge {
  from {
    stroke-dashoffset: 200;
    opacity: 0;
  }
  to {
    stroke-dashoffset: 0;
    opacity: 1;
  }
}
.arc-layer path {
  stroke-dasharray: 200;
  animation: arc-emerge 0.55s var(--ease-out-expo) both;
}

/* ---- "rewire" pulse: full-stage signal that the model re-thought --- */
.stage.is-rewiring > section {
  animation: rewire-pulse 0.7s var(--ease-out-expo) both;
}
.stage.is-rewiring > section:nth-child(odd) {
  animation-delay: 30ms;
}
.stage.is-rewiring > section:nth-child(even) {
  animation-delay: 80ms;
}
@keyframes rewire-pulse {
  0% {
    filter: brightness(1) blur(0);
    transform: translateY(0);
  }
  35% {
    filter: brightness(1.08) blur(1.5px);
    transform: translateY(-2px);
  }
  100% {
    filter: brightness(1) blur(0);
    transform: translateY(0);
  }
}

/* =========================================================================
   Single training corpus card  (replaces the multi-profile selector)
   ========================================================================= */
.corpus-card {
  margin-top: 14px;
  padding: 18px 20px;
  background: linear-gradient(
    180deg,
    rgba(14, 165, 233, 0.08),
    rgba(139, 92, 246, 0.06)
  );
  border: 1px solid rgba(14, 165, 233, 0.25);
  border-radius: 14px;
  box-shadow: 0 18px 40px -28px rgba(14, 165, 233, 0.55);
}

.corpus-card-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.corpus-card-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan-soft);
}

.corpus-card-title {
  margin: 0;
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.corpus-card-blank {
  display: inline-block;
  padding: 0 8px;
  margin-left: 4px;
  border-radius: 6px;
  background: rgba(139, 92, 246, 0.18);
  border: 1px dashed rgba(139, 92, 246, 0.5);
  color: var(--violet-soft);
  font-weight: 500;
  letter-spacing: 0.06em;
}

.corpus-card-sub {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.55;
  max-width: 64ch;
}

.corpus-card-sub strong {
  color: var(--ink);
  font-weight: 600;
}

.corpus-card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.corpus-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px auto;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-soft);
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease;
  animation: corpus-row-in 0.32s ease both;
  animation-delay: calc(var(--idx, 0) * 40ms);
}

@keyframes corpus-row-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.corpus-row.is-loudest {
  background: linear-gradient(
    90deg,
    rgba(14, 165, 233, 0.18),
    rgba(139, 92, 246, 0.12)
  );
  border-color: rgba(14, 165, 233, 0.45);
  color: var(--ink);
}

.corpus-row-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.corpus-row-prefix {
  color: var(--ink-mute);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.corpus-row-word {
  color: var(--ink);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.corpus-row.is-loudest .corpus-row-word {
  color: #fff;
  text-shadow: 0 0 14px rgba(14, 165, 233, 0.55);
}

.corpus-row-meter {
  position: relative;
  height: 6px;
  background: var(--bg-card-2);
  border-radius: 999px;
  overflow: hidden;
}

.corpus-row-meter-fill {
  display: block;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(139, 92, 246, 0.7),
    rgba(14, 165, 233, 0.95)
  );
  border-radius: inherit;
  transition: width 0.32s ease;
}

.corpus-row-count {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
  min-width: 28px;
  text-align: right;
}

.corpus-row.is-loudest .corpus-row-count {
  color: var(--cyan-soft);
  font-weight: 600;
}

.corpus-card-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.corpus-card-edit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid rgba(139, 92, 246, 0.5);
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.28),
    rgba(14, 165, 233, 0.22)
  );
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 8px 20px -12px rgba(139, 92, 246, 0.55);
  transition:
    transform 0.16s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}

.corpus-card-edit:hover {
  transform: translateY(-1px);
  border-color: var(--violet);
  box-shadow: 0 14px 30px -14px rgba(139, 92, 246, 0.7);
}

.corpus-card-edit svg {
  opacity: 0.85;
}

.corpus-card-hint {
  color: var(--ink-mute);
  font-size: 12px;
  font-style: italic;
}

@media (max-width: 700px) {
  .corpus-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "line  count"
      "meter meter";
    row-gap: 6px;
  }
  .corpus-row > .corpus-row-line {
    grid-area: line;
  }
  .corpus-row > .corpus-row-meter {
    grid-area: meter;
  }
  .corpus-row > .corpus-row-count {
    grid-area: count;
  }
}

/* =========================================================================
   RLHF candidate picker  (the user-driven "what should humans prefer?" UI)
   ========================================================================= */
.rlhf-picker {
  margin: 16px 0 18px;
  padding: 14px 16px;
  border: 1px solid rgba(34, 197, 94, 0.32);
  border-radius: 14px;
  background: linear-gradient(
    180deg,
    rgba(34, 197, 94, 0.07),
    rgba(34, 197, 94, 0.02)
  );
}

.rlhf-picker-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.rlhf-picker-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mint, #34d399);
}

.rlhf-picker-sub {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.rlhf-picker-sub strong.is-target {
  color: var(--mint, #34d399);
  font-weight: 600;
}

.rlhf-picker-sub strong.is-penalty {
  color: var(--rose, #fb7185);
  font-weight: 600;
}

.rlhf-picker-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rlhf-picker-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: var(--bg-card);
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition:
    transform 0.14s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease;
}

.rlhf-picker-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(52, 211, 153, 0.55);
  background: rgba(52, 211, 153, 0.1);
  color: var(--ink);
}

.rlhf-picker-chip.is-active {
  background: linear-gradient(
    135deg,
    rgba(34, 197, 94, 0.32),
    rgba(52, 211, 153, 0.22)
  );
  border-color: rgba(52, 211, 153, 0.85);
  color: #fff;
  box-shadow: 0 10px 24px -14px rgba(34, 197, 94, 0.7);
}

.rlhf-picker-chip.is-user-picked {
  outline: 2px solid rgba(52, 211, 153, 0.55);
  outline-offset: 2px;
}

/* "keep pretraining" chip: the pretraining winner shown as a way back. */
.rlhf-picker-chip.is-keep {
  border-color: rgba(250, 204, 21, 0.45);
  color: rgba(254, 240, 138, 0.92);
  background: linear-gradient(
    135deg,
    rgba(250, 204, 21, 0.08),
    rgba(245, 158, 11, 0.05)
  );
}

.rlhf-picker-chip.is-keep::before {
  content: "\2605";
  margin-right: 6px;
  font-size: 10px;
  color: rgba(250, 204, 21, 0.85);
  letter-spacing: 0;
}

.rlhf-picker-chip.is-keep:hover {
  border-color: rgba(250, 204, 21, 0.85);
  color: #fff;
  background: linear-gradient(
    135deg,
    rgba(250, 204, 21, 0.22),
    rgba(245, 158, 11, 0.16)
  );
}

.rlhf-picker-chip.is-keep.is-active {
  background: linear-gradient(
    135deg,
    rgba(250, 204, 21, 0.4),
    rgba(245, 158, 11, 0.28)
  );
  border-color: rgba(250, 204, 21, 0.95);
  color: #fff;
  box-shadow: 0 10px 24px -14px rgba(250, 204, 21, 0.7);
}

.rlhf-picker-chip-word {
  font-weight: 600;
}

.rlhf-picker-chip-prob {
  font-size: 11px;
  color: var(--ink-mute);
}

.rlhf-picker-chip:hover .rlhf-picker-chip-prob,
.rlhf-picker-chip.is-active .rlhf-picker-chip-prob {
  color: rgba(255, 255, 255, 0.85);
}

.rlhf-picker-clear {
  margin-top: 10px;
  background: transparent;
  border: 1px dashed var(--border-strong);
  color: var(--ink-mute);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition:
    color 0.18s ease,
    border-color 0.18s ease;
}

.rlhf-picker-clear:hover {
  color: var(--ink);
  border-color: var(--cyan);
}

/* =========================================================================
   Synthetic preference data card (mirrors the pretraining corpus card)
   ========================================================================= */
.rlhf-synth {
  margin: 14px 0 0;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid rgba(52, 211, 153, 0.22);
  background: linear-gradient(
    180deg,
    rgba(34, 197, 94, 0.05),
    rgba(14, 165, 233, 0.03)
  );
  transition:
    border-color 0.25s ease,
    box-shadow 0.25s ease;
}

.rlhf-synth.has-signal {
  border-color: rgba(52, 211, 153, 0.45);
  box-shadow: 0 16px 36px -22px rgba(34, 197, 94, 0.45);
}

.rlhf-synth-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.rlhf-synth-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mint, #34d399);
}

.rlhf-synth-sub {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-soft);
}

.rlhf-synth-sub strong {
  color: var(--ink);
}

.rlhf-synth-body {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.rlhf-synth-empty {
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px dashed var(--border-soft);
  background: rgba(7, 9, 26, 0.45);
  color: var(--ink-mute);
  font-size: 12.5px;
  font-style: italic;
  text-align: center;
}

.rlhf-synth-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-soft);
  animation: synth-row-in 0.36s var(--ease-out-expo, ease) both;
  animation-delay: calc(var(--idx, 0) * 80ms);
}

.rlhf-synth-row .rlhf-synth-line {
  flex: 1 1 auto;
  min-width: 0;
}

.rlhf-synth-row.is-target {
  background: linear-gradient(
    90deg,
    rgba(34, 197, 94, 0.18),
    rgba(52, 211, 153, 0.1)
  );
  border-color: rgba(52, 211, 153, 0.55);
  color: var(--ink);
}

.rlhf-synth-row.is-penalty {
  background: linear-gradient(
    90deg,
    rgba(225, 29, 72, 0.16),
    rgba(244, 63, 94, 0.08)
  );
  border-color: rgba(251, 113, 133, 0.45);
  color: var(--ink);
}

.rlhf-synth-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.rlhf-synth-prefix {
  color: var(--ink-mute);
  font-size: 12px;
}

.rlhf-synth-row.is-target .rlhf-synth-word {
  color: var(--mint, #34d399);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.rlhf-synth-row.is-penalty .rlhf-synth-word {
  color: var(--rose, #fb7185);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: line-through;
  text-decoration-color: rgba(251, 113, 133, 0.55);
}

.rlhf-synth-tag {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
}

.rlhf-synth-row.is-target .rlhf-synth-tag {
  color: var(--mint, #34d399);
}

.rlhf-synth-row.is-penalty .rlhf-synth-tag {
  color: var(--rose, #fb7185);
}

.rlhf-synth-reward {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  font-feature-settings: "tnum";
}

.rlhf-synth-row.is-target .rlhf-synth-reward {
  color: var(--mint, #34d399);
}

.rlhf-synth-row.is-penalty .rlhf-synth-reward {
  color: var(--rose, #fb7185);
}

@keyframes synth-row-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* =========================================================================
   "Now predicts" pill (the immediate, big result of the click)
   ========================================================================= */
.rlhf-now {
  margin: 14px 0 0;
  padding: 18px 20px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(7, 9, 26, 0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  transition:
    border-color 0.25s ease,
    background 0.25s ease,
    box-shadow 0.25s ease;
}

.rlhf-now[data-state="flipped"] {
  border-color: rgba(52, 211, 153, 0.55);
  background: radial-gradient(
    420px circle at 50% 0%,
    rgba(34, 197, 94, 0.18),
    rgba(7, 9, 26, 0.6) 70%
  );
  box-shadow: 0 22px 50px -28px rgba(34, 197, 94, 0.55);
}

.rlhf-now[data-state="held"] {
  border-color: rgba(251, 113, 133, 0.4);
  background: radial-gradient(
    420px circle at 50% 0%,
    rgba(225, 29, 72, 0.14),
    rgba(7, 9, 26, 0.6) 70%
  );
}

.rlhf-now-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.rlhf-now-pill {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  font-family: var(--sans);
}

.rlhf-now-was {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink-mute);
  text-decoration: line-through;
  text-decoration-color: rgba(251, 113, 133, 0.55);
  letter-spacing: -0.01em;
}

.rlhf-now-arrow {
  font-family: var(--mono);
  color: var(--ink-mute);
  font-size: 18px;
}

.rlhf-now-pred {
  display: inline-flex;
  align-items: center;
  padding: 8px 22px;
  border-radius: 999px;
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.rlhf-now[data-state="flipped"] .rlhf-now-pred {
  background: linear-gradient(135deg, #ecfdf5, #a7f3d0);
  color: #022c22;
  box-shadow: 0 16px 40px -12px rgba(34, 197, 94, 0.65);
}

.rlhf-now[data-state="held"] .rlhf-now-pred {
  background: linear-gradient(135deg, #fff1f2, #fecdd3);
  color: #4c0519;
  box-shadow: 0 16px 40px -12px rgba(225, 29, 72, 0.45);
}

.rlhf-now[data-state="idle"] .rlhf-now-pred {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink-mute);
}

/* "humans agreed" -> RLHF override is off, pretraining stays. */
.rlhf-now[data-state="agreed"] {
  border-color: rgba(250, 204, 21, 0.45);
  background: radial-gradient(
    420px circle at 50% 0%,
    rgba(250, 204, 21, 0.16),
    rgba(7, 9, 26, 0.6) 70%
  );
  box-shadow: 0 22px 50px -28px rgba(250, 204, 21, 0.45);
}

.rlhf-now[data-state="agreed"] .rlhf-now-pred {
  background: linear-gradient(135deg, #fefce8, #fde68a);
  color: #422006;
  box-shadow: 0 16px 40px -12px rgba(250, 204, 21, 0.55);
}

.rlhf-now[data-state="agreed"] .rlhf-now-was,
.rlhf-now[data-state="agreed"] .rlhf-now-arrow,
.rlhf-now[data-state="idle"] .rlhf-now-was,
.rlhf-now[data-state="idle"] .rlhf-now-arrow,
.rlhf-now[data-state="held"] .rlhf-now-was,
.rlhf-now[data-state="held"] .rlhf-now-arrow {
  display: none;
}

.rlhf-now[data-state="agreed"] .rlhf-now-verdict {
  color: rgba(250, 204, 21, 0.9);
}

/* Synth card "agreed" state: gold accent, pretraining stays. */
.rlhf-synth.is-agreed {
  border-color: rgba(250, 204, 21, 0.4);
  box-shadow: 0 16px 36px -22px rgba(250, 204, 21, 0.35);
}

.rlhf-synth-empty.is-agreed {
  border-color: rgba(250, 204, 21, 0.5);
  background: rgba(250, 204, 21, 0.06);
  color: rgba(254, 240, 138, 0.92);
  font-style: normal;
}

.rlhf-now-verdict {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.rlhf-now[data-state="flipped"] .rlhf-now-verdict {
  color: var(--mint, #34d399);
}

.rlhf-now[data-state="held"] .rlhf-now-verdict {
  color: var(--rose, #fb7185);
}

.rlhf-now.is-pop .rlhf-now-pred {
  animation: rlhf-now-pop 0.42s cubic-bezier(0.2, 0.9, 0.2, 1.2);
}

@keyframes rlhf-now-pop {
  0% {
    transform: scale(0.86);
    filter: brightness(1.25);
  }
  60% {
    transform: scale(1.04);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

/* =========================================================================
   Click feedback: chip burst + section-wide ripple
   ========================================================================= */
.rlhf-picker-chip.is-burst {
  animation: rlhf-chip-burst 0.42s cubic-bezier(0.2, 0.9, 0.2, 1.2);
}

@keyframes rlhf-chip-burst {
  0% {
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7);
  }
  60% {
    transform: scale(1.06);
    box-shadow: 0 0 0 14px rgba(52, 211, 153, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 10px 24px -14px rgba(34, 197, 94, 0.7);
  }
}

.rlhf-section.is-rippling .rlhf-synth,
.rlhf-section.is-rippling .rlhf-strength,
.rlhf-section.is-rippling .rlhf-now,
.rlhf-section.is-rippling .rlhf-probs {
  animation: rlhf-ripple 0.7s ease;
}

.rlhf-section.is-rippling .rlhf-synth   { animation-delay: 0ms; }
.rlhf-section.is-rippling .rlhf-strength { animation-delay: 80ms; }
.rlhf-section.is-rippling .rlhf-now     { animation-delay: 160ms; }
.rlhf-section.is-rippling .rlhf-probs   { animation-delay: 240ms; }

/* =========================================================================
   Strength slider: replaces the old beta/KL leash table with a single,
   intuitive "how much should the model listen to humans?" knob.
   ========================================================================= */
.rlhf-strength {
  margin: 14px 0 0;
  padding: 18px 20px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(
    180deg,
    rgba(124, 58, 237, 0.06),
    rgba(56, 189, 248, 0.04)
  );
}

.rlhf-strength-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.rlhf-strength-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.rlhf-strength-readout {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  font-feature-settings: "tnum";
  letter-spacing: -0.01em;
}

.rlhf-strength-track {
  position: relative;
  padding: 4px 0 22px;
}

.rlhf-strength-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(124, 58, 237, 0.45) 0%,
    rgba(56, 189, 248, 0.45) 50%,
    rgba(52, 211, 153, 0.65) 100%
  );
  border: 1px solid var(--border-soft);
  outline: none;
  cursor: pointer;
  margin: 0;
}

.rlhf-strength-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffffff, #d4f4e2);
  border: 2px solid rgba(52, 211, 153, 0.9);
  box-shadow:
    0 0 0 4px rgba(52, 211, 153, 0.18),
    0 8px 20px -8px rgba(34, 197, 94, 0.65);
  cursor: grab;
  transition:
    transform 0.12s ease,
    box-shadow 0.18s ease;
}

.rlhf-strength-input::-webkit-slider-thumb:hover {
  transform: scale(1.06);
}

.rlhf-strength-input::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.1);
  box-shadow:
    0 0 0 6px rgba(52, 211, 153, 0.28),
    0 12px 28px -10px rgba(34, 197, 94, 0.75);
}

.rlhf-strength-input::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffffff, #d4f4e2);
  border: 2px solid rgba(52, 211, 153, 0.9);
  box-shadow:
    0 0 0 4px rgba(52, 211, 153, 0.18),
    0 8px 20px -8px rgba(34, 197, 94, 0.65);
  cursor: grab;
}

.rlhf-strength-ticks {
  position: absolute;
  inset: 0 0 22px 0;
  pointer-events: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 12px;
}

.rlhf-strength-ticks span {
  width: 2px;
  height: 8px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 1px;
}

.rlhf-strength-labels {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  justify-content: space-between;
  padding: 0 4px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  pointer-events: none;
}

.rlhf-strength-poles {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 4px;
}

.rlhf-strength-pole {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: var(--mono);
}

.rlhf-strength-pole.is-right {
  text-align: right;
}

.rlhf-strength-pole em {
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.rlhf-strength-pole.is-left em {
  color: var(--rose, #fb7185);
}

.rlhf-strength-pole.is-right em {
  color: var(--mint, #34d399);
}

.rlhf-strength-pole small {
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
}

/* =========================================================================
   Live probability bars (top candidates at the current slider value).
   ========================================================================= */
.rlhf-probs {
  margin: 14px 0 0;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  background: rgba(7, 9, 26, 0.45);
  list-style: none;
  display: grid;
  gap: 6px;
}

.rlhf-prob-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1.1fr) minmax(0, 2fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-soft);
  transition:
    background 0.18s ease,
    border-color 0.18s ease;
  animation: synth-row-in 0.32s var(--ease-out-expo, ease) both;
  animation-delay: calc(var(--idx, 0) * 30ms);
}

.rlhf-prob-row.is-winner {
  background: linear-gradient(
    90deg,
    rgba(52, 211, 153, 0.16),
    rgba(56, 189, 248, 0.08)
  );
  border-color: rgba(52, 211, 153, 0.45);
  color: var(--ink);
}

.rlhf-prob-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  font-size: 11px;
  color: var(--ink-mute);
}

.rlhf-prob-row.is-winner .rlhf-prob-rank {
  background: rgba(52, 211, 153, 0.25);
  color: var(--ink);
}

.rlhf-prob-word {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.rlhf-prob-word > span:first-child {
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.rlhf-prob-row.is-rewarded .rlhf-prob-word > span:first-child {
  color: var(--mint, #34d399);
}

.rlhf-prob-row.is-penalized .rlhf-prob-word > span:first-child {
  color: var(--rose, #fb7185);
  text-decoration: line-through;
  text-decoration-color: rgba(251, 113, 133, 0.45);
}

.rlhf-prob-tag {
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(250, 204, 21, 0.6);
  color: rgba(254, 240, 138, 0.92);
  background: rgba(250, 204, 21, 0.06);
}

.rlhf-prob-bar {
  position: relative;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.rlhf-prob-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #8b5cf6);
  transition: width 0.18s var(--ease-out-expo, ease);
}

.rlhf-prob-row.is-winner .rlhf-prob-bar-fill {
  background: linear-gradient(90deg, #34d399, #10b981);
}

.rlhf-prob-row.is-penalized .rlhf-prob-bar-fill {
  background: linear-gradient(90deg, #fb7185, #f43f5e);
}

.rlhf-prob-pct {
  font-family: var(--mono);
  font-size: 12px;
  font-feature-settings: "tnum";
  color: var(--ink);
  min-width: 48px;
  text-align: right;
}

/* =========================================================================
   Collapsible "show the math" details block.
   ========================================================================= */
.rlhf-advanced {
  margin: 14px 0 0;
  border: 1px dashed var(--border-soft);
  border-radius: 12px;
  background: rgba(7, 9, 26, 0.35);
  overflow: hidden;
}

.rlhf-advanced > summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  user-select: none;
}

.rlhf-advanced > summary::-webkit-details-marker {
  display: none;
}

.rlhf-advanced > summary::before {
  content: "+";
  display: inline-block;
  width: 14px;
  margin-right: 6px;
  color: var(--accent);
  transition: transform 0.18s ease;
}

.rlhf-advanced[open] > summary::before {
  content: "\2212";
}

.rlhf-advanced > summary:hover {
  color: var(--ink);
}

.rlhf-advanced-body {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rlhf-advanced-body .rlhf-eyebrow {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  border-bottom: 1px dashed rgba(56, 189, 248, 0.25);
  padding-bottom: 8px;
}

.rlhf-advanced-body .rlhf-formula-note {
  font-size: 12px;
  color: var(--ink-soft);
  margin: 0;
}

.rlhf-insight-p {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border-left: 2px solid rgba(56, 189, 248, 0.4);
}

@keyframes rlhf-ripple {
  0% {
    filter: brightness(1) saturate(1);
  }
  35% {
    filter: brightness(1.18) saturate(1.18);
  }
  100% {
    filter: brightness(1) saturate(1);
  }
}
