:root { --bg:#f6f4ef; --fg:#26241f; --muted:#7a766b; --card:#fff; --accent:#4a6b5d; --line:#e2ded3; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--fg); font: 17px/1.5 system-ui, sans-serif; }
h1 { font-size: 1.3rem; font-weight: 600; margin: 0; }
button, textarea, input { font: inherit; }
button { background: var(--accent); color: #fff; border: 0; border-radius: 12px; padding: .7rem 1.1rem; cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
.gate { max-width: 22rem; margin: 0 auto; padding: 18vh 1.2rem 1rem; }
.gate h1 { text-align: center; margin-bottom: 1.5rem; }
.gate label { display: block; color: var(--muted); margin-bottom: .3rem; }
.gate input { width: 100%; padding: .7rem; border: 1px solid var(--line); border-radius: 12px; background: var(--card); margin-bottom: .8rem; }
.gate button { width: 100%; }
.error { color: #a33; margin: 0 0 .8rem; }
.chat { display: flex; flex-direction: column; height: 100dvh; max-width: 42rem; margin: 0 auto; }
.chat header { padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.log { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .6rem; }
.msg { max-width: 85%; padding: .6rem .9rem; border-radius: 16px; overflow-wrap: anywhere; background: var(--card); border: 1px solid var(--line); }
.msg.me { align-self: flex-end; background: var(--accent); color: #fff; border-color: var(--accent); }
.msg.me, .msg.wait, .msg.err { white-space: pre-wrap; }
.msg.md > :first-child { margin-top: 0; }
.msg.md > :last-child { margin-bottom: 0; }
.msg.md p, .msg.md ul, .msg.md ol, .msg.md pre { margin: .5rem 0; }
.msg.md ul, .msg.md ol { padding-left: 1.4rem; }
.msg.md h1, .msg.md h2, .msg.md h3, .msg.md h4, .msg.md h5, .msg.md h6 { font-size: 1.05rem; line-height: 1.3; margin: .8rem 0 .3rem; }
.msg.md h1 { font-size: 1.25rem; }
.msg.md h2 { font-size: 1.15rem; }
.msg.md a { color: var(--accent); text-decoration: underline; }
.msg.md code { font-family: ui-monospace, monospace; font-size: .9em; background: var(--bg); padding: .05rem .3rem; border-radius: 6px; }
.msg.md pre { overflow-x: auto; background: var(--bg); padding: .6rem .8rem; border-radius: 10px; }
.msg.md pre code { padding: 0; background: none; }
.msg.wait { color: var(--muted); font-style: italic; }
.msg.err { color: #a33; }
.composer { display: flex; gap: .5rem; padding: .7rem; border-top: 1px solid var(--line); background: var(--bg); }
.composer textarea { flex: 1; resize: none; max-height: 8rem; padding: .6rem .8rem; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
