:root {
  --bg0: #0b1014;
  --bg1: #121a21;
  --bg2: #1a2530;
  --line: rgba(156, 193, 210, 0.18);
  --text: #e8f0f4;
  --muted: #8aa0ae;
  --cyan: #3ddec7;
  --cyan-dim: rgba(61, 222, 199, 0.14);
  --amber: #f0b429;
  --amber-dim: rgba(240, 180, 41, 0.14);
  --rose: #ff6b7a;
  --pass: #4ade80;
  --fail: #fb7185;
  --font-display: "Sora", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --radius: 14px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-body);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(61, 222, 199, 0.12), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(240, 180, 41, 0.1), transparent 50%),
    linear-gradient(180deg, #0d141a 0%, var(--bg0) 40%, #0a0e12 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(156, 193, 210, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(156, 193, 210, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}

a {
  color: var(--cyan);
}

.shell {
  position: relative;
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 4rem;
}

/* —— Hero —— */
.hero {
  display: grid;
  gap: 1.25rem;
  padding: 1.5rem 0 1.75rem;
  animation: rise 0.7s ease both;
}

.brand-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.65rem, 3.5vw, 2.35rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.brand span {
  color: var(--cyan);
}

.mode-pill {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg1);
  color: var(--muted);
  max-width: 100%;
}

.mode-pill[data-mode="simulated"] {
  border-color: rgba(240, 180, 41, 0.45);
  color: var(--amber);
  background: var(--amber-dim);
}

.mode-pill[data-mode="live"] {
  border-color: rgba(61, 222, 199, 0.55);
  color: var(--cyan);
  background: var(--cyan-dim);
}

.hero-money {
  margin: 0;
  max-width: 52rem;
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  line-height: 1.45;
  color: #d5e4ec;
  border-left: 3px solid var(--amber);
  padding-left: 1rem;
}

.hero-sub {
  margin: 0;
  max-width: 40rem;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.5;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.btn {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  border-radius: 999px;
  padding: 0.8rem 1.35rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  color: #041210;
  background: linear-gradient(135deg, var(--cyan), #7af0c8);
  box-shadow: 0 0 0 0 rgba(61, 222, 199, 0.4);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(61, 222, 199, 0.25);
}

.btn-primary.is-hot {
  animation: hotpulse 1.2s ease 2;
}

.btn-ghost {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
}

.btn-ghost:hover {
  border-color: rgba(61, 222, 199, 0.45);
}

/* —— Value strip —— */
.before-after {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin: 0.5rem 0 1.5rem;
  opacity: 0.35;
  filter: grayscale(0.4);
  transition: opacity 0.45s ease, filter 0.45s ease, transform 0.45s ease;
  transform: translateY(6px);
}

.before-after.is-revealed {
  opacity: 1;
  filter: none;
  transform: none;
}

.ba-card {
  background: var(--bg1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
}

.ba-card strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin-top: 0.25rem;
  letter-spacing: -0.02em;
}

.ba-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* —— Observability —— */
.obs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.obs-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--bg2), var(--bg1));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}

.obs-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0.55;
}

.obs-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.obs-val {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  margin-top: 0.35rem;
  color: var(--cyan);
}

/* —— Main grid —— */
.layout {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 1rem;
}

.panel {
  background: rgba(18, 26, 33, 0.92);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  padding: 1.1rem 1.15rem 1.2rem;
  backdrop-filter: blur(8px);
  animation: rise 0.75s ease both;
}

.panel:nth-child(2) {
  animation-delay: 0.06s;
}
.panel:nth-child(3) {
  animation-delay: 0.12s;
}
.panel:nth-child(4) {
  animation-delay: 0.18s;
}

.panel-title {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.panel-title small {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.7rem;
  color: var(--muted);
}

.span-2 {
  grid-column: 1 / -1;
}

/* Samples + inbox */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg0);
  color: var(--text);
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  font-size: 0.82rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: border-color 0.15s, background 0.15s;
}

.chip:hover {
  border-color: rgba(61, 222, 199, 0.4);
}

.chip.is-active {
  border-color: var(--cyan);
  background: var(--cyan-dim);
}

.chip-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mail {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg0);
  padding: 1rem;
}

.mail-meta {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
}

.mail-meta dt {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.mail-meta dd {
  margin: 0;
}

.mail-body {
  margin: 0;
  white-space: pre-wrap;
  font-family: var(--font-body);
  font-size: 0.92rem;
  line-height: 1.5;
  color: #d7e3ea;
}

/* Graph */
.graph {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.45rem;
}

.gnode {
  position: relative;
  flex: 1 1 140px;
  min-width: 120px;
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.85rem 0.8rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg0);
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.gnode-index {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
}

.gnode-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.92rem;
}

.gnode-desc {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.gnode--running {
  border-color: var(--cyan);
  background: var(--cyan-dim);
  transform: translateY(-2px);
}

.gnode--running .gnode-pulse {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 0 rgba(61, 222, 199, 0.6);
  animation: ping 1.1s ease infinite;
}

.gnode--done {
  border-color: rgba(74, 222, 128, 0.45);
  background: rgba(74, 222, 128, 0.08);
}

.gnode--fail {
  border-color: rgba(251, 113, 133, 0.55);
  background: rgba(251, 113, 133, 0.08);
}

.gedge {
  width: 18px;
  align-self: center;
  height: 2px;
  background: var(--line);
  flex: 0 0 18px;
}

.gedge--lit {
  background: linear-gradient(90deg, var(--pass), var(--cyan));
}

/* Tools */
.tool-feed {
  display: grid;
  gap: 0.65rem;
  max-height: 360px;
  overflow: auto;
}

.tool-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg0);
  overflow: hidden;
}

.tool-card header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--line);
  background: rgba(61, 222, 199, 0.06);
}

.proto {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  color: #041210;
  background: var(--cyan);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-weight: 600;
}

.tool-name {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text);
}

.tool-t {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
}

.tool-json {
  margin: 0;
  padding: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.45;
  color: #b7c9d4;
  overflow: auto;
  max-height: 160px;
}

/* Draft */
.draft-kicker {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.draft-subject {
  margin: 0.4rem 0 0.75rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.draft-body {
  margin: 0;
  white-space: pre-wrap;
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.5;
  color: #d7e3ea;
  background: var(--bg0);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
}

.citations {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.citations code {
  font-family: var(--font-mono);
  color: var(--cyan);
  background: var(--cyan-dim);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  margin-right: 0.25rem;
}

/* Eval */
.score-grid {
  display: grid;
  gap: 0.7rem;
}

.score {
  display: grid;
  grid-template-columns: 7rem 1fr 3rem;
  gap: 0.6rem;
  align-items: center;
}

.score-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.score-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.score-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2bb8a3, var(--cyan));
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.score-val {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-align: right;
}

.gate {
  margin-top: 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid var(--line);
}

.gate--idle {
  color: var(--muted);
}

.gate--pass {
  color: #052e16;
  background: linear-gradient(135deg, #86efac, #4ade80);
  border-color: transparent;
  animation: gateflash 0.55s ease;
}

.gate--fail {
  color: #450a0a;
  background: linear-gradient(135deg, #fda4af, #fb7185);
  border-color: transparent;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
}

.footer {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
  display: grid;
  gap: 0.4rem;
}

.footer code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #b7c9d4;
}

.enter {
  animation: rise 0.4s ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes ping {
  0% {
    box-shadow: 0 0 0 0 rgba(61, 222, 199, 0.55);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(61, 222, 199, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(61, 222, 199, 0);
  }
}

@keyframes hotpulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(61, 222, 199, 0.35);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(61, 222, 199, 0);
  }
}

@keyframes gateflash {
  from {
    transform: scale(0.98);
    filter: brightness(1.2);
  }
  to {
    transform: none;
    filter: none;
  }
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .before-after {
    grid-template-columns: 1fr 1fr;
  }
  .gedge {
    display: none;
  }
}

@media (max-width: 560px) {
  .obs,
  .before-after {
    grid-template-columns: 1fr;
  }
  .score {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
  .score-val {
    text-align: left;
  }
}
