:root {
  --bg: #000000;        /* true black — OLED-friendly */
  --panel: #0c0c0c;
  --panel-2: #161616;
  --text: #f4f4f4;
  --muted: #8a8a8a;
  --line: #222222;      /* hairline borders */
  --hair: #2e2e2e;
  --white: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

/* the razor edge */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  background: var(--bg);
  border-top: 2px solid var(--white);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand { display: flex; align-items: center; gap: 14px; }
.logo { display: block; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.12; }
.eyebrow {
  font-size: 0.62rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted);
}
.brand-text h1 { font-size: 1.2rem; margin: 2px 0; letter-spacing: 0.06em; font-weight: 700; }
.sub { font-size: 0.72rem; color: var(--muted); }

.header-right { display: flex; align-items: center; gap: 12px; }
.project-select {
  background: #000; color: var(--text); border: 1px solid var(--hair);
  border-radius: 999px; padding: 3px 12px; font-size: 0.78rem;
  font-family: inherit; cursor: pointer; max-width: 230px;
}
.project-select:hover { border-color: var(--muted); }
.project-select:focus { outline: none; border-color: var(--white); }
.project-select option { background: var(--panel); color: var(--text); }
.icon-btn {
  background: none; border: none; cursor: pointer; color: var(--text);
  font-size: 1.15rem; padding: 4px; opacity: 0.8;
}
.icon-btn:hover { opacity: 1; }

/* status pill — monochrome, distinguished by brightness */
.status {
  font-size: 0.78rem; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--hair); white-space: nowrap; color: var(--muted);
}
.status.checking { color: var(--muted); }
.status.online   { color: var(--white); border-color: var(--white); }
.status.offline  { color: #5a5a5a; border-color: #333; }
.status.unset    { color: var(--text); border-color: var(--hair); }

.settings {
  background: var(--panel); border-bottom: 1px solid var(--line);
  padding: 16px 22px; display: grid; gap: 12px;
  max-width: 820px; margin: 0 auto;
}
.settings label { display: grid; gap: 4px; font-size: 0.85rem; color: var(--muted); }
.settings input {
  padding: 8px 10px; border-radius: 6px;
  border: 1px solid var(--line); background: #000; color: var(--text);
  font-size: 0.95rem;
}
.settings input:focus { outline: none; border-color: var(--white); }
.settings-actions { display: flex; align-items: center; gap: 12px; }

main { max-width: 820px; margin: 0 auto; padding: 22px; }

textarea {
  width: 100%; resize: vertical;
  padding: 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  font-size: 1rem; font-family: inherit;
}
textarea:focus { outline: none; border-color: var(--white); }

.ask-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; }

button {
  background: var(--white); color: #000; border: 1px solid var(--white);
  padding: 9px 18px; border-radius: 8px; font-weight: 600; cursor: pointer;
  font-size: 0.95rem;
}
button:hover { background: #e2e2e2; }
button:disabled { opacity: 0.35; cursor: not-allowed; }
button.secondary {
  background: transparent; color: var(--text); border: 1px solid var(--hair);
}
button.secondary:hover { background: transparent; border-color: var(--white); }

.toast { color: var(--muted); font-size: 0.85rem; }

#answerWrap h2 {
  font-size: 0.72rem; color: var(--muted); margin: 26px 0 8px;
  letter-spacing: 0.16em; text-transform: uppercase;
}
.progress {
  color: var(--muted); font-size: 0.85rem; margin-bottom: 8px;
  min-height: 1.2em; font-variant-numeric: tabular-nums;
}
.progress.done { color: var(--white); }

.answer {
  word-wrap: break-word;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 16px 18px; min-height: 40px;
}
/* rendered-markdown spacing */
.answer p { margin: 0 0 12px; }
.answer p:last-child { margin-bottom: 0; }
.answer ul, .answer ol { margin: 6px 0 14px; padding-left: 24px; }
.answer li { margin: 5px 0; }
.answer h4 { font-size: 0.95rem; margin: 16px 0 8px; color: var(--white); }
.answer code {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 4px; padding: 1px 5px; font-size: 0.9em;
}
.answer strong { color: var(--white); }
.answer .katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; margin: 10px 0; }

.sources { margin-top: 14px; }
.sources summary { cursor: pointer; color: var(--muted); }
.sources ol { margin: 10px 0 0; padding-left: 22px; }
.sources li { margin: 6px 0; }
.sources .sec { color: var(--muted); font-size: 0.85rem; }
.sources .score { color: var(--white); font-variant-numeric: tabular-nums; }

.muted { color: var(--muted); }
.hidden { display: none !important; }
.disclaimer { color: var(--muted); font-size: 0.8rem; margin-top: 30px; }
.tagline { color: #5a5a5a; font-size: 0.8rem; font-style: italic; margin-top: 6px; }
