:root{
  color-scheme:light dark;
  --page:#fff;--side:#f9f9f9;--ink:#171717;--muted:#6d6d6d;--hint:#888;--rule:#e7e7e7;
  --hover:#efefef;--selected:#e9e9e9;--bubble:#f4f4f4;--send:#161616;--on-send:#fff;
  --shadow:0 4px 20px #00000012,0 1px 3px #00000009;--rail:260px;--measure:768px;
  font:15px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
  color:var(--ink);background:var(--page);-webkit-font-smoothing:antialiased;
}
@media(prefers-color-scheme:dark){:root{
  --page:#212121;--side:#181818;--ink:#f1f1f1;--muted:#aaa;--hint:#aaa;--rule:#424242;
  --hover:#303030;--selected:#363636;--bubble:#303030;--send:#fff;--on-send:#121212;
  --shadow:0 4px 16px #0003;
}}
*{box-sizing:border-box}
[hidden]{display:none!important}
body{margin:0;display:flex;min-height:100vh;height:100dvh;overflow:hidden}
button,input,textarea{font:inherit;color:inherit}
button{cursor:pointer;border:0;background:transparent;text-align:inherit;padding:0;-webkit-tap-highlight-color:transparent}
button:focus-visible,input:focus-visible,textarea:focus-visible{outline:2px solid #698bc3;outline-offset:2px}
button:disabled{cursor:default}
svg{display:block;width:20px;height:20px;flex:none;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;pointer-events:none}
.icons{position:absolute;height:0;width:0;overflow:hidden}
.brand{width:26px;height:26px;fill:currentColor;stroke:none}
.icon-button{width:36px;height:36px;display:grid;place-items:center;border-radius:9px;color:var(--ink)}
.icon-button:hover,.side-actions button:hover,.account-button:hover,#modelBtn:hover,.thread-item:hover,.search-result:hover,.copy-answer:hover,.popover button:hover{background:var(--hover)}
#sidebar{width:var(--rail);flex:none;min-height:0;display:flex;flex-direction:column;background:var(--side);border-right:1px solid color-mix(in srgb,var(--rule) 65%,transparent);position:relative;z-index:4}
.side-top{height:64px;padding:0 14px 0 19px;display:flex;align-items:center;justify-content:space-between}
#sideClose{color:var(--muted)}
.side-actions{padding:8px 9px 0}
.side-actions button,.thread-item,.search-result{width:100%;border-radius:9px;padding:9px 10px;min-height:40px}
.side-actions button{display:flex;align-items:center;gap:12px;font-size:14px}
.side-actions kbd{margin-left:auto;font:11px -apple-system,sans-serif;color:var(--muted);opacity:0}
.side-actions button:hover kbd,.side-actions button:focus-visible kbd{opacity:1}
.recents{overflow:auto;flex:1;padding:0 9px 16px;scrollbar-width:thin}
.recents h2{font-size:13px;color:var(--muted);font-weight:500;margin:34px 10px 7px}
.recents:not(:has(.thread-item)) h2{display:none}
.thread-item{display:block;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.thread-item.selected{background:var(--selected)}
.side-bottom{margin:0 8px;border-top:1px solid var(--rule);padding:6px 0 max(6px,env(safe-area-inset-bottom));position:relative}
.account-button{display:flex;align-items:center;gap:10px;width:100%;padding:7px;border-radius:12px}
.avatar{display:grid;place-items:center;border-radius:50%;width:32px;height:32px;background:#386e64;color:white;font-size:14px;font-weight:500}
.profile{display:grid;line-height:1.35;text-align:left}
.profile strong{font-size:14px;font-weight:550}.profile small,.popover small{color:var(--muted);font-size:12px}
main{flex:1;min-width:0;min-height:0;position:relative;display:flex;flex-direction:column}
.topbar{height:60px;min-height:60px;display:flex;align-items:center;gap:4px;padding:0 16px}
#toggleSide{display:none}
.side-hidden #sidebar{display:none}
.side-hidden #toggleSide{display:grid}
.model-switch{position:relative}
#modelBtn{display:flex;align-items:center;gap:5px;height:38px;padding:0 10px;border-radius:9px;font-size:18px;letter-spacing:-.5px;font-weight:550}
#modelBtn svg{width:15px;height:15px;color:var(--muted)}
#tempChat{margin-left:auto}#tempChat svg{width:23px;height:23px}#tempChat[aria-pressed="true"]{background:var(--selected)}
.popover{position:absolute;z-index:7;background:var(--page);border:1px solid var(--rule);box-shadow:var(--shadow);border-radius:15px;padding:14px;display:grid;gap:4px;min-width:200px}
.popover strong{font-size:14px;font-weight:600}.popover button{display:flex;align-items:center;gap:9px;padding:8px;border-radius:7px;margin-top:7px}
.popover button svg{width:16px;height:16px}
.model-menu{top:44px;left:0}.model-menu>div{display:flex;align-items:center;justify-content:space-between;gap:24px}.model-menu svg{width:16px;height:16px}
.account-menu{bottom:calc(100% + 3px);left:6px;right:6px}
#chat{position:relative;flex:1;min-height:0;display:flex;flex-direction:column;align-items:stretch}
#chat[data-empty="true"]{justify-content:center;padding-bottom:clamp(50px,12vh,135px)}
#empty{width:100%;padding:0 20px;text-align:center;margin-bottom:26px}
#empty h1{font-size:clamp(24px,2.3vw,32px);line-height:1.4;letter-spacing:-.65px;font-weight:560;margin:0}
.transcript{min-height:0;flex:1;overflow:auto;overscroll-behavior:contain;padding:10px 24px 24px}
#chat[data-empty="true"] .transcript{display:none}
#messages,.composer-area{width:min(100%,var(--measure));margin-inline:auto}
.msg{margin:22px 0;overflow-wrap:anywhere}
.msg-content{white-space:pre-wrap;line-height:1.75;font-size:16px}
.msg.user{display:flex;justify-content:flex-end}
.msg.user .msg-content{max-width:80%;background:var(--bubble);padding:9px 17px;border-radius:20px}
.msg.assistant{margin-block:26px}
.copy-answer{display:grid;place-items:center;width:28px;height:28px;border-radius:6px;margin-top:5px;color:var(--muted)}
.pending{color:var(--muted);font-size:14px}
.composer-area{width:min(calc(100% - 44px),var(--measure));padding-block:8px 0}
#compose{display:flex;align-items:flex-end;gap:9px;padding:8px 9px;min-height:54px;border:1px solid var(--rule);border-radius:27px;background:var(--page);box-shadow:0 2px 7px #0000000d,0 0 1px #0002}
#attach{border-radius:50%}
#prompt{flex:1;width:0;min-height:32px;max-height:180px;resize:none;background:transparent;outline:0;border:0;border-radius:4px;padding:4px 0;align-self:center;line-height:24px;font-size:16px}
#prompt::placeholder{color:var(--hint)}
#compose:focus-within{border-color:color-mix(in srgb,var(--rule) 75%,var(--muted))}
#send{display:grid;place-items:center;flex:none;width:36px;height:36px;border-radius:50%;background:var(--send);color:var(--on-send)}
#send svg{stroke-width:2.3}#send:disabled{background:var(--selected);color:var(--hint)}
#footNote{font-size:12px;text-align:center;color:var(--muted);padding:8px 14px max(8px,env(safe-area-inset-bottom))}
#chat[data-empty="true"] #footNote{position:absolute;inset:auto 0 0}
#notice{position:absolute;bottom:108px;z-index:5;align-self:center;max-width:min(92%,560px);background:var(--ink);color:var(--page);border-radius:14px;padding:10px 16px;font-size:13px;line-height:1.55;box-shadow:var(--shadow);margin:0}
main:has(#chat[data-empty="true"]:not([hidden])) #notice{bottom:max(38px,12vh)}
#login{width:min(calc(100% - 40px),340px);margin:auto;text-align:center;padding-bottom:70px}
#login .brand{width:38px;height:38px;margin:0 auto 20px}#login h1{font-weight:550;font-size:28px;margin:0 0 24px}
#access{display:grid;gap:10px;text-align:left}#access label{font-size:14px}
#access input,#access button{width:100%;border-radius:13px;padding:12px 14px}
#access input{background:var(--page);color:var(--ink);border:1px solid var(--rule)}
#access button{text-align:center;background:var(--send);color:var(--on-send);font-weight:550}
body:not([data-authenticated="true"]) .topbar{visibility:hidden}
dialog{width:min(540px,calc(100% - 32px));max-height:min(570px,80dvh);padding:0;color:var(--ink);background:var(--page);border:1px solid var(--rule);border-radius:20px;box-shadow:0 16px 60px #0003}
dialog::backdrop{background:#0005}
.search-bar{display:flex;align-items:center;gap:12px;padding:13px 16px;border-bottom:1px solid var(--rule)}
.search-bar input{min-width:0;flex:1;border:0;outline:0;padding:5px;background:transparent}
#searchResults{padding:8px;max-height:50dvh;overflow:auto}
.search-result{display:flex;flex-direction:column;text-align:left}
.search-result strong{font-weight:500}.search-result small{color:var(--muted)}
.search-empty{font-size:14px;color:var(--muted);text-align:center;margin:34px auto}
@media(max-width:760px){
  body{min-height:0}
  #sidebar{display:none;position:fixed;z-index:9;inset:0 auto 0 0;width:min(300px,85vw)}
  .side-open #sidebar{display:flex}
  #shade{position:fixed;z-index:8;inset:0;background:#0006}
  #toggleSide,.side-hidden #toggleSide{display:grid}
  .topbar{padding:0 9px;height:54px;min-height:54px}
  #modelBtn{font-size:17px}
  #empty{margin-bottom:20px}
  #chat[data-empty="true"]{padding-bottom:10vh}
  .composer-area{width:calc(100% - 24px)}
  .transcript{padding-inline:15px}
  #footNote{font-size:11px}
}
