/* ─── DTS analysis.css ──────────────────────────────────────────────
   Landing state, results layout, panels, instrument mode.
   ──────────────────────────────────────────────────────────────────── */

/* ── Landing view ──────────────────────────────────────────────── */

.view--landing {
  max-width: var(--content-max-width-narrow);
  margin: 0 auto;
  padding: var(--space-8) var(--content-padding) var(--space-7);
  min-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.landing__hero {
  font-family: var(--font-sans);
  font-size: clamp(36px, 6vw, 56px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--foreground);
  margin-bottom: var(--space-6);
}

.landing__hero em {
  font-style: normal;
  color: var(--foreground-secondary);
}

.landing-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.prompt-input {
  background: var(--background-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  padding: 20px;
  min-height: 160px;
  color: var(--foreground);
  width: 100%;
  transition: border-color var(--transition-fast);
}

.prompt-input::placeholder {
  color: var(--foreground-muted);
}

.prompt-input:focus {
  border-color: var(--border-active);
  outline: none;
}

.landing-form__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

.landing__examples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.landing__examples-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--foreground-muted);
}

.example-chip {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--foreground-secondary);
  background: var(--background-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}

.example-chip:hover {
  border-color: var(--border-hover);
  color: var(--foreground);
}

.landing__credibility {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--foreground-muted);
  line-height: 1.6;
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-5);
}

.landing__credibility strong {
  color: var(--foreground-secondary);
  font-weight: 500;
}

/* ── Results view ──────────────────────────────────────────────── */

.view--analysis {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: var(--space-5) var(--content-padding) var(--space-7);
}

.results__toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

/* ── Two-column insights layout ──────────────────────────── */

.results__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
  align-items: start;
}

@media (min-width: 1024px) {
  .results__grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  }
}

.results__lhs {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* LHS sticks while RHS scrolls — so the prompt stays anchored with its rewrites */
@media (min-width: 1024px) {
  .results__lhs {
    position: sticky;
    top: calc(48px + var(--space-4));
    max-height: calc(100vh - 48px - var(--space-5));
    overflow-y: auto;
  }
}

.results__rhs {
  display: flex;
  flex-direction: column;
  gap: var(--space-7);
}

/* ── Verdict card (TL;DR at top of RHS) ─────────────────── */

.verdict-card {
  background: var(--background-subtle);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--foreground-muted);
  border-radius: var(--radius-md);
  padding: var(--panel-padding);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  transition: border-color var(--transition-medium);
}

.verdict-card--ok   { border-left-color: var(--semantic-ok); }
.verdict-card--warn { border-left-color: var(--semantic-warn); }
.verdict-card--fail { border-left-color: var(--semantic-fail); }
.verdict-card--muted { border-left-color: var(--foreground-muted); }

.verdict-card__eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--foreground-muted);
}

.verdict-card__headline {
  font-family: var(--font-sans);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.25;
  color: var(--foreground);
  margin: 0;
}

.verdict-card__headline strong {
  font-weight: 600;
  color: var(--foreground);
}

.verdict-card__sub {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--foreground-secondary);
  margin: 0;
}

.verdict-card__sub:empty { display: none; }

.btn--toggle-beast {
  padding: 6px 12px;
  font-size: 12px;
}

.btn--toggle-beast[aria-pressed="true"] {
  background: var(--background-subtle);
  border-color: var(--border-hover);
}

/* ── RHS section — one per question ──────────────────────── */

.rhs-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.rhs-section__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
}

.rhs-section__title {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--foreground);
  line-height: 1.2;
}

.rhs-section__beast {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-top: var(--space-1);
  animation: beast-in var(--transition-slow);
}

/* ── Prompt editor panel (left column in results) ──────────────── */

.prompt-editor {
  background: var(--background-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--panel-padding);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-height: 360px;
}

.prompt-editor__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.prompt-editor__title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--foreground-muted);
}

.prompt-zoom {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  margin-right: var(--space-3);
}

.prompt-zoom__btn {
  width: 22px;
  height: 22px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--foreground-muted);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.prompt-zoom__btn:hover {
  color: var(--foreground);
  border-color: var(--border-hover);
}

.prompt-zoom__btn--reset {
  font-size: 11px;
}

.prompt-editor__body {
  flex: 1;
  background: var(--background-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  font-family: var(--font-sans);
  /* Auto-adjust based on prompt length (JS sets --prompt-font-size).
     Floor at 14px; ceiling at 18px. */
  font-size: var(--prompt-font-size, clamp(14px, calc(13px + 0.3vw), 17px));
  line-height: 1.65;
  color: var(--foreground);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-y: auto;
  min-height: 280px;
}

.prompt-editor__body:focus {
  outline: none;
  border-color: var(--border-active);
}

.prompt-editor__actions {
  display: flex;
  gap: var(--space-2);
}

/* ── Verdict panel ─────────────────────────────────────────────── */

.verdict {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.verdict__main {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
}

.verdict__cl {
  font-family: var(--font-sans);
  font-size: 48px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}

.verdict__cl-unit {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--foreground-muted);
}

.verdict__tier {
  margin-left: auto;
}

/* ── Recommended route panel ─────────────────────────────── */

.route {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.route__option {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: baseline;
  gap: var(--space-3);
}

.route__label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--foreground-muted);
}

.route__arrow {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--foreground-muted);
}

.route__model {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 500;
  color: var(--foreground);
  line-height: 1.2;
}

.route__option--secondary .route__model {
  font-size: 16px;
  color: var(--foreground-secondary);
}

.route__reason {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.55;
  color: var(--foreground-secondary);
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-3);
  margin-top: var(--space-1);
}

.route__reason:empty {
  display: none;
}

/* ── Budget bars ──────────────────────────────────────────────── */

.budget {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.budget__row {
  display: grid;
  grid-template-columns: 120px 48px 1fr 80px;
  align-items: center;
  gap: var(--space-3);
}

.budget__model {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--foreground);
}

.budget__layers {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--foreground-muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Per-row: track spans this model's own capacity, fill shows how much of
   that capacity is needed. Overflow spills to the right in a separate
   strip (sized to the largest overflow across rows) so bigger budgets
   still read as "more headroom". */
.budget__bar {
  display: grid;
  grid-template-columns: 100% 0%;
  align-items: center;
  column-gap: 4px;
  height: 14px;
}

.budget__bar-track {
  position: relative;
  height: 100%;
  background: var(--background-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  overflow: hidden;
}

.budget__bar-ok {
  height: 100%;
  background: var(--semantic-ok);
  transition: width var(--transition-medium);
}

.budget__bar-ok--fail {
  background: var(--semantic-fail);
}

.budget__bar-ok--warn {
  background: var(--semantic-warn);
}

.budget__bar-spill {
  position: relative;
  height: 100%;
}

.budget__bar-over {
  height: 100%;
  background: var(--semantic-fail);
  border-radius: var(--radius-xs);
  transition: width var(--transition-medium);
}

.budget__status {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-align: right;
}

.budget__status--ok { color: var(--semantic-ok); }
.budget__status--warn { color: var(--semantic-warn); }
.budget__status--fail { color: var(--semantic-fail); }

/* ── Breakdown ─────────────────────────────────────────────────── */

.breakdown {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.breakdown__empty {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--foreground-muted);
  padding: var(--space-2) 0;
}

/* Bars live in a separate wrapper that collapses in non-beast mode.
   Beast toggle adds --open which animates max-height + opacity so the
   prose/driver cards below get pushed down gently. */
.breakdown__bars {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  margin-bottom: 0;
  transition:
    max-height 220ms ease,
    opacity 160ms ease,
    margin-bottom 160ms ease;
}

.breakdown__bars--open {
  max-height: 560px;
  opacity: 1;
  margin-bottom: var(--space-4);
}

@media (prefers-reduced-motion: reduce) {
  .breakdown__bars { transition: none; }
}

.dim-rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.dim-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: center;
  column-gap: var(--space-3);
  row-gap: 6px;
}

.dim-row__label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.03em;
  color: var(--foreground-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dim-row__code {
  color: var(--foreground-muted);
  margin-right: 6px;
}

.dim-row__value {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--foreground);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.dim-row__bar {
  grid-column: 1 / -1;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
}

.dim-row__fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease-out;
}

.dim-row__fill--low  { background: var(--semantic-ok); }
.dim-row__fill--mid  { background: var(--semantic-warn); }
.dim-row__fill--high { background: #F0883E; }
.dim-row__fill--max  { background: var(--semantic-fail); }

.breakdown__why {
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--foreground-secondary);
  align-self: flex-start;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}

.breakdown__why:hover {
  border-color: var(--border-hover);
  color: var(--foreground);
}

.breakdown__prose {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--foreground-secondary);
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-3);
}

/* ── Stale state ───────────────────────────────────────────────── */

.stale .panel,
.panel.is-stale,
.stress-test.is-stale {
  opacity: 0.5;
  transition: opacity var(--transition-medium);
}

.panel.is-stale .panel__header::after {
  content: 'STALE';
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  background: var(--semantic-warn-muted);
  color: var(--semantic-warn);
  margin-left: auto;
}

/* ── Instrument mode ───────────────────────────────────────────── */

.instrument {
  background: var(--instrument-bg);
  color: var(--instrument-green);
  font-family: var(--font-mono);
  border: 1px solid var(--instrument-green);
  border-radius: var(--radius-md);
  padding: var(--panel-padding);
  position: relative;
  text-shadow: var(--instrument-glow);
  overflow: hidden;
  background-image:
    linear-gradient(rgba(0,255,102,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,255,102,0.04) 1px, transparent 1px);
  background-size: 16px 16px;
}

.instrument__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-4);
}

.instrument__header::before {
  content: '■ ';
}

.instrument__rec {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--instrument-green);
  font-size: 11px;
}

.instrument__rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--instrument-green);
  box-shadow: 0 0 6px var(--instrument-green);
  animation: rec-blink 1s steps(2, end) infinite;
}

@keyframes rec-blink {
  50% { opacity: 0.2; }
}

.instrument__meta {
  font-size: 11px;
  color: var(--instrument-green-dim);
  margin-bottom: var(--space-4);
  letter-spacing: 0.04em;
}

.instrument__live {
  font-size: 11px;
  color: var(--instrument-green-dim);
  margin-top: var(--space-4);
  letter-spacing: 0.04em;
}

.instrument__live .cursor {
  display: inline-block;
  width: 7px;
  background: var(--instrument-green);
  animation: cursor-blink 1s steps(2, end) infinite;
  color: transparent;
}

@keyframes cursor-blink {
  50% { opacity: 0; }
}

/* ── Stress test (retro CRT pipeline) ───────────────────────── */

.stress-test {
  position: relative;
  padding: 16px 18px 14px;
  background: #000;
  border: 2px solid #0f0;
  border-radius: 6px;
  color: #0f0;
  font-family: var(--font-mono);
  overflow: hidden;
  box-shadow:
    0 0 20px rgba(0, 255, 0, 0.15),
    inset 0 0 40px rgba(0, 255, 0, 0.04);
}

.stress-test::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0) 0,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 255, 0, 0.035) 3px,
    rgba(0, 0, 0, 0) 4px
  );
  pointer-events: none;
  z-index: 2;
}

.stress-test::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.4) 100%);
  pointer-events: none;
  z-index: 3;
}

.stress-test--active {
  animation: stress-flicker 0.15s infinite;
}

@keyframes stress-flicker {
  0%, 100% { opacity: 1; }
  97% { opacity: 0.96; }
  98% { opacity: 1; }
}

.stress-test__header,
.stress-test__meta,
.stress-test__footer,
.stress-test__live {
  position: relative;
  z-index: 4;
  text-shadow: 0 0 3px #0f0;
}

.stress-test__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 10px;
  text-shadow: 0 0 4px #0f0;
}

.stress-test__rec {
  font-size: 11px;
}

.stress-test--active .stress-test__rec {
  animation: stress-blink 0.8s steps(1, end) infinite;
}

@keyframes stress-blink { 50% { opacity: 0; } }

.stress-test__canvas {
  display: block;
  width: 100%;
  height: 180px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  position: relative;
  z-index: 1;
}

.stress-test__meta {
  font-size: 10px;
  letter-spacing: 0.04em;
  margin-top: 8px;
  color: rgba(0, 255, 0, 0.75);
}

.stress-test__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  margin-top: 6px;
  gap: 12px;
}

.stress-test__bar {
  flex: 1;
  height: 10px;
  background: rgba(0, 255, 0, 0.08);
  border: 1px solid #0f0;
}

.stress-test__bar-fill {
  height: 100%;
  background: #0f0;
  box-shadow: 0 0 8px #0f0;
  transition: width 0.2s linear;
}

.stress-test__live {
  font-size: 10px;
  letter-spacing: 0.04em;
  margin-top: 8px;
  color: rgba(0, 255, 0, 0.65);
}

/* ── Rewrites ──────────────────────────────────────────────────── */

.rewrites {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.rewrites__empty {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--foreground-muted);
  line-height: 1.55;
  padding: var(--space-3) 0;
}

.rewrite-card {
  background: var(--background-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.rewrite-card:hover {
  border-color: var(--border-hover);
}

.rewrite-card[aria-selected="true"] {
  border-color: var(--border-selected);
  background: var(--semantic-info-muted);
}

.rewrite-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.rewrite-card__region {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--foreground-muted);
}

.rewrite-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.55;
}

.rewrite-card__before {
  color: var(--foreground-muted);
  text-decoration: line-through;
}

.rewrite-card__after {
  background: var(--semantic-ok-muted);
  color: var(--foreground);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  align-self: flex-start;
}

.rewrite-card__explain {
  color: var(--foreground-secondary);
}

.rewrite-card__footer {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--foreground-muted);
  letter-spacing: 0.04em;
}

/* ── Token heatmap ─────────────────────────────────────────────── */

.tok {
  padding: 1px 0;
  border-radius: 2px;
  transition: background var(--transition-fast);
}

.tok--s1 { background: rgba(183, 217, 76, 0.22); }
.tok--s2 { background: rgba(232, 210, 71, 0.28); }
.tok--s3 { background: rgba(232, 149, 71, 0.32); }
.tok--s4 { background: rgba(248, 81, 73, 0.35); }

/* ── Decompose ─────────────────────────────────────────────────── */

.decompose {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.decompose__gates {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: 12px;
}

.decompose__gate {
  display: inline-flex;
  gap: var(--space-1);
  align-items: baseline;
}

.decompose__gate-label {
  color: var(--foreground-muted);
}

.decompose__gate-value {
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}

.decompose__states {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.decompose__state {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--background-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  align-items: start;
}

.decompose__state-id {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--foreground-muted);
  font-variant-numeric: tabular-nums;
}

.decompose__state-desc {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.55;
  color: var(--foreground-secondary);
}

.decompose__state-model {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--foreground-muted);
  letter-spacing: 0.04em;
}

.decompose__cost {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--foreground-secondary);
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-3);
  display: flex;
  gap: var(--space-5);
}

.decompose__cost-label {
  color: var(--foreground-muted);
}

.decompose__cost-value {
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}

/* ── Beast-mode panels (rendered inside rhs-section__beast) ── */

@keyframes beast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.beast__raw {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--foreground-muted);
  background: var(--background-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── 2×2 stress landscape (composite × fb_stress) ─────────── */

.stress-landscape {
  width: 100%;
  max-width: 320px;
  height: auto;
  display: block;
  margin: 0 auto;
  font-family: var(--font-mono);
}

.stress-landscape__frame {
  fill: var(--background-inset);
  stroke: var(--border-subtle);
  stroke-width: 1;
}

.stress-landscape__split {
  stroke: var(--border-default);
  stroke-width: 1;
  stroke-dasharray: 2 3;
}

.stress-landscape__tick {
  stroke: var(--foreground-muted);
  stroke-width: 1;
}

.stress-landscape__axis-label {
  fill: var(--foreground-muted);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stress-landscape__quadrant-label {
  fill: var(--foreground-muted);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
}

.stress-landscape__quadrant-label--clear  { fill: var(--semantic-ok); }
.stress-landscape__quadrant-label--format { fill: var(--semantic-warn); }
.stress-landscape__quadrant-label--depth  { fill: #F0883E; }
.stress-landscape__quadrant-label--over   { fill: var(--semantic-fail); }

.stress-landscape__dot {
  stroke: var(--background);
  stroke-width: 2;
}

.stress-landscape__band {
  opacity: 0.45;
}

.stress-landscape__scale-label {
  fill: var(--foreground-faint);
  font-size: 8px;
  font-variant-numeric: tabular-nums;
}

.stress-landscape__note {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--foreground-muted);
  margin: var(--space-3) 0 0;
  text-align: center;
}

.stress-landscape__note:empty { display: none; }

/* fb_stress pending state: dim the Y-axis elements so it's visually
   obvious that the vertical dimension is unknown. Horizontal split line
   (fb=0) gets faded; quadrant labels dim since their vertical half is
   uncertain. Vertical split (composite=2.5) and X-axis stay crisp. */
.stress-landscape--fb-pending .stress-landscape__quadrant-label {
  opacity: 0.35;
}

.stress-landscape--fb-pending .stress-landscape__split--h {
  opacity: 0.2;
}

/* Dim profile SVG */
.dim-profile {
  width: 100%;
  max-width: 280px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.dim-profile__grid {
  stroke: var(--border-subtle);
  fill: none;
}

.dim-profile__area {
  fill: var(--semantic-info-muted);
  stroke: var(--semantic-info);
  stroke-width: 1.5;
}

.dim-profile__axis {
  stroke: var(--border-subtle);
  stroke-width: 1;
}

.dim-profile__label {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--foreground-muted);
  letter-spacing: 0.04em;
  text-anchor: middle;
}

.dim-profile__value {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--foreground);
  text-anchor: middle;
  font-variant-numeric: tabular-nums;
}

/* Format binding bar */
.format-stress {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.format-stress__scale {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--foreground-muted);
}

.format-stress__track {
  height: 12px;
  background: linear-gradient(90deg, var(--semantic-ok) 0%, var(--semantic-warn) 50%, var(--semantic-fail) 100%);
  border-radius: var(--radius-xs);
  position: relative;
}

.format-stress--empty .format-stress__track {
  filter: grayscale(1);
  opacity: 0.25;
}

.format-stress__marker {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 3px;
  background: var(--foreground);
  border-radius: 2px;
  transform: translateX(-50%);
}

.format-stress--empty .format-stress__marker { display: none; }

.format-stress__value {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}

.format-stress__pending {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--foreground-muted);
  text-transform: uppercase;
}

/* Time breakdown */
.time-breakdown {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--foreground-secondary);
}

.time-breakdown__row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: var(--space-3);
  align-items: baseline;
}

.time-breakdown__label { color: var(--foreground-muted); }
.time-breakdown__value { color: var(--foreground); font-variant-numeric: tabular-nums; }
.time-breakdown__pct   { color: var(--foreground-muted); font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }

/* ── Inline error ──────────────────────────────────────────────── */

.inline-error {
  border: 1px solid var(--semantic-fail);
  background: var(--semantic-fail-muted);
  color: var(--foreground);
  border-radius: var(--radius-md);
  padding: var(--panel-padding);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.inline-error--warn {
  border-color: var(--semantic-warn);
  background: var(--semantic-warn-muted);
}

.inline-error__label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--semantic-fail);
}

.inline-error--warn .inline-error__label {
  color: var(--semantic-warn);
}

.inline-error__msg {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--foreground);
}

/* ── Per-token beast heatmap ───────────────────────────────────── */

.per-token-heatmap {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.9;
  color: var(--foreground);
  background: var(--background-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 16px;
  max-height: 320px;
  overflow: auto;
}

/* ── Driver cards ("what's driving this difficulty") ─────── */

.drivers {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

.driver-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px 12px 14px;
  background: var(--background-inset);
  border: 1px solid var(--border-subtle);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
}

.driver-card--high { border-left-color: var(--semantic-fail); }
.driver-card--med  { border-left-color: var(--semantic-warn); }
.driver-card--low  { border-left-color: var(--foreground-muted); }

.driver-card__title {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--foreground);
}

.driver-card__detail {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.55;
  color: var(--foreground-secondary);
}

.driver-card__detail strong {
  color: var(--foreground);
  font-weight: 500;
}

/* ── Hardest prompt regions ──────────────────────────────── */

.hard-regions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.hard-region__empty {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--foreground-muted);
  padding: var(--space-2) 0;
}

.hard-region {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: 12px 14px;
  background: var(--background-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.hard-region--compact {
  flex-direction: row;
  align-items: center;
  gap: var(--space-3);
  padding: 8px 12px;
}

.hard-region__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}

.hard-region__id {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--foreground-muted);
}

.hard-region__meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--foreground-muted);
  font-variant-numeric: tabular-nums;
}

.hard-region__text {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--foreground);
}

.hard-region--compact .hard-region__text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hard-region__section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: var(--space-1);
}

.hard-region__label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--foreground-muted);
}

.hard-region__prose {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--foreground-secondary);
}

/* ── Instrument complete state (kills the blink) ─────────── */

.instrument--complete .instrument__rec-dot {
  animation: none;
  background: var(--semantic-ok);
  box-shadow: 0 0 6px var(--semantic-ok);
  opacity: 1;
}
