:root {
  --bg: #f6f7f9; --surface: #ffffff; --text: #14181f; --muted: #6b7380;
  --border: #e1e4ea; --accent: #209dd7; --action: #753991; --visitor: #e8f4fb;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1420; --surface: #121e2e; --text: #e6ebf2; --muted: #8b96a6;
    --border: #22324a; --accent: #4cb4e6; --action: #8e4bad; --visitor: #16324a;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex; flex-direction: column;
}
header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--border); background: var(--surface);
}
header h1 { font-size: 17px; margin: 0; font-weight: 650; }
header p { margin: 0; font-size: 13px; color: var(--muted); }
button {
  font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--border);
  background: transparent; color: var(--text); padding: 7px 12px;
}
button:hover { border-color: var(--accent); }
main { flex: 1; overflow-y: auto; }
#log { max-width: 760px; margin: 0 auto; padding: 24px 16px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 12px; overflow-wrap: anywhere; }
.msg p { margin: 0 0 8px; } .msg p:last-child { margin: 0; }
.msg ul { margin: 4px 0 8px; padding-left: 20px; }
.msg a { color: var(--accent); }
.msg code { font-family: ui-monospace, Menlo, monospace; font-size: 0.9em; }
.user { align-self: flex-end; background: var(--visitor); }
.assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); }
.thinking { color: var(--muted); font-style: italic; }
#intro { text-align: center; color: var(--muted); padding: 40px 0 8px; }
#intro h2 { color: var(--text); font-size: 22px; margin: 0 0 6px; }
#examples { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
#examples button { font-size: 14px; background: var(--surface); }
form {
  display: flex; gap: 8px; max-width: 760px; width: 100%; margin: 0 auto;
  padding: 12px 16px 16px;
}
textarea {
  flex: 1; resize: none; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; max-height: 160px;
}
textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
#send { background: var(--action); color: #fff; border-color: var(--action); padding: 0 18px; }
#send:disabled { opacity: 0.5; cursor: default; }
.footer-wrap { border-top: 1px solid var(--border); background: var(--bg); }
