/* Co-Help phone companion (/app/*). Mobile-first, dark. */
:root {
  --bg: #0f1420;
  --surface: #1a2130;
  --border: #2c3648;
  --text: #f1f5f9;
  --muted: #a3b1c6;
  --accent: #5b5bd6;
  --ok: #22c55e;
  --warn: #f59e0b;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.55 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: rgba(15, 20, 32, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.brand-sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.chip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.chip[data-state="connected"] { color: #bbf7d0; border-color: rgba(34, 197, 94, 0.35); }
.chip[data-state="connected"] .chip-dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18); }
.chip[data-state="reconnecting"] { color: #fde68a; border-color: rgba(245, 158, 11, 0.35); }
.chip[data-state="reconnecting"] .chip-dot { background: var(--warn); }

.wrap { max-width: 640px; margin: 0 auto; padding: 16px; }

.notice {
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 15px;
}
.notice strong { color: var(--text); display: block; margin-bottom: 4px; }

.empty { padding: 40px 8px; text-align: center; }
.empty-title { font-weight: 600; font-size: 18px; margin-bottom: 8px; }
.empty-body { color: var(--muted); font-size: 15px; }

.label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.question { font-size: 17px; font-weight: 500; margin-bottom: 14px; overflow-wrap: anywhere; }

.say {
  padding: 18px 16px;
  border: 1px solid rgba(91, 91, 214, 0.55);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(91, 91, 214, 0.16), rgba(91, 91, 214, 0.05)), var(--surface);
}
.say-label { color: #c7c7f7; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 8px; }

.answer { font-size: 18px; line-height: 1.6; overflow-wrap: anywhere; }
.answer p + p, .answer p + ul, .answer p + ol, .answer ul + p, .answer ol + p, .answer pre + p, .answer p + pre { margin-top: 10px; }
.answer ul, .answer ol { padding-inline-start: 1.3em; }
.answer li + li { margin-top: 4px; }
.answer strong { font-weight: 700; color: #fff; }
.answer .lead { font-weight: 600; color: #fff; }
.answer pre {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre;
  overflow-x: auto;
  direction: ltr;
  text-align: left;
}
.answer .muted { color: var(--muted); font-style: italic; }

.say .answer:empty::before { content: "Writing the answer…"; color: var(--muted); font-style: italic; font-size: 16px; }

#earlierWrap { margin-top: 28px; }
.earlier { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.earlier > li {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.earlier .question { font-size: 15px; color: var(--muted); margin-bottom: 8px; }
.earlier .answer { font-size: 15px; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
