:root {
  --bar: #0f5c4c;
  --bar-ink: #fff;
  --wall: #efe7dd;
  --me: #dcf7c5;
  --bot: #fff;
  --ink: #17202a;
  --muted: #667781;
  --gold: #d9a441;
  --send: #128c6e;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15.5px; color: var(--ink); background: #d6dbd6;
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.app {
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh;
  max-width: 560px; margin: 0 auto;
  background: var(--wall);
  background-image: radial-gradient(rgba(15, 92, 76, .06) 1px, transparent 1.4px);
  background-size: 18px 18px;
  box-shadow: 0 0 40px rgba(0, 0, 0, .12);
}

.bar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--bar); color: var(--bar-ink);
}
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--gold); color: #fff; font: 600 20px/1 Georgia, serif;
}
.who { flex: 1; min-width: 0; }
.who h1 { margin: 0; font-size: 17px; font-weight: 600; }
.who p { margin: 1px 0 0; font-size: 13px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.newchat {
  font: inherit; font-size: 13px; color: var(--bar-ink); background: rgba(255, 255, 255, .14);
  border: 0; border-radius: 16px; padding: 7px 12px; cursor: pointer;
}
.newchat:hover { background: rgba(255, 255, 255, .24); }

.chat { flex: 1; overflow-y: auto; padding: 12px 12px 6px; display: flex; flex-direction: column; gap: 6px; }
.day { align-self: center; margin: 4px 0 8px; font-size: 12.5px; color: var(--muted); background: #fff; padding: 4px 10px; border-radius: 8px; box-shadow: 0 1px 1px rgba(0,0,0,.06); }

.msg {
  max-width: 82%; padding: 7px 9px 5px 10px; border-radius: 8px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .1); position: relative;
  line-height: 1.38; overflow-wrap: anywhere;
}
.msg p { margin: 0; display: inline; }
.msg .time { float: right; margin: 6px 0 -2px 10px; font-size: 11px; color: var(--muted); }
.msg .ticks { color: #53bdeb; letter-spacing: -3px; margin-left: 2px; }
.bot { align-self: flex-start; background: var(--bot); border-top-left-radius: 2px; }
.me { align-self: flex-end; background: var(--me); border-top-right-radius: 2px; }

.note {
  align-self: center; margin: 6px 0; padding: 6px 12px; border-radius: 8px;
  font-size: 12.5px; text-align: center; color: #54400e; background: #fdf0c8;
}

.typing { display: flex; gap: 4px; padding: 12px 14px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: #9aa5ab; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .typing span { animation: none; opacity: .7; } }

.try { padding: 4px 12px 8px; }
.try[hidden] { display: none; }
.try p { margin: 0 0 6px; font-size: 12.5px; color: var(--muted); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips button {
  flex: none; font: inherit; font-size: 13.5px; color: var(--bar);
  background: #fff; border: 1px solid #c9d8d2; border-radius: 16px; padding: 7px 12px; cursor: pointer;
}
.chips button:hover { background: #f1f8f5; }

.compose {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 6px 8px; padding-bottom: max(8px, env(safe-area-inset-bottom));
}
.compose textarea {
  flex: 1; resize: none; font: inherit; font-size: 16px; line-height: 1.35; color: var(--ink);
  border: 0; border-radius: 22px; padding: 10px 16px; background: #fff; max-height: 120px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
}
.compose textarea:focus { outline: 2px solid var(--send); outline-offset: 0; }
.compose button {
  width: 44px; height: 44px; border-radius: 50%; border: 0; flex: none;
  background: var(--send); color: #fff; display: grid; place-items: center; cursor: pointer;
}
.compose button svg { width: 22px; height: 22px; }
.compose button:disabled { opacity: .55; cursor: wait; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
