:root {
  --bg: #16131f;
  --bg-2: #241f31;
  --card: rgba(255, 255, 255, 0.1);
  --card-strong: rgba(255, 255, 255, 0.16);
  --line: rgba(255, 255, 255, 0.18);
  --text: #f7f3ff;
  --muted: rgba(247, 243, 255, 0.7);
  --soft: rgba(247, 243, 255, 0.52);
  --accent: #d9c7ff;
  --accent-strong: #a98cff;
  --blue: #86d7ff;
  --danger: #ffb4c7;
  --shadow: rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 18%, rgba(169, 140, 255, 0.24), transparent 32rem),
    radial-gradient(circle at 82% 8%, rgba(134, 215, 255, 0.16), transparent 28rem),
    linear-gradient(135deg, var(--bg), var(--bg-2) 54%, #30283f);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(rgba(255,255,255,0.055) 1px, transparent 1px),
              linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent 72%);
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.075;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.site-header, main, footer { position: relative; z-index: 1; }
.site-header {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand img { width: 154px; height: auto; display: block; filter: drop-shadow(0 14px 28px var(--shadow)); }
.nav { display: flex; gap: 8px; padding: 6px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,0.07); backdrop-filter: blur(18px); }
.nav a { color: var(--muted); text-decoration: none; font-size: 0.92rem; padding: 9px 14px; border-radius: 999px; transition: 160ms ease; }
.nav a:hover { color: var(--text); background: rgba(255,255,255,0.1); }

main { width: min(1180px, calc(100vw - 32px)); margin: 0 auto; }
.hero { min-height: calc(100vh - 106px); display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr); align-items: center; gap: 34px; padding: 44px 0 72px; }
.eyebrow { margin: 0 0 14px; color: var(--accent); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; font-size: 0.76rem; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 22px; font-size: clamp(3.1rem, 7.4vw, 7.2rem); line-height: 0.88; letter-spacing: -0.08em; max-width: 760px; }
h2 { font-size: clamp(2rem, 4vw, 4rem); line-height: 1; letter-spacing: -0.055em; }
.lead { max-width: 680px; color: var(--muted); font-size: clamp(1.08rem, 2vw, 1.35rem); line-height: 1.7; }

.search-card, .result-panel, .metrics {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, var(--card-strong), rgba(255,255,255,0.06));
  box-shadow: 0 28px 90px var(--shadow);
  backdrop-filter: blur(22px);
}
.search-card { margin-top: 34px; max-width: 760px; padding: 18px; border-radius: 28px; }
.search-card label { display: block; margin-bottom: 10px; color: var(--soft); font-weight: 700; }
.search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
input, button { font: inherit; }
input { width: 100%; min-width: 0; border: 1px solid rgba(255,255,255,0.14); outline: 0; border-radius: 18px; padding: 18px 18px; color: var(--text); background: rgba(0,0,0,0.2); }
input::placeholder { color: rgba(247, 243, 255, 0.44); }
input:focus { border-color: rgba(217,199,255,0.75); box-shadow: 0 0 0 4px rgba(169,140,255,0.16); }
button { border: 0; border-radius: 18px; padding: 0 18px 0 22px; display: inline-flex; align-items: center; gap: 10px; color: #180f2a; font-weight: 800; background: linear-gradient(135deg, #ffffff, var(--accent)); cursor: pointer; transition: transform 160ms ease, box-shadow 160ms ease; }
button:hover { transform: translateY(-1px); box-shadow: 0 14px 34px rgba(169,140,255,0.28); }
button:disabled, input:disabled { opacity: 0.62; cursor: wait; }
button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.hint { margin: 12px 4px 0; color: var(--soft); font-size: 0.92rem; }

.result-panel { border-radius: 34px; padding: 22px; min-height: 430px; align-self: stretch; display: flex; flex-direction: column; }
.panel-topline { display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 700; margin-bottom: 18px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #65f0b0; box-shadow: 0 0 0 7px rgba(101,240,176,0.1), 0 0 34px rgba(101,240,176,0.9); }
.answer-tile { flex: 1; border-radius: 26px; padding: 24px; background: rgba(10,8,16,0.42); border: 1px solid rgba(255,255,255,0.12); overflow: auto; }
.answer-tile p { color: var(--muted); line-height: 1.7; }
.answer-list { margin: 0; padding-left: 20px; display: grid; gap: 16px; }
.answer-list li { line-height: 1.65; color: rgba(247,243,255,0.86); }
.answer-list strong { color: var(--text); }
.answer-list a { color: var(--blue); text-underline-offset: 0.2em; }
.answer-disclaimer { margin-top: 18px !important; color: var(--soft) !important; font-size: 0.9rem; }
.error { color: var(--danger) !important; }

.metrics { margin: 0 0 92px; border-radius: 30px; padding: 18px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.metrics div { padding: 24px; border-radius: 22px; background: rgba(255,255,255,0.055); }
.metrics strong { display: block; font-size: clamp(1.8rem, 4vw, 3.4rem); letter-spacing: -0.05em; }
.metrics span { color: var(--muted); }

footer { width: min(1180px, calc(100vw - 32px)); margin: 0 auto; padding: 28px 0 42px; display: flex; justify-content: space-between; gap: 18px; color: var(--soft); border-top: 1px solid var(--line); }

@keyframes tileIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.is-visible { animation: tileIn 220ms ease both; }

@media (max-width: 860px) {
  .site-header { align-items: flex-start; }
  .nav { display: none; }
  .hero { grid-template-columns: 1fr; min-height: auto; padding-top: 28px; }
  .result-panel { min-height: 320px; }
  .metrics { grid-template-columns: 1fr; }
  h1 { font-size: clamp(3rem, 16vw, 5.2rem); }
  .search-row { grid-template-columns: 1fr; }
  button { min-height: 56px; justify-content: center; }
  footer { flex-direction: column; }
}

.answer-summary h2 {
  margin: 0 0 12px;
  font-size: 1.35rem;
  letter-spacing: -0.035em;
}

.answer-summary p {
  color: rgba(247,243,255,0.84);
}

.answer-summary ul {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}

.answer-summary li {
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  background: rgba(255,255,255,0.055);
  color: rgba(247,243,255,0.88);
  line-height: 1.65;
}

.answer-summary li span {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
  font-weight: 800;
}

.source-details {
  margin-top: 18px;
}

.source-details summary {
  cursor: pointer;
  color: var(--blue);
  font-weight: 800;
  margin-bottom: 12px;
}

.answer-warning {
  margin-top: 16px !important;
  color: var(--danger) !important;
}

.answer-topic {
  margin-top: 16px;
  padding: 18px 20px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 22px;
  background: rgba(255,255,255,0.055);
}

.answer-topic header h3 {
  margin: 0 0 6px;
  font-size: 1.18rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.topic-summary {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.55;
}

.topic-bullets {
  margin: 0 0 12px;
  padding-left: 18px;
  display: grid;
  gap: 10px;
}

.topic-bullets li {
  color: rgba(247,243,255,0.88);
  line-height: 1.65;
}

.topic-sources {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  color: var(--soft);
  font-size: 0.92rem;
}

.topic-sources a {
  color: var(--blue);
  text-underline-offset: 0.2em;
}

.answer-sources {
  margin-top: 18px;
}

.answer-sources h3 {
  margin: 0 0 12px;
  font-size: 1.1rem;
}

.answer-sources ol {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 14px;
}

.answer-sources p {
  margin: 6px 0 4px;
  color: rgba(247,243,255,0.84);
  line-height: 1.6;
}

.agent-answer {
  display: grid;
  gap: 12px;
}

.agent-answer .verdict {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(124, 92, 255, 0.18);
  border: 1px solid rgba(124, 92, 255, 0.35);
  color: var(--text);
  font-weight: 800;
  letter-spacing: -0.01em;
}

.agent-answer h3 {
  margin: 14px 0 0;
  font-size: 1.12rem;
  color: var(--text);
}

.agent-answer p {
  margin: 0;
  color: rgba(247,243,255,0.88);
  line-height: 1.68;
}

.agent-answer ul {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
  color: rgba(247,243,255,0.88);
  line-height: 1.62;
}

.source-details {
  margin-top: 18px;
  color: var(--soft);
}

.source-details summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 700;
  margin-bottom: 10px;
}

.thinking-panel {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: start;
}

.thinking-orb {
  width: 54px;
  height: 54px;
  border-radius: 999px;
  background: radial-gradient(circle at 35% 35%, #fff, var(--blue) 35%, var(--purple) 72%);
  box-shadow: 0 0 34px rgba(124, 92, 255, 0.6);
  animation: pulseOrb 1.8s ease-in-out infinite;
}

.thinking-panel h2 {
  margin: 0 0 6px;
}

.thinking-panel p {
  margin: 0 0 14px;
  color: rgba(247,243,255,0.88);
}

.thinking-panel ol {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.thinking-panel li.active {
  color: var(--text);
  font-weight: 800;
}

.thinking-panel li.done {
  color: var(--green);
}

.thinking-panel small {
  display: block;
  margin-top: 14px;
  color: var(--soft);
  line-height: 1.5;
}

@keyframes pulseOrb {
  0%, 100% { transform: scale(1); filter: saturate(1); }
  50% { transform: scale(1.08); filter: saturate(1.35); }
}
