/* ==========================================================================
   LLM Playground "How an LLM predicts the next word"
   Dependency-free stylesheet. Every selector is namespaced under .llmp-root
   and every class is prefixed `llmp-`, so this cannot leak into a host site.
   ========================================================================== */

.llmp-root {
  /* ---- palette ---- */
  --llmp-bg: #0a0c10;
  --llmp-panel: #0e1115;
  --llmp-surface: #141720;
  --llmp-surface-2: #1c2030;
  --llmp-border: rgba(255, 255, 255, 0.08);
  --llmp-border-strong: rgba(255, 255, 255, 0.16);

  --llmp-text: #e8e4d9;
  --llmp-dim: rgba(232, 228, 217, 0.62);
  --llmp-faint: rgba(232, 228, 217, 0.38);

  --llmp-accent: #4d9ee8;
  --llmp-accent-2: #a78bfa;
  --llmp-hot: #ff9d4d;
  --llmp-good: #34d399;
  --llmp-warn: #fbbf24;

  --llmp-neg: #3b82f6;
  --llmp-pos: #fb923c;

  /* ---- geometry ---- */
  --llmp-radius: 14px;
  --llmp-radius-sm: 8px;
  --llmp-gap: 16px;

  --llmp-font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --llmp-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  position: relative;
  box-sizing: border-box;
  width: 100%;
  margin: 0 auto;
  padding: 0;
  color: var(--llmp-text);
  font-family: var(--llmp-font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-align: left;
}

.llmp-root *,
.llmp-root *::before,
.llmp-root *::after {
  box-sizing: border-box;
}

.llmp-root button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
  background: none;
}

.llmp-root input {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* ==========================================================================
   Panel shell
   ========================================================================== */

.llmp-panel {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1200px 400px at 50% -10%, rgba(77, 158, 232, 0.09), transparent 70%),
    radial-gradient(900px 500px at 100% 100%, rgba(167, 139, 250, 0.07), transparent 70%),
    var(--llmp-panel);
  border: 1px solid var(--llmp-border);
  border-radius: var(--llmp-radius);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 24px 60px -20px rgba(0, 0, 0, 0.7);
}

/* faint grid texture */
.llmp-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(70% 60% at 50% 40%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(70% 60% at 50% 40%, #000 40%, transparent 100%);
}

.llmp-panel > * {
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   Header
   ========================================================================== */

.llmp-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--llmp-border);
}

.llmp-title {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--llmp-text);
}

.llmp-title-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--llmp-accent);
  box-shadow: 0 0 0 3px rgba(77, 158, 232, 0.16);
}

.llmp-root.is-running .llmp-title-dot {
  animation: llmp-pulse-dot 1.4s ease-in-out infinite;
}

.llmp-title-sub {
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--llmp-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.llmp-header-spacer {
  flex: 1;
}

.llmp-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.llmp-speed {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--llmp-border);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
}

.llmp-speed-btn {
  padding: 4px 11px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--llmp-dim);
  border-radius: 999px;
  transition: color 0.16s, background 0.16s;
}

.llmp-speed-btn:hover {
  color: var(--llmp-text);
}

.llmp-speed-btn.is-active {
  color: #061020;
  background: var(--llmp-accent);
}

.llmp-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--llmp-dim);
  border: 1px solid var(--llmp-border);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.25);
  transition: color 0.16s, border-color 0.16s, transform 0.16s;
}

.llmp-icon-btn:hover:not(:disabled) {
  color: var(--llmp-text);
  border-color: var(--llmp-border-strong);
}

.llmp-icon-btn:active:not(:disabled) {
  transform: scale(0.93);
}

.llmp-icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.llmp-icon-btn svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

/* ==========================================================================
   Ask row
   ========================================================================== */

.llmp-ask {
  padding: 18px;
  border-bottom: 1px solid var(--llmp-border);
}

.llmp-ask-row {
  display: flex;
  gap: 10px;
}

.llmp-input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.llmp-input {
  width: 100%;
  padding: 12px 14px;
  color: var(--llmp-text);
  border: 1px solid var(--llmp-border-strong);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.32);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.llmp-input::placeholder {
  color: var(--llmp-faint);
}

.llmp-input:focus {
  border-color: var(--llmp-accent);
  box-shadow: 0 0 0 3px rgba(77, 158, 232, 0.16);
}

.llmp-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.llmp-run {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 12px 22px;
  font-weight: 600;
  color: #04101f;
  border-radius: 10px;
  background: linear-gradient(180deg, #6fb2ee, var(--llmp-accent));
  box-shadow: 0 6px 18px -6px rgba(77, 158, 232, 0.7);
  transition: transform 0.16s, box-shadow 0.16s, opacity 0.16s;
}

.llmp-run:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px -8px rgba(77, 158, 232, 0.85);
}

.llmp-run:active:not(:disabled) {
  transform: translateY(0);
}

.llmp-run:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.llmp-run svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

.llmp-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 11px;
}

.llmp-suggestions-label {
  font-size: 11px;
  color: var(--llmp-faint);
  align-self: center;
  margin-right: 2px;
}

.llmp-chip {
  padding: 5px 11px;
  font-size: 12px;
  color: var(--llmp-dim);
  border: 1px solid var(--llmp-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  transition: color 0.16s, border-color 0.16s, background 0.16s;
}

.llmp-chip:hover:not(:disabled) {
  color: var(--llmp-text);
  border-color: var(--llmp-accent);
  background: rgba(77, 158, 232, 0.1);
}

.llmp-chip:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ==========================================================================
   Stage rail
   ========================================================================== */

.llmp-rail {
  display: flex;
  align-items: stretch;
  padding: 0 18px;
  border-bottom: 1px solid var(--llmp-border);
  background: rgba(0, 0, 0, 0.2);
  overflow-x: auto;
  scrollbar-width: none;
}

.llmp-rail::-webkit-scrollbar {
  display: none;
}

.llmp-rail-step {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 118px;
  padding: 13px 6px;
  font-size: 12px;
  color: var(--llmp-faint);
  transition: color 0.3s;
}

.llmp-rail-step::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  transform: scaleX(0);
  transform-origin: left;
  background: linear-gradient(90deg, var(--llmp-accent), var(--llmp-accent-2));
  transition: transform 0.45s ease;
}

.llmp-rail-step.is-done {
  color: var(--llmp-dim);
}

.llmp-rail-step.is-done::after {
  transform: scaleX(1);
}

.llmp-rail-step.is-active {
  color: var(--llmp-text);
}

.llmp-rail-step.is-active::after {
  transform: scaleX(1);
}

.llmp-rail-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 21px;
  height: 21px;
  flex: none;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--llmp-mono);
  border: 1px solid var(--llmp-border-strong);
  border-radius: 50%;
  transition: all 0.3s;
}

.llmp-rail-step.is-active .llmp-rail-num {
  color: #04101f;
  border-color: transparent;
  background: var(--llmp-accent);
  box-shadow: 0 0 0 4px rgba(77, 158, 232, 0.15);
}

.llmp-rail-step.is-done .llmp-rail-num {
  color: var(--llmp-good);
  border-color: rgba(52, 211, 153, 0.4);
  background: rgba(52, 211, 153, 0.1);
}

.llmp-rail-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   Stage viewport
   ========================================================================== */

.llmp-stage {
  position: relative;
  min-height: 340px;
  padding: 20px 18px;
}

.llmp-scene {
  position: absolute;
  inset: 20px 18px;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.llmp-scene.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.llmp-scene-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.llmp-scene-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--llmp-text);
}

.llmp-scene-note {
  font-size: 12px;
  color: var(--llmp-dim);
}

.llmp-scene-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}

/* idle / empty state */
.llmp-idle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  height: 100%;
  text-align: center;
  color: var(--llmp-dim);
}

.llmp-idle-art {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 62px;
}

.llmp-idle-bar {
  width: 16px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--llmp-accent), rgba(77, 158, 232, 0.15));
  animation: llmp-idle-bounce 2.4s ease-in-out infinite;
}

.llmp-idle-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--llmp-text);
}

.llmp-idle-text {
  max-width: 44ch;
  font-size: 13px;
  line-height: 1.6;
}

/* ==========================================================================
   Stage 1 tokenize
   ========================================================================== */

.llmp-raw {
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 15px;
  color: var(--llmp-dim);
  border: 1px dashed var(--llmp-border-strong);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
}

.llmp-raw.is-splitting {
  animation: llmp-shimmer 0.9s ease-out;
}

.llmp-tokens {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-content: flex-start;
  max-height: 190px;
  overflow-y: auto;
  padding-right: 4px;
}

.llmp-token {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 9px 5px;
  border: 1px solid var(--llmp-border-strong);
  border-radius: var(--llmp-radius-sm);
  background: var(--llmp-surface);
  opacity: 0;
  transform: translateY(8px) scale(0.9);
  animation: llmp-token-in 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.3) forwards;
}

.llmp-token-text {
  font-family: var(--llmp-mono);
  font-size: 13px;
  color: var(--llmp-text);
  white-space: pre;
}

.llmp-token-space {
  color: var(--llmp-faint);
}

.llmp-token-id {
  font-family: var(--llmp-mono);
  font-size: 9.5px;
  letter-spacing: 0.03em;
  color: var(--llmp-faint);
}

/* ==========================================================================
   Stage 2 embeddings
   ========================================================================== */

.llmp-embeds {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 210px;
  overflow-y: auto;
  padding-right: 4px;
}

.llmp-embed-row {
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  animation: llmp-fade-in 0.34s ease forwards;
}

.llmp-embed-label {
  flex: none;
  width: 76px;
  font-family: var(--llmp-mono);
  font-size: 11.5px;
  color: var(--llmp-dim);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.llmp-embed-strip {
  display: flex;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.llmp-embed-cell {
  flex: 1;
  height: 17px;
  min-width: 0;
  border-radius: 2px;
  background: var(--llmp-surface-2);
  transition: background-color 0.09s linear;
}

.llmp-embed-dim {
  flex: none;
  font-family: var(--llmp-mono);
  font-size: 10.5px;
  color: var(--llmp-faint);
  white-space: nowrap;
}

/* ==========================================================================
   Stage 3 attention
   ========================================================================== */

.llmp-attn {
  position: relative;
  flex: 1;
  min-height: 200px;
}

.llmp-attn svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.llmp-attn-node {
  font-family: var(--llmp-mono);
  font-size: 11px;
  fill: var(--llmp-dim);
}

.llmp-attn-node.is-hot {
  fill: var(--llmp-text);
}

.llmp-attn-line {
  fill: none;
  stroke-linecap: round;
  stroke-dasharray: 5 7;
  opacity: 0;
  /* Fade-in is an animation, not a transition, so it does not depend on a
     requestAnimationFrame tick that a backgrounded tab never delivers. */
  animation: llmp-flow 1.1s linear infinite,
             llmp-line-in 0.5s ease forwards;
}

@keyframes llmp-line-in {
  to {
    opacity: var(--llmp-line-opacity, 0.6);
  }
}

.llmp-attn-target {
  fill: var(--llmp-accent);
}

/* ==========================================================================
   Stage 4 layers
   ========================================================================== */

.llmp-layers-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
}

.llmp-layers {
  display: flex;
  flex-direction: column-reverse;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.llmp-layer {
  display: flex;
  gap: 2px;
  height: 9px;
  border-radius: 3px;
  background: var(--llmp-surface);
  overflow: hidden;
  transition: background-color 0.25s, box-shadow 0.25s;
}

.llmp-layer.is-lit {
  background: rgba(77, 158, 232, 0.16);
  box-shadow: 0 0 14px rgba(77, 158, 232, 0.4);
}

.llmp-layer-cell {
  flex: 1;
  background: transparent;
  transition: background-color 0.18s;
}

.llmp-layer.is-lit .llmp-layer-cell {
  background: rgba(120, 186, 232, 0.55);
}

.llmp-layer-readout {
  flex: none;
  width: 128px;
  text-align: center;
}

.llmp-layer-count {
  font-family: var(--llmp-mono);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--llmp-text);
  font-variant-numeric: tabular-nums;
}

.llmp-layer-total {
  font-size: 12px;
  color: var(--llmp-faint);
}

.llmp-layer-cap {
  margin-top: 6px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--llmp-dim);
}

/* ==========================================================================
   Stage 5 prediction bars
   ========================================================================== */

.llmp-predict {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.llmp-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex: 1;
  min-height: 150px;
  padding-top: 20px;
}

.llmp-bar {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  flex: 1;
  min-width: 0;
  height: 100%;
  cursor: default;
}

.llmp-bar-pct {
  margin-bottom: 5px;
  font-family: var(--llmp-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--llmp-dim);
  font-variant-numeric: tabular-nums;
  transition: color 0.3s;
}

.llmp-bar-fill {
  position: relative;
  width: 100%;
  height: 0;
  min-height: 3px;
  border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg, rgba(77, 158, 232, 0.85), rgba(77, 158, 232, 0.22));
  transition: height 0.55s cubic-bezier(0.22, 1, 0.36, 1), background 0.3s,
    box-shadow 0.3s;
}

.llmp-bar-label {
  width: 100%;
  margin-top: 7px;
  padding: 4px 3px;
  font-family: var(--llmp-mono);
  font-size: 11.5px;
  color: var(--llmp-dim);
  text-align: center;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.3s, background 0.3s;
}

.llmp-bar.is-chosen .llmp-bar-fill {
  background: linear-gradient(180deg, #ffd08a, var(--llmp-hot));
  box-shadow: 0 0 22px rgba(255, 157, 77, 0.5);
}

.llmp-bar.is-chosen .llmp-bar-pct {
  color: var(--llmp-hot);
}

.llmp-bar.is-chosen .llmp-bar-label {
  color: #180d02;
  background: var(--llmp-hot);
  font-weight: 700;
}

.llmp-bar.is-scanning .llmp-bar-fill {
  background: linear-gradient(180deg, rgba(167, 139, 250, 0.9), rgba(167, 139, 250, 0.3));
}

.llmp-predict-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  min-height: 22px;
  font-size: 12px;
  color: var(--llmp-dim);
}

.llmp-verdict {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 999px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.3s, transform 0.3s;
}

.llmp-verdict.is-shown {
  opacity: 1;
  transform: translateY(0);
}

.llmp-verdict.is-certain {
  color: var(--llmp-good);
  background: rgba(52, 211, 153, 0.13);
}

.llmp-verdict.is-likely {
  color: var(--llmp-accent);
  background: rgba(77, 158, 232, 0.13);
}

.llmp-verdict.is-toss {
  color: var(--llmp-warn);
  background: rgba(251, 191, 36, 0.13);
}

/* ==========================================================================
   Output
   ========================================================================== */

.llmp-output {
  padding: 16px 18px;
  border-top: 1px solid var(--llmp-border);
  background: rgba(0, 0, 0, 0.25);
}

.llmp-output-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--llmp-faint);
}

.llmp-output-hint {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--llmp-faint);
  opacity: 0;
  transition: opacity 0.4s;
}

.llmp-output-hint.is-shown {
  opacity: 1;
}

.llmp-answer {
  min-height: 52px;
  font-size: 16px;
  line-height: 1.65;
  color: var(--llmp-text);
  word-break: break-word;
}

.llmp-out-token {
  border-radius: 3px;
  white-space: pre-wrap;
  transition: background-color 0.7s ease, color 0.7s ease;
  cursor: pointer;
}

.llmp-out-token.is-fresh {
  color: #180d02;
  background: var(--llmp-hot);
}

.llmp-out-token:hover {
  background: rgba(77, 158, 232, 0.26);
}

.llmp-out-token.is-open {
  background: rgba(77, 158, 232, 0.32);
  box-shadow: 0 0 0 1px rgba(77, 158, 232, 0.5);
}

.llmp-cursor {
  display: inline-block;
  width: 8px;
  height: 1.05em;
  margin-left: 1px;
  vertical-align: text-bottom;
  background: var(--llmp-accent);
  animation: llmp-blink 1.05s steps(2, start) infinite;
}

.llmp-cursor.is-hidden {
  display: none;
}

/* inspector popover for a finished token */
.llmp-pop {
  position: absolute;
  z-index: 30;
  width: 232px;
  padding: 11px 12px;
  border: 1px solid var(--llmp-border-strong);
  border-radius: 10px;
  background: var(--llmp-surface);
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.85);
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
}

.llmp-pop.is-shown {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.llmp-pop-head {
  margin-bottom: 8px;
  font-size: 10.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--llmp-faint);
}

.llmp-pop-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
  font-family: var(--llmp-mono);
  font-size: 11.5px;
}

.llmp-pop-tok {
  flex: none;
  max-width: 92px;
  color: var(--llmp-dim);
  white-space: pre;
  overflow: hidden;
  text-overflow: ellipsis;
}

.llmp-pop-row.is-picked .llmp-pop-tok {
  color: var(--llmp-hot);
  font-weight: 700;
}

.llmp-pop-track {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.llmp-pop-fillbar {
  height: 100%;
  border-radius: 3px;
  background: var(--llmp-accent);
}

.llmp-pop-row.is-picked .llmp-pop-fillbar {
  background: var(--llmp-hot);
}

.llmp-pop-pct {
  flex: none;
  width: 38px;
  text-align: right;
  color: var(--llmp-dim);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Stats footer
   ========================================================================== */

.llmp-stats {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  padding: 11px 18px;
  border-top: 1px solid var(--llmp-border);
}

.llmp-stat {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.llmp-stat-label {
  font-size: 10.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--llmp-faint);
}

.llmp-stat-value {
  font-family: var(--llmp-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--llmp-text);
  font-variant-numeric: tabular-nums;
}

.llmp-credit {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--llmp-faint);
}

/* ==========================================================================
   Error banner
   ========================================================================== */

.llmp-error {
  display: none;
  align-items: flex-start;
  gap: 9px;
  margin: 0 18px 18px;
  padding: 11px 13px;
  font-size: 13px;
  color: #ffd9d9;
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: 10px;
  background: rgba(248, 113, 113, 0.1);
}

.llmp-error.is-shown {
  display: flex;
}

.llmp-error svg {
  width: 15px;
  height: 15px;
  flex: none;
  margin-top: 2px;
  fill: #f87171;
}

/* ==========================================================================
   Keyframes
   ========================================================================== */

@keyframes llmp-token-in {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes llmp-fade-in {
  to {
    opacity: 1;
  }
}

@keyframes llmp-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes llmp-flow {
  to {
    stroke-dashoffset: -24;
  }
}

@keyframes llmp-pulse-dot {
  0%, 100% {
    box-shadow: 0 0 0 3px rgba(77, 158, 232, 0.16);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(77, 158, 232, 0.02);
  }
}

@keyframes llmp-shimmer {
  0% {
    border-color: var(--llmp-border-strong);
    background: rgba(0, 0, 0, 0.22);
  }
  40% {
    border-color: var(--llmp-accent);
    background: rgba(77, 158, 232, 0.14);
  }
  100% {
    border-color: var(--llmp-border-strong);
    background: rgba(0, 0, 0, 0.22);
  }
}

@keyframes llmp-idle-bounce {
  0%, 100% { height: 22%; }
  50% { height: 100%; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 720px) {
  .llmp-root { font-size: 14px; }

  .llmp-header { flex-wrap: wrap; padding: 12px 14px; }
  .llmp-title-sub { display: none; }

  .llmp-ask { padding: 14px; }
  .llmp-ask-row { flex-direction: column; }
  .llmp-run { justify-content: center; }

  .llmp-rail { padding: 0 14px; }
  .llmp-rail-step { min-width: 96px; font-size: 11px; }
  .llmp-rail-label { display: none; }
  .llmp-rail-step.is-active .llmp-rail-label { display: block; }

  .llmp-stage { min-height: 300px; padding: 16px 14px; }
  .llmp-scene { inset: 16px 14px; }

  .llmp-layers-wrap { flex-direction: column-reverse; gap: 12px; }
  .llmp-layers { width: 100%; }
  .llmp-layer-readout { width: auto; }

  .llmp-bars { gap: 5px; }
  .llmp-bar-label { font-size: 10px; padding: 3px 1px; }
  .llmp-bar-pct { font-size: 10px; }

  .llmp-embed-label { width: 58px; font-size: 10.5px; }
  .llmp-embed-dim { display: none; }

  .llmp-output { padding: 14px; }
  .llmp-answer { font-size: 15px; }
  .llmp-stats { gap: 14px; padding: 10px 14px; }
  .llmp-credit { width: 100%; margin-left: 0; }
}

/* ==========================================================================
   Reduced motion keep the information, drop the movement
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .llmp-root *,
  .llmp-root *::before,
  .llmp-root *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .llmp-token,
  .llmp-embed-row {
    opacity: 1;
    transform: none;
  }
}

/* ==========================================================================
   Pass indicator reinforces that the whole stack reruns for every token
   ========================================================================== */

.llmp-pass {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}

.llmp-pass-dots {
  display: flex;
  gap: 3px;
}

.llmp-pass-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  transition: background-color 0.14s, box-shadow 0.14s;
}

.llmp-pass-dot.is-lit {
  background: var(--llmp-accent);
  box-shadow: 0 0 8px rgba(77, 158, 232, 0.75);
}

.llmp-pass-label {
  font-family: var(--llmp-mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  color: var(--llmp-faint);
}

.llmp-foot-note {
  flex: 1;
  min-width: 0;
}
