:root {
  --bg: #0d1117; --panel: #161b22; --panel2: #11161d; --border: #30363d; --text: #e6edf3; --muted: #8b949e;
  --accent: #2ea043; --accent-hover: #3fb950; --link: #58a6ff; --user: #1f3a5f; --error: #f85149; --code: #0b0f14;
  --drawer: 440px; color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--link); }
code { font: .88em/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; }
:not(pre) > code { background: var(--code); border: 1px solid var(--border); padding: 0 5px; border-radius: 5px; }
pre { background: var(--code); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; overflow-x: auto; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
button { font: inherit; border-radius: 10px; padding: 9px 16px; border: 1px solid transparent; cursor: pointer; background: var(--accent); color: #fff; font-weight: 600; }
button:hover { background: var(--accent-hover); }
button:disabled { opacity: .5; cursor: default; }
button.ghost { background: transparent; color: var(--text); border-color: var(--border); font-weight: 500; }
button.ghost:hover { border-color: var(--muted); }
button.small { padding: 5px 10px; font-size: .85rem; }
button.link { background: none; border: 0; padding: 0; color: var(--link); font-weight: 500; text-decoration: underline; }
textarea:focus, input:focus, button:focus-visible, summary:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

.page { transition: margin-right .2s ease; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 920px; margin: 0 auto; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.brand { color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.15rem; }
.brand span { color: var(--muted); font-weight: 500; }
nav { display: flex; align-items: center; gap: 14px; }
nav a { color: var(--muted); text-decoration: none; }
nav a:hover { color: var(--text); }
main { max-width: 920px; margin: 0 auto; padding: 8px 16px 96px; }
.hero h1 { font-size: 1.8rem; margin: 24px 0 8px; }
.hero p { color: var(--muted); max-width: 680px; }
h2 { margin: 36px 0 12px; font-size: 1.3rem; }
.intro p { margin: 0 0 12px; }
.filter input { width: 100%; background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font: inherit; margin-bottom: 12px; }
.trouble { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; }
.trouble summary { cursor: pointer; padding: 12px 14px; font-weight: 600; list-style-position: outside; margin-left: 18px; }
.trouble[open] summary { border-bottom: 1px solid var(--border); }
.trouble .fix { padding: 4px 14px 0; }
.trouble .ask-about { margin: 0 14px 12px; }
.more p { color: var(--muted); }

.fab { position: fixed; right: 20px; bottom: 20px; z-index: 10; border-radius: 999px; padding: 12px 20px; box-shadow: 0 6px 24px rgba(0,0,0,.45); }
body.chat-open .fab { display: none; }
.drawer { position: fixed; top: 0; right: 0; z-index: 20; width: min(var(--drawer), 100vw); height: 100vh; height: 100dvh; display: flex; flex-direction: column;
  background: var(--panel2); border-left: 1px solid var(--border); transform: translateX(100%); visibility: hidden; transition: transform .2s ease, visibility .2s; }
body.chat-open .drawer { transform: none; visibility: visible; }
@media (min-width: 1100px) { body.chat-open .page { margin-right: var(--drawer); } }
@media (max-width: 560px) { nav a { display: none; } .hero h1 { font-size: 1.5rem; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.drawer-head strong { display: block; }
.small-text { font-size: .8rem; }
.drawer-actions { display: flex; gap: 6px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 14px; }
.drawer-foot { border-top: 1px solid var(--border); padding: 10px 14px 12px; }
#log { display: flex; flex-direction: column; gap: 10px; }
.msg { padding: 9px 12px; border-radius: 12px; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--user); white-space: pre-wrap; max-width: 90%; }
.msg.assistant { background: var(--panel); border: 1px solid var(--border); }
.msg.assistant > :first-child { margin-top: 0; } .msg.assistant > :last-child { margin-bottom: 0; }
.msg.pending:empty::after { content: "Thinking…"; color: var(--muted); }
.msg.error { border-color: var(--error); color: var(--error); }
.msg h3, .msg h4, .msg h5, .msg h6 { margin: .8em 0 .3em; font-size: 1rem; }
.msg ul, .msg ol { padding-left: 1.3em; }
.table { overflow-x: auto; }
table { border-collapse: collapse; font-size: .9rem; }
th, td { border: 1px solid var(--border); padding: 5px 8px; text-align: left; vertical-align: top; }
.starters { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.starters p { margin: 0 0 4px; }
.starter { text-align: left; background: var(--panel); color: var(--text); border: 1px solid var(--border); font-weight: 500; }
.starter:hover { background: var(--panel); border-color: var(--accent); }
form { display: flex; gap: 8px; align-items: flex-end; }
textarea { flex: 1; resize: none; max-height: 30vh; background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; font: inherit; }
.note { margin: 8px 0 0; font-size: .75rem; color: var(--muted); }
#status:not(:empty)::after { content: " "; }
