:root {
  --bg: #0a0c11;
  --panel: #131722;
  --panel-2: #1a1f2d;
  --line: #2a3144;
  --text: #f3f5fa;
  --muted: #9aa3b8;
  --A: #ffb347;
  --B: #3fd8f7;
  --web: #d792ff;
  --ok: #4ade80;
  --warn: #fbbf24;
  --err: #ff6b6b;
  --accent: #7c9cff;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: clamp(15px, 1.35vw, 22px);
  line-height: 1.35;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ---------- header ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.top h1 { margin: 0; font-size: 1.5em; font-weight: 800; letter-spacing: -0.01em; }
.top .dash { color: var(--muted); font-weight: 400; }
.top .accent { color: var(--accent); }
.top-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); font-weight: 700; white-space: nowrap;
}
.pill.phone { background: var(--accent); color: #0a0c11; border-color: transparent; font-size: 1.1em; }
.pill .dot, .party .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); flex: none; }
.conn.live .dot { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.conn.connecting .dot { background: var(--warn); }
.conn.offline .dot { background: var(--err); animation: blink 1s infinite; }
.conn.offline { color: var(--err); }

.btn {
  font: inherit; font-weight: 700; color: var(--text); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 18px; cursor: pointer;
  user-select: none; -webkit-user-select: none;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: #0a0c11; border-color: transparent; }
.btn.ghost { background: transparent; padding: 6px 14px; }
.btn.ghost.off { color: var(--muted); text-decoration: line-through; }
.btn.danger:hover { border-color: var(--err); color: var(--err); }
.btn.small { padding: 4px 10px; font-size: 0.8em; }

/* ---------- party cards ---------- */
.parties {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 12px 20px;
}
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 14px; min-width: 0;
}
.party { opacity: 0.7; transition: opacity 0.2s, border-color 0.2s; }
.party.on { opacity: 1; }
.party[data-party="A"].on { border-color: var(--A); }
.party[data-party="B"].on { border-color: var(--B); }
.party[data-party="web"].on { border-color: var(--web); }
.party.on .dot { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.card-top { display: flex; align-items: center; gap: 8px; }
.card-top .badge { margin-left: auto; font-size: 1.05em; }
.sub { color: var(--muted); font-size: 0.85em; margin: 4px 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.override { display: flex; align-items: center; gap: 8px; font-size: 0.8em; color: var(--muted); }
select {
  font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 4px 6px; min-width: 0; flex: 1;
}

.latency .lbl { font-size: 0.8em; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.latency .nums { display: flex; gap: 18px; align-items: baseline; flex-wrap: wrap; margin: 2px 0; }
.latency b { font-size: 1.9em; font-variant-numeric: tabular-nums; }
.latency small { color: var(--muted); }
.latency .note { font-size: 0.72em; color: var(--muted); }

/* ---------- chips & badges ---------- */
.chip {
  display: inline-block; padding: 2px 12px; border-radius: 999px; font-weight: 800; color: #0a0c11;
  background: var(--muted); white-space: nowrap; font-size: 0.85em;
}
.chip.p-A { background: var(--A); }
.chip.p-B { background: var(--B); }
.chip.p-web { background: var(--web); }
.badge {
  display: inline-block; padding: 1px 8px; border-radius: 6px; border: 1px solid var(--line);
  background: #0f1320; color: var(--text); font-weight: 700; font-size: 0.8em; text-transform: uppercase;
  font-variant-numeric: tabular-nums; letter-spacing: 0.04em;
}

/* ---------- transcript ---------- */
.stage { display: flex; min-height: 0; gap: 12px; padding: 0 20px; }
.transcript-wrap {
  flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.cols-head {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 8px 18px;
  font-size: 0.8em; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.transcript { flex: 1; overflow-y: auto; padding: 8px 10px 16px; scroll-behavior: smooth; }
.empty { color: var(--muted); padding: 40px 12px; text-align: center; font-size: 1.15em; }

.row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 12px 10px 12px 14px; margin: 6px 0;
  border-left: 6px solid var(--muted); border-radius: 8px; background: var(--panel-2);
}
.row.from-A { border-left-color: var(--A); }
.row.from-B { border-left-color: var(--B); }
.row.from-web { border-left-color: var(--web); }
.row.fresh { animation: pop 0.5s ease-out; }
.cell { min-width: 0; }
.meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.time { color: var(--muted); font-size: 0.75em; font-variant-numeric: tabular-nums; }
.row .text { font-size: clamp(19px, 2.05vw, 34px); line-height: 1.25; font-weight: 600; overflow-wrap: anywhere; }
.trans .text { color: #ffffff; }
.orig .text { color: #dfe4ef; }
.tr + .tr { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.arrow { color: var(--muted); font-size: 0.75em; text-transform: uppercase; font-weight: 700; }
.status { font-size: 0.75em; font-weight: 700; }
.status.ok { color: var(--ok); }
.status.pending { color: var(--warn); }
.status.err { color: var(--err); }
.tr.failed .text { color: var(--err); }
.lat { margin-top: 6px; color: var(--muted); font-size: 0.8em; font-variant-numeric: tabular-nums; font-weight: 700; }
.lat small { font-weight: 400; }
.muted { color: var(--muted); }

.intent {
  padding: 1px 10px; border-radius: 999px; font-size: 0.75em; font-weight: 800;
  background: #2b3550; color: #c9d6ff; border: 1px solid #3d4a6e;
}
.intent.i-booking { background: #183a2a; color: #86efac; border-color: #2c6b4b; }
.intent.i-complaint { background: #3d1c1c; color: #fca5a5; border-color: #7a3434; }
.intent.i-question { background: #1c2c46; color: #93c5fd; border-color: #345584; }
.intent.i-smalltalk { background: #3a2f17; color: #fcd34d; border-color: #6b5626; }

/* ---------- lookup side panel ---------- */
.lookup {
  width: min(380px, 34vw); flex: none; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
}
.aside-head { display: flex; align-items: center; justify-content: space-between; }
.aside-head h2 { margin: 0; font-size: 1.1em; }
.answer { font-size: 1em; line-height: 1.4; white-space: pre-wrap; }
.sources { margin: 0; padding-left: 18px; font-size: 0.8em; }
.sources a { color: var(--B); overflow-wrap: anywhere; }

/* ---------- composer ---------- */
.bottom { padding: 8px 20px 14px; }
.interim {
  margin: 0 0 8px; padding: 8px 14px; border-radius: 10px; background: #1f1630; border: 1px dashed var(--web);
  color: var(--web); font-style: italic; font-size: 1.05em;
}
.composer { display: flex; gap: 10px; align-items: stretch; }
.composer input {
  flex: 1; min-width: 0; font: inherit; font-size: 1.1em; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px;
}
.btn.mic { min-width: 9em; touch-action: none; }
.btn.mic.rec { background: var(--err); color: #0a0c11; border-color: transparent; animation: pulse 1s infinite; }

/* ---------- toasts ---------- */
.toasts {
  position: fixed; right: 16px; bottom: 96px; display: flex; flex-direction: column; gap: 8px;
  z-index: 50; max-width: min(440px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
  background: var(--panel-2); border: 1px solid var(--line); border-left: 6px solid var(--accent);
  padding: 10px 14px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  animation: pop 0.25s ease-out; transition: opacity 0.4s; font-size: 0.9em;
}
.toast.warn { border-left-color: var(--warn); }
.toast.error { border-left-color: var(--err); }
.toast.out { opacity: 0; }

@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes blink { 50% { opacity: 0.3; } }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(255, 107, 107, 0.25); } }

/* ---------- phone / narrow ---------- */
@media (max-width: 900px) {
  .parties { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  body { display: block; height: auto; overflow: auto; font-size: 16px; }
  .top { padding: 10px 16px; }
  .top h1 { font-size: 1.25em; }
  .parties { padding: 10px 16px; gap: 8px; }
  .stage { flex-direction: column; padding: 0 16px; }
  .transcript-wrap { min-height: 50vh; }
  .transcript { max-height: none; }
  .cols-head { display: none; }
  .row { grid-template-columns: 1fr; gap: 8px; }
  .row .text { font-size: 20px; }
  .lookup { width: auto; }
  .bottom { position: sticky; bottom: 0; background: var(--bg); padding: 8px 16px 12px; border-top: 1px solid var(--line); }
  .composer { flex-wrap: wrap; }
  .composer input { flex-basis: 100%; }
  .composer .btn { flex: 1; }
  .toasts { bottom: 140px; right: 16px; }
}


/* ===================== CrossTalk site theme ===================== */
:root {
  --bg: #0a0b0b;
  --panel: #131615;
  --panel-2: #1a1e1d;
  --line: #262b2a;
  --text: #eef4f1;
  --muted: #8f9a96;
  --mint: #9fe6c6;
  --mint-ink: #08110d;
  --accent: #9fe6c6;
  --A: #9fe6c6;
  --B: #8fb8ff;
  --web: #f5c07a;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --pad: clamp(16px, 4vw, 56px);
}
body.site {
  display: block; height: auto; overflow-x: hidden; overflow-y: auto;
  font-size: 17px; line-height: 1.5;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(159,230,198,0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(159,230,198,0.05), transparent 60%),
    var(--bg);
}
body.site a { color: inherit; }

/* nav */
.nav { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px var(--pad); background: rgba(10,11,11,0.78); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; font-size: 1.35rem; letter-spacing: -0.02em; }
.brand img { border-radius: 8px; }
.nav-links { display: flex; align-items: center; gap: clamp(12px, 2.5vw, 32px); }
.nav-links > a:not(.cta) { color: var(--muted); text-decoration: none; font-weight: 500; }
.nav-links > a:not(.cta):hover { color: var(--text); }

/* call-to-action pill */
.cta { display: inline-flex; align-items: center; gap: 14px; text-decoration: none; background: var(--mint); color: var(--mint-ink) !important;
  font-weight: 800; letter-spacing: -0.01em; border-radius: 999px; box-shadow: 0 10px 40px rgba(159,230,198,0.18); transition: transform .15s, box-shadow .15s; white-space: nowrap; }
.cta:hover { transform: translateY(-1px); box-shadow: 0 14px 50px rgba(159,230,198,0.28); }
.cta-ico { display: grid; place-items: center; border-radius: 50%; background: var(--mint-ink); color: var(--mint); }
.cta-ico svg { width: 55%; height: 55%; }
.cta-sm { padding: 8px 20px 8px 8px; font-size: 1.05rem; }
.cta-sm .cta-ico { width: 38px; height: 38px; }
.cta-lg { padding: 14px 40px 14px 14px; font-size: clamp(1.3rem, 2.6vw, 2.1rem); margin-top: 8px; }
.cta-lg .cta-ico { width: clamp(48px, 5vw, 68px); height: clamp(48px, 5vw, 68px); }

/* hero */
.hero { padding: clamp(56px, 10vw, 140px) var(--pad) clamp(40px, 6vw, 80px); max-width: 1400px; }
.eyebrow-pill { display: inline-flex; align-items: center; gap: 10px; padding: 8px 18px; border: 1px solid var(--line); border-radius: 999px; color: #c9d3cf; font-size: 0.95rem; background: rgba(255,255,255,0.02); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 0 rgba(159,230,198,.6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(159,230,198,0); } 100% { box-shadow: 0 0 0 0 rgba(159,230,198,0); } }
.display { font-size: clamp(2.8rem, 8.2vw, 7.2rem); font-weight: 900; line-height: 0.98; letter-spacing: -0.045em; margin: 36px 0 28px; }
.mint { color: var(--mint); }
.lede { font-size: clamp(1.1rem, 2vw, 1.6rem); color: #b7c2be; max-width: 52ch; margin: 0 0 40px; line-height: 1.55; }
.fine { color: var(--muted); font-size: 0.95rem; margin-top: 16px; }

/* marquee */
.marquee { border-block: 1px solid var(--line); overflow: hidden; padding: 22px 0; mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.marquee-track { display: flex; align-items: center; gap: 36px; width: max-content; animation: marquee 40s linear infinite; }
.marquee-track span { font-size: clamp(1.6rem, 3.2vw, 2.6rem); font-weight: 700; color: #c5cfcb; opacity: .85; }
.marquee-track i { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); opacity: .7; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* sections */
.section { padding: clamp(56px, 8vw, 110px) var(--pad) 0; max-width: 1500px; }
.kicker { display: flex; align-items: center; gap: 18px; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.28em; font-size: 0.85rem; color: var(--mint); }
.kicker .num { color: var(--muted); letter-spacing: 0.15em; }
.kicker .rule { width: 52px; height: 1px; background: var(--muted); opacity: .6; }
.h2 { font-size: clamp(2.2rem, 5.6vw, 4.6rem); font-weight: 900; letter-spacing: -0.04em; line-height: 1.02; margin: 22px 0 40px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.section-head .h2 { margin-bottom: 28px; }
.head-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* live console */
.console { border: 1px solid var(--line); border-radius: 28px; background: rgba(19,22,21,0.7); overflow: hidden; }
.console .parties { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; padding: 18px; border-bottom: 1px solid var(--line); }
.console .card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 18px; }
.console .stage { display: flex; gap: 12px; padding: 0; height: min(62vh, 640px); }
.console .transcript-wrap { border: 0; border-radius: 0; background: transparent; }
.console .bottom { border-top: 1px solid var(--line); padding: 14px 18px 18px; }
.console .row .text { font-size: clamp(18px, 1.6vw, 28px); }
.empty { display: grid; justify-items: center; gap: 18px; padding: 70px 12px; }
.empty-ring { width: 84px; height: 84px; border-radius: 22px; border: 1px dashed #3a4240; display: grid; place-items: center; color: var(--muted); }
.empty-ring svg { width: 34px; height: 34px; }
.pill { border-radius: 999px; }
.btn { border-radius: 999px; font-family: var(--font); }
.btn.primary { background: var(--mint); color: var(--mint-ink); font-weight: 800; }
.composer input { border-radius: 999px; padding-inline: 22px; font-family: var(--font); }
.lookup h3 { margin: 0; font-size: 1.1em; } .lookup h3 small { color: var(--muted); font-weight: 500; }

/* steps */
.steps { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 20px; }
.step { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 28px; padding: 40px 36px; background: linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0)); }
.step::after { content: attr(data-n); position: absolute; top: -18px; right: 10px; font-size: 9rem; font-weight: 900; color: rgba(255,255,255,0.045); line-height: 1; }
.step-ico { width: 64px; height: 64px; border-radius: 18px; background: var(--mint); color: var(--mint-ink); display: grid; place-items: center; margin-bottom: 34px; }
.step-ico svg { width: 30px; height: 30px; }
.step h3 { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 12px; }
.step p { color: #a9b4b0; font-size: 1.12rem; margin: 0; line-height: 1.6; }

/* examples */
.examples { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 20px; }
.ex { border: 1px solid var(--line); border-radius: 28px; padding: 32px 36px; background: rgba(255,255,255,0.02); }
.ex .tag { display: inline-block; font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--mint); background: rgba(159,230,198,0.10); padding: 6px 14px; border-radius: 999px; }
.ex .orig { font-size: clamp(1.4rem, 2.4vw, 2rem); font-weight: 600; line-height: 1.3; margin: 20px 0 20px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.ex .tr { color: var(--muted); font-size: 1.15rem; margin: 0; }

/* safety + built with + footer */
.alert { display: flex; gap: 20px; align-items: flex-start; margin-top: clamp(56px, 8vw, 110px); padding: 40px var(--pad); background: #1d1213; border-block: 1px solid #3a2223; }
.alert svg { width: 34px; height: 34px; color: #f2a5a5; flex: none; margin-top: 4px; }
.alert p { margin: 0; font-size: clamp(1.1rem, 2vw, 1.6rem); line-height: 1.6; color: #e9dede; }
.alert a { color: #f6b3b3; font-weight: 800; text-decoration: underline; text-underline-offset: 5px; }
.chips-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 30px; }
.chips-row span { border: 1px solid var(--line); border-radius: 999px; padding: 14px 30px; font-size: 1.3rem; font-weight: 600; color: #d7dfdc; }
.foot { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-top: clamp(56px, 8vw, 110px); padding: 40px var(--pad); border-top: 1px solid var(--line); color: var(--muted); }
.foot p { margin: 0; max-width: 70ch; }

@media (max-width: 1000px) {
  .console .parties { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .steps, .examples { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .nav-links > a:not(.cta) { display: none; }
  .cta-sm { font-size: 0.9rem; padding-right: 14px; }
  .console .parties { grid-template-columns: 1fr; }
  .console .stage { height: 70vh; }
  .composer { flex-wrap: wrap; }
}

/* watch-only mode: the page never speaks into calls */
body.no-web .party[data-party="web"], body.no-web #micBtn, body.no-web #voiceBtn,
body.no-web #composer button[type="submit"], body.no-web #lookupSend { display: none !important; }
body.no-web .console .parties { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1000px) { body.no-web .console .parties { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { body.no-web .console .parties { grid-template-columns: 1fr; } }
