:root {
  --bg: #0f1115;
  --panel: #161a22;
  --panel-2: #1c212c;
  --border: #232936;
  --text: #e6e9ef;
  --muted: #8b94a7;
  --accent: #7aa2f7;
  --accent-2: #bb9af7;
  --warn: #e0af68;
  --err: #f7768e;
  --ok: #9ece6a;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

header {
  padding: 24px 36px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 16px;
  background: linear-gradient(180deg, #1a2030 0%, var(--bg) 100%);
}
.brand h1 { margin: 0; font-size: 26px; letter-spacing: 0.01em;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand .sub { margin: 4px 0 0 0; color: var(--text); font-size: 13px; opacity: 0.85; }
.brand .capstone { margin: 4px 0 0 0; color: var(--muted); font-size: 12px; }
.status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block;
  box-shadow: 0 0 8px var(--ok);
}

main { max-width: 960px; margin: 0 auto; padding: 32px 24px 80px; }
.hint { color: var(--muted); margin-bottom: 20px; line-height: 1.65; }
.hint strong { color: var(--text); }

form { display: flex; flex-direction: column; gap: 14px; }
textarea {
  width: 100%; resize: vertical; padding: 14px 16px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  font-family: inherit; font-size: 15px; line-height: 1.55;
}
textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(122,162,247,0.12); }
.controls {
  display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; justify-content: flex-end;
}
.controls label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; }
.controls input[type="number"] {
  width: 100px; padding: 8px 10px; background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  font-family: ui-monospace, monospace; font-size: 13px;
}
.controls input[type="number"]:focus { outline: none; border-color: var(--accent); }
button {
  padding: 10px 28px; border: 0; border-radius: 8px; height: 38px;
  background: var(--accent); color: #0f1115; font-weight: 600; cursor: pointer; font-size: 14px;
  transition: filter 0.1s;
}
button:hover { filter: brightness(1.08); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

section#result { margin-top: 28px; }
.hidden { display: none !important; }
.loading { color: var(--muted); font-style: italic; padding: 8px 0; }
.error { color: var(--err); padding: 12px 16px; background: rgba(247,118,142,0.08); border-radius: 8px; }
.refusal {
  padding: 16px 18px; background: rgba(224,175,104,0.08);
  border-left: 3px solid var(--warn); border-radius: 6px; color: #f0d9a8;
  line-height: 1.6;
}

.answer { background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 22px 24px;
}
.answer-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 10px; }
.answer h3 {
  margin: 0; font-size: 12px; color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
}
.answer h3:not(:first-child) { margin-top: 24px; }

#answerText {
  font-size: 15px; line-height: 1.7; white-space: pre-wrap; word-wrap: break-word;
  min-height: 1.6em;
}
#answerText .cite {
  display: inline-block; padding: 0 6px; margin: 0 2px;
  font-family: ui-monospace, monospace; font-size: 12px;
  background: rgba(187,154,247,0.10); color: var(--accent-2);
  border: 1px solid rgba(187,154,247,0.25); border-radius: 4px;
}
.timing { font-size: 11px; color: var(--muted); font-weight: normal; letter-spacing: 0; text-transform: none; margin-left: 12px; }

.confidence-badge {
  display: inline-flex; align-items: center; gap: 10px; padding: 6px 12px;
  border-radius: 8px; font-size: 12px; font-family: ui-monospace, monospace;
  border: 1px solid var(--border);
}
.confidence-badge .conf-label { font-weight: 700; letter-spacing: 0.06em; }
.confidence-badge .conf-num { font-family: ui-monospace, monospace; font-size: 14px; }
.confidence-badge .conf-detail { color: var(--muted); font-size: 11px; }
.confidence-badge.high   { background: rgba(158,206,106,0.10); color: var(--ok); border-color: rgba(158,206,106,0.4); }
.confidence-badge.medium { background: rgba(224,175,104,0.10); color: var(--warn); border-color: rgba(224,175,104,0.4); }
.confidence-badge.low    { background: rgba(247,118,142,0.10); color: var(--err); border-color: rgba(247,118,142,0.4); }

.verify-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.verify-row {
  padding: 12px 14px; border-radius: 8px;
  background: var(--panel-2); border-left: 3px solid var(--border);
}
.verify-row.ok   { border-left-color: var(--ok); }
.verify-row.warn { border-left-color: var(--warn); }
.verify-row.bad  { border-left-color: var(--err); }
.verify-claim { font-size: 14px; line-height: 1.55; margin-bottom: 8px; }
.verify-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-family: ui-monospace, monospace; font-size: 11px; color: var(--muted); }
.verify-label { text-transform: uppercase; font-weight: 600; letter-spacing: 0.06em; color: var(--muted); }
.verify-num { color: var(--text); font-size: 13px; }
.verify-bar { width: 140px; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.verify-bar > span { display: block; height: 100%; background: var(--accent); }
.verify-row.ok   .verify-bar > span { background: var(--ok); }
.verify-row.warn .verify-bar > span { background: var(--warn); }
.verify-row.bad  .verify-bar > span { background: var(--err); }
.verify-tag { color: var(--muted); }

.ped-box {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 10px;
}
.ped-item { font-size: 14px; line-height: 1.55; }
.ped-label { color: var(--accent-2); font-weight: 600; margin-right: 8px; }

.answer ol { margin: 0; padding-left: 22px; color: var(--muted); font-size: 13px; }
.answer ol li { margin-bottom: 14px; }
.answer ol li strong { color: var(--text); }
.answer ol li .score { margin-left: 10px; font-family: ui-monospace, monospace; font-size: 11px; color: var(--accent); }
.answer ol li .preview {
  display: block; margin-top: 6px; font-family: ui-monospace, monospace;
  font-size: 12px; color: var(--muted); white-space: pre-wrap;
  background: var(--bg); padding: 8px 10px; border-radius: 4px;
  max-height: 130px; overflow: auto;
  border-left: 2px solid var(--border);
}

#research {
  margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--border);
}
#research h2 { font-size: 18px; margin: 0 0 14px 0; }
#research p { color: var(--muted); line-height: 1.7; margin: 0 0 14px 0; }
#research p em { color: var(--text); }
.gap-list { color: var(--muted); line-height: 1.65; padding-left: 20px; }
.gap-list li { margin-bottom: 12px; }
.gap-list li strong { color: var(--text); }
.gap-list li em { color: var(--accent-2); font-style: normal; font-family: ui-monospace, monospace; font-size: 12px; }
.meta { font-size: 12px; color: var(--muted); border-top: 1px dashed var(--border); padding-top: 14px; }

footer { text-align: center; padding: 22px; color: var(--muted); font-size: 12px;
  border-top: 1px solid var(--border);
}
footer small { line-height: 1.7; }
