:root {
  --bg: #0b0b0e;
  --panel: #14141a;
  --panel-2: #1c1c24;
  --line: #2a2a35;
  --text: #ececf1;
  --muted: #9a9aab;
  --accent: #5b8cff;
  --accent-2: #8fb0ff;
  --user: #223054;
  --danger: #ff6b6b;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
}
.app { display: flex; flex-direction: column; height: 100dvh; max-width: 860px; margin: 0 auto; padding: 0 16px; }
header { display: flex; align-items: center; justify-content: space-between; padding: 18px 4px 12px; border-bottom: 1px solid var(--line); }
header .brand { display: flex; align-items: baseline; gap: 10px; }
header h1 { margin: 0; font-size: 20px; letter-spacing: 0.02em; font-family: var(--mono); }
header .tag { color: var(--muted); font-size: 12px; font-family: var(--mono); }
header .badge { font-size: 11px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-family: var(--mono); }
header .badge.admin { border-color: var(--accent); color: var(--accent-2); }
.messages { flex: 1; overflow-y: auto; padding: 18px 4px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.msg { max-width: 92%; padding: 12px 14px; border-radius: 14px; white-space: pre-wrap; word-break: break-word; }
.msg.user { align-self: flex-end; background: var(--user); border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 4px; white-space: normal; }
.msg.assistant :is(p, ul, ol, table, pre, h1, h2, h3, blockquote) { margin: 0.4em 0; }
.msg.assistant :is(h1, h2, h3) { font-size: 1em; color: var(--accent-2); }
.msg.assistant table { border-collapse: collapse; width: 100%; font-size: 13.5px; display: block; overflow-x: auto; }
.msg.assistant th, .msg.assistant td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.msg.assistant th { background: var(--panel-2); }
.msg.assistant code { font-family: var(--mono); font-size: 0.9em; background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
.msg.assistant pre { background: var(--panel-2); padding: 10px 12px; border-radius: 8px; overflow-x: auto; }
.msg.assistant pre code { background: none; padding: 0; }
.msg.assistant a { color: var(--accent-2); }
.msg.assistant blockquote { border-left: 3px solid var(--line); margin-left: 0; padding-left: 10px; color: var(--muted); }
.tool { align-self: flex-start; font-family: var(--mono); font-size: 12px; color: var(--muted); padding: 2px 10px; }
.tool::before { content: "⚙ "; }
.error { align-self: center; color: var(--danger); font-size: 13px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 4px 10px; }
.suggestions button { background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.suggestions button:hover { border-color: var(--accent); }
form { display: flex; gap: 8px; padding: 10px 0 18px; border-top: 1px solid var(--line); }
textarea { flex: 1; resize: none; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font: inherit; min-height: 48px; max-height: 180px; outline: none; }
textarea:focus { border-color: var(--accent); }
button.send { background: var(--accent); color: white; border: 0; border-radius: 12px; padding: 0 18px; font: inherit; font-weight: 600; cursor: pointer; }
button.send:disabled { opacity: 0.5; cursor: default; }
.cursor::after { content: "▍"; color: var(--accent-2); animation: blink 1s steps(2) infinite; }
@keyframes blink { to { visibility: hidden; } }
footer { color: var(--muted); font-size: 12px; text-align: center; padding-bottom: 12px; font-family: var(--mono); }
@media (max-width: 600px) { .msg { max-width: 100%; } header h1 { font-size: 18px; } }
