:root {
  --chat-ink:#19191c;
  --chat-muted:#63636d;
  --chat-line:#e1e1e5;
  --chat-wash:#f3f3f5;
  --chat-white:#fdfdfd;
  --chat-font:'Microsoft YaHei UI','PingFang SC','Noto Sans CJK SC',sans-serif;
}
body {background:var(--chat-white);color:var(--chat-ink);font-family:var(--chat-font);overflow:hidden}
.chat-frame {width:min(100%,800px);height:100vh;height:100dvh;margin:auto;display:grid;grid-template-rows:68px minmax(0,1fr) auto}
.chat-header {border-bottom:1px solid #eeeeef;padding:0 24px;display:flex;align-items:center;justify-content:space-between;gap:12px}
.chat-header h1 {margin:0;font-size:15px;font-weight:800;line-height:1.3;letter-spacing:-.02em}
.chat-header-actions {display:flex;gap:8px;flex-shrink:0}
.chat-action {display:inline-flex;align-items:center;gap:6px;justify-content:center;min-height:37px;padding:0 13px;background:transparent;border:1px solid var(--chat-line);border-radius:8px;color:var(--chat-muted);font-size:12px;white-space:nowrap}
.chat-action:hover {background:var(--chat-wash);color:var(--chat-ink)}
.chat-action svg {width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.65;stroke-linecap:round;stroke-linejoin:round}
.chat-scroll {min-width:0;min-height:0;overflow:auto;overscroll-behavior:contain;padding:90px 24px 26px;scrollbar-width:thin;scrollbar-color:#dedee2 transparent}
.chat-scroll.has-messages {padding-top:30px}
.chat-welcome,.chat-turn.assistant-turn {display:grid;grid-template-columns:28px minmax(0,1fr);align-items:start;gap:16px}
.chat-avatar {display:grid;place-items:center;width:28px;height:28px;border-radius:8px;background:var(--chat-ink);color:white;box-shadow:0 2px 7px #00000022}
.chat-avatar svg {width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round}
.chat-welcome-body>p {margin:-1px 0 17px;max-width:650px;font-size:15px;line-height:1.65}
.chat-starters {display:grid;gap:10px;width:min(100%,400px)}
.chat-starters button {text-align:left;border:1px solid var(--chat-line);border-radius:12px;padding:10px 20px;min-height:46px;background:transparent;color:var(--chat-ink);font-size:14px}
.chat-starters button:hover {background:#f5f5f6;border-color:#cfcfd4}
.chat-log {display:grid;gap:22px}
.chat-turn {min-width:0;margin:0;font-size:15px;line-height:1.7}
.user-turn {justify-self:end;max-width:85%;padding:9px 15px;border-radius:17px 17px 4px 17px;background:var(--chat-wash);overflow-wrap:anywhere;white-space:pre-wrap}
.chat-reply {min-width:0;overflow-wrap:anywhere}
.chat-reply p {margin:1px 0 7px;white-space:pre-wrap}
.chat-reply .chat-meta {margin-top:0;margin-bottom:5px;color:var(--chat-muted);font-size:11px;letter-spacing:.02em;white-space:normal}
.chat-reply.pending {color:var(--chat-muted)}
.chat-reply ul {margin:7px 0 0;padding-left:18px;font-size:13px}
.chat-reply a {color:#31515b}
.chat-reply-actions {display:flex;flex-wrap:wrap;gap:6px;margin:10px 0 0}
.chat-structure-card {margin:12px 0;border:1px solid #d8e4df;border-radius:14px;background:#fcfdfc;overflow:hidden}
.chat-research-header {padding:14px 16px 11px;border-bottom:1px solid #e1e9e6;background:linear-gradient(112deg,#eef6f2,#fcfdfc 75%)}
.chat-structure-card h3 {margin:0;font:750 20px/1.3 var(--chat-font);letter-spacing:-.02em}
.chat-research-grid {display:grid;padding:12px 16px 14px;gap:13px}
.chat-research-grid>section {min-width:0}
.chat-structure-card h4 {margin:0 0 5px;font-size:14px;color:#173c35}
.chat-structure-card .chat-card-muted {font-size:12px;color:#526962;margin-bottom:5px}
.chat-annotation>p:not(.chat-card-muted):not(.chat-meta) {font-size:14px;margin-bottom:8px}
.chat-annotation>.chat-structure-header {margin-bottom:6px}
.chat-annotation-original {margin-top:7px}
.chat-annotation-original summary {color:#34594f;font-size:12px;font-weight:650;cursor:pointer;width:fit-content}
.chat-annotation-original blockquote {margin:7px 0;padding-left:10px;border-left:2px solid #cdded6;color:#3a4c45;font-size:13px}
.chat-research-grid>.chat-annotation+.chat-models {padding-top:10px;border-top:1px solid #e1e9e6}
.chat-model-picker {display:flex;gap:5px;margin:0 0 9px}
.chat-model-picker .chat-action {min-height:29px;padding:3px 10px}
.chat-model-picker .chat-action[aria-pressed=true] {background:#e6f5ee;border-color:#8ab4a1;color:#164f3e;font-weight:700}
.chat-markers .fold-legend {margin-bottom:4px}
.chat-prediction-stats {display:flex;flex-wrap:wrap;gap:7px 24px;margin:6px 0 10px;padding:8px 11px;background:#f0f6f3;border-radius:7px}
.chat-prediction-stats dt {color:#526962;font-size:11px}
.chat-prediction-stats dd {margin:0;color:#173c35;font:700 15px/1.5 var(--mono);font-variant-numeric:tabular-nums}
.chat-markers .chat-prediction-note {margin:8px 0 0;padding:7px 10px;border-left:2px solid #afcec0;background:#f4f8f6;color:#3b5a50;font-size:12px}
.chat-structure-header {display:flex;justify-content:space-between;align-items:baseline;gap:4px 10px;flex-wrap:wrap}
.chat-structure-header h4,.chat-structure-header .chat-card-muted {margin:0}
.chat-card-links,.chat-site-controls {display:flex;flex-wrap:wrap;gap:6px 10px;margin-top:7px}
.chat-card-links>a {font-size:12px}
.chat-structure-stage {position:relative;height:clamp(220px,38vw,268px);margin-top:8px;border-radius:9px;overflow:hidden;background:#102a2a}
.chat-preview-open {position:absolute;left:50%;top:66%;transform:translate(-50%,-50%);color:white;border-color:#75948b;background:#183b36}
.chat-preview-open:hover {background:#245447;color:white}
.chat-view-controls {position:absolute;right:9px;bottom:9px;display:flex;gap:4px;align-items:center}
.chat-view-controls button {border:1px solid #5a7b75;border-radius:6px;padding:4px 8px;color:#f4faf8;background:#193632;font-size:12px;min-height:28px}
.chat-view-controls button:hover:not(:disabled) {background:#2b5149}
.chat-view-controls :is(.chat-preview-in,.chat-preview-out) {min-width:30px;font:600 16px/1 var(--chat-font)}
.chat-markers {margin-top:11px}
.chat-markers h4 {margin-bottom:3px}
.chat-site-controls .chat-action {padding:3px 7px;min-height:26px;font-size:11px;white-space:normal;text-align:left}
.chat-site-controls .chat-action[aria-pressed=true] {background:#e6f5ee;border-color:#8ab4a1;color:#164f3e}
.chat-markers .chat-card-muted {margin-top:6px}
.chat-secondary {margin-top:7px}
.chat-secondary summary,.chat-research-sources summary {color:#34594f;font-size:12px;font-weight:650;cursor:pointer;width:fit-content}
.chat-research-sources {padding:9px 16px 11px;border-top:1px solid #e1e9e6;background:#f7faf8}
.chat-research-sources .chat-card-links {gap:4px 14px}
.chat-research-sources>p.chat-meta {margin-top:5px}
.chat-source-notes {display:grid;gap:7px;margin-top:8px}
.chat-source-note {min-width:0;padding:8px 0 2px;border-top:1px solid #e1e9e6}
.chat-source-note .chat-structure-header {align-items:flex-start;gap:3px 8px}
.chat-source-note .chat-structure-header>a {flex:1 1 220px;font-size:13px;font-weight:700;overflow-wrap:anywhere}
.chat-source-kind {font-size:11px;color:#35564c;background:#e8f2ed;border-radius:999px;padding:1px 7px}
.chat-source-note .chat-source-support {margin:5px 0 3px;font-size:13px}
.chat-source-note .chat-meta {margin-bottom:2px}
.chat-molecule {position:absolute;inset:0}
@media(max-width:610px) {
  .chat-research-header,.chat-research-grid,.chat-research-sources {padding-inline:11px}
  .chat-structure-card h3 {font-size:18px}
}
.chat-footer {padding:8px 24px max(25px,env(safe-area-inset-bottom));background:var(--chat-white)}
.chat-composer {display:flex;align-items:flex-end;gap:10px;width:min(100%,700px);margin:auto;padding:11px 8px 11px 23px;border:1px solid #e9e9ed;border-radius:30px;background:#f2f2f4;box-shadow:0 4px 23px #21212c09;min-height:60px}
.chat-composer:focus-within {border-color:#c8c8cf}
.chat-composer textarea {display:block;flex:1;min-width:0;resize:none;height:34px;max-height:100px;border:0;outline:0;background:transparent;color:var(--chat-ink);font:14px/22px var(--chat-font);padding:6px 0;scrollbar-width:thin}
.chat-composer textarea:focus-visible {outline:0}
.chat-composer textarea::placeholder {color:#666676}
.chat-send {flex:0 0 36px;height:36px;display:grid;place-items:center;border:0;border-radius:50%;background:var(--chat-ink);color:white}
.chat-send:hover:not(:disabled) {background:#3d3d44}
.chat-send svg {width:18px;height:18px;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;fill:none}
.chat-frame :focus-visible,.tool-dialog .chat-action:focus-visible {outline-offset:3px;outline-color:#383840}
.tool-dialog {position:fixed;inset:0 0 0 auto;margin:0;width:min(100%,940px);max-width:none;height:100dvh;max-height:none;padding:0;border:0;border-left:1px solid var(--chat-line);background:var(--chat-white);color:var(--chat-ink);box-shadow:-12px 0 42px #18181e20;overflow:auto;overscroll-behavior:contain}
.tool-dialog::backdrop {background:#1515192e}
.tool-header {position:sticky;top:0;z-index:2;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:14px 24px;border-bottom:1px solid var(--chat-line);background:var(--chat-white)}
.tool-header h2 {margin:0;font-size:17px;line-height:1.2}
.tool-mode {color:var(--chat-muted);font-size:11px}
.tool-content {padding:0 24px 26px}
.tool-nav {display:flex;flex-wrap:wrap;gap:6px;padding:14px 0}
.tool-nav button {padding:4px 10px;border:1px solid var(--chat-line);border-radius:8px;color:var(--chat-ink);background:transparent;font-size:13px}
.tool-nav button:hover {background:var(--chat-wash)}
.tool-content .query-box {padding:0}
.tool-content .workspace {padding-top:12px}
.tool-content :is(#protein-search,#protein-workspace,#comparison,#fold-panel) {scroll-margin-top:88px}
@media(max-width:575px) {
  .chat-frame {grid-template-rows:58px minmax(0,1fr) auto}
  .chat-header {padding:0 13px}.chat-header h1 {font-size:14px}
  .chat-header-actions {gap:5px}.chat-action {padding:0 8px;min-height:33px}
  .chat-scroll {padding:57px 14px 22px}.chat-scroll.has-messages {padding-top:22px}
  .chat-welcome,.chat-turn.assistant-turn {gap:10px}
  .chat-starters button {padding:9px 12px}
  .chat-footer {padding:4px 12px max(13px,env(safe-area-inset-bottom))}
  .chat-composer {padding-left:16px}.tool-header,.tool-content {padding-inline:13px}
}
@media(prefers-reduced-motion:no-preference) {
  .chat-welcome {animation:chat-appear .28s ease-out both}
  .chat-turn {animation:chat-appear .18s ease-out both}
  @keyframes chat-appear {from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
}
