/* Second Brain — phone-first: this gets used at a dinner table, one-handed. */
:root {
  color-scheme: dark;
  --bg: #070a12;
  --panel: #111726;
  --edge: rgba(255, 255, 255, .10);
  --ink: #eef3ff;
  --muted: rgba(238, 243, 255, .58);
  --accent: #8ee4ff;
  --live: #6ee7a8;
  --warn: #ffd27a;
  --error: #ff9b9b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans HK", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); min-height: 100%; }
/* An author `display: flex` outranks the UA rule for [hidden], so .setup and .live
   would both stay on screen when toggled. Needed for hiding to work at all. */
[hidden] { display: none !important; }

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100dvh;
}

.eyebrow { margin: 0 0 8px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.eyebrow a { color: var(--accent); text-decoration: none; }

.statusRow { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.dot { width: 10px; height: 10px; border-radius: 999px; background: var(--muted); flex: none; }
.dot[data-state="live"] { background: var(--live); box-shadow: 0 0 0 0 rgba(110, 231, 168, .6); animation: pulse 1.9s infinite; }
.dot[data-state="warm"] { background: var(--warn); }
.dot[data-state="error"] { background: var(--error); }
@keyframes pulse {
  70% { box-shadow: 0 0 0 9px rgba(110, 231, 168, 0); }
  100% { box-shadow: 0 0 0 0 rgba(110, 231, 168, 0); }
}
.status { font-size: 14px; font-weight: 650; }
.meter { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; margin-left: auto; }

.setup { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.label { font-size: 13px; font-weight: 650; color: var(--muted); }

textarea, select {
  width: 100%;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--edge);
  border-radius: 14px;
  padding: 12px;
  font: inherit;
  font-size: 16px; /* 16px stops iOS zooming the page on focus */
  outline: none;
  resize: vertical;
}
textarea:focus, select:focus { border-color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button {
  border: 1px solid var(--edge);
  background: rgba(142, 228, 255, .10);
  color: var(--accent);
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.chips button:active { transform: scale(.97); }

.note { margin: 0; font-size: 12px; line-height: 1.5; color: var(--muted); }

.primary {
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 17px;
  font-size: 17px;
  font-weight: 800;
  color: #06111f;
  background: var(--accent);
  cursor: pointer;
}
.primary.stop { background: var(--error); }
.primary:active { transform: scale(.99); }

.live { display: flex; flex-direction: column; gap: 12px; flex: 1; min-height: 0; }
.thinking { min-height: 18px; font-size: 12px; color: var(--muted); letter-spacing: .01em; }
.empty { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.5; }
.cards { display: flex; flex-direction: column; gap: 11px; overflow-y: auto; }

.card {
  display: flex;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 16px;
  padding: 14px;
  animation: rise .24s ease-out;
}
.card.leaving { animation: fall .22s ease-in forwards; }
@keyframes rise { from { opacity: 0; transform: translateY(-6px); } }
@keyframes fall { to { opacity: 0; transform: translateY(-6px); } }

.cardIcon { font-size: 20px; line-height: 1.2; flex: none; }
.cardBody { min-width: 0; flex: 1; }
.cardBody h3 { margin: 0; font-size: 15.5px; line-height: 1.35; font-weight: 750; }
.cardBody p { margin: 6px 0 0; font-size: 14px; line-height: 1.5; color: rgba(238, 243, 255, .8); }

.card.pending { opacity: .62; }
.card.pending h3 { font-weight: 600; color: var(--muted); }
.card.type-answer { border-left: 3px solid var(--accent); }
.card.type-idea { border-left: 3px solid #c4a6ff; }
.card.type-action { border-left: 3px solid var(--live); }
.card.offer { border-left: 3px solid var(--warn); background: rgba(255, 210, 122, .07); }

.sources { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.sources a { font-size: 12px; color: var(--accent); text-decoration: none; border-bottom: 1px solid rgba(142, 228, 255, .3); }

.offerButtons { display: flex; gap: 9px; margin-top: 11px; }
.offerButtons button {
  border: 0;
  border-radius: 11px;
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}
.offerButtons .yes { background: var(--accent); color: #06111f; }
.offerButtons .no { background: rgba(255, 255, 255, .09); color: var(--ink); }
.offerButtons button:active { transform: scale(.97); }

/* Debug view of what was actually heard. Deliberately quiet — it is there to explain
   a missing card, not to be read during the conversation. */
.heard {
  margin-top: 6px;
  border-top: 1px solid var(--edge);
  padding-top: 10px;
}
.heard summary {
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  padding: 4px 0;
}
.heard summary::-webkit-details-marker { display: none; }
.heard summary::before { content: "▸ "; }
.heard[open] summary::before { content: "▾ "; }
.partial { min-height: 16px; font-size: 13px; color: var(--muted); font-style: italic; margin: 4px 0; }
.transcript { display: flex; flex-direction: column; gap: 5px; max-height: 34vh; overflow-y: auto; }
.line { display: flex; gap: 8px; font-size: 13px; line-height: 1.45; color: rgba(238, 243, 255, .62); }
.stamp { color: rgba(238, 243, 255, .34); font-size: 11px; font-variant-numeric: tabular-nums; padding-top: 2px; flex: none; }
