:root {
  --bg: #0f1115; --panel: #171a21; --line: #272c36; --text: #e6e8ec; --muted: #9aa3b2; --accent: #7aa7ff;
  --ok: #4cc38a; --warn: #e8a24a; --bad: #e5645f;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
code { font: 0.9em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--panel); padding: 0.1em 0.35em; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.top, main, footer { max-width: 820px; margin: 0 auto; padding-left: 20px; padding-right: 20px; }
.top { display: flex; justify-content: space-between; align-items: center; padding-top: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line); max-width: none; padding-left: max(20px, calc((100% - 780px) / 2)); padding-right: max(20px, calc((100% - 780px) / 2)); }
.brand { color: var(--text); font-weight: 650; text-decoration: none; letter-spacing: 0.01em; }
.top nav { display: flex; gap: 18px; }
.top nav a { color: var(--muted); text-decoration: none; }
.top nav a:hover { color: var(--text); }
h1 { font-size: 1.9rem; line-height: 1.25; margin: 36px 0 12px; }
h2 { font-size: 1.2rem; margin: 40px 0 10px; }
h3 { font-size: 1rem; margin: 22px 0 8px; color: var(--muted); font-weight: 600; }
.intro p { margin: 0 0 12px; }
.privacy { padding: 10px 14px; border: 1px solid var(--line); border-left: 3px solid var(--warn); border-radius: 6px; background: var(--panel); }
.ask { margin-top: 24px; }
textarea { width: 100%; resize: vertical; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; font: inherit; }
textarea:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.row { display: flex; align-items: center; gap: 14px; margin-top: 10px; flex-wrap: wrap; }
.row #count { margin-right: auto; }
button { font: inherit; cursor: pointer; }
#ask { background: var(--accent); color: #0b1020; border: 0; border-radius: 8px; padding: 9px 22px; font-weight: 600; }
#ask:disabled { opacity: 0.5; cursor: progress; }
.examples { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
#examples { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 0.875rem; text-align: left; }
.chip:hover { border-color: var(--accent); }
.banner { margin-top: 20px; padding: 12px 14px; border: 1px solid var(--line); border-left: 3px solid var(--warn); border-radius: 6px; background: var(--panel); }
#result { margin-top: 26px; }
.answer { white-space: pre-wrap; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; min-height: 3.2rem; overflow-wrap: anywhere; }
.cite { background: none; color: var(--accent); border: 0; padding: 0 1px; font: inherit; font-size: 0.85em; vertical-align: baseline; cursor: pointer; text-decoration: underline dotted; }
.cite:hover { text-decoration: underline; }
.badge { display: inline-block; font-size: 0.72rem; line-height: 1.5; padding: 0 7px; margin-left: 6px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; vertical-align: 1px; user-select: none; }
.badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
.badge.na { color: var(--muted); }
#sources { margin-top: 18px; display: grid; gap: 8px; }
#sources details { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; }
#sources details.flash { border-color: var(--accent); }
#sources summary { cursor: pointer; }
#sources .meta { color: var(--muted); font-size: 0.875rem; }
#sources .passage { white-space: pre-wrap; margin: 10px 0 6px; font-size: 0.92rem; overflow-wrap: anywhere; }
.saved #saved { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.how ol { padding-left: 1.2em; }
.how li { margin-bottom: 8px; }
details > summary { cursor: pointer; font-weight: 600; margin: 6px 0; }
table { border-collapse: collapse; width: 100%; font-size: 0.85rem; margin: 6px 0 10px; display: block; overflow-x: auto; }
th, td { border-bottom: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
footer { margin-top: 48px; padding-top: 18px; padding-bottom: 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.875rem; }
@media (max-width: 520px) { h1 { font-size: 1.5rem; } .top nav { gap: 12px; } }
