/* talk.css — NetShow Alive face-to-face stage (Track B).
   Night tokens from the design handoff; the stage intentionally stays dark. */
:root {
  --nsa-bg: #0A0F22; --nsa-band: #0C1229; --nsa-panel: #101736; --nsa-panel2: #0F1634;
  --nsa-inset: #0C1230; --nsa-chip: #131B3D; --nsa-chip2: #151E42; --nsa-header: rgba(8, 13, 30, .94);
  --nsa-bd: #26325A; --nsa-bd2: #1E2A4E; --nsa-bd3: #161F44; --nsa-bd4: #2B3760; --nsa-bd5: #273358;
  --nsa-ink: #EAEFFF; --nsa-ink2: #DCE3FA; --nsa-text: #C7D0F2; --nsa-sub: #A9B4DE; --nsa-sub2: #8B97C4;
  --nsa-faint: #7C89B8; --nsa-faint2: #66739F;
  --nsa-peri: #8FA5FF; --nsa-peri2: #B9C6FF; --nsa-mint: #3EF0BE; --nsa-yel: #FFC94D;
  --nsa-coral: #FF9C8F; --nsa-vio: #B08CFF;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--nsa-bg); color: var(--nsa-ink);
  font-family: 'Instrument Sans', system-ui, sans-serif;
  display: flex; flex-direction: column; overflow: hidden;
  height: 100dvh;
}
a { color: var(--nsa-peri); text-decoration: none; }
a:hover { color: var(--nsa-peri2); }
:focus-visible { outline: 2px solid #8FA5FF; outline-offset: 2px; border-radius: 4px; }
::selection { background: #3EF0BE; color: #0A0F22; }
button { font: inherit; cursor: pointer; }

.skip {
  position: fixed; top: -60px; left: 16px; z-index: 200; background: #8FA5FF; color: #0A0F22;
  padding: 10px 14px; border-radius: 0 0 10px 10px; font-weight: 600;
}
.skip:focus { top: 0; color: #0A0F22; }

/* ---------- top bar (the minimal menu) ---------- */
.bar {
  display: flex; align-items: center; gap: 14px; padding: 0 14px; height: 50px; flex: 0 0 auto;
  background: var(--nsa-header); border-bottom: 1px solid var(--nsa-bd2);
  backdrop-filter: blur(14px); z-index: 40;
}
.bar .home {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 6px;
  font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 15px; color: var(--nsa-ink);
  white-space: nowrap;
}
.bar .home .arrow { color: var(--nsa-peri); }
.bar .home .brand-alive { color: var(--nsa-peri); }
.bar .ttl {
  flex: 1; text-align: center; font-family: 'IBM Plex Mono', monospace; font-size: 10.5px;
  letter-spacing: .16em; color: var(--nsa-sub2); overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.badge {
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
  padding: 7px 12px; border-radius: 999px; border: 1px solid var(--nsa-bd5); background: var(--nsa-chip);
  color: var(--nsa-sub); min-width: 92px; text-align: center; white-space: nowrap;
}
.badge[data-state="speaking"] { color: var(--nsa-mint); border-color: #1E4A3C; background: #0D2A22; }
.badge[data-state="listening"] { color: var(--nsa-peri2); }
.badge[data-state="thinking"], .badge[data-state="tool_use"], .badge[data-state="waiting_for_approval"] { color: var(--nsa-yel); }
.badge[data-state="interrupted"], .badge[data-state="error"] { color: var(--nsa-coral); }
.badge[data-state="success"] { color: var(--nsa-mint); }

/* ---------- stage ---------- */
.stage { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.stage-glow {
  position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 50% 8%, #17204A 0%, #0C1230 62%);
}
.face-mount {
  position: absolute; inset: 12px 12px 96px;
  display: flex; align-items: center; justify-content: center;
}
.mount-fill { width: 100%; height: 100%; position: relative; }
.mount-fill alive-avatar { width: 100%; height: 100%; display: block; }
.mount-canvas { width: 100%; height: 100%; display: block; }
/* keep text faces plain blocks — flex/grid on a <pre> breaks colored spans */
.basic-ascii {
  margin: 0; color: #cfe0ff; text-align: center; white-space: pre;
  max-width: 100%; max-height: 100%; overflow: hidden;
  font: 700 clamp(12px, 5vmin, 64px)/1.15 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
}
.sample-wrap { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.sample-inner { transform-origin: center center; }
.sample-pre { margin: 0; white-space: pre; text-align: center; color: #cfe0ff; }
.hyb-wrap {
  position: relative; height: min(100%, 78vmin); aspect-ratio: 1 / 1; max-width: 100%;
  border-radius: 18px; overflow: hidden;
}
.hyb-wrap img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; user-select: none; }
.hyb-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.face-name {
  position: absolute; top: 12px; left: 16px; z-index: 5;
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--nsa-faint); background: rgba(10, 15, 34, .55); padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--nsa-bd3); backdrop-filter: blur(6px);
}
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--nsa-mint); margin-right: 7px; vertical-align: 1px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

/* ---------- captions ---------- */
.captions-wrap {
  position: absolute; left: 0; right: 0; bottom: 10px; z-index: 6;
  display: flex; justify-content: center; padding: 0 16px; pointer-events: none;
}
.captions {
  max-width: 780px; width: 100%; text-align: center; min-height: 58px;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 4px;
}
.cap-user {
  font-size: 13px; color: var(--nsa-sub2); font-style: italic;
}
.cap-user b { color: var(--nsa-sub); font-weight: 600; font-style: normal; }
.cap-agent {
  font-size: clamp(15px, 2.2vmin, 19px); line-height: 1.45; color: var(--nsa-ink2);
  text-shadow: 0 2px 14px rgba(6, 10, 26, .9);
}
.cap-agent .cur { display: inline-block; width: 8px; border-bottom: 2px solid var(--nsa-mint); margin-left: 2px; animation: pulse 1s steps(2) infinite; }

/* ---------- error card ---------- */
.err-card {
  position: absolute; z-index: 30; left: 50%; top: 44%; transform: translate(-50%, -50%);
  width: min(430px, calc(100vw - 40px));
  background: var(--nsa-panel); border: 1px solid var(--nsa-bd4); border-radius: 16px;
  padding: 22px 22px 18px; box-shadow: 0 24px 70px rgba(3, 6, 18, .7);
}
.err-card h2 { margin: 0 0 8px; font-family: 'Space Grotesk', sans-serif; font-size: 19px; color: var(--nsa-ink); }
.err-card p { margin: 0 0 12px; font-size: 14px; line-height: 1.55; color: var(--nsa-text); }
.err-card .tech { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--nsa-faint2); word-break: break-word; margin-bottom: 14px; }
.err-card .err-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- controls ---------- */
.controls {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: 10px; padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--nsa-band); border-top: 1px solid var(--nsa-bd3); z-index: 40;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 12px; font-weight: 600; font-size: 14.5px;
  border: 1px solid var(--nsa-bd5); background: var(--nsa-chip); color: var(--nsa-text);
}
.btn:hover { background: var(--nsa-chip2); color: var(--nsa-ink); }
.btn.primary { background: #8FA5FF; border-color: #8FA5FF; color: #0A0F22; }
.btn.primary:hover { background: #B9C6FF; border-color: #B9C6FF; color: #0A0F22; }
.btn.primary.is-live { background: #FF9C8F; border-color: #FF9C8F; }
.btn.mint { background: #3EF0BE; border-color: #3EF0BE; color: #06281F; }
.btn.mint:hover { background: #6FF5D0; border-color: #6FF5D0; color: #06281F; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.active { border-color: var(--nsa-mint); color: var(--nsa-mint); }
.status {
  width: 100%; text-align: center; font-family: 'IBM Plex Mono', monospace; font-size: 10px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--nsa-faint2); min-height: 14px;
}

/* ---------- faces dock ---------- */
.dock {
  position: fixed; top: 50px; right: 0; bottom: 0; width: 316px; z-index: 60;
  background: var(--nsa-header); backdrop-filter: blur(16px);
  border-left: 1px solid var(--nsa-bd2); overflow-y: auto; overscroll-behavior: contain;
  transform: translateX(105%); transition: transform .28s ease; padding: 14px 16px 24px;
  scrollbar-width: thin;
}
@media (prefers-reduced-motion: reduce) { .dock { transition: none; } }
.dock[data-open="true"] { transform: translateX(0); }
.dock-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.dock-head h2 { margin: 0; font-family: 'Space Grotesk', sans-serif; font-size: 15px; letter-spacing: .02em; }
.dock-close { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--nsa-bd5); background: var(--nsa-chip); color: var(--nsa-sub); font-size: 15px; }
.dock h3 {
  margin: 18px 0 8px; font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--nsa-peri);
}
.dock h3:first-of-type { margin-top: 4px; }
.dock .sub {
  margin: 12px 0 6px; font-family: 'IBM Plex Mono', monospace; font-size: 9.5px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--nsa-faint);
}
.chip-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 44px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--nsa-bd5);
  background: var(--nsa-chip); color: var(--nsa-text); font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip small { display: block; font-weight: 400; font-size: 10px; color: var(--nsa-faint); }
.chip:hover { background: var(--nsa-chip2); color: var(--nsa-ink); }
.chip[aria-pressed="true"] { border-color: var(--nsa-peri); background: var(--nsa-panel2); color: var(--nsa-ink); box-shadow: inset 0 0 0 1px var(--nsa-peri); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.dots { display: flex; gap: 8px; flex-wrap: wrap; padding: 2px 0; }
.dot {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; padding: 0;
  outline-offset: 3px;
}
.dot[aria-pressed="true"] { border-color: var(--nsa-ink); box-shadow: 0 0 0 3px var(--nsa-bd4); }
.dock .note { font-size: 11.5px; color: var(--nsa-faint); line-height: 1.5; margin: 8px 0 0; }

@media (max-width: 700px) {
  .bar { padding: 0 8px; gap: 8px; }
  .bar .ttl { display: none; }
  .face-mount { inset: 8px 8px 118px; }
  .dock {
    top: auto; left: 0; right: 0; width: 100%; max-height: 62dvh;
    border-left: 0; border-top: 1px solid var(--nsa-bd2); border-radius: 16px 16px 0 0;
    transform: translateY(108%);
  }
  .dock[data-open="true"] { transform: translateY(0); }
  .captions-wrap { bottom: 6px; }
  .cap-agent { font-size: 14.5px; }
  .btn { padding: 0 13px; font-size: 13.5px; min-height: 44px; }
}
