/* WePre markdown renderer additions: code blocks (language label, copy button,
   lightweight highlighting), incremental streaming tail + cursor. */

.code-block{border:1px solid #d4deeb;border-radius:9px;margin:12px 0;overflow:hidden;background:#f7f8fa}
.code-block-head{display:flex;align-items:center;gap:8px;padding:4px 10px;background:#e4e9f1;border-bottom:1px solid #d4deeb;font-size:11px;line-height:1.6;color:#5a6b82;user-select:none}
.code-lang{font-weight:700;letter-spacing:.5px;text-transform:uppercase}
.code-copy{margin-left:auto;padding:1px 9px;font-size:11px;line-height:1.7;border:1px solid #c6d0de;border-radius:6px;background:#fff;color:#3b4d63;cursor:pointer}
.code-copy:hover{background:#eef3fa}
.code-copy:disabled{opacity:.6;cursor:default}
.markdown .code-block pre{margin:0;border-radius:0;background:#f7f8fa}
.code-block pre code{background:transparent}

.md-tok-c{color:#8a94a6;font-style:italic}
.md-tok-s{color:#188a4c}
.md-tok-k{color:#3269de;font-weight:600}
.md-tok-n{color:#b45309}
.md-tok-b{color:#8250df}
.md-tok-t{color:#3269de}
.md-tok-a{color:#8250df}
.md-tok-add{color:#188a4c;background:#e6f6ec;border-radius:3px}
.md-tok-del{color:#c0432b;background:#fdeceb;border-radius:3px}
.md-tok-meta{color:#536278;background:#eef2f8;border-radius:3px}

/* Incremental streaming: stable markdown prefix + plain tail with a caret. */
.md-stream{white-space:normal}
.md-stream .md-stream-stable>:first-child{margin-top:0}
.md-stream .md-stream-stable>:last-child{margin-bottom:0}
.md-stream .md-stream-tail{white-space:pre-wrap;overflow-wrap:anywhere}
.md-stream.is-streaming .md-stream-tail:empty::before{content:' '}
.md-stream.is-streaming .md-stream-tail::after{content:'';display:inline-block;width:2px;height:1em;margin-left:2px;vertical-align:-2px;background:currentColor;animation:md-caret-blink 1s steps(1) infinite}
@keyframes md-caret-blink{0%,60%{opacity:1}61%,100%{opacity:0}}

:root[data-theme="dark"] .code-block{background:#0d202a;border-color:#223743}
:root[data-theme="dark"] .code-block-head{background:#122934;border-color:#223743;color:#8fb0bc}
:root[data-theme="dark"] .code-copy{background:#0d202a;color:#c9e9df;border-color:#2a4753}
:root[data-theme="dark"] .code-copy:hover{background:#16303c}
:root[data-theme="dark"] .markdown .code-block pre{background:#0d202a}
:root[data-theme="dark"] .md-tok-c{color:#6f8296}
:root[data-theme="dark"] .md-tok-s{color:#7fd6a4}
:root[data-theme="dark"] .md-tok-k{color:#8ab8ff}
:root[data-theme="dark"] .md-tok-n{color:#e8b06a}
:root[data-theme="dark"] .md-tok-b{color:#c9a6f2}
:root[data-theme="dark"] .md-tok-t{color:#8ab8ff}
:root[data-theme="dark"] .md-tok-a{color:#c9a6f2}
:root[data-theme="dark"] .md-tok-add{color:#7fd6a4;background:#123526}
:root[data-theme="dark"] .md-tok-del{color:#f0978a;background:#3d211d}
:root[data-theme="dark"] .md-tok-meta{color:#9db4c0;background:#1a2e3a}
