/**
 * BiasBreak Analyzer — scoped entirely under .bba-widget.
 *
 * Tokens below map to the BiasBreak theme's actual CSS custom properties
 * (--ink, --clay, --amber, --green, etc. defined on :root in the theme's
 * main.css) with literal fallbacks, so the widget still looks reasonable
 * if this plugin is ever activated on a different theme.
 */

.bba-widget {
  --bba-ink: var(--ink, #1a1815);
  --bba-ink-2: var(--ink-2, #332f29);
  --bba-secondary: var(--secondary, #4a463f);
  --bba-body: var(--body-text, #6e6a63);
  --bba-muted: var(--muted, #9b968d);
  --bba-faint: var(--faint, #8a857c);
  --bba-faintest: var(--faintest, #b4afa6);

  --bba-bg: var(--card, #ffffff);
  --bba-panel: var(--panel, #f3f1ea);

  --bba-border: var(--border, rgba(26, 24, 21, 0.1));
  --bba-border-soft: var(--border-soft, rgba(26, 24, 21, 0.07));
  --bba-border-mid: var(--border-mid, rgba(26, 24, 21, 0.11));
  --bba-border-strong: var(--border-strong, rgba(26, 24, 21, 0.14));
  --bba-border-max: var(--border-max, rgba(26, 24, 21, 0.2));

  --bba-shadow: var(--shadow-sm, 0 1px 2px rgba(26, 24, 21, 0.05)), var(--shadow-lg, 0 8px 24px rgba(26, 24, 21, 0.05));

  --bba-clay: var(--clay, #a34a2e);
  --bba-amber: var(--amber, #a8722a);
  --bba-green: var(--green, #3d7a5c);
  /* No --blue exists in the theme's token set (only clay/amber/green) — this
     is the one new color the question route needs, for the "Developing"
     answer state. Same muted saturation/lightness as the other three. */
  --bba-blue: var(--blue, #3d6f96);

  --bba-radius: var(--radius-card, 10px);
  --bba-radius-lg: var(--radius-lg, 14px);
  --bba-radius-pill: var(--radius-pill, 999px);

  --bba-font-display: var(--font-display, Georgia, serif);
  --bba-font-ui: var(--font-ui, system-ui, -apple-system, sans-serif);
  --bba-font-mono: var(--font-mono, ui-monospace, monospace);

  display: block;
  /* Explicit width matters: the theme hero is a column flexbox with
   * align-items:center, where width:auto shrinks to content — the demo's
   * .bb-search was width:100% for the same reason. */
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  font-family: var(--bba-font-ui);
  font-size: 14px;
  line-height: 1.5;
  color: var(--bba-ink);
  text-align: start;
  box-sizing: border-box;
}

.bba-widget *,
.bba-widget *::before,
.bba-widget *::after {
  box-sizing: border-box;
}

.bba-widget .screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

/* ==========================================================================
   Input — mirrors the site's original .bb-search card exactly (padding,
   shadow, radius, borderless field, bottom bar treatment). The URL/Text
   tabs are the one necessary addition: the backend needs an explicit url
   vs text field, unlike the old single free-text box.
   ========================================================================== */
.bba-input {
  width: 100%;
  background: var(--bba-bg);
  border: 1px solid var(--bba-border-strong);
  border-radius: var(--bba-radius-lg);
  box-shadow: var(--bba-shadow);
  padding: 20px 20px 14px;
  box-sizing: border-box;
}

.bba-tabs {
  display: flex;
  gap: 14px;
  margin-bottom: 8px;
}

.bba-tab {
  appearance: none;
  background: none;
  border: none;
  padding: 0 0 4px;
  font-family: var(--bba-font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bba-faint);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.bba-tab.is-active {
  color: var(--bba-ink);
  border-bottom-color: var(--bba-ink);
}

.bba-tab:focus-visible {
  outline: 2px solid var(--bba-ink);
  outline-offset: 2px;
}

.bba-tabpanel[hidden] {
  display: none;
}

.bba-field {
  width: 100%;
  border: none;
  resize: none;
  background: transparent;
  font-family: inherit;
  font-size: 15px;
  color: var(--bba-ink);
  min-height: 24px;
  line-height: 1.5;
  padding: 0;
}

.bba-field {
  min-height: 52px;
  box-sizing: border-box;
}

.bba-field::placeholder {
  color: var(--bba-faintest);
}

.bba-field:focus {
  outline: none;
}

.bba-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  border-top: 1px solid var(--bba-border-soft);
  padding-top: 12px;
  flex-wrap: wrap;
}

.bba-decoy {
  appearance: none;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--bba-body);
  border: 1px solid var(--bba-border-strong);
  border-radius: 7px;
  padding: 6px 11px;
  background: none;
  cursor: default;
}

.bba-controls__end {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-inline-start: auto;
}

.bba-langtoggle {
  display: inline-flex;
  border: 1px solid var(--bba-border-strong);
  border-radius: var(--bba-radius-pill);
  padding: 2px;
  gap: 2px;
}

.bba-lang-btn {
  appearance: none;
  background: none;
  border: none;
  border-radius: var(--bba-radius-pill);
  padding: 4px 11px;
  font-family: var(--bba-font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--bba-muted);
  cursor: pointer;
}

.bba-lang-btn.is-active {
  background: var(--bba-ink);
  color: var(--bba-bg);
}

.bba-lang-btn:focus-visible,
.bba-submit:focus-visible,
.bba-btn:focus-visible {
  outline: 2px solid var(--bba-ink);
  outline-offset: 2px;
}

.bba-hint {
  font-family: var(--bba-font-mono);
  font-size: 11px;
  color: var(--bba-faintest);
}

.bba-submit {
  appearance: none;
  border: none;
  background: var(--bba-ink);
  color: var(--bba-bg);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 8px;
  padding: 9px 20px;
  cursor: pointer;
}

.bba-submit:hover:not(:disabled) {
  background: var(--bba-ink-2);
}

.bba-submit:disabled {
  opacity: 0.6;
  cursor: default;
}

.bba-inputerror {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--bba-clay);
}

.bba-inputerror[hidden] {
  display: none;
}

/* ==========================================================================
   Progress
   ========================================================================== */
.bba-progress {
  margin-top: 18px;
  padding: 16px;
  background: var(--bba-panel);
  border-radius: var(--bba-radius-lg);
}

.bba-progress[hidden] {
  display: none;
}

/* A connected stepper, not four separate bars. The track runs through every
   stage; completed segments and nodes fill in behind the run, and the active
   stage shows a flowing shimmer that reads as "working now" rather than the
   old whole-bar blink.

   Blue, deliberately, not green. Green is this project's "verified/high"
   colour, and a progress bar that fills green would quietly suggest the
   verdict is heading toward verified before any verdict exists. Blue is
   neutral processing. */
.bba-stages {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0;
}

.bba-stage {
  flex: 1;
  text-align: center;
  font-family: var(--bba-font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bba-muted);
  padding-top: 20px;
  position: relative;
  transition: color 0.3s ease;
}

/* The track segment for this stage. Segments touch (gap:0) to form one line. */
.bba-stage::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--bba-border);
}

.bba-stage:first-child::before {
  border-top-left-radius: 999px;
  border-bottom-left-radius: 999px;
}

.bba-stage:last-child::before {
  border-top-right-radius: 999px;
  border-bottom-right-radius: 999px;
}

.bba-stage.is-done::before {
  background: var(--bba-blue);
}

.bba-stage.is-active::before {
  background: linear-gradient(
    90deg,
    var(--bba-blue) 0%,
    color-mix(in srgb, var(--bba-blue) 42%, #fff) 50%,
    var(--bba-blue) 100%
  );
  background-size: 200% 100%;
  animation: bba-flow 1.15s linear infinite;
}

@keyframes bba-flow {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* The node sitting on the track for this stage. */
.bba-stage::after {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--bba-bg);
  border: 2px solid var(--bba-border-strong);
  transition: border-color 0.3s ease, background 0.3s ease;
}

.bba-stage.is-done::after {
  background: var(--bba-blue);
  border-color: var(--bba-blue);
}

.bba-stage.is-active::after {
  border-color: var(--bba-blue);
  background: var(--bba-bg);
  animation: bba-node 1.5s ease-in-out infinite;
}

@keyframes bba-node {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--bba-blue) 22%, transparent); }
  50%      { box-shadow: 0 0 0 6px color-mix(in srgb, var(--bba-blue) 7%, transparent); }
}

.bba-stage.is-done {
  color: var(--bba-secondary);
}

.bba-stage.is-active {
  color: var(--bba-blue);
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  .bba-stage.is-active::before,
  .bba-stage.is-active::after {
    animation: none;
  }
}

/* ==========================================================================
   Result container
   ========================================================================== */
.bba-result {
  margin-top: 0;
}

.bba-result:focus {
  outline: none;
}

/* ==========================================================================
   Quick-result card (2a) — mirrors the theme's .bb-quickresult
   ========================================================================== */
.bba-card {
  width: 100%;
  max-width: 560px;
  background: var(--bba-bg);
  border: 1px solid var(--bba-border-strong);
  border-radius: var(--bba-radius-lg);
  box-shadow: var(--bba-shadow);
  padding: 24px;
  margin: 22px auto 0;
  animation: bba-card-in 0.3s ease-out;
}

@keyframes bba-card-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .bba-card { animation: none; }
}

.bba-card__source {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.bba-card__source[hidden] { display: none; }

.bba-card__avatar {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--bba-panel);
  color: var(--bba-body);
  font-family: var(--bba-font-mono);
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.bba-card__sourcetext { min-width: 0; }

.bba-card__sourcename {
  font-size: 13px;
  font-weight: 500;
  color: var(--bba-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bba-card__sourcetag {
  font-family: var(--bba-font-mono);
  font-size: 10.5px;
  color: var(--bba-amber);
  text-transform: uppercase;
}

.bba-card__verdict {
  font-family: var(--bba-font-display);
  font-size: 19px;
  line-height: 1.35;
  color: var(--bba-ink);
  margin: 0 0 16px;
}

.bba-card__verdict[hidden] { display: none; }

.bba-card__flag {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--bba-secondary);
}

.bba-card__flag[hidden] { display: none; }

.bba-card__flagdot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bba-border-max);
  flex: 0 0 auto;
}

.bba-card__meta {
  font-family: var(--bba-font-mono);
  font-size: 10.5px;
  color: var(--bba-faint);
  margin-top: 10px;
}

.bba-card__meta[hidden] { display: none; }

.bba-card__actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.bba-card__actions[hidden] { display: none; }

.bba-card__actions .bba-btn { flex: 1; }

/* ==========================================================================
   Buttons & badges
   ========================================================================== */
.bba-btn {
  appearance: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  padding: 10px 16px;
  text-align: center;
  cursor: pointer;
}

.bba-btn--primary {
  border: none;
  background: var(--bba-ink);
  color: var(--bba-bg);
}

.bba-btn--primary:hover { background: var(--bba-ink-2); }

.bba-btn--outline {
  border: 1px solid var(--bba-border-max);
  background: none;
  color: var(--bba-ink);
}

.bba-btn--outline:hover { border-color: var(--bba-ink); }

.bba-btn--small {
  padding: 5px 12px;
  font-size: 12.5px;
}

.bba-btn-plain {
  appearance: none;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--bba-ink);
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.bba-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--bba-radius-pill);
  background: var(--bba-panel);
  color: var(--bba-secondary);
}

.bba-badge--mid { color: var(--bba-amber); }
.bba-badge--high { color: var(--bba-green); }

/* score / fill tone helpers */
.bba-score--low { color: var(--bba-clay); }
.bba-score--mid { color: var(--bba-amber); }
.bba-score--high { color: var(--bba-green); }
.bba-fill--low { background: var(--bba-clay); }
.bba-fill--mid { background: var(--bba-amber); }
.bba-fill--high { background: var(--bba-green); }

/* ==========================================================================
   Scorecard (verification route ONLY)
   ========================================================================== */
.bba-scorecard {
  background: var(--bba-bg);
  border: 1px solid var(--bba-border-strong);
  border-radius: var(--bba-radius);
  padding: 16px 18px;
}

.bba-scorecard__row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.bba-scorecard__value {
  font-family: var(--bba-font-mono);
  font-size: 32px;
  font-weight: 600;
  line-height: 1;
}

.bba-scorecard__value--lg { font-size: 38px; }

.bba-scorecard__conf {
  font-family: var(--bba-font-mono);
  font-size: 11px;
  color: var(--bba-muted);
}

.bba-scorecard__label {
  font-size: 12px;
  color: var(--bba-secondary);
  margin-inline-start: auto;
}

.bba-scorecard__label--strong {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--bba-ink);
}

.bba-scorecard__track {
  position: relative;
  height: 5px;
  background: var(--bba-border);
  border-radius: 3px;
  margin: 10px 0 16px;
}

.bba-scorecard__fill {
  position: absolute;
  height: 100%;
  border-radius: 3px;
  /* background comes from the bba-fill--* tone class */
}

.bba-dimensions {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.bba-dim-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bba-dim-row__label {
  font-size: 12.5px;
  color: var(--bba-secondary);
  width: 130px;
  flex: 0 0 auto;
}

.bba-dim-row__track {
  position: relative;
  flex: 1;
  height: 4px;
  background: var(--bba-border-soft);
  border-radius: 2px;
}

.bba-dim-row__fill {
  position: absolute;
  inset-inline-start: 0;
  height: 100%;
  border-radius: 2px;
  /* background comes from the bba-fill--* tone class */
}

.bba-dim-row__value {
  font-family: var(--bba-font-mono);
  font-size: 11.5px;
  font-weight: 600;
  width: 26px;
  flex: 0 0 auto;
  text-align: end;
  color: var(--bba-muted);
}

.bba-devbadge {
  display: inline-block;
  margin-top: 12px;
  font-family: var(--bba-font-mono);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--bba-amber);
  border: 1px dashed var(--bba-amber);
  border-radius: var(--bba-radius-pill);
  padding: 3px 10px;
}

.bba-devbadge[hidden] { display: none; }

/* ==========================================================================
   Non-scored route bodies (promotional / opinion / satire)
   ========================================================================== */
.bba-whitebox {
  background: var(--bba-bg);
  border: 1px solid var(--bba-border-strong);
  border-radius: var(--bba-radius);
  padding: 16px 18px;
}

.bba-minilabel {
  font-family: var(--bba-font-mono);
  font-size: 10.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--bba-faint);
  margin: 14px 0 8px;
}

.bba-minilabel:first-child { margin-top: 0; }
.bba-minilabel[hidden] { display: none; }

.bba-promolabels {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 4px;
}

.bba-labelpair {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px;
}

.bba-meta-label {
  font-family: var(--bba-font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bba-faint);
}

.bba-labelvalue {
  font-size: 12.5px;
  color: var(--bba-secondary);
}

.bba-risklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bba-risklist li {
  font-size: 13px;
  line-height: 1.5;
  color: var(--bba-body);
  padding-inline-start: 14px;
  position: relative;
}

.bba-risklist li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0.5em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--bba-amber);
}

.bba-promonote {
  font-family: var(--bba-font-display);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--bba-ink);
  background: var(--bba-panel);
  border-radius: var(--bba-radius);
  padding: 13px 16px;
  margin: 14px 0 0;
}

.bba-promonote[hidden] { display: none; }

.bba-framing {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--bba-body);
  margin: 0;
}

.bba-plainnote {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--bba-body);
  margin: 0 0 14px;
}

.bba-error-message {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--bba-ink);
  background: var(--bba-panel);
  border-radius: var(--bba-radius);
  padding: 14px 16px;
  margin: 0 0 14px;
}

/* ==========================================================================
   Question route (G) — direct-answer page for short-text inputs. Mirrors
   the community archive's published Q&A report (report-qa.php / "7b").
   ========================================================================== */
.bba-question__badge {
  display: inline-block;
  margin-bottom: 10px;
  font-family: var(--bba-font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bba-muted);
  border: 1px solid var(--bba-border-strong);
  border-radius: var(--bba-radius-pill);
  padding: 3px 9px;
}
.bba-question__badge[hidden] { display: none; }

/* 2. The reader's own words, above everything the machine produced. Display
   face and a real size: this is the question the page is about, not a label
   on it. */
.bba-question__asked {
  font-family: var(--bba-font-display);
  font-size: 21px;
  line-height: 1.3;
  font-weight: 500;
  color: var(--bba-ink);
  margin: 0 0 10px;
}
.bba-question__asked[hidden] { display: none; }

/* 7. Attribution. On this surface it is always the same statement, so it is
   set quietly rather than as a badge — a chip would read as a warning, and
   "an AI wrote this and no one has checked it" is a fact about the answer,
   not an alarm about it. The published report replaces this line with the
   reviewer's byline. */
.bba-question__attribution {
  font-family: var(--bba-font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bba-faint);
  margin: 10px 0 18px;
}

.bba-question__checked {
  font-size: 12px;
  color: var(--bba-faint);
  margin-bottom: 10px;
}
.bba-question__checked[hidden] { display: none; }

/* Amber, not clay: an incomplete analysis is a caution about confidence, not
   a finding that something is false. Clay is reserved for credibility. */
.bba-question__degraded {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--bba-ink);
  background: rgba(168, 114, 42, 0.08);
  border: 1px solid rgba(168, 114, 42, 0.35);
  border-radius: 8px;
  padding: 9px 12px;
  margin-bottom: 12px;
}
.bba-question__degraded[hidden] { display: none; }
.bba-question__degraded strong { color: var(--bba-amber); margin-inline-end: 4px; }

.bba-question__answerbox { margin-bottom: 14px; }

.bba-question__answerrow {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
}

.bba-question__answer {
  font-family: var(--bba-font-display);
  font-size: 26px;
  font-weight: 600;
  color: var(--bba-ink);
}
.bba-question__answer--yes { color: var(--bba-green); }
.bba-question__answer--no { color: var(--bba-clay); }
.bba-question__answer--depends { color: var(--bba-amber); }
.bba-question__answer--contested { color: var(--bba-muted); }
.bba-question__answer--unproven { color: var(--bba-muted); }
.bba-question__answer--developing { color: var(--bba-blue); }

/* .bba-question__category lived here: the pill between the verdict word and
   the sentence. With it, a contested legal question said so three times —
   chip, pill, sentence — and a reader had to work out which one was the
   finding. Chip plus one sentence now. */

.bba-question__lede {
  font-size: 13.5px;
  color: var(--bba-secondary);
  line-height: 1.5;
}

.bba-question__credibility {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--bba-border-soft);
}
.bba-question__credibility[hidden] { display: none; }

/* The scorecard's track, inside the credibility row rather than stacked
   under it: the row is a baseline-aligned flex line, so the track takes the
   remaining width and loses the block margins it carries on the scorecard. */
.bba-question__track {
  flex: 1;
  height: 4px;
  margin: 0;
  align-self: center;
  min-width: 80px;
}

.bba-question__credvalue {
  font-family: var(--bba-font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--bba-ink);
}

.bba-question__credband {
  font-family: var(--bba-font-mono);
  font-size: 11px;
  color: var(--bba-muted);
}

.bba-question__segments { margin-bottom: 4px; }

.bba-question__segment {
  font-family: var(--bba-font-display);
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--bba-ink);
  margin: 0 0 14px;
}

.bba-question__ref {
  position: relative;
  font-family: var(--bba-font-mono);
  font-size: 10px;
  margin-inline-start: 1px;
}
.bba-question__ref a {
  color: var(--bba-secondary);
  text-decoration: none;
}
.bba-question__ref a:hover { text-decoration: underline; }

.bba-question__sources {
  list-style: none;
  margin: 0 0 4px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bba-question__sources[hidden] { display: none; }

.bba-question__source {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  padding: 6px 0;
  border-bottom: 1px solid var(--bba-border-soft);
}
.bba-question__source:last-child { border-bottom: none; }

.bba-question__source-num {
  font-family: var(--bba-font-mono);
  font-size: 11px;
  color: var(--bba-muted);
  flex: 0 0 auto;
  width: 16px;
}

.bba-question__source-title {
  color: var(--bba-ink);
  text-decoration: none;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}
a.bba-question__source-title:hover { text-decoration: underline; }

.bba-question__inconclusive-note {
  font-size: 12.5px;
  color: var(--bba-faint);
  font-style: italic;
  margin: 10px 0 0;
}
.bba-question__inconclusive-note[hidden] { display: none; }

/* Stance chip — small dot + label, used on the sources list and inside the
   superscript ref tooltip. */
.bba-stancechip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--bba-font-mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--bba-secondary);
  flex: 0 0 auto;
}
.bba-stancedot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.bba-stancedot--supports { background: var(--bba-green); }
.bba-stancedot--refutes { background: var(--bba-clay); }
.bba-stancedot--neutral { background: var(--bba-muted); }

.bba-laterdev-tag {
  font-family: var(--bba-font-mono);
  font-size: 9px;
  text-transform: uppercase;
  color: var(--bba-faint);
  border: 1px solid var(--bba-border-strong);
  border-radius: 4px;
  padding: 1px 5px;
}

/* Superscript ref tooltip — CSS-only reveal on :hover/:focus-within so it
   works the same for mouse hover and (via the browser's own tap-shows-
   focus-state behavior) touch, with zero change to the existing anchor's
   click/navigate behavior. */
.bba-question__ref-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  inset-inline-start: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
  max-width: 220px;
  background: var(--bba-ink);
  color: var(--bba-bg);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: var(--bba-font-ui);
  text-align: start;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s ease;
  z-index: 20;
  pointer-events: none;
}
.bba-question__ref:hover .bba-question__ref-tooltip,
.bba-question__ref:focus-within .bba-question__ref-tooltip {
  opacity: 1;
  visibility: visible;
}
.bba-question__ref-tooltip-title {
  font-size: 11px;
  line-height: 1.4;
  color: var(--bba-bg);
}
.bba-question__ref-tooltip .bba-stancechip,
.bba-question__ref-tooltip .bba-stancechip__label {
  color: var(--bba-bg);
}
.bba-question__ref-tooltip .bba-laterdev-tag {
  color: var(--bba-bg);
  border-color: rgba(255, 255, 255, 0.3);
}

/* "How this was decided" — collapsed-by-default trace timeline. */
.bba-question__trace {
  margin: 10px 0 14px;
  padding-top: 10px;
  border-top: 1px solid var(--bba-border-soft);
}
.bba-question__trace[hidden] { display: none; }

.bba-question__trace-summary {
  cursor: pointer;
  list-style: none;
  font-family: var(--bba-font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bba-faint);
}
.bba-question__trace-summary::-webkit-details-marker { display: none; }
.bba-question__trace-summary::before {
  content: '▸';
  display: inline-block;
  margin-inline-end: 6px;
  font-size: 9px;
}
.bba-question__trace[open] > .bba-question__trace-summary::before { content: '▾'; }

.bba-question__trace-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0 0 0 14px;
  border-inline-start: 1px solid var(--bba-border-mid);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bba-question__trace-item { position: relative; }
.bba-question__trace-item::before {
  content: '';
  position: absolute;
  inset-inline-start: -18px;
  top: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bba-border-max);
}

.bba-question__trace-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.bba-question__trace-stage {
  font-family: var(--bba-font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--bba-ink);
  text-transform: capitalize;
}

.bba-question__trace-time {
  font-family: var(--bba-font-mono);
  font-size: 10px;
  color: var(--bba-faint);
  flex: 0 0 auto;
  white-space: nowrap;
}

/* No .bba-question__trace-model rule: the backend strips `model`,
   `prompt_id` and `prompt_version` from every served trace entry by policy
   (app/trace_policy.py), so that row can never have content to style. */
.bba-question__trace-detail {
  font-size: 11.5px;
  color: var(--bba-body);
  margin-top: 3px;
  line-height: 1.5;
}

/* ==========================================================================
   Full report (2b) — mirrors the theme's .bb-report
   ========================================================================== */
.bba-report {
  background: var(--bba-bg);
  border: 1px solid var(--bba-border);
  border-radius: var(--bba-radius-lg);
  overflow: hidden;
  margin-top: 22px;
  animation: bba-card-in 0.3s ease-out;
  /* The report is a wide artifact (2b is a 1120px layout). Break out of
   * the 760px widget column symmetrically, clamped to the viewport. */
  width: min(1120px, calc(100vw - 40px));
  margin-inline-start: calc((100% - min(1120px, calc(100vw - 40px))) / 2);
}

@media (prefers-reduced-motion: reduce) {
  .bba-report { animation: none; }
}

.bba-report__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--bba-border-soft);
  flex-wrap: wrap;
}

.bba-report__topbar-meta {
  display: flex;
  gap: 14px;
  align-items: center;
}

.bba-report__topbar-id {
  font-family: var(--bba-font-mono);
  font-size: 11px;
  color: var(--bba-muted);
}

.bba-report__grid {
  display: grid;
  grid-template-columns: 1fr 300px;
}

.bba-report__main {
  padding: 26px 28px 32px;
  border-inline-end: 1px solid var(--bba-border-soft);
  min-width: 0;
}

.bba-report__source-pill {
  display: inline-block;
  background: var(--bba-bg);
  border: 1px solid var(--bba-border-strong);
  border-radius: var(--bba-radius-pill);
  padding: 5px 12px;
  margin-bottom: 14px;
  font-family: var(--bba-font-mono);
  font-size: 11px;
  color: var(--bba-body);
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.bba-report__source-pill[hidden] { display: none; }

.bba-report__title {
  font-family: var(--bba-font-display);
  font-size: 24px;
  line-height: 1.3;
  font-weight: 500;
  color: var(--bba-ink);
  margin: 0 0 8px;
}

.bba-report__title:focus { outline: none; }

.bba-report__metaline {
  font-family: var(--bba-font-mono);
  font-size: 10.5px;
  color: var(--bba-muted);
  margin-bottom: 18px;
}

.bba-report__provenance {
  background: #fbf6ec;
  border: 1px solid rgba(168, 114, 42, 0.3);
  border-radius: var(--bba-radius);
  padding: 13px 16px;
  margin-bottom: 18px;
  display: flex;
  gap: 12px;
  align-items: baseline;
  flex-wrap: wrap;
}

.bba-report__provenance[hidden] { display: none; }

.bba-report__provenance-label {
  font-family: var(--bba-font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bba-amber);
  flex: 0 0 auto;
}

.bba-report__provenance-text {
  font-size: 13px;
  line-height: 1.55;
  color: var(--bba-body);
}

.bba-report__score {
  margin-bottom: 22px;
}

.bba-report__score[hidden] { display: none; }

.bba-report__narrative {
  font-family: var(--bba-font-display);
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--bba-ink);
  margin-bottom: 22px;
  /* The verification route's report is plain text whose newlines are real
     paragraph breaks, so they have to survive. */
  white-space: pre-line;
}

/* …but a route block injected into that wrapper is MARKUP, not text, and
   inherited pre-line turned every newline in its template — including the
   comments — into a rendered line break. That was 33-138px of dead space
   between every block on the question route, which looked like a margin
   problem and was not: the margins were 8-18px throughout. */
.bba-report__narrative .bba-route {
  white-space: normal;
}

.bba-report__narrative a {
  color: var(--bba-ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}

.bba-ledger {
  border-top: 1px solid var(--bba-border-mid);
}

.bba-ledger-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--bba-border-soft);
  align-items: start;
}

.bba-ledger-row__quote {
  font-family: var(--bba-font-display);
  font-size: 14.5px;
  line-height: 1.4;
  color: var(--bba-ink);
  margin: 0 0 4px;
}

.bba-ledger-row__note {
  font-size: 12px;
  color: var(--bba-body);
  margin: 0;
}

.bba-ledger-row__verdict {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.bba-ledger-row__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 auto;
  /* background comes from the bba-fill--* tone class */
}

.bba-ledger-row__label {
  font-family: var(--bba-font-mono);
  font-size: 10.5px;
  font-weight: 600;
}

.bba-ledger-row__evidence {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bba-ledger-row__evidence[hidden] { display: none; }

.bba-evidence {
  border: 1px solid var(--bba-border-mid);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12px;
}

.bba-evidence__summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
}

.bba-evidence__summary::-webkit-details-marker { display: none; }

.bba-evidence__tier {
  font-family: var(--bba-font-mono);
  font-size: 9.5px;
  font-weight: 600;
  border: 1px solid var(--bba-border-strong);
  border-radius: 4px;
  padding: 1px 5px;
  flex: 0 0 auto;
  text-transform: uppercase;
}

.bba-tier--1 { color: var(--bba-ink); border-color: var(--bba-border-max); }
.bba-tier--2 { color: var(--bba-secondary); }
.bba-tier--3 { color: var(--bba-body); }
.bba-tier--4 { color: var(--bba-muted); }

.bba-evidence__title {
  color: var(--bba-ink);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}

.bba-evidence__stance {
  font-family: var(--bba-font-mono);
  font-size: 9.5px;
  text-transform: uppercase;
  flex: 0 0 auto;
}

.bba-stance--supports { color: var(--bba-green); }
.bba-stance--refutes { color: var(--bba-clay); }
.bba-stance--neutral { color: var(--bba-muted); }

.bba-evidence__body {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--bba-border-soft);
}

.bba-evidence__snippet {
  margin: 0 0 6px;
  line-height: 1.5;
  color: var(--bba-body);
}

.bba-evidence__link {
  color: var(--bba-ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}

/* ==========================================================================
   Report chat (margin panel)
   ========================================================================== */
.bba-report__aside {
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

/* The same panel outside the report grid, on a published fact-check. Two
   things only: the side padding goes, so the thread lines up with the report
   text it sits under instead of being indented by a column gutter that is no
   longer there; and min-height stops meaning "fill the grid row". Everything
   inside is untouched — same label, same thread, same input. */
.bba-report__aside--standalone {
  padding-inline: 0;
  min-height: 0;
}

.bba-chat__thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* Not flex: 1. In the report grid the aside is min-height: 100%, so a
     growing thread filled the full height of the report and pushed the note
     and input to the middle of the page — with an EMPTY thread, which is
     every first visit. It now takes the height of what is in it and the
     input stays under the label. max-height still caps a long one. */
  flex: 0 1 auto;
  overflow-y: auto;
  max-height: 420px;
}

.bba-chat__bubble--user {
  align-self: flex-end;
  background: var(--bba-panel);
  border-radius: 12px 12px 3px 12px;
  padding: 9px 13px;
  font-size: 13px;
  color: var(--bba-ink);
  max-width: 88%;
}

.bba-chat__bubble--assistant {
  font-size: 13px;
  line-height: 1.6;
  color: var(--bba-secondary);
}

.bba-chat__grounded {
  font-family: var(--bba-font-mono);
  font-size: 9.5px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--bba-faintest);
  margin: 14px 0 8px;
}

/* A background answer is real information the reader asked for, so it is not
   styled as a warning — but it is not part of the verified finding either, so
   it does not get to look identical to one. A left rule and a label. */
.bba-chat__bubble--background {
  border-inline-start: 2px solid var(--bba-border-strong);
  padding-inline-start: 9px;
}

.bba-chat__basis {
  display: block;
  margin-top: 6px;
  font-family: var(--bba-font-mono);
  font-size: 9.5px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--bba-faintest);
}

/* The service is down. Amber, not clay: nothing about the report is in doubt,
   the follow-up just could not run. */
.bba-chat__bubble--error {
  color: var(--bba-amber);
}

/* An answer about a link the reader just pasted. Same left rule as a
   background answer, for the same reason: it is real information, it is not
   part of the verified record, and it must not be able to pass for one. */
.bba-chat__bubble--source {
  border-inline-start: 2px solid var(--bba-border-strong);
  padding-inline-start: 9px;
}


.bba-chat__form { margin: 0; }

.bba-chat__input {
  width: 100%;
  background: var(--bba-bg);
  border: 1px solid var(--bba-border-max);
  border-radius: var(--bba-radius);
  padding: 10px 13px;
  font-family: inherit;
  font-size: 13px;
  color: var(--bba-ink);
}

.bba-chat__input::placeholder { color: var(--bba-muted); }

.bba-chat__input:focus {
  outline: none;
  border-color: var(--bba-ink);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 760px) {
  .bba-report__grid { grid-template-columns: 1fr; }

  .bba-report__main {
    border-inline-end: none;
    border-bottom: 1px solid var(--bba-border-soft);
    padding: 20px;
  }

  .bba-report__aside { padding: 20px; }
}

@media (max-width: 420px) {
  .bba-stage { font-size: 9.5px; }

  .bba-card { padding: 18px; }

  .bba-scorecard__value { font-size: 28px; }

  .bba-dim-row__label { width: 104px; font-size: 11.5px; }

  .bba-ledger-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .bba-report__title { font-size: 20px; }
}

/* ==========================================================================
   RTL
   ========================================================================== */
.bba-widget[dir="rtl"] .bba-chat__bubble--user {
  border-radius: 12px 12px 12px 3px;
}
