:root {
  --accent: #2f6f5e;
  --accent-fg: #fff;
  --bg: #f6f7f5;
  --panel: #ffffff;
  --text: #1d2321;
  --muted: #6b7570;
  --user: #2f6f5e;
  --user-fg: #fff;
  --bot: #eef1ee;
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); }
[hidden] { display: none !important; }

.app { display: flex; flex-direction: column; height: 100%; max-width: 820px; margin: 0 auto; background: var(--panel); }

.top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid #e3e7e4; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--bot); display: grid; place-items: center; font-size: 20px; }
.title { flex: 1; display: flex; flex-direction: column; line-height: 1.2; }
.status { font-size: 12px; color: var(--muted); }
.status.on::before { content: "● "; color: #3a9a5b; }
.ghost { background: none; border: 0; font-size: 20px; color: var(--muted); cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.ghost:hover { background: var(--bot); }

.chat { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 85%; padding: 10px 13px; border-radius: var(--radius); line-height: 1.45; word-wrap: break-word; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--user); color: var(--user-fg); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.bot { align-self: flex-start; background: var(--bot); border-bottom-left-radius: 4px; }
.msg.bot p { margin: 0 0 .5em; } .msg.bot p:last-child { margin-bottom: 0; }
.msg.bot ul, .msg.bot ol { margin: .3em 0 .5em; padding-left: 1.3em; }
.msg.bot code { background: rgba(0,0,0,.07); padding: 1px 4px; border-radius: 4px; font-size: .92em; }
.msg.bot pre { background: rgba(0,0,0,.07); padding: 8px; border-radius: 8px; overflow-x: auto; }
.msg.bot a { color: var(--accent); }
.msg.error { align-self: center; background: #fff4e5; color: #7a4b00; font-size: 14px; }

.typing span { display: inline-block; width: 7px; height: 7px; margin: 0 2px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite both; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.composer { display: flex; gap: 8px; padding: 10px 14px 4px; border-top: 1px solid #e3e7e4; }
.composer textarea { flex: 1; resize: none; max-height: 140px; padding: 10px 12px; border: 1px solid #cfd6d2; border-radius: 12px; font: inherit; outline: none; }
.composer textarea:focus { border-color: var(--accent); }
.composer button { width: 44px; border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-fg); font-size: 18px; cursor: pointer; }
.composer button:disabled { opacity: .5; cursor: default; }
.hint { margin: 0; padding: 2px 14px 8px; font-size: 11px; color: var(--muted); text-align: center; }

.offline { position: fixed; inset: 0; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; }
.offline h1 { font-size: 1.4rem; margin: .4em 0 .3em; }
.offline p { color: var(--muted); max-width: 420px; line-height: 1.5; }
.offline button { margin-top: 10px; padding: 10px 18px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-fg); font: inherit; cursor: pointer; }
.offline .small { font-size: 12px; }
.lotus { font-size: 64px; animation: breathe 5s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(1); opacity: .85; } 50% { transform: scale(1.12); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .lotus, .typing span { animation: none; } }
