@property --spin { syntax: "<angle>"; inherits: false; initial-value: 0deg; }

:root {
  color-scheme: dark;
  --bg: #05070c;
  --surface: #0b0e14;
  --panel: rgba(10, 13, 20, 0.84);
  --line: rgba(255, 255, 255, 0.09);
  --text: #e8ecf3;
  --text-2: #a3acbb;
  --text-3: #6d7686;
  --blue: #3987e5;
  --blue-soft: rgba(57, 135, 229, 0.45);
  --red: #e66767;
  --yellow: #c98500;
  --neutral: #3a4254;
  --display: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--display);
  -webkit-font-smoothing: antialiased;
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Layers, back to front: grid and glow, the web, a vignette, then the page. */
.backdrop, #web, .vignette { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.backdrop {
  background:
    radial-gradient(60% 50% at 50% 38%, rgba(57, 135, 229, 0.16), transparent 70%),
    radial-gradient(40% 35% at 82% 78%, rgba(230, 103, 103, 0.07), transparent 70%),
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 56px 56px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 56px 56px;
  -webkit-mask-image: radial-gradient(90% 80% at 50% 45%, #000 30%, transparent 100%);
  mask-image: radial-gradient(90% 80% at 50% 45%, #000 30%, transparent 100%);
  animation: gridDrift 40s linear infinite;
}
#web { display: block; }
.vignette { background: radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(5, 7, 12, 0.85) 100%); }

.top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3;
  display: flex; align-items: center; gap: 14px;
  padding: 18px 24px;
  pointer-events: none;
  animation: fadeDown 0.9s var(--ease) both;
}
.brand {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  font: 600 14px/1 var(--mono); letter-spacing: 0.42em;
  color: var(--text); text-decoration: none;
}
.mark { width: 26px; height: 26px; border-radius: 7px; box-shadow: 0 0 18px rgba(57, 135, 229, 0.55); animation: breathe 2.6s ease-in-out infinite; }
.tag { font: 11px/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); }

main { position: relative; z-index: 2; }

.stage {
  position: relative;
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 96px 16px 28px;
  text-align: center;
  overflow: hidden;
}
.stage.live { justify-content: flex-start; padding-top: 64px; }
.stage.live .counters { margin-top: auto; }
/* A scan line sweeps the stage while a forecast is being fetched. */
.stage.busy::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 140px; pointer-events: none;
  background: linear-gradient(to bottom, transparent, rgba(57, 135, 229, 0.12) 85%, rgba(120, 190, 255, 0.55) 100%);
  animation: scan 2.8s linear infinite;
}

.hero { max-width: 780px; width: 100%; }
.stage.live .hero h1, .stage.live .hero .lede, .stage.live .hero .chips, .stage.live .hero .eyebrow { display: none; }
.stage.live .note:not(.err):not(:empty) { font-size: 12px; color: var(--text-3); }

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  margin: 0 0 22px; padding: 7px 14px;
  background: rgba(10, 13, 20, 0.7); border: 1px solid var(--line); border-radius: 999px;
  font: 11px/1.2 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-2);
  animation: rise 0.9s var(--ease) 0.1s both;
}
.pulse { position: relative; width: 7px; height: 7px; border-radius: 50%; background: var(--blue); }
.pulse::after { content: ""; position: absolute; inset: -1px; border-radius: 50%; border: 1px solid var(--blue); animation: ping 1.8s ease-out infinite; }

h1 {
  margin: 0 0 16px;
  font: 700 clamp(38px, 7.4vw, 84px)/0.98 var(--display); letter-spacing: -0.035em;
  filter: drop-shadow(0 0 34px rgba(5, 7, 12, 0.95));
}
h1 span {
  display: inline-block;
  background: linear-gradient(180deg, #ffffff 20%, #9fb4d6 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: word 0.9s var(--ease) both;
}
h1 span:nth-child(1) { animation-delay: 0.15s; }
h1 span:nth-child(2) { animation-delay: 0.25s; }
h1 span:nth-child(3) { animation-delay: 0.35s; }
h1 span:nth-child(4) { animation-delay: 0.5s; }
h1 .hl {
  background: linear-gradient(100deg, #8fc0ff, #3987e5 45%, #c9dcff 60%, #3987e5 80%);
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text;
  animation: word 0.9s var(--ease) 0.5s both, sheen 6s linear 1.4s infinite;
}
.lede { margin: 0 auto 30px; max-width: 580px; font-size: 17px; color: var(--text-2); text-shadow: 0 0 18px var(--bg); animation: rise 0.9s var(--ease) 0.6s both; }
.lede strong { color: var(--text); font-weight: 600; }

/* Question box with a light travelling round its border. */
form {
  position: relative;
  display: flex; gap: 8px;
  padding: 6px;
  border: 1px solid transparent; border-radius: 16px;
  background:
    linear-gradient(rgba(9, 12, 18, 0.92), rgba(9, 12, 18, 0.92)) padding-box,
    conic-gradient(from var(--spin), rgba(57, 135, 229, 0.15), rgba(57, 135, 229, 0.15) 60%, #8fc0ff 78%, #ffffff 82%, rgba(57, 135, 229, 0.15) 90%) border-box;
  box-shadow: 0 0 60px rgba(57, 135, 229, 0.18), 0 20px 60px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  animation: rise 0.9s var(--ease) 0.75s both, spin 7s linear infinite;
  transition: box-shadow 0.3s;
}
form:focus-within { box-shadow: 0 0 80px rgba(57, 135, 229, 0.34), 0 20px 60px rgba(0, 0, 0, 0.5); }
.stage.busy form { animation: spin 1.6s linear infinite; }
input {
  flex: 1; min-width: 0;
  padding: 15px 16px;
  background: transparent; border: 0; outline: 0;
  color: var(--text); font: 17px/1.3 var(--display);
}
input::placeholder { color: var(--text-3); }
button {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 0 22px;
  border: 0; border-radius: 11px;
  background: linear-gradient(180deg, #4a95ee, #2f76d0); color: #fff;
  font: 600 13px/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s;
}
button[type="submit"] { box-shadow: 0 0 24px rgba(57, 135, 229, 0.45); }
button[type="submit"]::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: skewX(-20deg);
}
button[type="submit"]:hover::after { animation: shimmer 0.8s ease; }
button:hover { transform: translateY(-1px); }
button:hover .arrow { transform: translateX(3px); }
.arrow { font-style: normal; transition: transform 0.2s var(--ease); }
button:disabled { opacity: 0.6; cursor: progress; transform: none; }
button:focus-visible, input:focus-visible, .chip:focus-visible, summary:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.ghost {
  padding: 6px 10px; background: transparent; color: var(--text-2);
  border: 1px solid var(--line); border-radius: 8px; font-size: 11px; box-shadow: none;
}
.ghost:hover { color: var(--text); border-color: var(--blue-soft); }

.progress { margin: 14px auto 0; max-width: 560px; font: 12px/1.4 var(--mono); color: var(--text-2); text-shadow: 0 0 12px var(--bg); }
.progress[hidden] { display: none; }
.bar { position: relative; height: 2px; margin-bottom: 10px; overflow: hidden; background: rgba(255, 255, 255, 0.08); border-radius: 2px; }
.bar i { position: absolute; top: 0; bottom: 0; width: 35%; background: linear-gradient(90deg, transparent, #8fc0ff, transparent); animation: slide 1.4s ease-in-out infinite; }

.note { min-height: 22px; margin: 12px 0 0; font-size: 13px; color: var(--text-2); text-shadow: 0 0 12px var(--bg); }
.note:empty { min-height: 0; margin: 0; }
.note.err { color: var(--red); }

.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; animation: rise 0.9s var(--ease) 0.9s both; }
.chip {
  padding: 8px 13px;
  background: rgba(10, 13, 20, 0.72); color: var(--text-2);
  border: 1px solid var(--line); border-radius: 999px; box-shadow: none;
  font: 400 13px/1.2 var(--display); letter-spacing: 0; text-transform: none; cursor: pointer;
  transition: color 0.2s, border-color 0.2s, transform 0.2s var(--ease), box-shadow 0.2s;
}
.chip:hover { color: var(--text); border-color: var(--blue-soft); box-shadow: 0 0 20px rgba(57, 135, 229, 0.2); }

.hud {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 22px;
  margin-top: 12px; padding: 8px 14px;
  background: rgba(10, 13, 20, 0.72); border: 1px solid var(--line); border-radius: 999px;
  backdrop-filter: blur(10px);
  animation: rise 0.6s var(--ease) both;
}
.hud[hidden] { display: none; }
.hud-day { display: flex; align-items: center; gap: 10px; font: 600 13px/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; list-style: none; font-size: 12px; color: var(--text-2); }
.legend li { display: flex; align-items: center; gap: 6px; }
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; }
.swatch { width: 12px; height: 4px; border-radius: 2px; }
.dot.unaware { background: #5b6a88; }
.neutral.swatch { background: var(--neutral); }
.dot.neutral { background: #aab3c2; }
.support { background: var(--blue); }
.oppose { background: var(--red); }
.aware { background: var(--yellow); }
.dot.support { box-shadow: 0 0 8px var(--blue); }
.dot.oppose { box-shadow: 0 0 8px var(--red); }

.counters {
  position: relative;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px;
  width: 100%; max-width: 1100px; margin: 30px 0 0;
  background: var(--line); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  backdrop-filter: blur(12px);
  animation: rise 0.9s var(--ease) 1.05s both;
}
.counters::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; z-index: 1;
  background: linear-gradient(90deg, transparent, #8fc0ff, transparent);
  background-size: 40% 100%; background-repeat: no-repeat;
  animation: trace 5s linear infinite;
}
.counters div { padding: 15px 14px; background: var(--panel); text-align: left; }
.counters dt { font: 10px/1.3 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); }
.counters dd { margin: 7px 0 0; font: 600 clamp(15px, 2.1vw, 23px)/1.1 var(--mono); font-variant-numeric: tabular-nums; color: var(--text); }

.results {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start;
  max-width: 1132px; margin: 0 auto; padding: 8px 16px 80px;
}
.results[hidden] { display: none; }
.banner {
  grid-column: 1 / -1; padding: 10px 14px;
  background: rgba(201, 133, 0, 0.12); border: 1px solid rgba(201, 133, 0, 0.45); border-radius: 10px;
  font-size: 13px; color: var(--text);
}
.panel {
  position: relative;
  min-width: 0; padding: 24px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  backdrop-filter: blur(14px);
  opacity: 0; transform: translateY(26px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease), border-color 0.3s;
}
.panel.in { opacity: 1; transform: none; }
.panel:hover { border-color: rgba(57, 135, 229, 0.35); }
/* Corner brackets. */
.panel::before, .panel::after {
  content: ""; position: absolute; width: 14px; height: 14px; pointer-events: none;
  border: 1px solid rgba(143, 192, 255, 0.7);
}
.panel::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; border-radius: 14px 0 0 0; }
.panel::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; border-radius: 0 0 14px 0; }
.wide { grid-column: 1 / -1; }
h2 {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 16px; font: 600 11px/1.2 var(--mono); letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-2);
}
h2::before { content: ""; width: 14px; height: 1px; background: var(--blue); box-shadow: 0 0 8px var(--blue); }
h2.gap { margin-top: 26px; }
.summary { margin: 0 0 22px; max-width: 70ch; font-size: 19px; line-height: 1.5; }
.fine { margin: 14px 0 0; font-size: 12px; color: var(--text-3); }
.method p { margin: 0; max-width: 80ch; font-size: 14px; color: var(--text-2); }

.out { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) 56px; align-items: center; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line); }
.out:first-child { border-top: 0; }
.out-label { font-size: 14px; }
.track { position: relative; height: 10px; background: rgba(255, 255, 255, 0.06); border-radius: 4px; }
.fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  background: var(--blue); border-radius: 0 4px 4px 0;
  box-shadow: 0 0 14px rgba(57, 135, 229, 0.55);
  transition: width 1.1s var(--ease);
}
.whisker { position: absolute; top: -4px; bottom: -4px; border-left: 2px solid var(--text); border-right: 2px solid var(--text); opacity: 0; transition: opacity 0.5s 0.9s; }
.whisker::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 2px solid var(--text); transform: translateY(-1px); }
.drawn .whisker { opacity: 1; }
.out-val { text-align: right; font: 600 15px/1 var(--mono); font-variant-numeric: tabular-nums; }

.seg { padding: 10px 0; border-top: 1px solid var(--line); }
.seg:first-child { border-top: 0; }
.seg-head { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.seg-meta { color: var(--text-3); font: 12px/1.6 var(--mono); white-space: nowrap; }
.stack { display: flex; gap: 2px; height: 10px; margin: 7px 0 6px; transform-origin: left; }
.panel.in .stack { animation: grow 1s var(--ease) both; }
.stack i { display: block; min-width: 2px; border-radius: 2px; }
.stack.tall { height: 14px; margin: 12px 0 16px; }
.fine.lead { margin: 0 0 12px; font-size: 13px; color: var(--text-2); }
.evidence { margin: 0; padding: 0; list-style: none; font-size: 14px; }
.evidence li { display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); color: var(--text-2); }
.evidence a { color: var(--text); text-decoration-color: var(--text-3); }
.tone { display: flex; align-items: center; gap: 6px; font: 12px/1.5 var(--mono); color: var(--text); white-space: nowrap; }
.seg-text { margin: 0; font-size: 13px; color: var(--text-2); }

.list { margin: 0; padding-left: 18px; font-size: 14px; color: var(--text-2); }
.list li { margin: 0 0 10px; }
.list b { color: var(--text); font-weight: 600; }
.sources a { color: var(--text); text-decoration-color: var(--text-3); overflow-wrap: anywhere; }
.sources a:hover, .evidence a:hover { text-decoration-color: var(--blue); }

.chart { position: relative; margin-top: 12px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--text-3); font: 11px var(--mono); }
.chart .end { fill: var(--text); }
.chart .draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.6s var(--ease) 0.2s forwards; }
.chart .band { animation: fadeBand 1s ease 1.2s both; }
.chart .endpoint { animation: fadeIn 0.5s ease 1.6s both; }
details { margin-top: 12px; font-size: 13px; color: var(--text-2); }
summary { cursor: pointer; }
table { width: 100%; margin-top: 8px; border-collapse: collapse; font: 12px var(--mono); font-variant-numeric: tabular-nums; }
th, td { padding: 4px 6px; text-align: right; border-top: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }

.tip {
  position: fixed; z-index: 10; max-width: 280px; padding: 8px 10px;
  background: #121722; border: 1px solid rgba(143, 192, 255, 0.3); border-radius: 8px;
  font-size: 12px; line-height: 1.45; color: var(--text); pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 24px rgba(57, 135, 229, 0.15);
}
.tip[hidden] { display: none; }
.tip b { font-weight: 600; }
.tip .row { display: flex; align-items: center; gap: 6px; font-family: var(--mono); }

@keyframes spin { to { --spin: 360deg; } }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
@keyframes fadeDown { from { opacity: 0; transform: translateY(-10px); } }
@keyframes word { from { opacity: 0; transform: translateY(0.35em); filter: blur(10px); } }
@keyframes sheen { to { background-position: -220% 0; } }
@keyframes breathe { 50% { box-shadow: 0 0 30px rgba(57, 135, 229, 0.9); } }
@keyframes ping { to { transform: scale(3.2); opacity: 0; } }
@keyframes shimmer { to { left: 130%; } }
@keyframes slide { from { left: -35%; } to { left: 100%; } }
@keyframes scan { from { transform: translateY(-140px); } to { transform: translateY(100vh); } }
@keyframes trace { from { background-position: -40% 0; } to { background-position: 140% 0; } }
@keyframes gridDrift { to { background-position: 0 0, 0 0, 0 56px, 56px 0; } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fadeBand { from { opacity: 0; } }
@keyframes fadeIn { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .panel { opacity: 1; transform: none; }
  .chart .draw { stroke-dashoffset: 0; }
  .whisker { opacity: 1; }
}

@media (max-width: 760px) {
  .tag { display: none; }
  .results { grid-template-columns: minmax(0, 1fr); }
  .counters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .counters div:last-child { grid-column: 1 / -1; }
  .out { grid-template-columns: minmax(0, 1fr) 56px; }
  .out-label { grid-column: 1 / -1; }
  form { flex-direction: column; }
  .hud { border-radius: 14px; }
  .eyebrow { font-size: 10px; letter-spacing: 0.08em; }
  .evidence li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  button[type="submit"] { padding: 15px; }
}
