:root {
  /* Light theme — near-neutral background (least gray needed to separate dialogue), dark-fuchsia accent. */
  --bg: #f6f5f7;
  --panel: #ffffff;
  --panel-2: #f8f4f8;
  --line: #ececef;
  --text: #211f36;
  --muted: #726f89;
  --accent: #c026a3;
  --accent-2: #e879f9;
  --warn: #e0954e;
  --bad: #e0607a;
  --bar-bg: #ece8f8;
  --radius: 20px;
  --maxw: 760px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: flex;
  flex-direction: column;
}

/* ── Visor ──────────────────────────────────────────────── */
.visor {
  position: sticky;
  top: 0;
  z-index: 20;
  /* tinted visor (fuchsia) over a light chat background */
  background: linear-gradient(180deg, #fdf2fa 0%, #f7e2f1 100%);
  border-bottom: 1px solid #f0d4e8;
  backdrop-filter: blur(8px);
}
.visor-body {
  overflow: hidden;
  transition: max-height 0.28s ease, opacity 0.22s ease, padding 0.28s ease;
  max-height: 420px;
  opacity: 1;
  padding: 16px max(16px, calc((100% - var(--maxw)) / 2));
}
.visor.collapsed .visor-body { max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0; }
.visor-handle {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.visor-handle:hover { color: var(--text); }
.visor-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.visor-handle.pulse { color: var(--accent); }
.visor-handle.pulse .visor-dot { background: var(--accent-2); box-shadow: 0 0 10px var(--accent-2); animation: hs-pulse 1.1s ease-in-out infinite; }
@keyframes hs-pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(1.5); } }
.visor-handle.pulse .visor-title::after { content: ' · new data'; color: var(--accent-2); }
.visor-title { flex: 1; text-align: left; }
.visor-chevron { transition: transform 0.28s ease; }
.visor:not(.collapsed) .visor-chevron { transform: rotate(180deg); }

/* gauges */
.gauge-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 20px; }
.gauge { display: flex; flex-direction: column; gap: 5px; }
.gauge .g-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; display: flex; justify-content: space-between; }
.gauge .g-val { color: var(--text); font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 6px; background: var(--bar-bg); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 6px; background: var(--accent); transition: width 0.3s ease; }
.bar.warn > span { background: var(--warn); }
.bar.good > span { background: var(--accent-2); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.chip { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); }
.chip.accent { border-color: var(--accent); color: var(--accent); }
.chip.good { border-color: var(--accent-2); color: var(--accent-2); }
.chip.warn { border-color: var(--warn); color: var(--warn); }
.chip.muted { color: var(--muted); }

.visor-section-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 14px 0 8px; }
.kv { display: flex; gap: 6px; font-size: 13px; color: var(--muted); }
.kv b { color: var(--text); font-weight: 600; }
.note { font-size: 12.5px; color: var(--muted); margin-top: 6px; font-style: italic; }
.mapkey { font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: var(--muted); }

/* ── Chat ──────────────────────────────────────────────── */
.chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.messages { flex: 1; overflow-y: auto; padding: 24px max(16px, calc((100% - var(--maxw)) / 2)); display: flex; flex-direction: column; gap: 16px; }
.messages::before { content: ""; margin-top: auto; } /* chat flows up from the bottom (ChatGPT/Claude style) */
.msg { display: flex; }
.msg.user { justify-content: flex-end; }
.bubble { max-width: 80%; padding: 11px 15px; border-radius: var(--radius); white-space: pre-wrap; word-wrap: break-word; }
.msg.user .bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant .bubble { background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.assistant.thinking .bubble { color: var(--muted); }

.composer { display: flex; gap: 10px; padding: 12px max(16px, calc((100% - var(--maxw)) / 2)); border-top: 1px solid var(--line); background: var(--bg); }
.composer textarea {
  flex: 1; resize: none; background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; font: inherit; max-height: 160px;
}
.composer textarea:focus { outline: none; border-color: var(--accent); }
.composer button {
  width: 42px; height: 42px; border-radius: 12px; border: none; background: var(--accent);
  color: #08131f; font-size: 18px; cursor: pointer; align-self: flex-end;
}
.composer button:disabled { opacity: 0.4; cursor: default; }

.footer { display: flex; align-items: center; gap: 12px; padding: 0 max(16px, calc((100% - var(--maxw)) / 2)) 12px; }
.badge { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; }
.badge.full { color: var(--warn); border-color: var(--warn); }
.linkbtn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 12px; text-decoration: underline; }
.linkbtn:hover { color: var(--text); }

/* ── Persona Register — base-persona dropdown (moat-safe names only) ── */
.persona-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px max(16px, calc((100% - var(--maxw)) / 2)) 2px;
  font-size: 12px; color: var(--muted); letter-spacing: 0.02em;
}
.persona-select {
  appearance: none; -webkit-appearance: none;
  background: var(--panel-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%239aa1ad' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  padding: 7px 30px 7px 12px; font: inherit; font-size: 13px; cursor: pointer;
}
.persona-select:focus { outline: none; border-color: var(--accent); }

/* voice-mode resonance orb — floats over the chat, breathes when voice mode is on, reacts to the
   spoken reply, warms to an accent while listening; invisible when voice mode is off */
#viz {
  position: fixed;
  left: 50%;
  top: 38%;
  /* width/height are set by voice.js (responsive to viewport); keep only positioning here */
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 5;
}

/* mic (voice) button in the composer — ghost when off, accent when on, red+pulsing while listening */
.composer .mic {
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
}
.composer .mic:hover { color: var(--text); border-color: var(--accent); }
.composer .mic.on { color: var(--accent); border-color: var(--accent); }
.composer .mic.listening {
  color: #fff;
  background: var(--bad);
  border-color: var(--bad);
  animation: mic-pulse 1s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 106, 106, 0.55); }
  50% { box-shadow: 0 0 0 9px rgba(224, 106, 106, 0); }
}

/* voice status line under the composer */
.voice-hint {
  padding: 6px max(16px, calc((100% - var(--maxw)) / 2)) 0;
  font-size: 12px;
  color: var(--muted);
  min-height: 14px;
}
.voice-hint.live { color: var(--accent); }
.voice-hint.warn { color: var(--warn); }
.voice-hint:empty { padding: 0; min-height: 0; }

/* ══════════════════════════════════════════════════════════════════════════
   Orion skin (light) — adapted from the "Orion" template: friendly lavender-white,
   violet accent, soft shadows, segmented tabs, pill composer. Styling only — overrides
   the existing structure, no DOM/function change. Easy to revert (delete block + tokens).
   ══════════════════════════════════════════════════════════════════════════ */
body { background: radial-gradient(1000px 520px at 50% -6%, #efe9ff 0%, #f5f2fc 46%, #f2f0fb 100%) fixed, var(--bg); color: var(--text); }

/* segmented Chat|Voice control */
.tabs { gap: 6px; padding: 14px 10px 4px; }
.tabs .tab { border-radius: 999px; padding: 8px 22px; color: var(--muted); transition: background .18s, color .18s, box-shadow .18s; }
.tabs .tab.active { background: #fff; color: var(--accent); box-shadow: 0 2px 10px rgba(124,92,255,.16), inset 0 0 0 1px #ece6ff; }
.tabs .tab:hover:not(.active) { color: #4b4864; }

/* messages — soft rounded bubbles with a gentle shadow */
.messages { gap: 18px; }
.bubble { border-radius: 20px; padding: 12px 16px; line-height: 1.55; box-shadow: 0 2px 10px rgba(40,30,80,.05); }
.msg.user .bubble { background: linear-gradient(135deg, #8b6bff, #7c5cff); color: #fff; border-bottom-right-radius: 7px; }
.msg.assistant .bubble { background: #fff; border: 1px solid var(--line); color: var(--text); border-bottom-left-radius: 7px; }
.msg.assistant.thinking .bubble { color: var(--muted); }

/* composer — white pill input + circular violet send */
.composer { border-top: 1px solid var(--line); background: transparent; padding-top: 14px; padding-bottom: 14px; }
.composer textarea { border-radius: 22px; background: #fff; border-color: var(--line); color: var(--text); padding: 12px 16px; box-shadow: 0 2px 10px rgba(40,30,80,.05); }
.composer textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,92,255,.14); }
#send { border-radius: 50%; background: linear-gradient(135deg, #8b6bff, #7c5cff); color: #fff; box-shadow: 0 4px 14px rgba(124,92,255,.32); }
.composer .mic { border-radius: 50%; background: #fff; border-color: var(--line); }

/* persona control — pill */
.persona-bar { padding-top: 6px; }
.persona-select { border-radius: 999px; background-color: #fff; }

/* visor — light glass */
.visor { background: linear-gradient(180deg, #ffffff 0%, rgba(248,246,255,.92) 100%); border-bottom-color: var(--line); }
.badge { background: #fff; }
.linkbtn { color: var(--accent); }

/* ══════════════════════════════════════════════════════════════════════════
   UI v2 (2026-07-30) — dialogue as a solid white rounded card (no border) aligned to the visor
   margins; composer & strips aligned to the same --maxw; chat dialogue = the send-icon accent.
   ══════════════════════════════════════════════════════════════════════════ */
.messages {
  width: min(var(--maxw), calc(100% - 32px));
  margin: 14px auto 8px;
  padding: 20px 22px;
  background: #fff;
  border: none;                 /* no colour on the border */
  border-radius: 22px;
  box-shadow: 0 2px 16px rgba(30,20,50,.06);
  flex: 1; min-height: 0;
}
/* the strips above/below the dialogue share the same margins */
.copybar, .voice-hint { width: min(var(--maxw), calc(100% - 32px)); margin-left: auto; margin-right: auto; padding-left: 4px; padding-right: 4px; }
.copybar { justify-content: flex-end; }

/* chat dialogue = the same accent as the (outline) send icon */
.msg.user .bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 7px; box-shadow: 0 2px 10px rgba(192,38,163,.18); }
.msg.assistant .bubble { background: #fff; border: 1px solid var(--line); color: var(--text); }

/* the composer sits on the light bg, not a competing panel colour */
.composer-v2 { background: #fff; }

/* ── Top bar — brand (face + wordmark) left · "What Is S.I.F.A ?" right ── */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px; background: #fff; border-bottom: 1px solid var(--line); z-index: 22; }
.brand { display: flex; align-items: center; gap: 9px; }
.brand-face { width: 30px; height: 30px; object-fit: contain; filter: drop-shadow(0 1px 3px rgba(192,38,163,.28)); }
.brand-word { font-family: Arial, Helvetica, sans-serif; font-weight: 800; letter-spacing: .06em; color: var(--accent); font-size: 16px; }
.topbar-links { display: flex; align-items: center; gap: 10px; }
.topbar-pipe { color: var(--line); font-weight: 300; }
.about-link { font: inherit; font-size: 13px; font-weight: 600; color: #fff; background: var(--accent); border: 1.5px solid var(--accent); border-radius: 999px; padding: 6px 15px; cursor: pointer; transition: background .15s, color .15s, box-shadow .15s; }
.about-link:hover { box-shadow: 0 4px 16px rgba(192,38,163,.32); }
.about-link.ghost { color: var(--accent); background: transparent; }
.about-link.ghost:hover { background: var(--accent); color: #fff; box-shadow: none; }
@media (max-width: 560px) { .brand-word { display: none; } .about-link { padding: 6px 11px; font-size: 12px; } }

/* ── "Request an Invitation" modal (with a little sizzle) ── */
.invite-modal { position: fixed; inset: 0; z-index: 330; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(13,7,16,.62); backdrop-filter: blur(6px); }
.invite-modal[hidden] { display: none; }
.invite-card { position: relative; width: min(460px, 96vw); max-height: 92vh; overflow: auto; border-radius: 22px; padding: 30px 28px 26px; color: #f0e3ef;
  background: radial-gradient(120% 90% at 50% -10%, #4a1247 0%, #2a0b2c 45%, #17091a 100%); border: 1px solid rgba(217,70,239,.35); box-shadow: 0 30px 80px rgba(10,4,14,.6), 0 0 0 1px rgba(232,121,249,.12) inset; }
.invite-x { position: absolute; top: 12px; right: 14px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(247,196,238,.4); background: transparent; color: #f7c4ee; font-size: 15px; cursor: pointer; }
.invite-x:hover { background: rgba(217,70,239,.2); color: #fff; }
.invite-face { width: 62px; height: auto; display: block; margin: 0 auto 8px; filter: drop-shadow(0 6px 20px rgba(232,121,249,.5)); }
.invite-title { font-family: Arial, Helvetica, sans-serif; font-weight: 800; font-size: 26px; text-align: center; color: #fff; margin: 0 0 4px; }
.invite-sub { text-align: center; color: #d9a8ce; font-size: 14px; margin: 0 0 20px; line-height: 1.5; }
.invite-field { margin-bottom: 13px; }
.invite-field label { display: block; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: #c479b6; margin-bottom: 5px; }
.invite-field input, .invite-field textarea { width: 100%; box-sizing: border-box; background: rgba(255,255,255,.06); border: 1px solid rgba(247,196,238,.28); border-radius: 12px; padding: 11px 13px; font: inherit; font-size: 15px; color: #fff; resize: vertical; }
.invite-field input::placeholder, .invite-field textarea::placeholder { color: #9a6f92; }
.invite-field input:focus, .invite-field textarea:focus { outline: none; border-color: #e879f9; box-shadow: 0 0 0 3px rgba(217,70,239,.18); }
.invite-submit { width: 100%; margin-top: 6px; font: inherit; font-size: 16px; font-weight: 700; color: #fff; border: none; border-radius: 12px; padding: 13px; cursor: pointer;
  background: linear-gradient(135deg, #e879f9, #c026a3); box-shadow: 0 8px 26px rgba(192,38,163,.4); transition: transform .1s, box-shadow .15s, filter .15s; }
.invite-submit:hover { filter: brightness(1.06); box-shadow: 0 10px 32px rgba(217,70,239,.5); }
.invite-submit:active { transform: translateY(1px); }
.invite-submit:disabled { opacity: .6; cursor: default; }
.invite-note { text-align: center; font-size: 12px; color: #a17a99; margin: 12px 0 0; }
.invite-done { text-align: center; padding: 20px 0 6px; }
.invite-done .dot { font-size: 42px; }
.invite-done h3 { font-family: Arial, Helvetica, sans-serif; color: #fff; margin: 8px 0 6px; }
.invite-done p { color: #d9a8ce; font-size: 14px; margin: 0; }

/* ── About "page" — a full-screen manifesto overlay (dark fuchsia, matches the splash) ── */
.about-modal { position: fixed; inset: 0; z-index: 320; overflow-y: auto; background: #0d0710; }
.about-modal[hidden] { display: none; }
.about-page { position: relative; min-height: 100%; background: radial-gradient(125% 80% at 50% -10%, #e879f9 0%, #c026a3 16%, #86198f 34%, #3b0f3d 60%, #0d0710 100%); }
.about-x { position: fixed; top: 16px; right: 18px; width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid rgba(247,196,238,.5); background: rgba(13,7,16,.5); color: #f7c4ee; font-size: 16px; cursor: pointer; z-index: 2; }
.about-x:hover { background: rgba(217,70,239,.22); color: #fff; }
.about-inner { max-width: 720px; margin: 0 auto; padding: 54px 24px 84px; color: #ecdcea; font-size: 16.5px; line-height: 1.72; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.about-face { width: 118px; height: auto; display: block; margin: 0 auto 14px; filter: drop-shadow(0 8px 30px rgba(232,121,249,.5)); }
.about-title { font-family: Arial, Helvetica, sans-serif; font-weight: 800; font-size: clamp(48px,9vw,84px); text-align: center; margin: 0; color: #fff; letter-spacing: .02em; }
.about-expand { text-align: center; margin: 8px 0 2px; color: #f0c2ea; letter-spacing: .16em; text-transform: uppercase; font-size: 12.5px; }
.about-by { text-align: center; color: #c479b6; margin: 0 0 8px; font-size: 15px; }
.about-eq { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 30px 0 6px; font-family: "DejaVu Serif", Georgia, "Times New Roman", serif; font-size: clamp(21px,4.2vw,32px); color: #fff; }
.eqpsi { font-style: italic; }
.eqpsi sub { font-size: .5em; letter-spacing: .05em; }
.eqop { opacity: .8; }
.frac { display: inline-flex; flex-direction: column; text-align: center; }
.frac .num { padding: 0 10px 5px; border-bottom: 2px solid rgba(247,196,238,.7); }
.frac .den { padding: 5px 10px 0; }
.about-eqnote { text-align: center; font-style: italic; color: #b06ea6; font-size: 13px; margin: 4px 0 34px; }
.about-body p { margin: 0 0 18px; }
.about-body em { color: #f7c4ee; font-style: italic; }
.about-h { font-family: Arial, Helvetica, sans-serif; font-weight: 800; color: #fff; font-size: 22px; margin: 36px 0 12px; }
.about-values { list-style: none; padding: 0; margin: 0 0 18px; }
.about-values li { padding: 4px 0 4px 18px; border-left: 2px solid rgba(217,70,239,.55); margin-bottom: 12px; }
.about-values b { color: #fff; }
.about-sign { text-align: center; font-size: 18px; color: #f7c4ee; margin-top: 32px; font-style: italic; }
/* manifesto */
.about-lead { text-align: center; font-family: Arial, Helvetica, sans-serif; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: #f7c4ee; font-size: 14px; margin: 40px 0 6px; }
.about-body h2.about-h:first-of-type { margin-top: 8px; }
.about-quote { margin: 20px 0; padding: 12px 20px; border-left: 3px solid #e879f9; background: rgba(217,70,239,.10); border-radius: 0 10px 10px 0; color: #fff; font-size: 18px; font-style: italic; }
.about-commit { counter-reset: c; list-style: none; padding: 0; margin: 6px 0 18px; }
.about-commit li { position: relative; padding: 8px 0 8px 40px; margin-bottom: 8px; border-bottom: 1px solid rgba(247,196,238,.12); }
.about-commit li::before { counter-increment: c; content: counter(c); position: absolute; left: 0; top: 8px; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid #c026a3; color: #f7c4ee; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.about-commit b { color: #fff; }
.about-byline { text-align: center; margin: 44px 0 0; font-family: Arial, Helvetica, sans-serif; font-weight: 800; font-size: 20px; color: #fff; }
.about-byline span { display: block; font-weight: 400; font-size: 14px; color: #c479b6; letter-spacing: .06em; text-transform: uppercase; margin-top: 4px; }
