:root {
  --bar: #008069;
  --bg: #efeae2;
  --in: #ffffff;
  --out: #d9fdd3;
  --text: #111b21;
  --muted: #667781;
  --accent: #00a884;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #d1d7db;
  color: var(--text);
}
.app {
  max-width: 520px; height: 100dvh; margin: 0 auto;
  display: flex; flex-direction: column; background: var(--bg);
}
.top {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--bar); color: #fff;
}
.avatar {
  width: 38px; height: 38px; border-radius: 50%; background: #fff; color: var(--bar);
  display: grid; place-items: center; font-weight: 600; font-size: 22px; flex: none;
}
.who { flex: 1; min-width: 0; }
.name { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { font-size: 12px; opacity: .85; }
.counter { font-size: 12px; background: rgba(255,255,255,.18); padding: 4px 8px; border-radius: 10px; white-space: nowrap; }
.counter:empty { display: none; }
.feed {
  flex: 1; overflow-y: auto; padding: 12px 10px; display: flex; flex-direction: column; gap: 6px;
}
.msg {
  max-width: 82%; padding: 7px 10px; border-radius: 8px; font-size: 15px; line-height: 1.35;
  white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 1px 0 rgba(0,0,0,.08);
}
.msg.in { align-self: flex-start; background: var(--in); border-top-left-radius: 2px; }
.msg.out { align-self: flex-end; background: var(--out); border-top-right-radius: 2px; }
.msg.note { align-self: center; background: #fff3c4; font-size: 13px; color: #54430a; }
.typing { display: inline-flex; gap: 4px; padding: 11px 12px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }
.tools { padding: 4px 10px; }
.summary-btn {
  width: 100%; border: 1px solid var(--accent); background: #fff; color: var(--bar);
  border-radius: 18px; padding: 8px 12px; font: 500 13px Inter, sans-serif; cursor: pointer;
}
.summary-btn:disabled { opacity: .5; }
.composer { display: flex; gap: 8px; padding: 6px 10px 2px; }
.composer input {
  flex: 1; min-width: 0; border: 0; border-radius: 22px; padding: 11px 16px;
  font: 16px Inter, sans-serif; background: #fff; outline: none;
}
.composer button {
  width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 18px; cursor: pointer;
}
.composer button:disabled { opacity: .5; }
.disclaimer {
  text-align: center; font-size: 11px; color: var(--muted);
  padding: 4px 10px; padding-bottom: max(6px, env(safe-area-inset-bottom));
}
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; padding: 16px;
}
.modal[hidden] { display: none; }
.card { background: #fff; border-radius: 12px; padding: 16px; width: 100%; max-width: 440px; max-height: 80dvh; overflow: auto; }
.card-title { font-weight: 600; margin-bottom: 8px; }
.card pre { white-space: pre-wrap; font: 14px/1.45 Inter, sans-serif; margin: 0 0 12px; }
.card button {
  border: 0; background: var(--accent); color: #fff; border-radius: 18px; padding: 9px 18px; font: 500 14px Inter, sans-serif; cursor: pointer;
}
