:root {
  --bg: #0a0d14;
  --bg-2: #10141e;
  --bg-3: #181d2b;
  --ink: #e7ecf3;
  --ink-dim: #8894a8;
  --accent: #4ade80;    /* USDC-ish green */
  --accent-2: #60a5fa;  /* orchestrator blue */
  --warn: #f59e0b;
  --edge: rgba(255,255,255,0.08);
  --mono: "SF Mono","JetBrains Mono","Menlo",monospace;
  --sans: "Inter","SF Pro Text",system-ui,sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 0.85em; color: var(--ink-dim); }

header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 32px; border-bottom: 1px solid var(--edge);
  background: linear-gradient(180deg, rgba(96,165,250,0.06), rgba(0,0,0,0));
}
.brand { display: flex; align-items: center; gap: 16px; }
.logo {
  width: 44px; height: 44px; border-radius: 10px;
  display: grid; place-items: center; font-weight: 800; font-size: 22px;
  background: linear-gradient(135deg, #4ade80, #60a5fa); color: #0a0d14; letter-spacing: -1px;
}
.logo span { color: #0a0d14; opacity: 0.75; }
h1 { margin: 0; font-size: 20px; letter-spacing: -0.01em; }
.tagline { margin: 2px 0 0; color: var(--ink-dim); font-size: 12px; }
.mode-pill {
  padding: 6px 12px; border-radius: 999px;
  background: rgba(74,222,128,0.14); color: var(--accent);
  font-family: var(--mono); font-size: 12px; text-transform: lowercase;
}
.mode-pill.live { background: rgba(245,158,11,0.14); color: var(--warn); }

main { max-width: 1320px; margin: 0 auto; padding: 24px 32px 48px; }

.launch { margin-bottom: 18px; }
.launch label { display: block; color: var(--ink-dim); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; }
.input-row { display: flex; gap: 10px; }
#goal {
  flex: 1; background: var(--bg-2); color: var(--ink); border: 1px solid var(--edge);
  border-radius: 10px; padding: 14px 16px; font-size: 15px; outline: none; font-family: var(--sans);
}
#goal:focus { border-color: var(--accent-2); }
#launch {
  background: linear-gradient(135deg, #4ade80, #60a5fa); color: #06080d; border: 0;
  padding: 0 22px; border-radius: 10px; font-weight: 600; font-size: 15px; cursor: pointer;
  transition: transform 120ms ease;
}
#launch:hover  { transform: translateY(-1px); }
#launch:active { transform: translateY(0); }
#launch:disabled { opacity: 0.5; cursor: wait; }
.hint { color: var(--ink-dim); font-size: 12px; margin: 8px 0 0; }

.stats {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin: 18px 0 20px;
}
.stats > div {
  background: var(--bg-2); border: 1px solid var(--edge); border-radius: 12px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.stats .lbl { color: var(--ink-dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.stats .val { font-family: var(--mono); font-size: 24px; font-weight: 600; }

.grid {
  display: grid; gap: 16px;
  grid-template-columns: 1.4fr 1fr;
  grid-template-rows: auto auto;
  grid-template-areas:
    "graph ticker"
    "answer board";
}
.panel { background: var(--bg-2); border: 1px solid var(--edge); border-radius: 14px; padding: 16px 18px; }
.panel h2 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-dim); font-weight: 600; }
.count { float: right; color: var(--accent); font-family: var(--mono); }

.graph-panel { grid-area: graph; min-height: 520px; }
.ticker-panel { grid-area: ticker; max-height: 520px; display: flex; flex-direction: column; }
.board-panel { grid-area: board; }
.answer-panel { grid-area: answer; }

#graph { width: 100%; height: 480px; display: block; }
.node circle { transition: r 180ms ease, stroke 180ms ease; filter: drop-shadow(0 4px 14px rgba(0,0,0,0.35)); }
.node.active circle { stroke: var(--accent); stroke-width: 3px; }
.node.orchestrator circle { fill: #1e293b; stroke: var(--accent-2); stroke-width: 2px; }
.node text { fill: var(--ink); font-family: var(--mono); font-size: 10px; pointer-events: none; text-anchor: middle; }
.node .emoji { font-size: 22px; font-family: sans-serif; }
.node .earn { fill: var(--accent); font-family: var(--mono); font-size: 10px; }

.edge { stroke: var(--edge); stroke-width: 1px; }
.coin { fill: var(--accent); filter: drop-shadow(0 0 4px rgba(74,222,128,0.7)); }

.ticker { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.ticker li {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px;
  padding: 8px 6px; border-bottom: 1px dashed var(--edge);
  font-family: var(--mono); font-size: 12px;
}
.ticker li .who { color: var(--ink); }
.ticker li .t   { color: var(--ink-dim); }
.ticker li .amt { color: var(--accent); font-weight: 600; }
.ticker li.settlement { background: rgba(96,165,250,0.06); }
.ticker li.settlement .amt { color: var(--accent-2); }

.board { list-style: none; margin: 0; padding: 0; }
.board li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px dashed var(--edge);
}
.board li:last-child { border-bottom: 0; }
.board .rank { color: var(--ink-dim); font-family: var(--mono); width: 28px; }
.board .name { flex: 1; }
.board .earn { font-family: var(--mono); color: var(--accent); font-weight: 600; }

.answer-panel pre {
  white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: 13px; color: var(--ink-dim);
  max-height: 220px; overflow-y: auto; margin: 0; line-height: 1.6;
}

footer {
  margin-top: 24px; color: var(--ink-dim); font-size: 12px;
  display: flex; gap: 18px; flex-wrap: wrap;
}

/* animated coin along an edge */
@keyframes coinTravel {
  from { offset-distance: 0%; opacity: 1; }
  to   { offset-distance: 100%; opacity: 0; }
}

@media (max-width: 1024px) {
  .grid { grid-template-columns: 1fr; grid-template-areas: "graph" "ticker" "answer" "board"; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
