/* ─── DTS analysis-v2.css ────────────────────────────────────────
   Net-new styles for v2 RHS components only. Shared primitives
   (panel, pill, btn, prompt-editor, stress-test, hard-regions,
   rewrites) are inherited from base.css + analysis.css.
   ──────────────────────────────────────────────────────────── */


/* ── Section headers (v2 mono caps, overrides analysis.css) ───── */

.rhs-section__title {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--foreground);
  line-height: 1.2;
}

.rhs-section__header .pill {
  flex: 0 0 auto;
}

/* Compact beast toggle inside a section header — keeps header height
   the same whether toggle is present or not. */
.rhs-section__header .btn--toggle-beast {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

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

.rhs-section__header .btn--toggle-beast[aria-pressed="true"] .btn__hint {
  color: rgba(10, 10, 10, 0.55);
}


/* Raw response JSON pre-block (beast mode) */

.raw-response {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--foreground-secondary);
  background: var(--background-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  max-height: 360px;
  overflow: auto;
  white-space: pre;
  line-height: 1.5;
  tab-size: 2;
}


/* ── 100ms chunk fade-in ──────────────────────────────────────── */

@keyframes v2FadeIn {
  from { opacity: 0; transform: translateY(2px); }
  to   { opacity: 1; transform: translateY(0); }
}

.v2-fade {
  animation: v2FadeIn 100ms ease-out;
}


/* ── 1. Recommended path ─────────────────────────────────────── */

.panel--recpath {
  border-color: var(--semantic-info);
  background: linear-gradient(
    180deg,
    rgba(88, 166, 255, 0.04) 0%,
    var(--background-subtle) 100%
  );
}

.recpath {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.recpath__empty {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--foreground-muted);
  padding: var(--space-3) 0;
}

.recpath__step {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: var(--space-3);
  align-items: start;
  padding: var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.015);
}

.recpath__num {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--semantic-info);
  width: 24px;
  height: 24px;
  border-radius: var(--radius-pill);
  background: var(--semantic-info-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.recpath__step--restructure .recpath__num { color: var(--semantic-warn); background: var(--semantic-warn-muted); }
.recpath__step--split       .recpath__num { color: var(--semantic-fail); background: var(--semantic-fail-muted); }

.recpath__label {
  font-size: 14px;
  font-weight: 500;
  color: var(--foreground);
  margin-bottom: 4px;
}

.recpath__detail {
  font-size: 13px;
  color: var(--foreground-secondary);
  line-height: 1.5;
}


/* ── 2. Prompt difficulty headline ───────────────────────────── */

.panel--headline { padding: var(--space-5) var(--panel-padding); }

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

.headline__score {
  font-family: var(--font-mono);
  font-size: 56px;
  font-weight: 500;
  line-height: 1;
  color: var(--foreground);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  min-width: 1.8ch;
  display: inline-block;
}

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

.headline__pill {
  margin-left: auto;
  align-self: center;
}

.headline__pill .pill {
  font-size: 12px;
  padding: 6px 12px;
}


/* ── 3. Difficulty breakdown (4 bars) ────────────────────────── */

.dim-breakdown {
  display: flex;
  flex-direction: column;
}

.dim-breakdown__empty {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--foreground-muted);
  padding: var(--space-3) 0;
}

.dim-bar {
  display: grid;
  grid-template-columns: 180px 1fr 44px;
  gap: var(--space-3);
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.dim-bar:last-child { border-bottom: none; }

.dim-bar__label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--foreground-secondary);
  letter-spacing: 0.01em;
}

.dim-bar__track {
  height: 6px;
  background: var(--background-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.dim-bar__fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width var(--transition-medium);
}

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

.dim-bar--ok   .dim-bar__fill { background: var(--semantic-ok); }
.dim-bar--warn .dim-bar__fill { background: var(--semantic-warn); }
.dim-bar--fail .dim-bar__fill { background: var(--semantic-fail); }
.dim-bar--ok   .dim-bar__value { color: var(--semantic-ok); }
.dim-bar--warn .dim-bar__value { color: var(--semantic-warn); }
.dim-bar--fail .dim-bar__value { color: var(--semantic-fail); }


/* ── 4. Why cards ────────────────────────────────────────────── */

.why-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-3);
}

.why-card {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-subtle);
  border-left: 2px solid var(--semantic-warn);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.015);
}

.why-card--high { border-left-color: var(--semantic-fail); }
.why-card--med  { border-left-color: var(--semantic-warn); }

.why-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

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

.why-card__body {
  font-size: 13px;
  color: var(--foreground-secondary);
  line-height: 1.55;
}

.why-card__evidence {
  margin: var(--space-2) 0 0 0;
  padding-left: var(--space-4);
  font-size: 13px;
  color: var(--foreground-secondary);
  line-height: 1.5;
}

.why-card__evidence li {
  margin-bottom: var(--space-1);
}

.why-card__where,
.why-card__context {
  margin: var(--space-2) 0 0 0;
  font-size: 13px;
  color: var(--foreground-secondary);
  line-height: 1.5;
}


/* ── 6. W2L horizontal gauge ─────────────────────────────────── */

.w2l-gauge {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.w2l-gauge__track {
  position: relative;
  height: 10px;
  background: var(--background-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  overflow: visible;
}

.w2l-gauge__fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(
    90deg,
    var(--semantic-ok) 0%,
    var(--semantic-warn) 55%,
    var(--semantic-fail) 100%
  );
  transition: width var(--transition-medium);
}

.w2l-gauge__marker {
  position: absolute;
  top: -4px;
  width: 2px;
  height: 18px;
  background: var(--foreground);
  border-radius: 1px;
  transform: translateX(-1px);
  transition: left var(--transition-medium);
  box-shadow: 0 0 0 2px rgba(10, 10, 10, 0.6);
}

.w2l-gauge__scale {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--foreground-muted);
  letter-spacing: 0.03em;
}


/* ── 7. 4-axis radar ─────────────────────────────────────────── */

.dim-radar {
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  display: block;
  aspect-ratio: 1 / 0.92;
}

.dim-radar__grid {
  fill: none;
  stroke: var(--border-subtle);
  stroke-width: 1;
}

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

.dim-radar__area {
  fill: rgba(88, 166, 255, 0.18);
  stroke: var(--semantic-info);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.dim-radar__vertex {
  fill: var(--semantic-info);
  stroke: var(--background);
  stroke-width: 1;
}

.dim-radar__label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  fill: var(--foreground);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dim-radar__value {
  font-family: var(--font-mono);
  font-size: 12px;
  fill: var(--foreground-muted);
  font-variant-numeric: tabular-nums;
}


/* ── Recommended model card ──────────────────────────────────── */

.rec-model {
  border-left: 3px solid var(--semantic-info);
  background: linear-gradient(
    180deg,
    rgba(88, 166, 255, 0.05) 0%,
    var(--background-subtle) 100%
  );
  padding: var(--space-4) var(--space-5);
}

.rec-model__eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--foreground-muted);
  margin-bottom: var(--space-2);
}

.rec-model__name {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 500;
  line-height: 1.1;
  color: var(--foreground);
  letter-spacing: -0.01em;
  margin-bottom: var(--space-3);
  min-height: 40px;
}

.rec-model__name.skeleton {
  display: inline-block;
  min-width: 180px;
}

.rec-model__detail {
  font-size: 14px;
  line-height: 1.55;
  color: var(--foreground-secondary);
  max-width: 58ch;
}


/* ── Model fit table ─────────────────────────────────────────── */

.model-fit {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.model-fit__table { display: flex; flex-direction: column; }

.model-fit__empty {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--foreground-muted);
  padding: var(--space-4);
}

.model-fit__row {
  display: grid;
  grid-template-columns: 14px minmax(130px, 1fr) 60px 60px 60px 60px 96px 72px;
  align-items: center;
  gap: var(--space-2);
  padding: 10px var(--space-3);
  font-size: 13px;
  border-bottom: 1px solid var(--border-subtle);
  border-left: 2px solid transparent;
}

.model-fit__row:last-child { border-bottom: none; }

.model-fit__row--head {
  background: var(--background-inset);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--foreground-muted);
  padding: 10px var(--space-3);
  line-height: 1.25;
  align-items: end;
}

.model-fit__row--head > span {
  text-align: center;
}

.model-fit__row--head > span:nth-child(1),
.model-fit__row--head > span:nth-child(2) {
  text-align: left;
}

.model-fit__row--head > span:last-child {
  text-align: right;
}

.model-fit__row--recommended {
  border-left-color: var(--semantic-info);
  background: rgba(88, 166, 255, 0.05);
}

.model-fit__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--semantic-info);
  display: inline-block;
}

.model-fit__dot--spacer { background: transparent; }

.model-fit__model {
  font-family: var(--font-mono);
  font-weight: 400;
  color: var(--foreground);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.model-fit__row--recommended .model-fit__model { font-weight: 500; }

.model-fit__cell {
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: center;
  padding: 3px 0;
  border-radius: var(--radius-xs);
  letter-spacing: 0.02em;
  text-transform: lowercase;
}

.model-fit__cell--strong  { color: var(--semantic-ok);    background: var(--semantic-ok-muted); }
.model-fit__cell--stretch { color: var(--semantic-warn);  background: var(--semantic-warn-muted); }
.model-fit__cell--miss    { color: var(--semantic-fail);  background: var(--semantic-fail-muted); }
.model-fit__cell--dash    { color: var(--foreground-faint); background: rgba(255, 255, 255, 0.04); }

.model-fit__price {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--foreground-secondary);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.model-fit__legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 10px var(--space-3);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--foreground-muted);
  border-top: 1px solid var(--border-subtle);
  background: var(--background-inset);
}

.model-fit__legend > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.model-fit__swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.model-fit__swatch--strong  { background: var(--semantic-ok); }
.model-fit__swatch--stretch { background: var(--semantic-warn); }
.model-fit__swatch--miss    { background: var(--semantic-fail); }
.model-fit__swatch--dash    { background: rgba(255, 255, 255, 0.12); }

.model-fit__footnote {
  padding: 10px var(--space-3) var(--space-3);
  font-size: 12px;
  line-height: 1.5;
  color: var(--foreground-muted);
  border-top: 1px solid var(--border-subtle);
}


/* ── Pending-data treatment ─────────────────────────────────────
   Shown wherever a backend field is pending. A single uniform pill
   — no verbose field names, no explanations (those live in
   BACKEND_DELTA.md). Read like a subtle stamp over the slot.
   ────────────────────────────────────────────────────────── */

.pill--pending {
  background: transparent;
  color: var(--foreground-muted);
  border: 1px dashed var(--border-default);
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

.pending-block {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: var(--space-3) 0;
}

/* Dashed empty track (reused by dim-bar + w2l). */
.dim-bar__track--dashed,
.w2l-gauge--missing .w2l-gauge__track {
  border: 1px dashed var(--border-default);
  background: transparent;
}

/* W2L missing: suppress colour fill + marker. */
.w2l-gauge--missing .w2l-gauge__fill { background: transparent; }
.w2l-gauge--missing .w2l-gauge__marker { display: none; }

/* Radar pending: small pill-styled label at centre. */
.dim-radar__missing {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  fill: var(--foreground-muted);
  text-transform: lowercase;
}

/* Model-fit empty row spans the full panel width. */
.model-fit__empty-row {
  padding: var(--space-4) var(--space-3);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: center;
}

/* Recpath pending placeholder. */
.recpath__missing {
  list-style: none;
  padding: var(--space-3);
  display: flex;
  justify-content: flex-start;
}


/* Retry button inside the inline-error panel. Sits below the message. */

.inline-error__retry {
  align-self: flex-start;
  font-size: 12px;
  padding: 6px 12px;
}


/* Live character counter — landing form, left of the Analyse button. */

.char-counter {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--foreground-muted);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  margin-right: auto;            /* push button to the right */
}


/* Raw-JSON download button (beast-mode raw-response panel header). */

.raw-download {
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 3px 6px;
  color: var(--foreground-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  margin-left: var(--space-2);
  transition: color var(--transition-fast),
              border-color var(--transition-fast),
              background var(--transition-fast);
}

.raw-download:hover {
  color: var(--foreground);
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.04);
}

.raw-download[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

.raw-download svg { display: block; }


/* ── Reduced motion override ─────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .v2-fade { animation: none; }
  .dim-bar__fill,
  .w2l-gauge__fill,
  .w2l-gauge__marker { transition: none; }
}
