/* Confidence visualisation — tool-specific styles.
 * The shared design system in /style.css handles header, palette, layout.
 * This file does: the prompt picker, the typed-out fabricated answer with
 * per-token confidence colouring, the confidence legend, the reveal callout,
 * and the explainer.
 * Colours come from the shared CSS variables — never hard-coded.
 */

[hidden] { display: none !important; }

/* ── per-audience subtitle (swaps with the audience chip) ───── */
.aud-subtitle {
  font-size: 17px;
  line-height: 1.5;
  font-weight: 500;
  color: var(--text);
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  padding: 10px 16px;
  border-radius: 0 8px 8px 0;
  margin: 0 0 22px;
  max-width: 760px;
}
.aud-subtitle:empty { display: none; }
@media (max-width: 640px) { .aud-subtitle { font-size: 15px; } }

.loading {
  color: var(--text-dim);
  font-style: italic;
  font-family: var(--font-mono);
  font-size: 13px;
}

/* ── illustrative-data note ────────────────────────────────── */

.data-note {
  font-size: 12px;
  color: var(--text-dim);
  background: var(--accent-soft);
  border: 1px dashed rgba(245, 166, 35, 0.35);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 0 0 18px;
  line-height: 1.5;
}
.data-note strong { color: var(--accent); }

/* ── live-model control bar ────────────────────────────────── */

.live-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 18px;
}
.btn-live {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-live:hover:not(:disabled) { background: var(--accent); color: var(--bg); }
.btn-live:disabled { opacity: 0.6; cursor: progress; }
.btn-live .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  flex: none;
  transition: background 0.2s ease;
}
.btn-live.loading .dot {
  background: var(--accent);
  animation: live-pulse 1s ease-in-out infinite;
}
.btn-live.on { background: var(--green); color: var(--bg); border-color: var(--green); }
.btn-live.on .dot { background: var(--bg); animation: none; }
@keyframes live-pulse { 50% { opacity: 0.3; } }

.live-note {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
}
.live-status {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--accent);
}
.live-status.ok { color: var(--green); }
.live-status.warn { color: var(--yellow); }
.live-status.err { color: var(--red); }

.data-note.is-live {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.4);
}
.data-note.is-live strong { color: var(--green); }

/* ── prompt picker ─────────────────────────────────────────── */

.prompt-picker {
  margin-bottom: 16px;
}
.prompt-picker .label {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.prompt-picker .chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.prompt-picker .pchip {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}
.prompt-picker .pchip:hover {
  color: var(--text);
  border-color: var(--accent);
  border-style: solid;
}
.prompt-picker .pchip.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  border-style: solid;
  color: var(--accent);
}

/* ── the answer stage ──────────────────────────────────────── */

.answer-stage {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 24px;
  margin-bottom: 16px;
}
.answer-stage .as-kicker {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-bottom: 12px;
}
.answer-stage .as-prompt {
  font-family: var(--font-mono);
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
}
.answer-stage .as-answer {
  font-family: var(--font-mono);
  font-size: 17px;
  line-height: 2.1;
  display: inline;
}

/* per-token chip: background tinted by confidence, set inline by JS */
.ctok {
  display: inline;
  padding: 2px 3px;
  border-radius: 4px;
  border-bottom: 2px solid transparent;
  white-space: pre;
  transition: background 0.2s ease;
}
.ctok.appear {
  animation: tokIn 0.18s ease;
}
@keyframes tokIn {
  from { opacity: 0; transform: translateY(2px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* tooltip on hover — show the confidence number */
.ctok[data-conf]:hover::after {
  content: attr(data-conf);
  position: absolute;
  transform: translate(-50%, -130%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 5;
}
.ctok { position: relative; }

.as-cursor {
  display: inline-block;
  color: var(--accent);
  animation: blink 1.1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ── action row ────────────────────────────────────────────── */

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}
.btn-replay {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-replay:hover { color: var(--text); border-color: var(--text-muted); }

/* ── confidence legend ─────────────────────────────────────── */

.conf-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--text-muted);
}
.conf-legend .lg-label {
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-size: 11px;
}
.conf-legend .lg-bar {
  flex: 1;
  min-width: 160px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg,
    #ef4444 0%, #f97316 25%, #eab308 50%, #84cc16 75%, #22c55e 100%);
}
.conf-legend .lg-ends {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font-mono);
}
.conf-legend .lg-low { color: var(--red); }
.conf-legend .lg-high { color: var(--green); }

/* ── reveal callout ────────────────────────────────────────── */

.reveal-callout {
  margin-bottom: 18px;
  padding: 18px 20px;
  background: rgba(239, 68, 68, 0.07);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-left: 3px solid var(--red);
  border-radius: 10px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.reveal-callout.show { opacity: 1; transform: translateY(0); }
.reveal-callout .rc-kicker {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--red);
  font-family: var(--font-mono);
  font-weight: 600;
  margin-bottom: 8px;
}
.reveal-callout h3 {
  margin: 0 0 10px;
  font-size: 18px;
  color: var(--text);
  font-weight: 600;
  line-height: 1.35;
}
.reveal-callout .rc-why {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-muted);
}
.reveal-callout .rc-fact {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}
.reveal-callout .rc-fact strong { color: var(--accent); }
.reveal-callout .rc-punch {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  font-weight: 600;
}
.reveal-callout .rc-punch .green { color: var(--green); }
.reveal-callout .rc-punch .red { color: var(--red); }

/* ── explainer (collapsible) — matches tokenizer convention ── */

.explainer {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 22px;
  margin-top: 22px;
}
.explainer summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  color: var(--accent);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.explainer summary::before {
  content: "▸";
  display: inline-block;
  transition: transform 0.15s ease;
  color: var(--text-muted);
  font-size: 12px;
}
.explainer[open] summary::before { transform: rotate(90deg); }
.explainer .body {
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.65;
}
.explainer .body h3 {
  color: var(--text);
  margin: 18px 0 6px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.explainer .body p { margin: 0 0 10px; }
.explainer .body code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--accent);
}
