/* ttm: a late-night common room. Warm dark, cream type, marigold for you, lilac for voice. */
:root {
  --bg: #14110f;
  --surface: #1c1815;
  --raise: #25201b;
  --line: #352d26;
  --fg: #f3eadf;
  --dim: #9c8c7c;
  --faint: #6b5f54;
  --accent: #ffb347;
  --accent-ink: #2a1a05;
  --voice: #c3a6ff;
  --live: #9be3a4;
  --danger: #ff8473;
  --radius: 16px;
  --font: "Bricolage Grotesque", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;

  /* The arugula components read these. */
  --arugula-bg: #100d0b;
  --arugula-surface: var(--surface);
  --arugula-line: var(--line);
  --arugula-fg: var(--fg);
  --arugula-dim: var(--dim);
  --arugula-accent: var(--accent);
  --arugula-info: var(--voice);
  --arugula-ok: var(--live);
  --arugula-danger: var(--danger);
  --arugula-radius: var(--radius);
  --arugula-font: var(--font);

  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background:
    radial-gradient(60rem 40rem at -10% -20%, rgb(255 179 71 / 0.09), transparent 60%),
    radial-gradient(50rem 40rem at 110% 120%, rgb(195 166 255 / 0.08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--fg);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2, p { margin: 0; }

button, input { font: inherit; color: inherit; }

button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--raise);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
button:hover { border-color: var(--faint); }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
}
button.primary:hover { background: #ffc267; }
button.quiet { background: transparent; color: var(--dim); }
button.quiet:hover { color: var(--fg); }
button.link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

button.small { padding: 0.4rem 0.9rem; font-size: 0.9rem; }

/* The mark */
.mark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  font-size: 1.05rem;
  white-space: nowrap;
}
.mark svg { width: 1.35em; height: 1.35em; color: var(--fg); flex: none; }
.mark.big { font-size: clamp(1.6rem, 6vw, 2.1rem); gap: 0.6rem; }

/* Sign-in and naming */
.gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.gate[hidden] { display: none; }
.gate-card {
  width: min(100%, 440px);
  display: grid;
  gap: 1.5rem;
}
.lede { color: var(--dim); font-size: 1.1rem; line-height: 1.5; max-width: 32ch; }
.gate form { display: grid; gap: 0.5rem; }
.gate label { font-size: 0.9rem; color: var(--dim); }
.field {
  display: flex;
  gap: 6px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.field:focus-within { border-color: var(--accent); }
.field input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  padding: 0.55rem 0.9rem;
  font-size: 1rem;
}
.field input:focus { outline: none; }
.field input::placeholder { color: var(--faint); }
.status { min-height: 1.4em; color: var(--dim); font-size: 0.9rem; padding-left: 1rem; }
.status.error { color: var(--danger); }
.sent {
  padding: 1.1rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  display: grid;
  gap: 0.4rem;
}
.sent[hidden] { display: none; }
.sent-title { font-weight: 700; font-size: 1.1rem; }
.sent-body { color: var(--dim); }
.sent-body b { color: var(--fg); font-weight: 600; overflow-wrap: anywhere; }
.sent .link { justify-self: start; margin-top: 0.3rem; font-size: 0.9rem; }
.fine { color: var(--faint); font-size: 0.85rem; }
.gate .link { justify-self: start; }

/* What a share link opens onto */
.join-card {
  padding: 1.1rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--voice);
  border-radius: 12px;
  display: grid;
  gap: 0.3rem;
}
.join-card[hidden] { display: none; }
.kicker { font: 500 0.7rem var(--mono); text-transform: uppercase; letter-spacing: 0.12em; color: var(--voice); }
.join-title { font-size: 1.25rem; line-height: 1.3; }
.join-title b { font-weight: 750; }
.join-people { color: var(--dim); font-size: 0.95rem; }
.or {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--faint);
  font-size: 0.85rem;
}
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.me-name .tag { margin-left: 6px; color: var(--accent); }

/* The app: your chats on the left, the open one beside them */
#app {
  height: 100dvh;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
}
#app[hidden] { display: none; }
[hidden] { display: none !important; }

button.icon {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--dim);
}
button.icon:hover { background: var(--raise); color: var(--fg); }
button.icon.on { background: var(--raise); color: var(--accent); }
button.icon svg { width: 22px; height: 22px; }

/* Faces: a circle that holds a live arugula face, or an initial on a steady colour. */
.face {
  --size: 40px;
  --arugula-radius: 50%;
  --arugula-bg: oklch(0.32 0.05 var(--hue, 40));
  position: relative;
  flex: none;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  overflow: hidden;
  display: inline-grid;
  place-items: center;
  background: oklch(0.32 0.05 var(--hue, 40));
  color: oklch(0.88 0.08 var(--hue, 40));
  font-weight: 700;
  font-size: calc(var(--size) * 0.42);
  line-height: 1;
  user-select: none;
}
.face > div { position: absolute; inset: 0; }
.face.big { --size: 112px; }
.faces { position: relative; flex: none; display: inline-flex; width: 48px; height: 48px; }
.faces .face { --size: 48px; }
.faces[data-count="2"] .face { --size: 34px; position: absolute; box-shadow: 0 0 0 2px var(--bg); }
.faces[data-count="2"] .face:first-child { left: 0; top: 0; }
.faces[data-count="2"] .face:last-child { right: 0; bottom: 0; }

/* The sidebar */
.sidebar {
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgb(20 17 15 / 0.6);
}
.side-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 8px 14px;
}
.side-head .mark { flex: 1; }
.me-button { padding: 0; border: 0; background: none; border-radius: 50%; }
.me-button .face { --size: 32px; }
.chat-list { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 8px 12px; }
.chat-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  grid-template-areas: "face name time" "face line badge";
  column-gap: 12px;
  row-gap: 1px;
  align-items: center;
  padding: 10px;
  border-radius: 14px;
  color: inherit;
  text-decoration: none;
}
.chat-item:hover { background: var(--surface); }
.chat-item[aria-current="page"] { background: var(--raise); }
.chat-item .faces { grid-area: face; }
.ci-name { grid-area: name; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-time { grid-area: time; font-size: 0.75rem; color: var(--faint); }
.ci-line { grid-area: line; font-size: 0.88rem; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-badge {
  grid-area: badge;
  min-width: 1.3rem;
  height: 1.3rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 600 0.72rem/1.3rem var(--mono);
  text-align: center;
}
.chat-item.unread .ci-name { color: var(--fg); }
.chat-item.unread .ci-time { color: var(--accent); }
.chat-item.calling .ci-line { color: var(--live); }
.chat-item.calling .ci-line::before { content: "● "; }
.chat-item.on-call .faces .face { box-shadow: 0 0 0 2px var(--live); }
.no-chats { padding: 1rem 1.2rem; color: var(--dim); }

/* The call you're on, while you're elsewhere */
.pill {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 12px max(12px, env(safe-area-inset-bottom));
  padding: 10px 16px;
  border: 0;
  border-radius: 14px;
  background: color-mix(in srgb, var(--live) 18%, var(--surface));
  color: var(--fg);
  text-align: left;
}
.pill-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); animation: pulse 1.6s ease-in-out infinite; }
.pill-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.pill-time { font: 0.8rem var(--mono); color: var(--live); }
@keyframes pulse { 50% { opacity: 0.35; } }

/* The open chat */
.convo {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.convo:not(.open) > :not(.pick) { display: none !important; }
.convo.open .pick { display: none; }
.pick { flex: 1; display: grid; place-content: center; justify-items: center; gap: 1rem; color: var(--dim); }
.pick-mark { width: 56px; height: 56px; color: var(--faint); }

.convo-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 10px 16px;
  border-bottom: 1px solid var(--line);
}
button.back { display: none; }
.who {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 10px 2px 2px;
  border: 0;
  background: none;
  border-radius: 999px;
  text-align: left;
}
.who:hover { background: var(--surface); }
.who .faces { width: 40px; height: 40px; }
.who .faces .face { --size: 40px; }
.who .faces[data-count="2"] .face { --size: 28px; }
.who-text { min-width: 0; display: grid; }
.who-name { font-weight: 700; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-sub { font-size: 0.82rem; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-sub.here { color: var(--live); }
.head-actions { display: flex; gap: 2px; }

.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 16px;
  background: color-mix(in srgb, var(--live) 12%, var(--bg));
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.banner span:nth-child(2) { flex: 1; min-width: 0; }
.banner-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); animation: pulse 1.6s ease-in-out infinite; }
button.join { background: var(--live); border-color: var(--live); color: #0c2410; font-weight: 650; }

.body { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* Messages */
.chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 16px 8px; display: flex; flex-direction: column; }
#thread { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.earlier { align-self: center; margin-bottom: 8px; font-size: 0.85rem; color: var(--dim); background: transparent; }
.quiet-note { align-self: center; margin: auto 0 1rem; color: var(--faint); font-size: 0.9rem; text-align: center; }
.day {
  align-self: center;
  margin: 8px 0 2px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--dim);
  font-size: 0.75rem;
  font-weight: 600;
}
.run { display: flex; align-items: flex-end; gap: 8px; max-width: min(78%, 620px); }
.run.mine { align-self: flex-end; }
.run-face .face { --size: 28px; }
.run-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.run.mine .run-body { align-items: flex-end; }
.run-name { padding-left: 12px; font-size: 0.78rem; font-weight: 650; color: oklch(0.8 0.1 var(--hue, 40)); }
.bubble {
  max-width: 100%;
  padding: 7px 12px 6px;
  border-radius: 18px;
  background: var(--raise);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.38;
}
.run.them .bubble { border-bottom-left-radius: 6px; border-top-left-radius: 6px; }
.run.them .bubble:first-of-type { border-top-left-radius: 18px; }
.run.them .bubble:last-child { border-bottom-left-radius: 18px; }
.run.them .run-name + .bubble { border-top-left-radius: 18px; }
.run.mine .bubble { background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 6px; border-top-right-radius: 6px; }
.run.mine .bubble:first-child { border-top-right-radius: 18px; }
.run.mine .bubble:last-child { border-bottom-right-radius: 18px; }
.bubble time { float: right; margin: 0.45em 0 0 0.75em; font-size: 0.68rem; opacity: 0.55; line-height: 1; }
.bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 4px 12px 0;
  padding: 6px 6px 6px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
}
.composer:focus-within { border-color: var(--faint); }
.composer textarea {
  flex: 1;
  min-width: 0;
  resize: none;
  border: 0;
  background: none;
  color: var(--fg);
  font: inherit;
  padding: 7px 0;
  max-height: 160px;
  outline: none;
}
.composer textarea::placeholder { color: var(--faint); }
.send { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; background: var(--accent); color: var(--accent-ink); }
.send svg { width: 18px; height: 18px; }
.say-error { min-height: 1.2rem; padding: 2px 28px max(8px, env(safe-area-inset-bottom)); font-size: 0.82rem; color: var(--danger); }

/* Who's here: a strip of live tiles atop the chat. On a call it's the call; expanded, it's the stage. */
.call {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: #0d0b09;
}
.tiles { flex: 1; min-width: 0; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: thin; }
.tile {
  flex: none;
  position: relative;
  margin: 0;
  width: 104px;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  outline: 2px solid transparent;
  outline-offset: -2px;
  transition: outline-color 0.15s;
}
.call.joined .tile { width: 200px; }
.tile.speaking, .tile.in-call { outline-color: var(--live); }
.tile-face {
  --arugula-radius: 0;
  --arugula-bg: oklch(0.26 0.04 var(--hue, 40));
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: oklch(0.26 0.04 var(--hue, 40));
  color: oklch(0.88 0.08 var(--hue, 40));
  font-weight: 700;
  font-size: 1.6rem;
}
.tile-face > div { position: absolute; inset: 0; }
.tile-name {
  position: absolute;
  left: 6px;
  bottom: 6px;
  max-width: calc(100% - 12px);
  padding: 1px 7px;
  border-radius: 999px;
  background: rgb(0 0 0 / 0.55);
  font-size: 0.72rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tile-mic { position: absolute; right: 6px; bottom: 6px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: rgb(0 0 0 / 0.55); color: var(--danger); }
.tile-mic svg { width: 13px; height: 13px; }
.call-note { flex: none; color: var(--dim); font-size: 0.85rem; }
.controls { flex: none; display: flex; justify-content: center; gap: 10px; }
.call:not(.joined) .controls { display: none; }
.ctl {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--raise);
  color: var(--fg);
}
.ctl svg { width: 20px; height: 20px; }
.ctl:hover { background: #342c25; }
.ctl.off { background: var(--fg); color: var(--bg); }
.ctl.end { background: #e5484d; color: #fff; }
.ctl.end:hover { background: #f2555a; }
.ctl.go { background: var(--live); color: #0c2410; }
.ctl.wide { width: auto; padding: 0 16px; border-radius: 999px; font-weight: 600; }

/* The call, expanded to fill the chat */
.convo[data-mode="stage"] .chat { display: none; }
.convo[data-mode="stage"] .call { flex: 1; min-height: 0; flex-direction: column; align-items: stretch; padding: 16px; border: 0; }
.convo[data-mode="stage"] .tiles { display: grid; grid-template-columns: 1fr; grid-auto-rows: 1fr; overflow: visible; gap: 10px; }
.convo[data-mode="stage"] .tile { width: auto; aspect-ratio: auto; min-height: 0; border-radius: 18px; }
.convo[data-mode="stage"] .tile-name { left: 10px; bottom: 10px; padding: 3px 10px; font-size: 0.82rem; }
.convo[data-mode="stage"] .tile-mic { right: 10px; bottom: 10px; width: 28px; height: 28px; }
.convo[data-mode="stage"] .tile-face { font-size: 3rem; }
.convo[data-mode="stage"] .call-note { text-align: center; }
.convo[data-mode="stage"] .controls { gap: 14px; padding-bottom: env(safe-area-inset-bottom); }
.convo[data-mode="stage"] .ctl { width: 52px; height: 52px; }
.convo[data-mode="stage"] .tiles[data-count="3"], .convo[data-mode="stage"] .tiles[data-count="4"] { grid-template-columns: repeat(2, 1fr); }
.convo[data-mode="stage"] .tiles[data-count="5"], .convo[data-mode="stage"] .tiles[data-count="6"], .convo[data-mode="stage"] .tiles[data-count="7"], .convo[data-mode="stage"] .tiles[data-count="8"], .convo[data-mode="stage"] .tiles[data-count="9"] { grid-template-columns: repeat(3, 1fr); }
/* Two of you: them filling the stage, you in the corner. */
.convo[data-mode="stage"] .tiles[data-count="2"] { display: block; position: relative; }
.convo[data-mode="stage"] .tiles[data-count="2"] .tile:not(.me) { position: absolute; inset: 0; }
.convo[data-mode="stage"] .tiles[data-count="2"] .tile.me { position: absolute; right: 14px; bottom: 14px; width: clamp(110px, 22%, 220px); height: auto; aspect-ratio: 3 / 4; z-index: 1; box-shadow: 0 10px 30px -8px rgb(0 0 0 / 0.8); }
.convo[data-mode="stage"] .tiles[data-count="1"] .tile { max-width: 520px; width: 100%; justify-self: center; }

/* Someone's calling */
.incoming {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  width: min(380px, calc(100% - 32px));
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px 14px;
  align-items: center;
  padding: 16px;
  border-radius: 22px;
  background: var(--raise);
  border: 1px solid var(--line);
  box-shadow: 0 30px 70px -20px rgb(0 0 0 / 0.9);
  animation: arrive 0.25s ease-out;
}
.incoming .face { --size: 56px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--live) 50%, transparent); animation: halo 1.6s ease-in-out infinite; }
.in-title { font-weight: 700; font-size: 1.05rem; }
.in-sub { color: var(--dim); font-size: 0.88rem; }
.in-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 12px; }
.in-actions .ctl { width: 48px; height: 48px; }
@keyframes arrive { from { transform: translateY(12px); opacity: 0; } }
@keyframes halo { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--live) 0%, transparent); } }

/* Your face, in the dialog */
.face-pick { display: flex; align-items: center; gap: 16px; }
.face-pick .face.big { --arugula-radius: 50%; }
.face-pick-side { display: grid; gap: 0.6rem; min-width: 0; }
.seg { display: inline-flex; justify-self: start; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); }
.seg button { border: 0; background: transparent; padding: 0.35rem 0.8rem; font-size: 0.88rem; color: var(--dim); }
.seg button:hover { color: var(--fg); }
.seg button[aria-checked="true"] { background: var(--raise); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line); }
.seg button[aria-checked="true"]:not([data-mode="off"]) { color: var(--accent); }
.seg button:disabled { opacity: 0.45; cursor: default; color: var(--dim); }

/* New chat */
.block.first { border-top: 0; padding-top: 0; }
.pick-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 260px; overflow-y: auto; }
.pick-person { width: 100%; display: flex; align-items: center; gap: 12px; padding: 6px 10px 6px 6px; border: 0; border-radius: 12px; background: none; text-align: left; }
.pick-person:hover { background: var(--raise); }
.pick-person .face { --size: 36px; }

dialog {
  width: min(100% - 32px, 480px);
  max-height: min(100dvh - 32px, 760px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--fg);
  box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.8);
}
dialog::backdrop { background: rgb(10 8 6 / 0.6); backdrop-filter: blur(4px); }
.card { display: grid; gap: 0.9rem; padding: 22px 22px 18px; }
.card h2 { font-size: 1.3rem; font-weight: 750; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.card h3 { font: 500 0.72rem var(--mono); text-transform: uppercase; letter-spacing: 0.12em; color: var(--dim); }
.card .field { background: var(--bg); }
.card .status { padding-left: 0; }
.status.ok { color: var(--live); }
.hint { color: var(--dim); font-size: 0.88rem; }
.hint .link { font-size: inherit; }
.block { display: grid; gap: 0.5rem; padding-top: 0.9rem; border-top: 1px solid var(--line); }
.rename { display: grid; gap: 0.6rem; }
#room-dialog .rename .field { display: none; }
#room-dialog.owner .rename h2 { display: none; }
#room-dialog.owner .rename .field { display: flex; }
#room-dialog:not(.owner) .owner-only { display: none; }
#rd-link { font: 0.82rem var(--mono); color: var(--dim); }
.people-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.people-list li { display: flex; align-items: center; gap: 10px; padding: 6px 2px; }
.people-list li > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people-list .link { font-size: 0.82rem; color: var(--dim); }
.people-list .link:hover { color: var(--fg); }
.tag { font: 500 0.66rem var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); }
.add { display: grid; gap: 0.5rem; }
.known { display: flex; flex-wrap: wrap; gap: 6px; }
.known:empty { display: none; }
.chip { padding: 0.25rem 0.7rem; font-size: 0.85rem; color: var(--dim); background: transparent; }
.chip:hover { color: var(--fg); }
.card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.danger-text { color: var(--danger); }
.danger-text[data-armed="1"] { border-color: var(--danger); }

/* Toasts */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 32px);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 16px;
  border-radius: 999px;
  background: var(--raise);
  border: 1px solid var(--line);
  box-shadow: 0 16px 40px -12px rgb(0 0 0 / 0.8);
  z-index: 10;
}

/* Phones and narrow windows: the list, or one chat. */
@media (max-width: 820px) {
  #app { grid-template-columns: minmax(0, 1fr); }
  #app[data-screen="list"] .convo { display: none; }
  #app[data-screen="chat"] .sidebar { display: none; }
  .sidebar { border-right: 0; }
  button.back { display: inline-grid; }
  .convo-head { padding: 8px 8px 8px 4px; gap: 4px; }
  .messages { padding: 10px 12px 6px; }
  .run { max-width: 86%; }
  .composer { margin: 4px 8px 0; }
  .call { padding: 8px 10px; gap: 8px; }
  .tile { width: 84px; }
  .call.joined { flex-wrap: wrap; }
  .call.joined .tile { width: 140px; }
  .call.joined .controls { width: 100%; }
  .convo[data-mode="stage"] .call { padding: 10px; }
  .convo[data-mode="stage"] .tiles[data-count="5"], .convo[data-mode="stage"] .tiles[data-count="6"] { grid-template-columns: 1fr 1fr; }
  .incoming { top: max(12px, env(safe-area-inset-top)); bottom: auto; left: 50%; right: auto; transform: translateX(-50%); }
  @keyframes arrive { from { opacity: 0; } }
}
