/* Liaison: two pairs facing each other. The viewer's own side is always on the right. */
:root {
  --bg: #E0E3E8; --surface: #FFFFFF; --ink: #0F141B; --muted: #6A7383; --faint: #9AA2AF; --line: #E4E7EC;
  --ours: #3F5E9C; --ours-wash: #E8EDF6; --ours-edge: #C3CEE4;
  --theirs: #A9613F; --theirs-wash: #F4EAE4; --theirs-edge: #E2C8BA;
  --end: #A3412A;
  --person-edge: #AEB4BE;   /* a person's edge; an agent's is ink */
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  --serif: "New York", ui-serif, Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overscroll-behavior-y: none; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--sans); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }

/* sides, from the viewer's point of view: "mine" sits right, "other" left */
.mine { --side: var(--ours); --wash: var(--ours-wash); --edge: var(--ours-edge); }
.other { --side: var(--theirs); --wash: var(--theirs-wash); --edge: var(--theirs-edge); }

/* faces: a person a circle in the full colour; an agent a rounded square in the light tint, edged in black */
.face { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 600 12px/1 var(--sans); background: var(--side); color: #fff; border: 1.5px solid var(--person-edge); }
.face.agent { border-radius: 8px; background: var(--edge); color: var(--side); border: 1.5px solid var(--ink); }
.face.lg { width: 34px; height: 34px; font-size: 13.5px; }
.face.lg.agent { border-radius: 10px; }
.face.sm { width: 18px; height: 18px; font-size: 9px; }
.face.sm.agent { border-radius: 5px; }
.face.sm { border-width: 1px; }

.app { height: 100dvh; display: flex; flex-direction: column; position: relative; }
.col { width: 100%; max-width: 760px; margin: 0 auto; }

/* header: the cast, and one line of state */
.top { position: absolute; top: 0; left: 0; right: 0; z-index: 5; border-bottom: 1px solid rgba(15, 20, 27, .08);
  background: rgba(196, 201, 210, .72); -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px; }
.cast { display: flex; align-items: center; margin-bottom: 8px; }
.pair { display: flex; gap: 6px; align-items: center; min-width: 0; }
.pair.right { flex-direction: row-reverse; text-align: right; }
.pair .names { font-size: 12px; color: var(--muted); line-height: 1.25; margin: 0 2px; white-space: nowrap; }
.pair .names b { display: block; color: var(--ink); font-weight: 600; font-size: 12.5px; }
.between { flex: 1; min-width: 0; display: flex; justify-content: center; align-items: center; margin: 0 8px; }
.between img { display: block; height: 30px; width: auto; max-width: 100%; opacity: .9; }
.between .mark-only { display: none; height: 18px; }
@media (max-width: 430px) { .between .full { display: none; } .between .mark-only { display: block; } }
.state { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-height: 26px; }
.state .now { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.state .next { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.trail { display: inline-flex; align-items: center; gap: 3px; flex: none; }
.trail i { width: 10px; height: 3px; border-radius: 2px; background: var(--ink); opacity: .35; }
.trail i.now { width: 20px; opacity: .9; }
.dots { margin-left: auto; flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; }
.dots svg { width: 13px; height: 13px; }

/* the conversation */
.thread { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.thread .col { padding: var(--top-h, 110px) 14px 18px; display: flex; flex-direction: column; gap: 10px; min-height: 100%; justify-content: flex-end; }
.m { display: flex; gap: 8px; align-items: flex-end; max-width: 80%; }
.m.mine { align-self: flex-end; flex-direction: row-reverse; }
.m.other { align-self: flex-start; }
@media (min-width: 700px) { .m { max-width: 68%; } }
.b { border-radius: 16px; padding: 8px 12px 9px; min-width: 0; overflow-wrap: anywhere; }
.m.other .b { border-bottom-left-radius: 5px; }
.m.mine .b { border-bottom-right-radius: 5px; }
/* the bubbles match the faces: an agent edged in black, a person in grey */
.m.agent .b { background: var(--surface); border: 1.5px solid var(--ink); }
.m.person .b { background: var(--wash); border: 1.5px solid var(--person-edge); }
.kind { font: 600 9.5px/1.4 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 1px 0 3px; }
/* the time sits at the end of the words, small, never on a row of its own */
.body .t { float: right; margin: 7px -2px -5px 10px; font-size: 10.5px; line-height: 1; color: var(--faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.body { white-space: pre-wrap; font-size: 15px; line-height: 1.42; }
pre { margin: 7px 0 0; padding: 8px 10px; background: #F1F3F6; border-radius: 8px; font: 12px/1.55 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.blockbar { display: flex; gap: 14px; margin-top: 5px; }
.blockbar button { font-size: 12.5px; font-weight: 600; color: var(--side); }
.asks { display: flex; align-items: center; gap: 6px; margin-top: 8px; padding-top: 7px; border-top: 1px dashed var(--line); font-size: 12.5px; font-weight: 500; }
.asks .w { margin-left: auto; color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.m.waiting .b { box-shadow: 0 0 0 3px rgba(15, 20, 27, .08); }
.event { align-self: center; display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; }
.event.quiet { font-weight: 400; color: var(--muted); }
.event svg { width: 9px; height: 9px; flex: none; }
/* someone is writing */
.m.typing .b { padding: 10px 13px; }
.typing-dots { display: inline-flex; gap: 4px; align-items: center; height: 10px; }
.typing-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--side); opacity: .3; animation: liaison-dot 1.2s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: .18s; }
.typing-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes liaison-dot { 0%, 70%, 100% { opacity: .25; transform: translateY(0); } 35% { opacity: .85; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .typing-dots i { animation: none; opacity: .6; } }

/* composing */
.compose { flex: none; border-top: 1px solid var(--line); background: var(--bg); padding: 10px 14px calc(env(safe-area-inset-bottom, 0px) + 10px); }
.bar { display: flex; gap: 8px; align-items: flex-end; }
.field { flex: 1; min-width: 0; display: flex; align-items: flex-end; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 5px 5px 5px 16px; }
.field textarea { flex: 1; min-width: 0; border: 0; outline: 0; resize: none; font: 16px/1.35 var(--sans); padding: 6px 0; max-height: 140px; background: transparent; color: var(--ink); }
.send { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--ours); display: grid; place-items: center; }
.send:disabled { opacity: .35; }
.send svg { width: 14px; height: 14px; }
.pbtn { flex: none; height: 44px; padding: 0 15px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); font: 600 12px var(--sans); letter-spacing: .06em; text-transform: uppercase; display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.pbtn.resume { background: var(--ours); border-color: var(--ours); color: #fff; }
.pbtn svg { width: 11px; height: 11px; }
.ended { text-align: center; font-size: 13px; color: var(--muted); padding: 8px 0 4px; }

/* the session panel */
.scrim { position: fixed; inset: 0; background: rgba(15, 20, 27, .32); z-index: 10; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 88dvh; background: var(--bg); border-radius: 22px 22px 0 0; z-index: 11; overflow-y: auto; overscroll-behavior: contain; padding: 8px 18px calc(env(safe-area-inset-bottom, 0px) + 24px); }
.scrim { touch-action: none; }
.x { position: absolute; top: 12px; right: 14px; width: 30px; height: 30px; border-radius: 50%; background: #C2C8D1; display: grid; place-items: center; }
.x svg { width: 11px; height: 11px; }
@media (min-width: 700px) { .sheet { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: 440px; border-radius: 18px; max-height: 86dvh; } }
.grab { width: 38px; height: 5px; border-radius: 3px; background: #AEB4BF; margin: 0 auto 14px; }
.sheet h2 { font: 600 22px/1.2 var(--serif); margin: 0; }
.sheet .sub { font-size: 12px; color: var(--muted); margin: 3px 0 16px; font-variant-numeric: tabular-nums; }
.back { font-size: 14px; color: var(--muted); margin-bottom: 10px; display: inline-flex; gap: 4px; }
.group { margin-bottom: 16px; }
.label { font: 600 10.5px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 4px 7px; }
.card { background: var(--surface); border-radius: 12px; overflow: hidden; }
.li { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-top: 1px solid var(--line); font-size: 15px; width: 100%; text-align: left; }
.li:first-child { border-top: 0; }
.li .t { flex: 1; min-width: 0; }
.li .t small { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
.li .chev { color: var(--faint); font-size: 17px; }
.li.end { color: var(--end); font-weight: 500; }
.here { width: 8px; height: 8px; border-radius: 50%; background: #4E9A6F; flex: none; }
.away { width: 8px; height: 8px; border-radius: 50%; background: #C9CED6; flex: none; }
.sw { width: 44px; height: 27px; border-radius: 14px; background: #D7DBE2; position: relative; flex: none; transition: background .15s; }
.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 23px; height: 23px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: left .15s; }
.sw.on { background: var(--ours); }
.sw.on::after { left: 19px; }
.doc { background: var(--surface); border-radius: 12px; padding: 4px 16px 14px; font-size: 14.5px; line-height: 1.5; }
.doc h1, .doc h2, .doc h3 { font: 600 17px/1.3 var(--serif); margin: 16px 0 6px; }
.doc p { margin: 0 0 9px; }
.doc ul, .doc ol { margin: 0 0 9px; padding-left: 20px; }
.doc li { margin-bottom: 4px; }
.mono { font: 12px/1.5 var(--mono); color: var(--muted); overflow-wrap: anywhere; }

/* the door: signing in, or taking a seat */
.door { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 22px; text-align: center; }
.door .logo { width: 132px; height: auto; margin-bottom: 30px; }
.door h1 { font: 600 26px/1.2 var(--serif); margin: 0 0 8px; max-width: 22ch; text-wrap: balance; }
.door p { color: var(--muted); margin: 0 0 22px; max-width: 34ch; }
.door .cast { justify-content: center; gap: 0; margin: 18px 0 26px; width: 100%; max-width: 330px; }
.cta { height: 50px; padding: 0 26px; border-radius: 25px; background: var(--ours); color: #fff; font-weight: 600; font-size: 16px; }
.cta.other { background: var(--theirs); }
.note { margin-top: 16px; font-size: 12.5px; color: var(--faint); max-width: 32ch; }
.err { margin-top: 14px; color: var(--end); font-size: 13.5px; max-width: 34ch; }
.dev { margin-top: 30px; display: flex; gap: 10px; }
.dev button { font-size: 12px; color: var(--muted); border: 1px dashed var(--line); padding: 6px 10px; border-radius: 8px; }
