:root{font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC",sans-serif;color:#24372d;background:#f2f6f3;font-synthesis:none;--green:#276b50;--green-dark:#19543e;--sage:#e4efe8;--line:#dce7df;--muted:#7c8d82;--sand:#f7f1e7;--danger:#a24747}*{box-sizing:border-box}body{margin:0;min-height:100vh;background:radial-gradient(circle at 15% 5%,#e9f2eb 0,transparent 32%),#f4f7f5}button,textarea{font:inherit}button{cursor:pointer}.chat-app{width:min(1180px,calc(100vw - 48px));min-height:calc(100vh - 48px);margin:24px auto;background:#fff;border:1px solid var(--line);border-radius:18px;box-shadow:0 24px 70px #22433414;overflow:hidden}.chat-topbar{height:72px;padding:0 28px;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between}.chat-brand{font-size:14px;font-weight:800;letter-spacing:2.4px;color:var(--green);text-decoration:none}.chat-topbar-actions{display:flex;align-items:center;gap:15px}.connection-state{font-size:11px;color:#7b8d81}.connection-state.ready{color:#3d805c}.connection-state.error{color:var(--danger)}.ghost-button{border:1px solid var(--line);background:#fff;color:#4e6758;border-radius:8px;padding:9px 13px;font-size:12px;font-weight:650}.ghost-button:hover{background:#f0f6f1;border-color:#bfd4c5}.chat-layout{display:grid;grid-template-columns:300px minmax(0,1fr);min-height:calc(100vh - 144px)}.character-panel{padding:42px 30px;background:linear-gradient(160deg,#eff6f0,#f7f9f7 70%);border-right:1px solid var(--line)}.character-avatar{width:72px;height:72px;border-radius:22px;background:linear-gradient(135deg,#3d8b67,#1e5b43);color:#fff;display:grid;place-items:center;font-size:28px;font-weight:750;box-shadow:0 12px 24px #2c765422;margin-bottom:24px}.character-kicker,.eyebrow{font-size:9px;letter-spacing:1.8px;font-weight:750;color:var(--green);margin:0 0 10px}.character-panel h1{font-size:25px;line-height:1.35;letter-spacing:-.4px;margin:0 0 12px}.character-summary{font-size:13px;line-height:1.9;color:#6e8074;margin:0}.character-tags{display:flex;flex-wrap:wrap;gap:6px;margin-top:20px}.character-tag{padding:5px 9px;border-radius:999px;background:#fff;border:1px solid #dbe8de;color:#5b7463;font-size:10px}.character-panel-divider{height:1px;background:#dbe6df;margin:32px 0 22px}.character-meta{display:flex;justify-content:space-between;gap:10px;font-size:11px;color:#87958b}.character-meta strong{font-weight:650;color:#4c6656}.character-note{font-size:11px;line-height:1.8;color:#96a29a;margin:14px 0 0}.conversation-shell{min-width:0;display:flex;flex-direction:column;background:#fff}.conversation-header{display:flex;justify-content:space-between;align-items:center;padding:25px 30px 20px;border-bottom:1px solid #edf2ee}.conversation-header h2{font-size:20px;margin:0;font-weight:680}.conversation-header .eyebrow{margin-bottom:6px}.auth-banner{margin:18px 24px 0;padding:13px 16px;border:1px solid #eadfcb;background:var(--sand);border-radius:9px;color:#806d4e;display:flex;flex-direction:column;gap:3px;font-size:12px}.auth-banner span{font-size:11px;color:#9b8a6b}.message-list{flex:1;min-height:360px;max-height:calc(100vh - 330px);overflow:auto;padding:30px 34px;display:flex;flex-direction:column;gap:18px;background:linear-gradient(#fff,#fcfefc)}.conversation-empty{margin:auto;text-align:center;color:#8a9a8f}.conversation-empty .empty-mark{display:block;color:#76a88a;font-size:24px;margin-bottom:12px}.conversation-empty strong{font-size:13px;color:#58705f}.conversation-empty p{font-size:11px;margin:7px 0 0}.message{display:flex;gap:10px;max-width:78%;align-items:flex-end}.message.user{margin-left:auto;flex-direction:row-reverse}.message-avatar{width:28px;height:28px;flex:none;border-radius:10px;background:#e3f0e6;color:#397356;display:grid;place-items:center;font-size:11px;font-weight:750}.message.user .message-avatar{background:#dfe6e1;color:#68786d}.message-bubble{border:1px solid #e1ebe3;background:#f6faf7;color:#344d3d;border-radius:4px 14px 14px 14px;padding:11px 14px;font-size:13px;line-height:1.75;white-space:pre-wrap;overflow-wrap:anywhere}.message.user .message-bubble{background:var(--green);color:#fff;border-color:var(--green);border-radius:14px 4px 14px 14px}.message-meta{font-size:10px;color:#a2aea6;margin-top:4px}.message.user .message-meta{text-align:right}.message.pending .message-bubble{color:#789080}.typing-dots{display:inline-flex;gap:3px;vertical-align:middle}.typing-dots i{width:4px;height:4px;border-radius:50%;background:#76a187;animation:typing 1s infinite}.typing-dots i:nth-child(2){animation-delay:.14s}.typing-dots i:nth-child(3){animation-delay:.28s}@keyframes typing{0%,60%,100%{opacity:.25;transform:translateY(0)}30%{opacity:1;transform:translateY(-2px)}}.composer{margin:0 24px 24px;border:1px solid #d9e5dc;border-radius:13px;background:#fbfdfb;box-shadow:0 6px 20px #2b593d0b}.composer:focus-within{border-color:#9fc4aa;box-shadow:0 0 0 3px #d9ece0}.composer textarea{width:100%;border:0;outline:0;resize:none;background:transparent;padding:15px 16px 7px;line-height:1.65;font-size:13px;color:#2f4537;min-height:52px;max-height:170px}.composer textarea::placeholder{color:#a3aea7}.composer textarea:disabled{cursor:not-allowed}.composer-footer{display:flex;align-items:center;justify-content:space-between;padding:4px 8px 8px 16px}.composer-footer span{color:#a0aca4;font-size:10px}.send-button{border:0;background:var(--green);color:#fff;border-radius:8px;padding:8px 13px;font-size:12px;font-weight:700}.send-button:hover:not(:disabled){background:var(--green-dark)}.send-button:disabled{opacity:.45;cursor:not-allowed}.toast{position:fixed;bottom:28px;left:50%;transform:translateX(-50%);padding:10px 15px;border-radius:8px;background:#263b2e;color:#fff;font-size:12px;box-shadow:0 8px 26px #1f3b2c30}.toast.error{background:#963f3f}@media(max-width:780px){.chat-app{width:100%;min-height:100vh;margin:0;border:0;border-radius:0}.chat-topbar{height:62px;padding:0 18px}.chat-layout{display:flex;flex-direction:column;min-height:calc(100vh - 62px)}.character-panel{padding:22px 20px 20px;border-right:0;border-bottom:1px solid var(--line);display:grid;grid-template-columns:56px 1fr;column-gap:14px}.character-avatar{width:56px;height:56px;border-radius:17px;grid-row:span 3;margin:0;font-size:22px}.character-kicker{align-self:end;margin:0}.character-panel h1{font-size:20px;margin:0}.character-summary{grid-column:1/-1;margin-top:13px}.character-tags,.character-panel-divider,.character-meta,.character-note{grid-column:1/-1}.character-tags{margin-top:14px}.character-panel-divider{margin:20px 0 14px}.character-meta{margin-bottom:0}.character-note{display:none}.conversation-shell{min-height:calc(100vh - 270px)}.conversation-header{padding:18px 18px 15px}.conversation-header h2{font-size:17px}.message-list{max-height:none;min-height:280px;padding:22px 18px}.message{max-width:88%}.composer{margin:0 12px 12px}.chat-topbar-actions .connection-state{display:none}}

[hidden]{display:none!important}button:disabled{opacity:.5;cursor:not-allowed}:focus-visible{outline:3px solid #80b39a;outline-offset:3px}

.auth-banner{display:flex;align-items:center;justify-content:space-between;gap:16px}.auth-banner p{margin:6px 0 0;font-size:12px}.auth-banner .send-button{white-space:nowrap;flex-shrink:0}.conversation-header>div{flex:1}.conversation-header{gap:8px}.composer-footer #composer-hint{max-width:75%;line-height:1.5}.conversation-empty button{margin-top:12px}

#memory-dialog{width:min(620px,calc(100vw - 24px));max-height:90vh;overflow:auto;border:1px solid #dce4df;border-radius:16px;padding:24px;color:#2f4337}#memory-dialog::backdrop{background:#29413455;backdrop-filter:blur(3px)}.memory-header,.memory-actions{display:flex;align-items:center;justify-content:space-between;gap:12px}.memory-note{font-size:13px;line-height:1.7;color:#64766c;margin:16px 0}.memory-item{padding:14px 0;border-bottom:1px solid #e4eae6}.memory-item p{white-space:pre-wrap;overflow-wrap:anywhere}.memory-item small{color:#64766c}#memory-form{display:grid;gap:10px;margin-top:22px}#memory-form textarea,#memory-form select{width:100%;box-sizing:border-box;border:1px solid #cbd8d0;border-radius:8px;padding:12px;font:inherit}#memory-error{color:#a43e3e;font-size:13px}#memory-dialog button:disabled{opacity:.5;cursor:not-allowed}
