:root {
  --bg: #ffffff;
  --fg: #111111;
  --muted: #6b6b6b;
  --rule: #e2e2e2;
  --soft: #f5f5f5;
  --accent: #1f4fff;
  --accent-soft: #eef2ff;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e0e; --fg: #ececec; --muted: #8a8a8a; --rule: #262626; --soft: #171717;
    --accent: #6d8bff; --accent-soft: #151a33;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.5 var(--sans); display: flex; flex-direction: column;
}
button { font: inherit; color: inherit; background: none; border: 1px solid var(--fg); padding: 5px 12px; cursor: pointer; border-radius: 2px; }
button:hover { background: var(--fg); color: var(--bg); }
button.ghost { border-color: var(--rule); color: var(--muted); }
button.ghost:hover { border-color: var(--fg); color: var(--fg); background: none; }
button:disabled { opacity: .4; cursor: default; }
textarea { width: 100%; font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--fg); border-radius: 2px; padding: 10px 12px; resize: vertical; }
textarea:focus { outline: none; border-color: var(--accent); }
code { font-family: var(--mono); font-size: .92em; }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 28px 0 8px; font-weight: 600; }
h2 .sub { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: 8px; }

/* header */
.top { display: flex; justify-content: space-between; align-items: baseline; padding: 18px 24px 0; border-bottom: 1px solid var(--rule); }
.brand { display: flex; gap: 14px; align-items: baseline; padding-bottom: 14px; }
.wordmark { font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.meta { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.dot { margin: 0 4px; }
.tabs { display: flex; gap: 4px; }
.tab { border: none; border-bottom: 2px solid transparent; border-radius: 0; padding: 6px 10px 14px; color: var(--muted); }
.tab:hover { background: none; color: var(--fg); }
.tab.active { color: var(--fg); border-bottom-color: var(--accent); }

main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.panel { display: none; flex: 1; flex-direction: column; min-height: 0; width: 100%; max-width: 860px; margin: 0 auto; padding: 0 24px; }
.panel.active { display: flex; }

/* chat */
.messages { flex: 1; overflow-y: auto; padding: 24px 20px 12px 0; }
.empty { color: var(--muted); max-width: 620px; margin: 40px auto; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.example { border-color: var(--rule); color: var(--muted); font-size: 13px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.example:hover { background: none; border-color: var(--fg); color: var(--fg); }
.msg { display: grid; grid-template-columns: 96px 1fr; gap: 16px; padding: 14px 0; border-top: 1px solid var(--rule); }
.msg:first-child { border-top: none; }
.role { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding-top: 4px; }
.msg.assistant .role { color: var(--accent); }
.content { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.content.streaming::after { content: "▍"; color: var(--accent); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.composer { padding: 12px 20px 16px 0; border-top: 1px solid var(--rule); }
.field { position: relative; }
.field textarea { padding-right: 48px; resize: none; overflow-y: auto; max-height: 40vh; line-height: 1.5; display: block; }
.send { position: absolute; right: 8px; bottom: 8px; width: 30px; height: 30px; padding: 0; border-radius: 4px;
        background: var(--fg); color: var(--bg); border: none; display: flex; align-items: center; justify-content: center; }
.send:hover { background: var(--accent); color: #fff; }
.send:disabled { opacity: .25; }
.composer-row { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; gap: 12px; }
.hint { font-family: var(--mono); font-size: 12px; color: var(--muted); min-height: 1.4em; }
.hint .n { color: var(--accent); }

/* dna */
.dna-inline { font-family: var(--mono); color: var(--accent); background: var(--accent-soft); padding: 1px 4px; border-radius: 2px; letter-spacing: .02em; }
.dna-block { border: 1px solid var(--rule); border-left: 3px solid var(--accent); border-radius: 2px; margin: 8px 0; background: var(--soft); white-space: normal; }
.dna-head { display: flex; align-items: center; gap: 10px; padding: 6px 10px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.dna-head .label { color: var(--accent); font-weight: 600; letter-spacing: .06em; }
.dna-head .spacer { flex: 1; }
.dna-head button.icon { border: none; padding: 0; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); border-radius: 3px; }
.dna-head button.icon:hover { background: var(--rule); color: var(--fg); }
.dna-head button.icon.copied { color: var(--accent) !important; background: none !important; }
.dna-head .spacer + button.icon { margin-left: 4px; }
.dna-body { padding: 4px 10px 10px; font-family: var(--mono); font-size: 13px; line-height: 1.6; overflow-x: auto; }
.dna-line { display: flex; gap: 14px; white-space: pre; }
.dna-pos { color: var(--muted); width: 6ch; text-align: right; flex: none; user-select: none; }
.dna-seq { color: var(--fg); }
.dna-seq .g { margin-right: 1ch; }
.dna-preview { padding: 0 10px 8px; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.dna-preview .partial { color: var(--fg); }

/* lookup */
.lookup-intro { color: var(--muted); padding-top: 24px; }
.lookup-form { padding-bottom: 8px; }
.actions { display: flex; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: max-content 1fr; gap: 4px 20px; margin: 0; font-family: var(--mono); font-size: 13px; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; overflow-wrap: anywhere; }
table { border-collapse: collapse; width: 100%; font-family: var(--mono); font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--rule); padding: 4px 8px 4px 0; }
td { padding: 5px 8px 5px 0; border-bottom: 1px solid var(--rule); vertical-align: top; overflow-wrap: anywhere; }
td.prot { max-width: 420px; }
.none { color: var(--muted); font-family: var(--mono); font-size: 13px; }
.warn { color: var(--muted); font-size: 13px; border-left: 2px solid var(--fg); padding-left: 10px; }
.error { color: #c22; font-family: var(--mono); font-size: 13px; margin-top: 8px; }
.copied { color: var(--accent) !important; border-color: var(--accent) !important; background: none !important; }
#tab-lookup { overflow-y: auto; padding-bottom: 48px; }

@media (max-width: 600px) {
  .top { flex-direction: column; gap: 4px; }
  .msg { grid-template-columns: 1fr; gap: 4px; }
}
