:root {
  --bg: #f6f4ef; --panel: #ffffff; --ink: #1d1e21; --muted: #6b6c70; --line: #dedbd2;
  --me: #1d1e21; --me-ink: #ffffff; --bot: #ffffff; --accent: #d9822b; --danger: #b3261e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16171a; --panel: #1f2125; --ink: #ececea; --muted: #9a9b9f; --line: #33353b;
    --me: #ececea; --me-ink: #16171a; --bot: #24262b; --accent: #f0a04b; --danger: #f2b8b5;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex; flex-direction: column; min-height: 100dvh;
  -webkit-text-size-adjust: 100%;
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg); z-index: 2;
}
.brand { display: flex; align-items: center; gap: 10px; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }
h1 { font-size: 20px; font-weight: 650; margin: 0; letter-spacing: 0.01em; }
.ghost {
  min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 22px;
  background: transparent; color: var(--ink); font: inherit; font-size: 15px;
}
.ghost:active { background: var(--panel); }
.log {
  flex: 1; width: 100%; max-width: 680px; margin: 0 auto; padding: 16px 14px 8px;
  display: flex; flex-direction: column; gap: 10px;
}
.intro { margin: 6px 2px 10px; }
.lead { margin: 0 0 6px; font-size: 19px; font-weight: 600; line-height: 1.3; }
.sub { margin: 0 0 14px; color: var(--muted); font-size: 15px; }
.starters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 22px;
  background: var(--panel); color: var(--ink); font: inherit; font-size: 15px;
}
.row { display: flex; flex-direction: column; max-width: 86%; }
.row.me { align-self: flex-end; align-items: flex-end; }
.row.bot { align-self: flex-start; align-items: flex-start; }
.bubble { padding: 10px 14px; border-radius: 18px; overflow-wrap: anywhere; white-space: pre-wrap; }
.me .bubble { background: var(--me); color: var(--me-ink); border-bottom-right-radius: 6px; }
.bot .bubble { background: var(--bot); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.time { margin: 3px 6px 0; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.row.err .bubble { border-color: var(--danger); color: var(--danger); }
.typing span {
  display: inline-block; width: 7px; height: 7px; margin: 0 2px; border-radius: 50%;
  background: var(--muted); opacity: 0.35; animation: blink 1s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink { 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .typing span { animation: none; opacity: 0.7; } }
.bottom {
  position: sticky; bottom: 0; background: var(--bg); border-top: 1px solid var(--line);
  padding: 10px 12px calc(8px + env(safe-area-inset-bottom));
}
.composer { display: flex; gap: 8px; max-width: 680px; margin: 0 auto; }
#box {
  flex: 1; min-width: 0; min-height: 48px; padding: 0 16px; border: 1px solid var(--line);
  border-radius: 24px; background: var(--panel); color: var(--ink);
  font: inherit; font-size: 17px;   /* 16px or more stops phones zooming in on focus */
}
#box:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
#send {
  min-width: 72px; min-height: 48px; padding: 0 18px; border: 0; border-radius: 24px;
  background: var(--accent); color: #1d1e21; font: inherit; font-weight: 650;
}
#send:disabled { opacity: 0.5; }
.meter, .legal { max-width: 680px; margin: 6px auto 0; text-align: center; font-size: 12px; color: var(--muted); }
