:root {
  --bg: #0b0b0e;
  --surface: #141418;
  --text: #ededf0;
  --muted: #8a8a93;
  --accent: #5b9dff;
  --border: #23232a;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

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

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px;
}

/* Header */
header {
  margin-bottom: 28px;
}

h1 {
  margin: 0 0 6px;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0;
  color: var(--muted);
}

.tagline {
  max-width: 620px;
  margin: 12px 0 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted);
}

/* Input row */
.row {
  display: flex;
  gap: 10px;
  margin-bottom: 0;
}

#topic {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#topic::placeholder {
  color: var(--muted);
}

#topic:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 157, 255, 0.25);
}

button {
  padding: 12px 18px;
  background: var(--accent);
  color: #0b0b0e;
  border: none;
  border-radius: var(--radius);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

button:hover:not(:disabled) {
  background: #7db0ff;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Steps tracker */
.steps {
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.step {
  display: flex;
  align-items: center;
  gap: 12px;
}

.indicator {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.step .label {
  color: var(--muted);
  transition: color 0.2s ease;
}

.step.pending .indicator {
  border-color: var(--border);
  background: transparent;
}

.step.active .indicator {
  border-color: var(--accent);
  animation: pulse 1.4s ease-in-out infinite;
}

.step.active .label {
  color: var(--text);
}

.step.done .indicator {
  border-color: var(--accent);
  background: var(--accent);
  color: #0b0b0e;
}

.step.done .indicator::after {
  content: "\2713"; /* checkmark */
}

.step.done .label {
  color: var(--text);
}

.step.failed .indicator {
  border-color: #ff6b6b;
  background: transparent;
  color: #ff6b6b;
}

.step.failed .indicator::after {
  content: "\2715"; /* cross */
}

.step.failed .label {
  color: #ff6b6b;
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(91, 157, 255, 0.4);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(91, 157, 255, 0);
  }
}

/* Query chips */
.queries {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.chip {
  display: inline-flex;
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--text);
}

/* Result sections */
.result {
  margin-bottom: 24px;
}

.block {
  margin-bottom: 28px;
}

.block:last-child {
  margin-bottom: 0;
}

h2 {
  margin: 0 0 12px;
  padding-left: 10px;
  border-left: 3px solid var(--accent);
  font-size: 18px;
}

.block ul {
  margin: 0;
  padding-left: 20px;
}

.block li {
  margin-bottom: 8px;
}

.sources {
  list-style: none;
  padding-left: 0;
}

.sources li {
  margin-bottom: 10px;
}

.sources a {
  color: var(--accent);
  text-decoration: none;
  word-break: break-word;
  transition: color 0.15s ease;
}

.sources a:hover {
  text-decoration: underline;
}

/* Download */
#download {
  margin-bottom: 24px;
}

/* Error */
.error {
  margin-bottom: 24px;
  padding: 14px 16px;
  background: rgba(255, 107, 107, 0.08);
  border: 1px solid #ff6b6b;
  border-radius: var(--radius);
  color: #ff9b9b;
}

/* Example chips */
.examples {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  margin-bottom: 24px;
}

.try-label {
  color: var(--muted);
  font-size: 13px;
}

.example-chip {
  padding: 3px 10px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.example-chip:hover {
  border-color: var(--accent);
}

/* Blinking caret for the live stream */
.caret {
  display: inline-block;
  width: 8px;
  height: 1.05em;
  margin-left: 1px;
  background: var(--accent);
  vertical-align: -2px;
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* Report header */
.eyebrow {
  margin-bottom: 6px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.report-title {
  margin: 0;
  font-size: 26px;
  font-weight: 500;
  color: var(--text);
}

.report-rule {
  margin: 16px 0 20px;
  border: none;
  border-top: 1px solid var(--border);
}

/* Streamed markdown brief — styled like a document */
#brief h2 {
  margin: 24px 0 12px;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
  border-radius: 0;
  font-size: 17px;
  font-weight: 500;
}

#brief h2:first-child {
  margin-top: 0;
}

#brief h3 {
  margin: 18px 0 8px;
  font-size: 15px;
  font-weight: 500;
}

#brief p {
  margin: 0 0 12px;
  line-height: 1.7;
}

#brief ul {
  margin: 0 0 16px;
  padding-left: 20px;
}

#brief li {
  margin-bottom: 8px;
  line-height: 1.7;
}

#brief strong {
  font-weight: 500;
}

/* Meta line (rendered after the stream finishes) */
.meta {
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}

.meta:empty {
  display: none;
}

/* Sources block (rendered after the stream finishes) */
#sources {
  margin-top: 12px;
}

#sources ul {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

/* One-click live demo button — the primary "start here" affordance */
.demo-btn {
  display: inline-block;
  margin-top: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border: 0.5px solid var(--accent);
  border-radius: var(--radius);
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.demo-btn:hover:not(:disabled) {
  background: rgba(91, 157, 255, 0.12);
}

/* Site footer */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-top: 48px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}

.footer-links {
  display: flex;
  gap: 16px;
}

.site-footer a {
  color: var(--accent);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* Copy-email control — reads as a footer link, not a button */
#copy-email {
  width: auto;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
}

#copy-email:hover {
  text-decoration: underline;
}

/* Mobile */
@media (max-width: 560px) {
  .container {
    padding: 20px 16px;
  }

  .row {
    flex-direction: column;
  }

  button {
    width: 100%;
  }
}
