:root {
  --ink: #152238;
  --muted: #637083;
  --line: #dce3eb;
  --canvas: #f6f8fb;
  --panel: #ffffff;
  --blue: #1769e0;
  --blue-dark: #0d4da8;
  --mint: #1fa574;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background-color: var(--canvas);
  background-image: linear-gradient(rgba(23, 105, 224, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(23, 105, 224, .035) 1px, transparent 1px);
  background-size: 36px 36px;
  font-family: "DM Sans", sans-serif;
}

button, textarea { font: inherit; }
button { cursor: pointer; }

.shell { width: min(100% - 40px, 1040px); margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { min-height: 84px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { color: var(--ink); display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 500; text-decoration: none; }
.brand strong { color: var(--blue); font-weight: 700; }
.brand-mark { display: grid; place-items: center; width: 28px; height: 28px; color: white; background: var(--blue); border-radius: 7px; font-family: Georgia, serif; font-weight: 700; }
.status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px rgba(31, 165, 116, .1); }

.workspace { width: min(100%, 820px); margin: auto; padding: 74px 0 64px; }
.intro { animation: reveal .55s ease-out both; }
.eyebrow { margin: 0 0 14px; color: var(--blue); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
h1 { margin: 0; max-width: 700px; font-family: "Newsreader", Georgia, serif; font-size: 54px; font-weight: 600; line-height: 1.02; letter-spacing: 0; }
h1 em { color: var(--blue); font-style: italic; }
.lede { margin: 20px 0 32px; color: var(--muted); font-size: 17px; }

.query-panel, .result { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 14px 32px rgba(20, 42, 76, .07); }
.query-panel { padding: 22px; animation: reveal .55s .08s ease-out both; }
label { display: block; margin-bottom: 9px; color: var(--muted); font-size: 13px; font-weight: 600; }
.input-row { display: flex; gap: 12px; align-items: stretch; }
textarea { min-width: 0; flex: 1; resize: vertical; padding: 13px 14px; color: var(--ink); border: 1px solid #c9d4e1; border-radius: 6px; outline: none; line-height: 1.45; }
textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(23, 105, 224, .12); }
textarea::placeholder { color: #8490a0; }
#submit-button { min-width: 92px; padding: 0 20px; color: white; background: var(--blue); border: 0; border-radius: 6px; font-weight: 700; transition: background .18s ease, transform .18s ease; }
#submit-button:hover { background: var(--blue-dark); transform: translateY(-1px); }
#submit-button:disabled { cursor: wait; opacity: .7; transform: none; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.examples button { padding: 7px 10px; color: #34506f; background: #f3f7fc; border: 1px solid #dce6f2; border-radius: 5px; font-size: 12px; font-weight: 600; }
.examples button:hover { color: var(--blue); border-color: #adc9ee; background: #edf5ff; }

.result { margin-top: 22px; padding: 26px; animation: reveal .35s ease-out both; }
.hidden { display: none; }
.answer-heading { display: flex; justify-content: space-between; gap: 12px; color: var(--blue); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.loading { color: var(--muted); letter-spacing: .05em; }
.answer { margin: 16px 0 26px; font-family: "Newsreader", Georgia, serif; font-size: 23px; line-height: 1.35; }
.sources-wrap { padding-top: 19px; border-top: 1px solid var(--line); }
h2 { margin: 0 0 12px; font-size: 13px; }
.sources { display: grid; gap: 9px; }
.source { background: #f8fafc; border-left: 3px solid #8bb7f4; }
.source summary { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 12px 13px; cursor: pointer; list-style: none; }
.source summary::-webkit-details-marker { display: none; }
.source summary::after { align-self: center; content: "+"; color: var(--blue); font-size: 18px; font-weight: 500; }
.source[open] summary::after { content: "-"; }
.source-details { min-width: 0; }
.source-name { font-size: 14px; font-weight: 700; }
.source-section { margin-top: 3px; color: var(--muted); font-size: 13px; }
.score { align-self: center; color: var(--blue); font-size: 12px; font-weight: 700; }
.source-excerpt { margin: 0; padding: 0 13px 14px; color: #40536c; font-size: 13px; line-height: 1.55; }
footer { margin-top: auto; padding: 24px 0; color: var(--muted); border-top: 1px solid var(--line); font-size: 12px; }
footer span { display: inline-block; width: 3px; height: 3px; margin: 0 8px 2px; background: #95a4b7; border-radius: 50%; }

@keyframes reveal { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 600px) { .shell { width: min(100% - 28px, 1040px); } .topbar { min-height: 70px; } .status { font-size: 11px; } .workspace { padding: 52px 0 44px; } h1 { font-size: 39px; } .lede { font-size: 15px; } .query-panel, .result { padding: 17px; } .input-row { display: block; } textarea { width: 100%; } #submit-button { width: 100%; min-height: 43px; margin-top: 10px; } .answer { font-size: 21px; } }