/* ─────────────────────────────────────────────────────────────────────────
   Vey · pixel-map frontend

   Consumer map chrome, in the Apple Maps / Mapbox idiom: near-opaque white
   cards floating on soft diffuse shadows, generous padding, one blue accent,
   black text. Cards are opaque rather than glassy on purpose — that is what
   keeps light chrome legible over bright satellite imagery.

   Type follows the Apple HIG scale; space follows a 4px step. Values come
   from the scales in :root.
   ───────────────────────────────────────────────────────────────────────── */
:root {
  /* ── space ── 4px step ────────────────────────────────────────────────── */
  --s-1:  4px;
  --s-2:  8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 32px;
  --s-8: 40px;

  /* ── radius ── generous and consistent, no per-component decisions ────── */
  --r-sm:   10px;
  --r-md:   14px;
  --r-lg:   18px;
  --r-xl:   22px;
  --r-full: 999px;

  /* ── type ── Apple HIG scale ──────────────────────────────────────────── */
  --fs-caption2: 11px;
  --fs-caption:  12px;
  --fs-footnote: 13px;
  --fs-subhead:  15px;
  --fs-callout:  16px;
  --fs-body:     17px;
  --fs-title3:   20px;
  --fs-title2:   22px;
  --fs-title1:   28px;
  --fs-large:    34px;
  --fs-display:  52px;   /* the number the whole app exists to show */

  --lh-flat:  1;
  --lh-tight: 1.25;
  --lh-body:  1.45;

  --fw-reg:  400;
  --fw-med:  500;
  --fw-semi: 600;
  --fw-bold: 700;

  --tr-tight: -.02em;   /* large text optically tightens */
  --tr-label: .06em;    /* the few uppercase labels */

  /* ── control sizing ───────────────────────────────────────────────────── */
  --ctl:    46px;
  --ctl-sm: 40px;
  --icon:   20px;
  --stroke: 1.9;
  --hair:   1px;
  --panel-w: 440px;   /* the top-right instruments and the timeline share one width and right edge */

  /* ── color ────────────────────────────────────────────────────────────── */
  --card:      rgba(255, 255, 255, 0.96);
  --card-thin: rgba(255, 255, 255, 0.92);
  --ink:       #000000;
  --ink-2:     rgba(0, 0, 0, 0.56);   /* secondary */
  --ink-3:     rgba(0, 0, 0, 0.32);   /* tertiary / placeholder */
  --sep:       rgba(0, 0, 0, 0.10);   /* hairline separators */
  --bubble-line: #141414;             /* speech outline, matching the in-map bubbles */
  --fill:      rgba(0, 0, 0, 0.045);  /* inset wells, track backgrounds */
  --fill-hi:   rgba(0, 0, 0, 0.08);

  --accent:  #007aff;
  --yes:     #34c759;
  --no:      #ff3b30;
  --ab-a:    #007aff;
  --ab-b:    #34c759;
  --water:   #aecbdc;

  /* ── elevation ── soft, diffuse, layered; never a hard drop shadow ────── */
  --sh-1: 0 1px 2px rgba(0, 0, 0, .10), 0 4px 12px rgba(0, 0, 0, .10);
  --sh-2: 0 1px 3px rgba(0, 0, 0, .10), 0 8px 24px rgba(0, 0, 0, .14);
  --sh-3: 0 2px 6px rgba(0, 0, 0, .10), 0 16px 48px rgba(0, 0, 0, .20);

  --t-fast: .12s; --t: .18s; --t-mid: .24s;
  --ease: cubic-bezier(.32, .72, 0, 1);   /* the iOS-ish ease */

  --font: "neue-haas-grotesk-display", -apple-system, BlinkMacSystemFont,
          "SF Pro Text", "Segoe UI", Helvetica, Arial, sans-serif;
  --nums: tabular-nums lining-nums;
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: var(--font);
  font-size: var(--fs-subhead);
  font-weight: var(--fw-reg);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--water);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* one focus ring, everywhere */
.ask:focus-visible, .btn:focus-visible, .info-btn:focus-visible,
.about-close:focus-visible, .char-close:focus-visible, .ab-form textarea:focus-visible,
.filter-form input:focus-visible, .filter-form select:focus-visible,
.title-btn:focus-visible, .title-option:focus-visible, .res-example:focus-visible,
.news-bubble:focus-visible, .return:focus-visible {
  outline: var(--rule, 2px) solid var(--accent);
  outline-offset: 2px;
}

/* one scrollbar, everywhere */
.title-menu, .result-card, .about, .news-bubble, .ask-input {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, .22) transparent;
}
.title-menu::-webkit-scrollbar, .result-card::-webkit-scrollbar,
.about::-webkit-scrollbar, .news-bubble::-webkit-scrollbar { width: var(--s-2); }
.title-menu::-webkit-scrollbar-thumb, .result-card::-webkit-scrollbar-thumb,
.about::-webkit-scrollbar-thumb, .news-bubble::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, .20); border-radius: var(--r-full);
  border: 2px solid transparent; background-clip: content-box;
}

#map { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; cursor: grab; }
#map:active { cursor: grabbing; }

#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }

/* The map is the subject. No grid overlay, no vignette, no survey marks — a
   clean consumer map shows the map, and the cards carry their own contrast. */
.map-atmosphere, .map-grid, .map-coordinates { display: none !important; }

.hidden { display: none !important; }

/* ── shared card ──────────────────────────────────────────────────────── */
.title, .status, .summary, .ask, .result-card, .toast, .return,
.title-menu, .news-bubble, .char-card, .info-btn, .about, .audience-card {
  background: var(--card);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  backdrop-filter: saturate(1.6) blur(12px);
  border: none;
  color: var(--ink);
}

/* ── title / city switcher (top-left) ─────────────────────────────────── */
.title-select {
  position: absolute; top: var(--s-5); left: var(--s-5); z-index: 20;
  max-width: min(440px, calc(100vw - var(--s-8)));
}
.title {
  font-size: var(--fs-title2); font-weight: var(--fw-bold);
  letter-spacing: var(--tr-tight); line-height: var(--lh-flat);
  padding: var(--s-3) var(--s-4); border-radius: var(--r-md);
  box-shadow: var(--sh-1); user-select: none;
}
.title-btn {
  display: inline-flex; align-items: center; gap: var(--s-3); max-width: 100%;
  cursor: pointer; text-align: left; appearance: none;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t) var(--ease);
}
.title-lockup { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.title-kicker {
  font-size: var(--fs-caption2); font-weight: var(--fw-semi);
  letter-spacing: var(--tr-label); text-transform: uppercase;
  color: var(--ink-3); line-height: var(--lh-flat);
}
.title-btn:hover { transform: translateY(-1px); box-shadow: var(--sh-2); }
.title-btn:active { transform: translateY(0); }
.title-current { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title-caret { flex: none; width: var(--icon); height: var(--icon); color: var(--ink-3); transition: transform var(--t-mid) var(--ease); }
.title-btn[aria-expanded="true"] .title-caret { transform: rotate(180deg); }
.title-btn:disabled { cursor: default; }
.title-btn:disabled:hover { transform: none; box-shadow: var(--sh-1); }

.title-menu {
  margin-top: var(--s-2); display: flex; flex-direction: column;
  padding: var(--s-2); border-radius: var(--r-md);
  box-shadow: var(--sh-2);
  animation: rise var(--t-mid) var(--ease);
  max-height: min(60vh, 440px); overflow-y: auto;
}
.title-option {
  position: relative;
  font-family: var(--font); font-size: var(--fs-callout); font-weight: var(--fw-med);
  line-height: var(--lh-flat); color: var(--ink);
  text-align: left; white-space: nowrap; cursor: pointer; appearance: none;
  padding: var(--s-3); border-radius: var(--r-sm);
  border: none; background: transparent;
  transition: background var(--t) var(--ease);
}
.title-option:hover { background: var(--fill); }
.title-option[aria-selected="true"] { color: var(--accent); font-weight: var(--fw-semi); }
/* the selected city gets a checkmark, the way a list row does on iOS */
.title-option[aria-selected="true"]::after {
  content: "✓"; float: right; margin-left: var(--s-4); font-weight: var(--fw-bold);
}
.title-option:disabled { color: var(--ink-3); cursor: default; }

/* ── status (top-right) ───────────────────────────────────────────────── */
.status {
  position: absolute; top: var(--s-5); right: var(--s-5);
  width: min(var(--panel-w), 78vw);
  font-size: var(--fs-subhead); font-weight: var(--fw-semi);
  line-height: var(--lh-tight); font-variant-numeric: var(--nums);
  padding: var(--s-3) var(--s-4) var(--s-3) var(--s-7);
  border-radius: var(--r-md); box-shadow: var(--sh-1);
  white-space: normal; overflow-wrap: anywhere;
}
.status::before {
  content: ""; position: absolute; left: var(--s-4); top: var(--s-4);
  width: var(--s-2); height: var(--s-2); border-radius: 50%;
  background: var(--yes);
  animation: live-pulse 2.4s ease-in-out infinite;
}
@keyframes live-pulse { 50% { opacity: .35; } }
.status.is-loading::before {
  background: transparent; border: 2px solid var(--sep); border-top-color: var(--accent);
  width: 10px; height: 10px; box-sizing: border-box;
  animation: spin .8s linear infinite;
}
@media (prefers-reduced-motion: reduce) { .status.is-loading::before { animation: none; } }
.status .status-clock {
  display: block; margin-top: 3px;
  font-size: var(--fs-footnote); font-weight: var(--fw-reg); color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.status--audience { white-space: normal; padding: var(--s-4); overflow-wrap: anywhere; }
.status--audience::before { display: none; }
.status-audience-label {
  display: block; font-size: var(--fs-caption2); font-weight: var(--fw-semi);
  letter-spacing: var(--tr-label); text-transform: uppercase; color: #0064d2;
}
.status-persona { display: block; margin-top: var(--s-1); font-size: var(--fs-title3); line-height: var(--lh-tight); }
.status-persona-detail { display: block; margin-top: 3px; font-size: var(--fs-footnote); font-weight: var(--fw-reg); color: var(--ink-2); }
.status-sample { display: block; margin-top: var(--s-2); font-size: var(--fs-caption); font-weight: var(--fw-med); }

/* ── news (below status) ──────────────────────────────────────────────── */
.news-bubble {
  position: absolute; top: var(--context-bottom, 92px); right: var(--s-5);
  width: min(var(--panel-w), 64vw);
  display: flex; flex-direction: column; gap: var(--s-2);
  font-size: var(--fs-footnote); line-height: var(--lh-tight); color: var(--ink-2);
  padding: var(--s-4); border-radius: var(--r-md);
  box-shadow: var(--sh-1); cursor: pointer;
  transition: box-shadow var(--t) var(--ease);
}
.news-bubble:hover { box-shadow: var(--sh-2); }
.news-bubble .news-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  font-size: var(--fs-caption2); font-weight: var(--fw-semi);
  letter-spacing: var(--tr-label); text-transform: uppercase; color: var(--ink-3);
}
.news-bubble .news-toggle { flex: none; width: var(--icon); height: var(--icon); color: var(--ink-3); transition: transform var(--t-mid) var(--ease); }
.news-bubble[data-expanded="true"] .news-toggle { transform: rotate(180deg); }
.news-bubble .news-item { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.news-bubble[data-expanded="true"] {
  width: min(440px, 78vw); gap: 0;
  max-height: min(70vh, 540px); overflow-y: auto; box-shadow: var(--sh-2);
}
.news-bubble .news-art {
  display: flex; flex-direction: column; gap: 3px;
  padding: var(--s-3) 0; border-top: var(--hair) solid var(--sep);
}
.news-bubble .news-art:first-of-type { border-top: none; }
.news-bubble .news-art-date {
  font-size: var(--fs-caption2); font-weight: var(--fw-semi);
  letter-spacing: var(--tr-label); text-transform: uppercase; color: var(--ink-3);
}
.news-bubble .news-art-head { font-size: var(--fs-footnote); font-weight: var(--fw-semi); color: var(--ink); line-height: var(--lh-tight); }
.news-bubble .news-art-sum { font-size: var(--fs-caption); line-height: var(--lh-body); color: var(--ink-2); }

/* ── boot progress ────────────────────────────────────────────────────── */
.boot { position: absolute; top: var(--context-bottom, 92px); right: var(--s-5); width: min(var(--panel-w), 64vw); pointer-events: none; }
.boot-track {
  height: var(--s-1); border-radius: var(--r-full); overflow: hidden;
  background: rgba(255, 255, 255, .7); box-shadow: var(--sh-1);
}
.boot-fill { height: 100%; width: 5%; border-radius: var(--r-full); background: var(--accent); transition: width .35s var(--ease); }

/* ── return to overview ───────────────────────────────────────────────── */
.return {
  position: absolute; top: 92px; left: var(--s-5);
  display: flex; align-items: center; gap: var(--s-2);
  font-size: var(--fs-subhead); font-weight: var(--fw-semi); color: var(--accent);
  line-height: var(--lh-flat);
  padding: var(--s-3) var(--s-4); border-radius: var(--r-full);
  cursor: pointer; box-shadow: var(--sh-1);
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t) var(--ease);
}
.return:hover { transform: translateY(-1px); box-shadow: var(--sh-2); }
.return:active { transform: translateY(0); }
.return svg { width: var(--icon); height: var(--icon); }
.return svg [stroke] { stroke-width: var(--stroke); }

/* ── loading summary ──────────────────────────────────────────────────── */
.summary {
  width: min(430px, 92vw);
  border-radius: var(--r-lg); padding: var(--s-5);
  box-shadow: var(--sh-2); animation: rise var(--t-mid) var(--ease);
}
@keyframes rise { from { opacity: 0; transform: translateY(var(--s-2)) scale(.98); } to { opacity: 1; transform: none; } }
.summary-label {
  font-size: var(--fs-caption2); font-weight: var(--fw-semi);
  letter-spacing: var(--tr-label); text-transform: uppercase;
  color: var(--ink-3); margin-bottom: var(--s-2);
}
.summary-text { font-size: var(--fs-callout); font-weight: var(--fw-reg); line-height: var(--lh-tight); }

.progress { margin-top: var(--s-4); }
.progress-track { height: var(--s-1); border-radius: var(--r-full); background: var(--fill); overflow: hidden; }
.progress-fill { height: 100%; width: 0%; border-radius: var(--r-full); background: var(--accent); transition: width var(--t) var(--ease); }
.progress-label { margin-top: var(--s-2); font-size: var(--fs-footnote); color: var(--ink-2); font-variant-numeric: var(--nums); }
.progress.indeterminate .progress-fill { width: 38% !important; transition: none; animation: indet 1s ease-in-out infinite; }
@keyframes indet { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }

/* ── dock ──
   Apple Maps keeps its search field and its round controls as separate
   floating pieces rather than one welded bar. Same here. */
.dock {
  position: absolute; left: 50%; bottom: var(--s-6);
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: var(--s-3);
  width: max-content; max-width: 94vw;
}
.dock-row { display: flex; align-items: center; gap: var(--s-2); }
.dock-tools { flex: none; display: flex; align-items: center; gap: var(--s-2); }
.dock-tools--balance { justify-content: flex-start; }
/* invisible counterweight keeps the field optically centred in the row */
.dock-tool-spacer { flex: none; width: var(--ctl); height: var(--hair); }

.ask {
  display: flex; flex-direction: column; gap: var(--s-3);
  min-height: var(--ctl); padding: var(--s-2) var(--s-3) var(--s-2) var(--s-2);
  width: max-content; max-width: 90vw;
  border-radius: var(--r-full);
  cursor: text; overflow: hidden;
  box-shadow: var(--sh-2);
  transition: width var(--t-mid) var(--ease), box-shadow var(--t) var(--ease);
}
.ask-head { display: flex; align-items: center; padding: 2px 0 0 2px; }
.ask-main { display: flex; align-items: center; gap: var(--s-2); min-height: calc(var(--ctl) - 2 * var(--s-2)); }
/* who gets asked: a chip at the head of the box, blue when a filter is on */
.audience-chip {
  border: 1.5px solid var(--accent); flex: none; display: inline-flex; align-items: center; gap: 7px;
  max-width: 300px; height: 38px; padding: 0 12px 0 12px;
  border-radius: var(--r-full); background: #fff; color: var(--accent);
  font-family: var(--font); font-size: var(--fs-footnote); font-weight: var(--fw-semi); line-height: 1;
  cursor: pointer; transition: background var(--t) var(--ease), color var(--t) var(--ease);
}
.audience-chip svg { flex: none; }
.audience-chip svg [stroke] { stroke-width: 2.2; }
.audience-chip-kicker { font-weight: var(--fw-reg); color: var(--ink-3); }
.audience-chip #audience-chip-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audience-chip:hover { background: #edf5ff; }
.audience-chip[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.audience-chip[aria-pressed="true"] .audience-chip-kicker { color: rgba(255,255,255,.75); }
.audience-chip[aria-pressed="true"]:hover { background: #0069db; }
.audience-chip:disabled { opacity: .5; cursor: default; }
.audience-chip-count {
  flex: none; padding: 2px 6px; border-radius: var(--r-full);
  background: #fff; color: var(--accent); font-size: var(--fs-caption2); font-weight: var(--fw-semi);
  font-variant-numeric: var(--nums);
}
/* the send action: a round accent button, same footprint as the dock icons */
.ask-send {
  border: 0; flex: none; display: none; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: #fff; cursor: pointer;
  transition: transform var(--t-fast) var(--ease), background var(--t) var(--ease);
}
.ask-send:hover { background: #0069db; transform: translateY(-1px); }
.ask-send:active { transform: scale(.96); }
.ask-send:disabled { background: var(--fill-hi); color: var(--ink-3); cursor: default; transform: none; }
.ask-send svg [stroke] { stroke-width: 2; }
/* question type + extra fields, only while composing */
.ask-extra { display: none; flex-direction: column; gap: var(--s-2); padding: 0 var(--s-2) var(--s-1); }
.ask-modes { display: flex; gap: var(--s-1); }
.ask-mode {
  border: 0; padding: 5px 11px; border-radius: var(--r-full);
  background: transparent; color: var(--ink-2);
  font-family: var(--font); font-size: var(--fs-footnote); font-weight: var(--fw-med); line-height: 1;
  cursor: pointer; transition: background var(--t) var(--ease), color var(--t) var(--ease);
}
.ask-mode:hover { background: var(--fill); color: var(--ink); }
.ask-mode[aria-checked="true"] { background: var(--ink); color: #fff; }
.ask-fields { display: grid; gap: var(--s-2); max-height: 320px; overflow: hidden; opacity: 1; transition: max-height var(--t-mid) var(--ease), opacity var(--t-mid) var(--ease), margin var(--t-mid) var(--ease); }
.ask-fields[hidden] { display: grid; max-height: 0; opacity: 0; margin-top: calc(-1 * var(--s-2)); pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .ask-fields { transition: none; } }
.ask-field {
  width: 100%; resize: vertical; min-height: 44px; max-height: 22vh;
  border: none; border-radius: var(--r-md); padding: var(--s-2) var(--s-3);
  background: var(--fill); color: var(--ink); caret-color: var(--accent);
  font: var(--fw-reg) var(--fs-subhead)/var(--lh-body) var(--font);
}
.ask-field::placeholder { color: var(--ink-3); }
.ask-field:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.ask-field:disabled { opacity: .6; }
.ask-error { min-height: 0; color: var(--no); font-size: var(--fs-footnote); line-height: var(--lh-tight); }
.ask-error:empty { display: none; }
.ask[aria-busy="true"] .ask-input { opacity: .6; }
.ask-search { flex: none; width: var(--icon); height: var(--icon); color: var(--ink-3); }
.ask-search [stroke] { stroke-width: var(--stroke); }
.ask-label { font-size: var(--fs-callout); font-weight: var(--fw-reg); color: var(--ink-3); white-space: nowrap; user-select: none; }
.ask-input {
  flex: 1 1 0; width: 0; min-width: 0;
  border: none; background: transparent; outline: none; resize: none;
  font-family: var(--font); font-size: var(--fs-callout); font-weight: var(--fw-reg);
  line-height: var(--s-6); color: var(--ink); caret-color: var(--accent);
  opacity: 0; pointer-events: none;
  height: var(--s-6); max-height: 40vh; overflow-y: hidden; overscroll-behavior: contain;
  padding: 0; margin: 0;
}
.ask-input::placeholder { color: var(--ink-3); }
.ask-enter {
  flex: none; opacity: 0;
  font-family: var(--font); font-size: var(--fs-caption); font-weight: var(--fw-med); color: var(--ink-3);
  border-radius: var(--r-sm); padding: 2px var(--s-2); background: var(--fill);
}
/* idle: the full composer is visible before the first click — audience chip, a
   large placeholder field, and the send button — so the controls are discoverable.
   A tap anywhere in the box opens it for typing (the mode row appears then). */
.ask[data-state="idle"] { width: min(620px, 90vw); border-radius: var(--r-xl); }
.ask[data-state="idle"] .ask-enter, .ask[data-state="idle"] .ask-search, .ask[data-state="idle"] .ask-label { display: none; }
.ask[data-state="idle"] .ask-input { display: block; opacity: 1; pointer-events: auto; margin-top: 4px; }
.ask[data-state="idle"] .ask-main { align-items: flex-start; }
.ask[data-state="idle"] .ask-extra { display: flex; }
.ask[data-state="idle"] .audience-chip { display: inline-flex; }
.ask[data-state="idle"] .ask-head, .ask[data-state="input"] .ask-head { display: flex; }
.ask[data-state="busy"] .ask-head { display: none; }
.ask { gap: var(--s-2); }
.ask[data-state="idle"] .ask-send { display: flex; }
.ask[data-state="input"] { width: min(620px, 90vw); border-radius: var(--r-xl); }
.ask[data-state="input"] .ask-main { align-items: flex-start; }
.ask[data-state="input"] .ask-label, .ask[data-state="input"] .ask-search { display: none; }
.ask[data-state="input"] .ask-input { opacity: 1; pointer-events: auto; margin-top: 4px; }
.ask[data-state="input"] .ask-send { display: flex; }
.ask[data-state="input"] .ask-extra { display: flex; }
.ask[data-state="busy"] { cursor: default; }
.ask[data-state="busy"] .ask-input, .ask[data-state="busy"] .ask-enter, .ask[data-state="busy"] .audience-chip { display: none; }
.ask[data-state="busy"] .ask-search { display: block; color: var(--accent); animation: spin 1.6s linear infinite; margin-left: var(--s-2); }
.ask[data-state="busy"] .ask-label { color: var(--ink); padding-right: var(--s-3); }

/* audience confirmation: a small card in the dock, same chrome as the rest */
.audience-card {
  width: min(420px, 92vw); padding: var(--s-4) var(--s-5);
  border-radius: var(--r-lg); box-shadow: var(--sh-2);
  display: grid; grid-template-columns: 1fr auto; column-gap: var(--s-4); align-items: center;
  animation: rise var(--t-mid) var(--ease);
}
.audience-card-kicker {
  grid-column: 1; font-size: var(--fs-caption2); font-weight: var(--fw-semi);
  letter-spacing: var(--tr-label); text-transform: uppercase; color: var(--ink-3);
}
.audience-card-title { grid-column: 1; margin-top: 2px; font-size: var(--fs-subhead); font-weight: var(--fw-semi); line-height: var(--lh-tight); }
.audience-card-meta { grid-column: 1; margin-top: 2px; font-size: var(--fs-footnote); color: var(--ink-2); }
.audience-card .btn { grid-column: 2; grid-row: 1 / span 3; }
@keyframes spin { to { transform: rotate(360deg); } }

.info-btn {
  flex: none; width: var(--ctl); height: var(--ctl); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font); font-size: var(--fs-body); font-weight: var(--fw-med);
  line-height: var(--lh-flat); color: var(--accent);
  cursor: pointer; box-shadow: var(--sh-2);
  transition: transform var(--t-fast) var(--ease), background var(--t) var(--ease);
}
.info-btn:hover { background: #fff; transform: translateY(-1px); }
.info-btn:active { transform: translateY(0) scale(.96); background: var(--fill); }
.info-btn:disabled { opacity: .45; cursor: default; transform: none; }
.info-btn svg { width: var(--icon); height: var(--icon); }
.info-btn svg [stroke] { stroke-width: var(--stroke); }
.ab-btn { font-size: var(--fs-footnote); font-weight: var(--fw-bold); }
.marketing-btn svg { pointer-events: none; }
.filter-btn { position: relative; }
.filter-btn svg { pointer-events: none; }
.filter-btn[aria-pressed="true"] { background: var(--accent); color: #fff; }
.filter-btn[aria-pressed="true"]:hover { background: #0069db; }
.filter-count {
  position: absolute; top: -4px; right: -4px;
  min-width: 18px; height: 18px; padding: 0 5px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff; border-radius: var(--r-full);
  background: var(--ink); color: #fff;
  font-size: 10px; font-weight: var(--fw-bold); line-height: 1;
  font-variant-numeric: var(--nums);
}

/* ── result card ──────────────────────────────────────────────────────── */
.result-card {
  width: min(520px, 92vw);
  border-radius: var(--r-lg); padding: var(--s-5);
  box-shadow: var(--sh-3);
  animation: rise var(--t-mid) var(--ease);
  max-height: calc(100vh - 160px); overflow-y: auto; overscroll-behavior: contain;
}
.res-audience { margin-bottom: var(--s-4); padding-bottom: var(--s-4); border-bottom: var(--hair) solid var(--sep); }
.audience-eyebrow {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2);
  font-size: var(--fs-caption2); font-weight: var(--fw-semi); letter-spacing: var(--tr-label);
  text-transform: uppercase; color: #0064d2;
}
.audience-eyebrow { padding-right: 44px; } /* keep clear of the card close button */
.audience-badge { padding: 3px 8px; border-radius: var(--r-full); background: #edf5ff; letter-spacing: 0; text-transform: none; }
.audience-title { margin: var(--s-2) 0 0; font-size: var(--fs-title2); font-weight: var(--fw-bold); line-height: var(--lh-tight); letter-spacing: var(--tr-tight); }
.audience-qualification { margin: 4px 0 0; font-size: var(--fs-subhead); font-weight: var(--fw-med); }
.audience-location { margin: 4px 0 0; font-size: var(--fs-footnote); color: var(--ink-2); overflow-wrap: anywhere; }
.audience-sample {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4);
  margin-top: var(--s-3); padding: var(--s-3); border-radius: var(--r-sm); background: var(--fill);
}
.audience-sample > div + div { padding-left: var(--s-4); border-left: var(--hair) solid var(--sep); }
.audience-sample strong { display: block; font-size: var(--fs-title3); font-weight: var(--fw-semi); line-height: var(--lh-tight); font-variant-numeric: var(--nums); }
.audience-sample span { display: block; margin-top: 3px; font-size: var(--fs-caption); line-height: var(--lh-tight); color: var(--ink-2); }
.audience-basis { margin: var(--s-2) 0 0; font-size: var(--fs-caption); line-height: var(--lh-body); color: var(--ink-2); }
.audience-basis--limited { padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); background: #fff5e5; color: #835317; }
.res-scope { margin-top: var(--s-3); font-size: var(--fs-caption); font-weight: var(--fw-med); color: var(--ink-2); }
.summary-audience { margin-top: var(--s-2); font-size: var(--fs-caption); color: var(--ink-2); line-height: var(--lh-body); }
.res-q { font-size: var(--fs-footnote); color: var(--ink-2); line-height: var(--lh-body); }
.res-headline { display: flex; align-items: baseline; gap: var(--s-3); margin: var(--s-4) 0; }
.res-pct {
  font-size: var(--fs-display); font-weight: var(--fw-bold); line-height: var(--lh-flat);
  letter-spacing: var(--tr-tight); font-variant-numeric: var(--nums);
}
.res-pct-sym { font-size: var(--fs-title2); font-weight: var(--fw-semi); color: var(--ink-3); }
.res-verb { font-size: var(--fs-footnote); font-weight: var(--fw-semi); color: var(--ink-2); }
.res-bar { display: flex; height: var(--s-2); border-radius: var(--r-full); overflow: hidden; background: var(--fill); }
.res-bar-yes { background: var(--yes); transition: width .6s var(--ease); }
.res-bar-no  { background: var(--no);  transition: width .6s var(--ease); }
.res-legend {
  display: flex; gap: var(--s-5); margin-top: var(--s-3);
  font-size: var(--fs-footnote); color: var(--ink); font-variant-numeric: var(--nums);
}
.res-legend i.dot { display: inline-block; width: var(--s-2); height: var(--s-2); border-radius: 50%; margin-right: var(--s-2); vertical-align: middle; }
.res-legend i.yes { background: var(--yes); }
.res-legend i.no  { background: var(--no); }
.res-meta { margin-top: var(--s-3); font-size: var(--fs-caption); color: var(--ink-3); font-variant-numeric: var(--nums); }
/* HydraDB provenance (from main): a second-tier note under the sample meta,
   set quieter still so evidence sourcing never competes with the estimate */
.res-hydra {
  margin-top: var(--s-1); font-size: var(--fs-caption2);
  line-height: var(--lh-tight); color: var(--ink-3);
}

/* marketing counterfactual */
.res-cf-headline { display: flex; align-items: baseline; gap: var(--s-3); margin: var(--s-4) 0; }
.res-cf-delta { font-size: var(--fs-large); font-weight: var(--fw-bold); line-height: var(--lh-flat); letter-spacing: var(--tr-tight); font-variant-numeric: var(--nums); }
.res-cf-delta.positive { color: var(--yes); }
.res-cf-delta.negative { color: var(--no); }
.res-cf-verb { font-size: var(--fs-caption); font-weight: var(--fw-semi); color: var(--ink-3); text-transform: uppercase; letter-spacing: var(--tr-label); }
.res-cf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
.res-cf-arm { padding: var(--s-3); border-radius: var(--r-md); background: var(--fill); }
.res-cf-arm.exposed { background: rgba(52, 199, 89, .10); }
.res-cf-label { display: block; font-size: var(--fs-caption2); font-weight: var(--fw-semi); text-transform: uppercase; letter-spacing: var(--tr-label); color: var(--ink-3); }
.res-cf-value { display: block; margin-top: var(--s-2); font-size: var(--fs-title2); font-weight: var(--fw-bold); letter-spacing: var(--tr-tight); font-variant-numeric: var(--nums); line-height: var(--lh-flat); }
.res-cf-ci { display: block; margin-top: 3px; font-size: var(--fs-caption2); color: var(--ink-3); font-variant-numeric: var(--nums); }
.res-cf-note { margin-top: var(--s-4); font-size: var(--fs-caption); line-height: var(--lh-body); color: var(--ink-2); }

/* ── section divider, shared ──────────────────────────────────────────── */
.res-why, .char-think { margin-top: var(--s-4); padding-top: var(--s-4); border-top: var(--hair) solid var(--sep); }
.res-why-label, .res-rephrase-label, .char-label {
  font-size: var(--fs-caption2); font-weight: var(--fw-semi);
  letter-spacing: var(--tr-label); text-transform: uppercase;
  color: var(--ink-3); margin-bottom: var(--s-3);
}
.res-why ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: var(--s-2); }
.res-why li { font-size: var(--fs-footnote); line-height: var(--lh-body); color: var(--ink-2); }

/* multi-option result */
.res-options { margin-top: var(--s-4); display: flex; flex-direction: column; gap: var(--s-3); }
.res-opt-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); }
.res-opt-label { font-size: var(--fs-footnote); font-weight: var(--fw-med); color: var(--ink-2); line-height: var(--lh-tight); }
.res-opt-pct { font-size: var(--fs-footnote); font-weight: var(--fw-semi); color: var(--ink-2); flex: none; font-variant-numeric: var(--nums); }
.res-opt-track { margin-top: var(--s-2); height: var(--s-2); border-radius: var(--r-full); overflow: hidden; background: var(--fill); }
.res-opt-fill { height: 100%; border-radius: var(--r-full); width: 0%; background: var(--ink-3); transition: width .6s var(--ease); }
.res-opt.win .res-opt-label, .res-opt.win .res-opt-pct { color: var(--ink); }
.res-opt.win .res-opt-fill { background: var(--accent); }

/* ── A/B result ───────────────────────────────────────────────────────── */
.result-card.ab-result { width: min(570px, 94vw); }
.ab-headline { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); margin: var(--s-4) 0 var(--s-3); }
.ab-headline strong { font-size: var(--fs-title2); font-weight: var(--fw-bold); letter-spacing: var(--tr-tight); }
.ab-headline span { font-size: var(--fs-footnote); color: var(--ink-2); font-variant-numeric: var(--nums); }
.ab-split { display: flex; height: var(--s-2); overflow: hidden; border-radius: var(--r-full); background: var(--fill); }
.ab-split .ab-a { background: var(--ab-a); }
.ab-split .ab-b { background: var(--ab-b); }
.ab-overall { height: var(--s-3); }
.ab-legend { justify-content: space-between; }
.res-legend i.ab-a-dot { background: var(--ab-a); }
.res-legend i.ab-b-dot { background: var(--ab-b); }
.ab-strong {
  display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4);
  margin-top: var(--s-4); padding: var(--s-4) 0;
  border-top: var(--hair) solid var(--sep); border-bottom: var(--hair) solid var(--sep);
  font-size: var(--fs-footnote); color: var(--ink-2);
}
.ab-strong .res-why-label { flex-basis: 100%; margin: 0; }
.ab-breakdowns { margin-top: var(--s-4); display: grid; gap: var(--s-2); }
.ab-demographic { border-radius: var(--r-md); background: var(--fill); }
.ab-demographic summary {
  cursor: pointer; padding: var(--s-3); font-size: var(--fs-footnote);
  font-weight: var(--fw-semi); list-style: none;
}
.ab-demographic summary::-webkit-details-marker { display: none; }
.ab-demographic summary::after { content: "›"; float: right; color: var(--ink-3); font-size: var(--fs-callout); transition: transform var(--t) var(--ease); }
.ab-demographic[open] summary::after { transform: rotate(90deg); }
.ab-group { padding: var(--s-3); border-top: var(--hair) solid var(--sep); }
.ab-group-head { display: flex; justify-content: space-between; gap: var(--s-3); font-size: var(--fs-footnote); }
.ab-group-head span:last-child { color: var(--ink-2); white-space: nowrap; font-variant-numeric: var(--nums); }
.ab-group .ab-split { margin-top: var(--s-2); }
.ab-group-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-2);
  margin-top: var(--s-1); font-size: var(--fs-caption2);
  color: var(--ink-3); font-variant-numeric: var(--nums);
}
.ab-note { margin: var(--s-4) 0 0; font-size: var(--fs-caption); line-height: var(--lh-body); color: var(--ink-3); }

/* ── advanced breakdown ─────────────────────────────────────────────────
   Main's ranked, per-dimension, and cross-tab views use the same tokenized
   surface as the refreshed A/B card. Text always carries lean and share;
   color remains a redundant cue. */
.ab-adv.tone-yesno { --ab-a: var(--yes); --ab-b: var(--no); }
.ab-adv {
  margin-top: var(--s-4); padding-top: var(--s-3);
  border-top: var(--hair) solid var(--sep);
}
.ab-adv-summary {
  display: flex; align-items: center; gap: var(--s-2); cursor: pointer; list-style: none;
  padding: var(--s-1) 0; border-radius: var(--r-sm); color: var(--ink-2);
}
.ab-adv-summary::-webkit-details-marker { display: none; }
.ab-adv-summary:hover { color: var(--ink); }
.ab-adv-summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ab-adv-caret { display: inline-flex; color: var(--ink-3); transition: transform var(--t-mid) var(--ease); }
.ab-adv[open] .ab-adv-caret { transform: rotate(90deg); }
.ab-adv-title { font-size: var(--fs-footnote); font-weight: var(--fw-semi); color: var(--ink); }
.ab-adv-hint { font-size: var(--fs-caption); color: var(--ink-3); }
.ab-adv-inner { margin-top: var(--s-3); }
.ab-adv[open] .ab-adv-inner { animation: adv-open var(--t-mid) var(--ease); }
@keyframes adv-open { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ab-adv[open] .ab-adv-inner { animation: none; } .ab-adv-caret { transition: none; } }
.ab-adv-head {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: var(--s-2);
}
.ab-adv-head .res-why-label { margin: 0; }
.ab-views {
  display: flex; gap: 2px; padding: 2px;
  border-radius: var(--r-full); background: var(--fill);
}
.ab-view {
  padding: 5px 11px; border: 0; border-radius: var(--r-full);
  font-family: var(--font); font-size: var(--fs-caption);
  font-weight: var(--fw-semi); color: var(--ink-3);
  background: transparent; cursor: pointer;
  transition: background var(--t) var(--ease), color var(--t) var(--ease);
}
.ab-view:hover { color: var(--ink); }
.ab-view.active { background: var(--card); color: var(--ink); box-shadow: var(--sh-1); }
.ab-adv-body { margin-top: var(--s-3); }
.ab-lede {
  margin: 0 0 var(--s-2); font-size: var(--fs-caption);
  line-height: var(--lh-body); color: var(--ink-3);
}
.ab-empty { margin: var(--s-1) 0; font-size: var(--fs-caption); color: var(--ink-3); }

.ab-chips { display: flex; flex-wrap: wrap; gap: var(--s-1); margin-bottom: var(--s-3); }
.ab-chip {
  padding: 5px 10px; border: none; border-radius: var(--r-full);
  font-family: var(--font); font-size: var(--fs-caption);
  font-weight: var(--fw-semi); color: var(--ink-2);
  background: var(--fill); cursor: pointer;
  transition: background var(--t) var(--ease), color var(--t) var(--ease);
}
.ab-chip:hover { background: var(--fill-hi); color: var(--ink); }
.ab-chip.active { background: var(--accent); color: #fff; }

/* Segment rows reuse .ab-group; these are the advanced-only additions. */
.ab-adv .ab-group {
  padding: 9px 0 10px;
  border-top: var(--hair) solid var(--sep);
}
.ab-adv .ab-group:first-of-type { border-top: 0; }
.ab-group-dim {
  margin-left: var(--s-2); font-style: normal;
  font-size: var(--fs-caption2); font-weight: var(--fw-semi);
  letter-spacing: var(--tr-label); text-transform: uppercase; color: var(--ink-3);
}
.ab-swing {
  padding: 1px 6px; border-radius: var(--r-full);
  font-weight: var(--fw-bold); font-variant-numeric: var(--nums);
}
.ab-swing.lean-a { color: var(--ab-a); background: color-mix(in srgb, var(--ab-a) 13%, transparent); }
.ab-swing.lean-b { color: var(--ab-b); background: color-mix(in srgb, var(--ab-b) 13%, transparent); }
.ab-thin { color: var(--ink-3); font-style: italic; }

.ab-matrix-wrap { overflow-x: auto; margin: 0 -2px; padding: 0 2px 2px; }
.ab-matrix {
  width: 100%; border-collapse: separate; border-spacing: 3px;
  font-size: var(--fs-caption2);
}
.ab-matrix th {
  padding: 3px 5px; white-space: nowrap; text-align: left;
  font-weight: var(--fw-semi); color: var(--ink-3);
}
.ab-matrix thead th {
  font-size: var(--fs-caption2);
  letter-spacing: var(--tr-label); text-transform: uppercase;
}
.ab-matrix tbody th { color: var(--ink); }
.ab-cell {
  --lean-alpha: .1;
  min-width: 62px; padding: 6px 7px; border-radius: var(--r-sm);
  border: var(--hair) solid var(--sep); background: var(--fill);
  text-align: left;
}
.ab-cell.lean-a {
  background: color-mix(in srgb, var(--ab-a) calc(var(--lean-alpha) * 100%), var(--card));
}
.ab-cell.lean-b {
  background: color-mix(in srgb, var(--ab-b) calc(var(--lean-alpha) * 100%), var(--card));
}
.ab-cell.empty {
  color: var(--ink-3); text-align: center;
  background: transparent; border-style: dashed;
}
/* Thin cells keep a hatch, so low-confidence data remains visible without
   relying on color and survives forced-colors mode. */
.ab-cell.thin {
  background-image: repeating-linear-gradient(135deg, rgba(0, 0, 0, .10) 0 3px, transparent 3px 7px);
}
.ab-cell-share {
  display: block; font-weight: var(--fw-bold);
  font-variant-numeric: var(--nums); color: var(--ink);
}
.ab-cell-swing {
  display: block; margin-top: 1px; font-size: var(--fs-caption2);
  font-variant-numeric: var(--nums); color: var(--ink-2);
}
.ab-matrix-key {
  display: flex; flex-wrap: wrap; gap: 5px 14px;
  margin-top: var(--s-2); font-size: var(--fs-caption2); color: var(--ink-3);
}
.ab-matrix-key i.dot {
  display: inline-block; width: var(--s-2); height: var(--s-2);
  margin-right: 5px; border-radius: 50%; vertical-align: middle;
}
.ab-matrix-key i.ab-a-dot { background: var(--ab-a); }
.ab-matrix-key i.ab-b-dot { background: var(--ab-b); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .ab-view, .ab-chip { transition: none; }
}
@media (forced-colors: active) {
  .ab-cell { forced-color-adjust: none; border-color: CanvasText; }
  .ab-chip.active, .ab-view.active { border: var(--hair) solid CanvasText; }
}

/* ── rephrase card ────────────────────────────────────────────────────── */
.res-rephrase-reason { font-size: var(--fs-callout); line-height: var(--lh-body); }
.res-examples { margin-top: var(--s-4); display: flex; flex-direction: column; gap: var(--s-2); }
.res-example {
  text-align: left; width: 100%;
  font-family: var(--font); font-size: var(--fs-footnote); line-height: var(--lh-body); color: var(--accent);
  padding: var(--s-3); border-radius: var(--r-md); cursor: pointer;
  border: none; background: var(--fill);
  transition: background var(--t) var(--ease);
}
.res-example:hover { background: var(--fill-hi); }

/* ── buttons ──────────────────────────────────────────────────────────── */
.res-actions { display: flex; gap: var(--s-2); margin-top: var(--s-5); }
.btn {
  font-family: var(--font); font-size: var(--fs-subhead); font-weight: var(--fw-semi);
  line-height: var(--lh-flat);
  padding: var(--s-3) var(--s-5); border-radius: var(--r-full); cursor: pointer;
  border: none; background: var(--fill); color: var(--ink);
  transition: background var(--t) var(--ease), transform var(--t-fast) var(--ease);
}
.btn:hover { background: var(--fill-hi); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #0069db; }

/* ── toast ────────────────────────────────────────────────────────────── */
.toast {
  position: absolute; left: 50%; bottom: 104px; transform: translateX(-50%);
  max-width: min(420px, 88vw);
  font-size: var(--fs-footnote); line-height: var(--lh-tight);
  padding: var(--s-3) var(--s-4); border-radius: var(--r-md);
  box-shadow: var(--sh-2); color: var(--no);
  animation: rise var(--t-mid) var(--ease);
}

/* ── modals ───────────────────────────────────────────────────────────── */
.about-scrim {
  position: fixed; inset: 0; z-index: 10;
  background: rgba(0, 0, 0, .28);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  animation: fadeIn var(--t-mid) var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.about {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  z-index: 11; width: min(580px, 92vw); max-height: 86vh;
  overflow-y: auto; overscroll-behavior: contain;
  border-radius: var(--r-xl); padding: var(--s-7);
  box-shadow: var(--sh-3);
  animation: rise var(--t-mid) var(--ease);
  background: #fff;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.about-close, .char-close {
  position: absolute; border-radius: 50%;
  border: none; background: var(--fill); color: var(--ink-2);
  cursor: pointer; line-height: var(--lh-flat);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t) var(--ease);
}
.about-close:hover, .char-close:hover { background: var(--fill-hi); }
.about-close { top: var(--s-4); right: var(--s-4); width: var(--s-7); height: var(--s-7); font-size: var(--fs-title3); }
.about-title { font-size: var(--fs-title1); font-weight: var(--fw-bold); letter-spacing: var(--tr-tight); line-height: var(--lh-tight); }
.about-sub { font-size: var(--fs-callout); color: var(--ink-2); margin: var(--s-2) 0 0; line-height: var(--lh-body); }
.about-h {
  font-size: var(--fs-caption2); font-weight: var(--fw-semi);
  letter-spacing: var(--tr-label); text-transform: uppercase;
  color: var(--ink-3); margin: var(--s-6) 0 var(--s-3);
}
.about p { font-size: var(--fs-subhead); line-height: var(--lh-body); margin: 0 0 var(--s-3); color: var(--ink-2); }
.about b { font-weight: var(--fw-semi); color: var(--ink); }
.about i { color: var(--ink); }
.about-name { font-weight: var(--fw-semi); color: var(--ink); }
.about-ex { border-left: 3px solid var(--sep); padding-left: var(--s-4); margin: var(--s-4) 0; }
.about-list { margin: 0 0 var(--s-3); padding-left: 1.2em; font-size: var(--fs-subhead); line-height: var(--lh-body); color: var(--ink-2); }
.about-list li { margin: 0 0 var(--s-2); }
.about-list li b { font-weight: var(--fw-semi); color: var(--ink); }
.about-list--steps li::marker { font-weight: var(--fw-semi); color: var(--ink); }
.about-track { font-size: var(--fs-footnote); line-height: var(--lh-body); color: var(--ink-2); margin: 0 0 var(--s-3); }
.about-track b { color: var(--ink); font-weight: var(--fw-semi); }
.about-ex-title { font-size: var(--fs-footnote); font-weight: var(--fw-semi); margin-bottom: var(--s-2); color: var(--ink); }
.about-ex-q { font-size: var(--fs-footnote); line-height: var(--lh-body); color: var(--ink-3); margin-bottom: var(--s-3); }
.about-ex-nums { display: flex; gap: var(--s-5); flex-wrap: wrap; font-size: var(--fs-footnote); font-weight: var(--fw-semi); font-variant-numeric: var(--nums); }
.about-ex-nums .actual { color: var(--ink); }
.about-ex-nums .pred { color: var(--yes); }
.about-credit {
  margin-top: var(--s-6); padding-top: var(--s-4); border-top: var(--hair) solid var(--sep);
  font-size: var(--fs-footnote); line-height: var(--lh-body); color: var(--ink-3);
}
.about-credit b { color: var(--ink); }
.about-credit a { color: var(--accent); text-decoration: none; }
.about-credit a:hover { text-decoration: underline; }

.ab-modal { width: min(620px, 94vw); }
.ab-form { margin-top: var(--s-5); display: grid; gap: var(--s-2); }
.ab-form label {
  margin-top: var(--s-3); font-size: var(--fs-caption2); font-weight: var(--fw-semi);
  letter-spacing: var(--tr-label); text-transform: uppercase; color: var(--ink-3);
}
.ab-form textarea {
  width: 100%; resize: vertical; min-height: 58px; max-height: 22vh;
  border: var(--hair) solid var(--sep); border-radius: var(--r-sm); padding: var(--s-3);
  background: #fff; color: var(--ink); caret-color: var(--accent);
  font: var(--fw-reg) var(--fs-subhead)/var(--lh-body) var(--font);
  transition: border-color var(--t) var(--ease);
}
.ab-form textarea:focus { border-color: var(--accent); }
.ab-form textarea::placeholder { color: var(--ink-3); }
.ab-error { min-height: var(--s-5); color: var(--no); font-size: var(--fs-footnote); }
.ab-form .res-actions { margin-top: var(--s-2); }

.marketing-modal { width: min(560px, 94vw); }
.marketing-note { margin-right: var(--s-8); }
.marketing-form textarea:last-of-type { min-height: 132px; }
.marketing-limit { text-align: right; font-size: var(--fs-caption2); color: var(--ink-3); }
.marketing-form[aria-busy="true"] textarea { opacity: .6; }

/* ── resident filters ───────────────────────────────────────────────── */
.filter-modal { width: min(600px, 94vw); }
.filter-note { max-width: 500px; margin-right: var(--s-8); }
.filter-form {
  margin-top: var(--s-5);
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-4);
}
.filter-field { display: grid; gap: var(--s-2); }
.filter-field label {
  font-size: var(--fs-caption2); font-weight: var(--fw-semi);
  letter-spacing: var(--tr-label); text-transform: uppercase; color: var(--ink-3);
}
.filter-field input, .filter-field select {
  width: 100%; min-height: var(--ctl); appearance: none;
  border: var(--hair) solid var(--sep); border-radius: var(--r-sm);
  padding: 10px var(--s-3); background: #fff; color: var(--ink);
  font: var(--fw-reg) var(--fs-subhead)/var(--lh-tight) var(--font);
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.filter-field select {
  padding-right: var(--s-8);
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
                    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 17px) 19px, calc(100% - 12px) 19px;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.filter-field input:focus, .filter-field select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 122, 255, .12); outline: none;
}
.filter-field input::placeholder { color: var(--ink-3); }
.filter-error, .filter-actions { grid-column: 1 / -1; }
.filter-error { margin-top: -4px; }
.filter-form[aria-busy="true"] input,
.filter-form[aria-busy="true"] select { opacity: .6; }

/* ── resident inspector ───────────────────────────────────────────────── */
.char-card {
  position: fixed; left: var(--s-5); bottom: 104px; z-index: 9;
  width: min(300px, 86vw);
  border-radius: var(--r-lg); padding: var(--s-4);
  box-shadow: var(--sh-3); animation: rise var(--t-mid) var(--ease);
}
.char-close { top: var(--s-3); right: var(--s-3); width: var(--s-6); height: var(--s-6); font-size: var(--fs-subhead); }
.char-head { display: flex; align-items: center; gap: var(--s-3); padding-right: var(--s-6); }
.char-portrait {
  width: var(--s-8); height: var(--s-8); image-rendering: pixelated;
  background: var(--fill); border-radius: var(--r-sm); flex: none;
}
.char-id { min-width: 0; }
.char-name { font-size: var(--fs-callout); font-weight: var(--fw-semi); line-height: var(--lh-tight); }
.char-sub { font-size: var(--fs-footnote); color: var(--ink-2); line-height: var(--lh-tight); }
.char-tags { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-4); }
.char-tag {
  font-size: var(--fs-caption); font-weight: var(--fw-med); color: var(--ink);
  line-height: var(--lh-flat); background: var(--fill);
  border-radius: var(--r-full); padding: 5px var(--s-3);
}
.char-tag.issue { color: var(--ink-2); }
.char-label.yes { color: var(--yes); }
.char-label.no  { color: var(--no); }
.char-thought { font-size: var(--fs-subhead); line-height: var(--lh-body); color: var(--ink-2); }

/* ── spotlight: the post-poll inspector ──
   The resident becomes the subject — a large portrait, and their rationale
   delivered as speech that types itself out. */
.char-card--spotlight { width: min(400px, 90vw); padding: var(--s-5); }
.char-card--spotlight .char-head { align-items: center; gap: var(--s-4); }
.char-card--spotlight .char-portrait {
  width: 96px; height: 96px; border-radius: var(--r-md);
  background: var(--fill);
}
.char-card--spotlight .char-name { font-size: var(--fs-title3); font-weight: var(--fw-bold); letter-spacing: var(--tr-tight); }
.char-card--spotlight .char-sub { font-size: var(--fs-footnote); margin-top: 2px; }

/* Echoes the in-map thought bubbles: white fill, dark outline, tail. On the
   card's white surface the fill reads as nothing — the outline is the shape. */
.char-speech {
  position: relative; margin-bottom: var(--s-5);
  padding: var(--s-3) var(--s-4); border-radius: var(--r-md);
  background: #fff; border: 2px solid var(--bubble-line);
}
/* the tail is a rotated square carrying two of the outline's edges; its white
   fill covers the bubble's bottom border, so the outline reads as continuous */
.char-speech::after {
  content: ""; position: absolute; left: 58px; bottom: -8px;   /* points at the portrait's centre */
  width: 14px; height: 14px; background: #fff;
  border-right: 2px solid var(--bubble-line);
  border-bottom: 2px solid var(--bubble-line);
  transform: rotate(45deg);
}
/* A hidden copy of the finished sentence sets the bubble's height on the first
   frame; the animating copy is overlaid on top. The bubble is therefore the
   exact size of the final text throughout — it neither grows while typing nor
   reserves slack that stays empty afterwards. */
.char-speech-text {
  position: relative; margin: 0;
  font-size: var(--fs-subhead); line-height: var(--lh-body); color: var(--ink);
}
.char-speech-ghost { visibility: hidden; }
.char-speech-typed { position: absolute; inset: 0; }
.char-caret {
  display: inline-block; width: 2px; height: 1.05em; margin-left: 1px;
  vertical-align: text-bottom; background: var(--accent);
  animation: caret 1s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

/* sits under the identity, not beside it — competing for that row forced the
   name to wrap on any resident with a long name or neighbourhood */
.char-verdict {
  display: inline-block; margin-top: var(--s-2);
  font-size: var(--fs-caption2); font-weight: var(--fw-semi);
  letter-spacing: var(--tr-label); text-transform: uppercase;
  padding: var(--s-1) var(--s-2); border-radius: var(--r-full);
  background: var(--fill); color: var(--ink-2); white-space: nowrap;
}
.char-verdict.yes { background: rgba(52, 199, 89, .14); color: #1e8e3e; }
.char-verdict.no  { background: rgba(255, 59, 48, .12); color: #c9271d; }

/* ── mobile ───────────────────────────────────────────────────────────── */
@media (max-width: 560px) {
  .title-select { top: var(--s-3); left: var(--s-3); max-width: calc(100vw - 168px); }
  .title { font-size: var(--fs-title3); padding: var(--s-2) var(--s-3); }
  .title-btn { gap: var(--s-2); }
  .title-option { font-size: var(--fs-subhead); padding: var(--s-3); }

  .status {
    top: 70px; left: var(--s-3); right: var(--s-3); font-size: var(--fs-footnote);
    padding: var(--s-2) var(--s-3) var(--s-2) var(--s-6);
    width: auto; max-width: none;
  }
  .status::before { left: var(--s-3); top: var(--s-3); }
  .status .status-clock { display: none; }
  .status--audience { top: 70px; left: var(--s-3); right: var(--s-3); width: auto; max-width: none; padding: var(--s-3); }
  .status-persona { font-size: var(--fs-body); }
  .status--audience ~ .return { top: 22px; left: auto; right: var(--s-3); }
  .boot { top: var(--context-bottom, 56px); right: var(--s-3); width: min(200px, 60vw); }
  .return { top: 96px; left: var(--s-3); }

  .news-bubble { display: flex; top: var(--context-bottom, 62px); right: var(--s-3); left: auto; width: auto; padding: var(--s-3); }
  .news-bubble[data-expanded="false"] { max-width: calc(100vw - var(--s-6)); }
  .news-bubble[data-expanded="false"] .news-item { display: none; }
  .news-bubble[data-expanded="true"] { width: calc(100vw - var(--s-6)); max-height: 70vh; overflow-y: auto; }
  .news-clock { font-size: var(--fs-footnote); font-weight: var(--fw-semi); color: var(--ink-2); padding-bottom: var(--s-2); margin-bottom: var(--s-1); border-bottom: var(--hair) solid var(--sep); }

  .dock { bottom: 60px; gap: var(--s-2); max-width: 96vw; }
  .dock-row { gap: var(--s-1); }
  .dock-tools { gap: var(--s-1); }
  .summary, .result-card { width: min(94vw, 440px); }
  .about, .result-card { padding: var(--s-5); }
  .ask { min-height: var(--ctl-sm); padding: var(--s-2) var(--s-3); }
  .ask[data-state="input"] { width: calc(96vw - 60px); }
  .audience-chip { max-width: 150px; }
  .info-btn { width: var(--ctl-sm); height: var(--ctl-sm); font-size: var(--fs-subhead); }
  .dock-tool-spacer { display: none; }

  .filter-form { grid-template-columns: 1fr; gap: var(--s-3); }
  .filter-error, .filter-actions { grid-column: auto; }

  .about-title { font-size: var(--fs-title2); }
  .res-pct { font-size: var(--fs-large); }
  .res-cf-delta { font-size: var(--fs-title1); }

  .toast { bottom: 130px; }
  .char-card { left: var(--s-2); right: var(--s-2); bottom: 130px; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* Interactive evidence: keep map context visible, including on narrow screens. */
/* data-source note as a tooltip on a small "i" next to the evidence disclosure */
.evidence-info-wrap { position: relative; display: inline-block; margin-left: 6px; vertical-align: middle; }
.evidence-info, .pc-info { width: 16px; height: 16px; padding: 0; border: var(--hair) solid var(--sep); border-radius: 50%; background: var(--fill); color: var(--ink-3); font-family: var(--font); font-size: 10px; font-weight: var(--fw-semi); line-height: 14px; cursor: default; vertical-align: middle; }
.evidence-info:focus-visible, .pc-info:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.evidence-tooltip, .pc-tooltip { position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); width: min(320px, 78vw); padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); background: var(--ink); color: #fff; font-family: var(--font); font-size: var(--fs-caption); font-weight: var(--fw-reg); line-height: var(--lh-body); text-align: left; white-space: normal; box-shadow: var(--sh-2); z-index: 5; opacity: 0; visibility: hidden; transition: opacity .12s; pointer-events: none; text-transform: none; letter-spacing: 0; }
.evidence-info:hover + .evidence-tooltip, .evidence-info:focus-visible + .evidence-tooltip, .evidence-info-wrap:hover .evidence-tooltip,
.pc-info:hover + .pc-tooltip, .pc-info:focus-visible + .pc-tooltip, .pc-tip-wrap:hover .pc-tooltip { opacity: 1; visibility: visible; }
.pc-tip-wrap { position: relative; display: inline-block; margin-left: 6px; vertical-align: middle; }
.evidence-fixture { margin: 8px 0; font-size: 13px; color: #193520; }
#evidence-details > summary { cursor: pointer; min-height: 44px; padding: 12px 0; font-weight: 700; }
.evidence-controls { display: grid; gap: 8px; margin-bottom: 12px; }
.evidence-controls select { width: 100%; min-width: 0; min-height: 44px; border: 1px solid #667568; border-radius: 6px; padding: 8px; background: #fff; color: #17231a; font: inherit; }
.combine-control { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.combine-control input { width: 22px; height: 22px; }
.evidence-chart { color: #17231a; font-size: 13px; line-height: 1.5; }
.evidence-chart > h2 { font-size: 16px; }
.evidence-chart fieldset { min-width: 0; margin: 12px 0; padding: 10px; border: 1px solid #7b897e; border-radius: 8px; }
.evidence-chart button { min-height: 44px; padding: 12px; background: #fff; color: #24432b; border: 1px solid #788b7d; border-radius: 6px; font: inherit; cursor: pointer; }
.evidence-chart button[aria-pressed="true"] { background: #e1f7e6; border: 3px solid #177b37; padding: 10px; }
.evidence-chart button > span:first-child { font-size: 15px; font-weight: 700; }
.evidence-chart [data-evidence-summary] { padding: 12px; border-left: 4px solid #177b37; background: #eaf2e9; font-weight: 700; overflow-wrap: anywhere; }
.evidence-chart dd { margin: 0 0 8px; overflow-wrap: anywhere; }
.evidence-chart dt { font-weight: 700; }
.evidence-chart h3 { margin-top: 20px; }
.evidence-count-note { font-size: 12px; }
#evidence-panel :focus-visible, #map:focus-visible, #ask:focus-visible { outline: 3px solid #1655d8; outline-offset: 3px; }
#demo-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 30; margin: 0; padding: 8px 14px; background: #183924; color: #fff; font: 12px/1.5 system-ui,sans-serif; text-align: center; }
#demo-banner a { color: #fff; text-decoration: underline; }
body.offline-demo .title-select, body.offline-demo .status { margin-top: 46px; }
body.offline-demo .result-card { max-height: min(60dvh, 720px); }
.result-card:has(.pc) { width: min(570px, 94vw); }
@media (max-width: 600px) {
  .result-card:has(#evidence-panel) { max-height: 52dvh; width: min(94vw, 440px); padding: 16px; }
  .evidence-chart button, .evidence-controls select { font-size: 16px; }
  #demo-banner { font-size: 11px; }
  body.offline-demo .title-select, body.offline-demo .status { margin-top: 66px; }
}
@media (forced-colors: active) {
  .evidence-tooltip, .evidence-chart button, .evidence-controls select, .evidence-chart [data-evidence-summary] { forced-color-adjust: auto; background: Canvas; color: CanvasText; border-color: CanvasText; }
  .evidence-chart button[aria-pressed="true"] { border: 3px solid Highlight; }
  #evidence-panel :focus-visible { outline-color: Highlight; }
}
@media (prefers-reduced-motion: reduce) {
  #evidence-panel *, .result-card, .summary { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
.evidence-selection-bar { position: sticky; top: -16px; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 8px 0; background: #fff; border-bottom: 1px solid #788b7d; }
.evidence-selection-bar button { flex: 0 0 94px; }
.evidence-selection-bar [data-evidence-summary] { margin: 0; flex: 1; padding: 8px; font-size: 12px; }
@media (forced-colors: active) { .evidence-selection-bar { background: Canvas; border-color: CanvasText; } }

/* Explicit statistical/simulation modes and accessible full-snapshot bars. */
.query-modes { display:flex; flex-wrap:wrap; justify-content:center; gap:4px 14px; margin:8px 0 0; padding:4px 10px; border:1px solid #788b7d; border-radius:12px; background:#fff; color:#17231a; font:13px/1.4 system-ui,sans-serif; }
.query-modes legend { padding:0 6px; font-weight:700; background:#fff; border-radius:4px; }
.query-modes label { display:flex; align-items:center; gap:6px; min-height:44px; cursor:pointer; }
.query-modes input { width:20px; height:20px; accent-color:#177b37; }
.query-mode-hint { margin:4px 0 8px; padding:4px 8px; border-radius:6px; background:#fff; color:#17231a; text-align:center; font:12px/1.4 system-ui,sans-serif; }

#verified-panel { overflow-wrap:anywhere; }
#verified-panel h2 { scroll-margin-top:16px; }
.verified-bars { display:grid; gap:10px; margin-block:12px; }
.verified-bars button { display:grid; gap:5px; width:100%; min-width:0; text-align:left; }
.verified-track { display:block; width:100%; height:14px; border:1px solid currentColor; }
.verified-track > span { display:block; height:100%; background:#24733b; }
#verified-panel [data-verified-summary] { padding:12px; border-left:4px solid #177b37; background:#eaf2e9; }
#verified-panel :focus-visible, .ask-send:focus-visible, .audience-chip:focus-visible, .ask-mode:focus-visible { outline:3px solid #1655d8; outline-offset:3px; }
.result-card:has(#verified-panel) { width:min(570px,94vw); max-height:55dvh; }
@media (max-width:600px) { .result-card:has(#verified-panel) { max-height:48dvh; padding:16px; } .query-modes { gap:0 10px; font-size:12px; } .verified-bars button { font-size:16px; } }
@media (forced-colors:active) { .verified-track > span { background:Highlight; } #verified-panel [data-verified-summary], .query-modes, .query-mode-hint { background:Canvas; color:CanvasText; } }
@media (prefers-reduced-motion:reduce) { #verified-panel * { animation:none !important; transition:none !important; scroll-behavior:auto !important; } }

.dock-tools button[hidden] { display:none; }


/* ── persona chart (result card + timeline) ───────────────────────────── */
.pc { margin-top: var(--s-4); padding-top: var(--s-4); border-top: var(--hair) solid var(--sep); }
.pc-head { display: flex; flex-direction: column; align-items: stretch; gap: var(--s-2); margin: var(--s-2) 0 var(--s-3); }
.pc-title { margin: 0; font-size: var(--fs-title3); font-weight: var(--fw-bold); letter-spacing: var(--tr-tight); line-height: var(--lh-tight); color: var(--ink); }
.pc:not(.pc-compact) .pc-row { padding: var(--s-2) var(--s-2); }
.pc-compact .pc-title { font-size: var(--fs-subhead); }
.pc-head .res-why-label { margin: 0; }
.pc-controls { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.pc-dim { font-family: var(--font); font-size: var(--fs-caption); font-weight: var(--fw-med); color: var(--ink); border: none; border-radius: var(--r-full); padding: 4px var(--s-3); background: var(--fill); }
.pc-types { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--r-full); background: var(--fill); }
.pc-type { border: none; background: transparent; border-radius: var(--r-full); padding: 3px var(--s-2); font-family: var(--font); font-size: var(--fs-caption); font-weight: var(--fw-med); color: var(--ink-2); cursor: pointer; }
.pc-type[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: var(--sh-1); }
.pc-type:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pc-note { margin: var(--s-3) 0 0; font-size: var(--fs-caption); color: var(--ink-2); line-height: var(--lh-body); }
.pc-empty { margin: var(--s-3) 0; font-size: var(--fs-footnote); color: var(--ink-2); }
.pc-caption { margin-top: var(--s-2); font-size: var(--fs-caption); color: var(--ink-2); line-height: var(--lh-body); }

/* bar rows: the result card's own option-bar anatomy */
.pc-rows { margin-top: var(--s-4); display: flex; flex-direction: column; gap: var(--s-3); }
.pc-row { border-radius: var(--r-sm); cursor: pointer; margin: 0 calc(-1 * var(--s-2)); padding: var(--s-1) var(--s-2); }
.pc-row:hover, .pc-row:focus-visible { background: var(--fill); outline: none; }
.pc-row[aria-pressed="true"] { background: var(--fill); }
.pc-row-head { display: flex; align-items: center; gap: var(--s-2); min-height: 22px; }
.pc-row-label { font-size: var(--fs-footnote); font-weight: var(--fw-med); color: var(--ink-2); line-height: var(--lh-tight); white-space: nowrap; }
.pc-row[aria-pressed="true"] .pc-row-label, .pc-row:hover .pc-row-label { color: var(--ink); }
.pc-row-pct { margin-left: auto; font-size: var(--fs-subhead); font-weight: var(--fw-bold); color: var(--ink); flex: none; font-variant-numeric: var(--nums); }
.pc-track { margin-top: var(--s-2); height: 8px; border-radius: var(--r-full); overflow: hidden; background: var(--fill); display: flex; }
.pc-fill { display: block; height: 100%; border-radius: var(--r-full); background: var(--accent); }
.pc-seg { display: block; height: 100%; }
.pc-seg.top, .pc-sw.top { background: var(--accent); }
.pc-seg.g0, .pc-sw.g0 { background: rgba(0,0,0,.30); } .pc-seg.g1, .pc-sw.g1 { background: rgba(0,0,0,.20); }
.pc-seg.g2, .pc-sw.g2 { background: rgba(0,0,0,.13); } .pc-seg.g3, .pc-sw.g3 { background: rgba(0,0,0,.08); }
.pc-legend { margin-top: var(--s-3); display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); font-size: var(--fs-caption); color: var(--ink-2); }
.pc-legend span { display: inline-flex; align-items: center; gap: 6px; }
.pc-sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* sprite heads inside the chart */
.pc-heads-slot { display: none; min-height: 20px; }
.pc-row:hover .pc-heads-slot, .pc-row:focus-visible .pc-heads-slot, .pc-row[aria-pressed="true"] .pc-heads-slot,
[data-group]:hover .pc-heads-slot, [data-group]:focus-visible .pc-heads-slot { display: inline-flex; }
.pc-heads { display: inline-flex; align-items: center; gap: 1px; }
.pc-head-c { width: 20px; height: 20px; image-rendering: pixelated; border-radius: 4px; background: var(--fill); }
.pc-heads-more { margin-left: 4px; font-size: var(--fs-caption); font-weight: var(--fw-semi); color: var(--ink-2); font-variant-numeric: var(--nums); }
.pc-hover { min-height: 26px; margin-top: var(--s-2); display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; font-size: var(--fs-caption); color: var(--ink-2); }
.pc-hover-label { font-weight: var(--fw-med); color: var(--ink); }

/* svg charts */
.pc-svg { display: block; width: 100%; height: auto; margin-top: var(--s-3); font-family: var(--font); overflow: visible; }
.pc-axis { font-size: 11px; fill: var(--ink-3); }
.pc-base { stroke: var(--sep); stroke-width: 1; }
.pc-grid { stroke: var(--sep); stroke-width: 1; stroke-dasharray: 2 3; }
.pc-bin-hit, .pc-box-hit { fill: transparent; }
.pc-bin-bar { fill: rgba(0,0,0,.22); }
.pc-bin:hover .pc-bin-bar, .pc-bin:focus-visible .pc-bin-bar, .pc-bin.sel .pc-bin-bar { fill: var(--accent); }
.pc-bin, .pc-box, .pc-lpt, .pc-pt { cursor: pointer; outline: none; }
.pc-bin:focus-visible .pc-bin-hit, .pc-box:focus-visible .pc-box-hit { fill: var(--fill); }
.pc-mean { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 3 3; }
.pc-pt { fill: var(--accent); fill-opacity: .45; }
.pc-pt:hover, .pc-pt:focus-visible { fill-opacity: 1; r: 4; }
.pc-trend { fill: none; stroke: var(--ink); stroke-opacity: .28; stroke-width: 1.5; }
.pc-box-label { font-size: 12px; fill: var(--ink-2); font-weight: 500; }
.pc-box:hover .pc-box-label, .pc-box.sel .pc-box-label { fill: var(--ink); }
.pc-whisk { stroke: var(--ink-3); stroke-width: 1; }
.pc-box-rect { fill: rgba(0,122,255,.18); stroke: var(--accent); stroke-width: 1; }
.pc-box:hover .pc-box-hit, .pc-box.sel .pc-box-hit { fill: var(--fill); }
.pc-median { stroke: var(--accent); stroke-width: 2; }
.pc-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.pc-lpt circle { fill: var(--card); stroke: var(--accent); stroke-width: 2; }
.pc-lpt:hover circle, .pc-lpt:focus-visible circle, .pc-lpt.sel circle, .pc-lpt.cur circle { fill: var(--accent); }
.pc-tick line { stroke: var(--ink-3); stroke-width: 1.5; }
.pc-modes { margin-top: var(--s-3); display: inline-flex; gap: var(--s-2); }
.pc-mode { border: none; background: transparent; padding: 0; font-family: var(--font); font-size: var(--fs-caption); font-weight: var(--fw-med); color: var(--ink-3); cursor: pointer; }
.pc-mode.on { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* people behind a statistic */
.pc-people { margin-top: var(--s-4); padding-top: var(--s-4); border-top: var(--hair) solid var(--sep); }
.pc-people-head { display: flex; align-items: baseline; gap: var(--s-3); flex-wrap: wrap; }
.pc-link { border: none; background: transparent; padding: 0; font-family: var(--font); font-size: var(--fs-footnote); font-weight: var(--fw-med); color: var(--accent); cursor: pointer; }
.pc-link:hover { text-decoration: underline; }
.pc-people-title { font-size: var(--fs-callout); font-weight: var(--fw-semi); color: var(--ink); }
.pc-people-sub { font-size: var(--fs-caption); color: var(--ink-2); }
.pc-list { list-style: none; margin: var(--s-3) 0 0; padding: 0; display: flex; flex-direction: column; }
.pc-person { display: flex; gap: var(--s-3); padding: var(--s-2) var(--s-2); margin: 0 calc(-1 * var(--s-2)); border-radius: var(--r-sm); cursor: pointer; border-top: var(--hair) solid var(--sep); }
.pc-list .pc-person:first-child { border-top: none; }
.pc-person:hover, .pc-person:focus-visible { background: var(--fill); outline: none; }
.pc-person-portrait { width: 28px; height: 28px; flex: none; image-rendering: pixelated; border-radius: 6px; background: var(--fill); }
.pc-person-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pc-person-name { font-size: var(--fs-footnote); font-weight: var(--fw-semi); color: var(--ink); display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.pc-answer { font-size: var(--fs-caption); font-weight: var(--fw-med); color: var(--ink-2); background: var(--fill); border-radius: var(--r-full); padding: 1px 8px; }
.pc-answer.pos { color: var(--accent); background: rgba(0,122,255,.10); }
.pc-person-meta { font-size: var(--fs-caption); color: var(--ink-2); }
.pc-person-why { font-size: var(--fs-caption); color: var(--ink-2); line-height: var(--lh-body); }
.pc-person-why.pending { color: var(--ink-3); font-style: italic; animation: pc-shimmer 1.2s ease-in-out infinite; }
@keyframes pc-shimmer { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .pc-person-why.pending { animation: none; } }
.pc-archetype { margin-left: 6px; font-size: var(--fs-caption2); font-style: normal; color: var(--ink-3); }
.pc-answer.own { color: var(--accent); background: rgba(0,122,255,.10); }
.persona-answer .pc-archetype { display: block; margin: 4px 0 0; }
.pc-people-more { margin-top: var(--s-3); }

/* persona modal */
.persona-modal { width: min(560px, 94vw); }
.persona-head { display: flex; align-items: center; gap: var(--s-4); padding-right: var(--s-7); }
.persona-portrait { width: 72px; height: 72px; flex: none; image-rendering: pixelated; border-radius: var(--r-sm); background: var(--fill); }
.persona-name { font-size: var(--fs-title3); font-weight: var(--fw-bold); letter-spacing: var(--tr-tight); line-height: var(--lh-tight); }
.persona-sub { margin-top: 2px; font-size: var(--fs-footnote); color: var(--ink-2); line-height: var(--lh-body); }
.persona-answer { margin-top: var(--s-4); padding: var(--s-3) var(--s-4); border-radius: var(--r-sm); background: var(--fill); font-size: var(--fs-footnote); line-height: var(--lh-body); color: var(--ink-2); }
.persona-answer b { color: var(--ink); }
.persona-section { margin-top: var(--s-4); }
.persona-prose { font-size: var(--fs-subhead); line-height: var(--lh-body); color: var(--ink-2); white-space: pre-wrap; }
.persona-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s-3) var(--s-4); margin: 0; font-size: var(--fs-caption); }
.persona-fact { min-width: 0; }
.persona-facts dt { color: var(--ink-3); }
.persona-facts dd { margin: 2px 0 0; color: var(--ink); font-weight: var(--fw-med); }
.persona-loading { font-size: var(--fs-footnote); color: var(--ink-3); }

.pc-compact .pc-controls { width: 100%; }
.pc-compact .pc-row-label { font-size: var(--fs-caption); }
.pc-compact .pc-svg { margin-top: var(--s-2); }
@media (prefers-reduced-motion: reduce) { .pc-tooltip, .evidence-tooltip { transition: none; } }

/* result card close: the card scrolls internally, so the button sticks to the top edge */
.result-card { position: relative; }
.result-card .res-close { position: sticky; top: 0; float: right; margin: -6px -6px 0 0; z-index: 3; }

/* ── first-run tour: one small callout at a time ─────────────────────────── */
.tour-tip {
  position: fixed; z-index: 60; width: min(300px, 86vw);
  padding: var(--s-3) var(--s-4); border-radius: var(--r-md);
  background: var(--card); color: var(--ink); box-shadow: var(--sh-3);
  font-size: var(--fs-footnote); line-height: var(--lh-body);
  opacity: 0; transform: translateY(4px);
  transition: opacity var(--t-mid) var(--ease), transform var(--t-mid) var(--ease);
}
.tour-tip.in { opacity: 1; transform: none; }
.tour-tip p { margin: 0 0 var(--s-2); color: var(--ink); }
.tour-actions { display: flex; justify-content: flex-end; gap: var(--s-2); }
.tour-actions button { border: 0; border-radius: var(--r-full); padding: 5px 12px; font: inherit; font-size: var(--fs-caption); font-weight: var(--fw-semi); cursor: pointer; }
.tour-skip { background: var(--fill); color: var(--ink-2); }
.tour-next { background: var(--accent); color: #fff; }
.tour-arrow { position: absolute; left: var(--tour-arrow-x, 50%); width: 12px; height: 12px; background: var(--card); transform: translateX(-50%) rotate(45deg); }
.tour-tip[data-side="above"] .tour-arrow { bottom: -6px; }
.tour-tip[data-side="below"] .tour-arrow { top: -6px; }
.about-tips { display: block; margin-top: var(--s-3); border: 0; background: none; padding: 0; color: var(--accent); font: inherit; font-size: var(--fs-footnote); cursor: pointer; }
.about-tips:hover { text-decoration: underline; }
@media (prefers-reduced-motion: reduce) { .tour-tip { transition: none; transform: none; } }

/* ── user manual: four big steps ─────────────────────────────────────────── */
.about-intro { font-size: var(--fs-subhead); line-height: var(--lh-body); color: var(--ink-2); margin: var(--s-4) 0 var(--s-5); }
.manual-step { padding: var(--s-5) 0; border-top: var(--hair) solid var(--sep); }
.manual-kicker { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-2); }
.manual-n { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: #fff; font-size: var(--fs-footnote); font-weight: var(--fw-bold); font-variant-numeric: var(--nums); }
.manual-name { font-size: var(--fs-caption); font-weight: var(--fw-semi); letter-spacing: var(--tr-label); text-transform: uppercase; color: var(--ink-3); }
.manual-title { margin: 0 0 var(--s-3); font-size: var(--fs-title3); font-weight: var(--fw-bold); letter-spacing: var(--tr-tight); line-height: var(--lh-tight); color: var(--ink); }
.manual-step .about-list { margin-bottom: 0; }
.manual-step + .about-h { margin-top: var(--s-5); }

/* Keep retrieved evidence compact until the user wants to inspect it. */
.res-web-sources { margin: 12px 0; font-size: 12px; line-height: 1.5; }
.res-web-sources summary { cursor: pointer; color: #3175f5; font-weight: 600; }
.res-web-sources ul { margin: 8px 0; padding-left: 18px; }
.res-web-sources a { color: #245bc3; overflow-wrap: anywhere; }
