:root {
  color-scheme: light;
  font-family: "DM Sans","Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
  --paper:#faf9f5; --ink:#292f2c; --muted:#67736c; --green:#365f4d; --line:#dedfd6;
}
* {box-sizing:border-box}
[hidden] {display:none!important}
body {margin:0; display:flex; height:100vh; height:100dvh; overflow:hidden; color:var(--ink); background:var(--paper)}
button,input,textarea {font:inherit}
button {border:0; background:transparent; color:inherit; cursor:pointer; -webkit-tap-highlight-color:transparent}
button:disabled {cursor:default; opacity:.52}
button:focus-visible, textarea:focus-visible, input:focus-visible, a:focus-visible {outline:2px solid #568b6e; outline-offset:3px}
button:not(:disabled):hover {filter:brightness(.94)}
button svg, .icon svg, .settings svg, .export svg {width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.65; stroke-linecap:round; stroke-linejoin:round; flex-shrink:0}
.symbols,.sr-only {position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%)}
#sidebar {width:260px; flex:none; display:flex; flex-direction:column; padding:30px 16px 18px; background:#efefe8; border-right:1px solid var(--line); min-height:0}
.brand {display:flex; align-items:center; gap:11px; font-family:"STSong","Songti SC","SimSun",serif; font-weight:700; font-size:27px; letter-spacing:2px; padding:0 10px 30px}
.brandmark {width:39px; height:39px; background:var(--green); border-radius:12px; display:grid; place-items:center; color:#fffdf3}
.brandmark svg {width:31px; height:31px}
.new-chat {display:flex; align-items:center; gap:10px; width:100%; padding:13px 15px; border-radius:11px; font-size:14px; font-weight:600; background:var(--green); color:#fff; box-shadow:0 2px 4px #243e2f12}
.new-chat .new-plus {margin-left:auto; width:15px; opacity:.75}
.history-head {font-size:12px; color:var(--muted); margin:31px 12px 11px}
#historyList {overflow:auto; min-height:0; flex:1; scrollbar-width:thin}
#historyList:empty:before {content:"暂无会话"; display:block; color:#798179; font-size:13px; padding:9px 12px}
.history-item {width:100%; text-align:left; display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-size:14px; padding:12px; border-radius:8px; line-height:1.45}
.history-item:hover, .history-item.active {background:#dfe5d9; color:#284c3b}
.side-bottom {padding-top:12px; border-top:1px solid #d5d8cd}
.settings {padding:10px 8px; display:flex; align-items:center; gap:10px; font-size:14px}
.storage {display:flex; align-items:center; gap:5px; padding:11px 7px 0; font-size:11px; color:var(--muted)}
.storage button {padding:3px 0}
.status-dot {width:6px; height:6px; border-radius:50%; background:#8c9e8d; flex:none}
#loginBtn {margin-left:auto; color:var(--green); font-weight:600}
main {display:flex; flex:1; min-width:0; flex-direction:column; min-height:0}
header {display:flex; height:70px; padding:0 clamp(18px,3vw,44px); justify-content:space-between; align-items:center; border-bottom:1px solid #e6e6df; flex:none; gap:12px}
.head-left {display:flex; align-items:center; gap:9px; min-width:0}
#chatTitle {margin:0; font-size:16px; line-height:1.5; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.icon,.export {display:inline-flex; align-items:center; justify-content:center; flex:none}
.icon {width:36px; height:36px; border-radius:8px; color:var(--muted)}
.icon:hover {background:#ebece5}
.export {gap:8px; border:1px solid #d7dacf; border-radius:8px; background:#fdfcf9; font-size:13px; padding:8px 13px}
.export svg {width:15px; height:15px}
.mobile-only,.mobile-storage,.veil {display:none}
#messages {flex:1; display:flex; flex-direction:column; overflow:auto; min-height:0; overscroll-behavior:contain; scrollbar-gutter:stable both-edges; scrollbar-width:thin}
#welcome {text-align:center; margin:auto; padding:36px 10px; max-width:100%}
.welcome-mark {margin:auto; display:grid; place-items:center; width:76px; height:76px; border-radius:24px; transform:rotate(-7deg); background:#e1e8d8; color:#3d624e; box-shadow:inset 0 0 0 1px #cddac6}
.welcome-mark svg {width:53px; height:53px; transform:rotate(7deg)}
#welcome h2 {font-family:"STSong","Songti SC","Noto Serif CJK SC","SimSun",serif; margin:25px 0 10px; font-size:clamp(27px,3.6vw,44px); font-weight:600; letter-spacing:.02em; line-height:1.35}
#welcome p {font-size:14px; color:var(--muted); margin:0; line-height:1.7}
.starters {display:flex; justify-content:center; flex-wrap:wrap; gap:9px; margin-top:27px}
.starters button {display:inline-flex; align-items:center; gap:8px; border:1px solid var(--line); background:#fffefa; color:#4e5b51; font-size:13px; padding:9px 14px; border-radius:20px}
.starters svg {width:15px; height:15px; color:#598068}
#messageList,.compose-area {width:min(100%,840px); margin:0 auto; padding-inline:30px}
#messageList:not(:empty) {padding-block:28px 15px}
.message {min-width:0; margin-bottom:27px}
.message.user {width:fit-content; margin-left:auto; max-width:88%}
.message-body {font-size:15px; line-height:1.85; overflow-wrap:anywhere; max-width:100%; min-width:0}
.message.user .message-body {background:#e7ecdf; border-radius:16px 16px 3px 16px; padding:9px 15px; white-space:pre-wrap}
.message-label {font-size:12px; font-weight:600; color:#607362; margin-bottom:6px; letter-spacing:.01em}
.message.user .message-label {text-align:right}
.message-body>:first-child {margin-top:0}
.message-body>:last-child {margin-bottom:0}
.message-body p {margin:.65em 0}
.message-body a {color:#326947; text-underline-offset:3px}
.message-body blockquote {margin:10px 0; padding:0 14px; color:var(--muted); border-left:3px solid #afc0ab}
.message-body pre,.message-body table {max-width:100%; overflow-x:auto; scrollbar-width:thin}
.message-body pre {line-height:1.65; background:#eeeee7; border:1px solid var(--line); border-radius:10px; padding:13px; white-space:pre; overflow-wrap:normal}
.message-body code {background:#efefe9; border-radius:4px; font: .9em/1.55 "Cascadia Code",Consolas,monospace; padding:2px 4px}
.message-body pre code {padding:0; background:transparent}
.message-body table {display:block; border-collapse:collapse; margin:12px 0}
.message-body th,.message-body td {border:1px solid var(--line); padding:6px 11px; min-width:60px}
.message-body th {background:#ecefe7}
.message-body img {max-width:100%}
.message-actions {display:flex; gap:8px; margin-top:8px; color:var(--muted); font-size:12px}
.message-actions button {border:1px solid var(--line); padding:3px 9px; border-radius:7px}
.compose-area {flex:none; padding-block:10px max(17px,env(safe-area-inset-bottom));}
#composer {background:#fffefb; border:1px solid #cacfc2; border-radius:17px; box-shadow:0 3px 12px #364b3410; padding:13px 14px 10px}
#composer:focus-within {border-color:#89a18b; box-shadow:0 0 0 2px #496c4d0d}
#draft {background:transparent; color:var(--ink); border:0; outline:0; display:block; min-height:46px; width:100%; max-height:min(170px,24dvh); resize:none; padding:1px 3px; line-height:1.6; font-size:16px}
#draft::placeholder {color:#899088}
.compose-tools,.prompt-tools {display:flex; align-items:center; gap:7px}
.compose-tools {justify-content:space-between; margin-top:6px}
.prompt-tools {min-width:0; flex-wrap:wrap}
#promptsBtn,#activePrompt {display:inline-flex; align-items:center; gap:5px; border-radius:7px; font-size:12px}
#promptsBtn {color:#58685b; border:1px solid #e0e2d8; padding:6px 9px}
#promptsBtn svg {width:14px; height:14px}
#activePrompt {color:var(--green); padding:2px 5px; background:#edf1e8; max-width:100%}
#promptName {max-width:11em; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
#removePrompt {font-size:19px}
#sendBtn,#stopBtn {display:grid; flex:none; width:37px; height:37px; place-items:center; border-radius:11px; color:white; background:var(--green)}
.footnote {display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:3px 10px; color:#6d756d; font-size:10.5px; margin-top:10px; line-height:1.55; text-align:center}
#modelStatus:not(:empty) {font-weight:600; color:#746446}
dialog {max-width:min(440px,calc(100vw - 28px)); width:440px; max-height:85dvh; background:#fffefb; color:var(--ink); border:1px solid var(--line); border-radius:19px; padding:22px; box-shadow:0 16px 70px #1e322327; overscroll-behavior:contain}
dialog::backdrop {background:#202b254c}
.dialog-head {display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:14px}
.dialog-head h2 {font-size:19px; margin:0}
#dialogBody {font-size:14px; line-height:1.6}
#dialogBody input,#dialogBody textarea {display:block; width:100%; margin:5px 0 13px; padding:10px; border:1px solid var(--line); border-radius:8px; background:#fff; color:var(--ink); font-size:16px}
#dialogBody textarea {min-height:100px; resize:vertical}
#dialogBody label {display:block}
#dialogBody button {border:1px solid var(--line); border-radius:8px; padding:8px 13px; margin:3px 4px 3px 0; background:#f7f8f1}
#dialogBody button.primary {background:var(--green); border-color:var(--green); color:white}
#dialogBody button.danger {color:#994c43; border-color:#dfc6bf; background:#fbf4ef}
.prompt-row {display:flex; align-items:center; padding:6px 0; gap:3px; border-bottom:1px solid var(--line)}
.prompt-list:not(:empty) {margin-bottom:12px}
.prompt-row .prompt-use {flex:1; min-width:0; text-align:left; overflow-wrap:anywhere}
.prompt-row button {flex:none}
#toast {position:fixed; bottom:max(18%,120px); left:50%; transform:translateX(-50%); background:#34493b; color:#fff; border-radius:10px; padding:10px 16px; max-width:85vw; z-index:12; font-size:13px; box-shadow:0 3px 15px #0002}
@media(max-width:760px){
 #sidebar {position:fixed; inset:0 auto 0 0; width:min(294px,84vw); z-index:6; transform:translateX(-103%); visibility:hidden; transition:transform .18s ease; padding-bottom:max(18px,env(safe-area-inset-bottom))}
 body.drawer-open #sidebar {transform:none; visibility:visible}
 body.drawer-open .veil {display:block; position:fixed; inset:0; z-index:5; background:#263b2e4f}
 .mobile-only {display:inline-flex}
 .mobile-storage {display:flex; align-items:center; justify-content:center; gap:9px; font-size:11px; color:var(--muted); line-height:1.4; padding-bottom:3px}
 .mobile-storage button {padding:4px 0}
 #mobileLoginBtn {color:var(--green); font-weight:600}
 header {height:55px; padding:0 12px; gap:6px}
 .head-left {gap:3px}
 #chatTitle {font-size:15px}
 .export {padding:8px 11px}
 #messages {scrollbar-gutter:auto}
 #messageList,.compose-area {padding-inline:14px}
 .compose-area {padding-top:4px; padding-bottom:max(8px,env(safe-area-inset-bottom))}
 .footnote {margin-top:6px; gap:2px 7px; font-size:10px}
 #privacyNote {width:100%}
 #welcome {padding:22px 10px}
 .welcome-mark {width:63px; height:63px; border-radius:20px}
 .welcome-mark svg {width:45px; height:45px}
 #welcome h2 {margin-top:20px}
 #welcome p {font-size:13px}
 .starters {gap:6px; margin-top:19px}
 .starters button {padding:7px 9px; gap:5px; font-size:12px}
 .message.user {max-width:94%}
}
@media(max-height:480px) {#welcome {padding-block:14px} .welcome-mark,.starters {display:none} #welcome h2 {margin:5px} header {height:45px} #draft {min-height:34px; height:34px} #composer {padding-block:7px} .footnote {margin:3px 0 0}}
@media(prefers-reduced-motion:reduce) {* {scroll-behavior:auto!important; transition:none!important}}

