:root {
  --bg: #f7f8f7;
  --ink: #1c2421;
  --muted: #5f6b67;
  --line: #dde3e0;
  --brand: #0f766e;
  --brand-soft: #e3f3f1;
  --user: #e8efed;
  --warn-soft: #fdf3e2;
  --warn: #8a4b04;
  font-family: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #141917; --ink: #e7ecea; --muted: #9aa6a2; --line: #2b3431; --brand-soft: #18302c; --user: #222b28; --warn-soft: #33270f; --warn: #f3c47a; }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { display: flex; flex-direction: column; font-size: 17px; line-height: 1.9; }
button { font: inherit; color: inherit; cursor: pointer; }

.top { display: flex; align-items: center; justify-content: space-between; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 19px; }
.ghost { background: none; border: 1px solid var(--line); border-radius: 10px; padding: 4px 12px; font-size: 14px; }
.ghost:hover { background: var(--brand-soft); }

main { flex: 1; overflow-y: auto; padding: 20px 16px 8px; }
.welcome { max-width: 680px; margin: 8vh auto 0; text-align: center; }
.welcome h1 { font-size: 26px; margin: 12px 0 4px; }
.welcome p { color: var(--muted); margin: 0 0 22px; }
.chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.chips button { text-align: right; background: transparent; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: 15px; line-height: 1.7; }
.chips button:hover { border-color: var(--brand); background: var(--brand-soft); }

.log { list-style: none; margin: 0 auto; padding: 0; max-width: 720px; display: flex; flex-direction: column; gap: 18px; }
.msg { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { align-self: flex-start; background: var(--user); border-radius: 18px; padding: 8px 16px; max-width: 85%; }
.msg.bot { align-self: stretch; display: flex; gap: 12px; }
.msg.bot img { flex: none; margin-top: 4px; }
.msg.bot .text { flex: 1; min-width: 0; }
.msg.bot.error .text { background: var(--warn-soft); color: var(--warn); border-radius: 12px; padding: 6px 12px; }
.thinking { color: var(--muted); font-size: 15px; }
.dots::after { content: ""; animation: dots 1.4s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.cursor::after { content: "▍"; color: var(--brand); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.composer-wrap { padding: 8px 16px calc(10px + env(safe-area-inset-bottom)); }
.composer { max-width: 720px; margin: 0 auto; display: flex; align-items: flex-end; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 22px; padding: 8px 8px 8px 8px; box-shadow: 0 2px 12px rgba(0,0,0,.05); }
.composer:focus-within { border-color: var(--brand); }
textarea { flex: 1; border: 0; outline: 0; resize: none; background: transparent; color: var(--ink); font: inherit; padding: 6px 10px; max-height: 180px; }
.send { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; display: grid; place-items: center; }
.send:disabled { opacity: .35; cursor: default; }
.send.stop { background: var(--ink); color: var(--bg); }
.note { max-width: 720px; margin: 6px auto 0; text-align: center; color: var(--muted); font-size: 12.5px; line-height: 1.7; }
