:root {
  --bg: #07090f;
  --bg2: #0e1420;
  --ink: #eef2ff;
  --muted: #8b95b0;
  --line: rgba(238, 242, 255, 0.1);
  --main: #3dffa8;
  --support: #6ea8ff;
  --warn: #ffb454;
  --bad: #ff6b7a;
  --write: #ff7ad9;
  --font-d: "Syne", system-ui, sans-serif;
  --font-b: "DM Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-b);
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 0% -10%, rgba(61,255,168,0.14), transparent 55%),
    radial-gradient(800px 480px at 100% 0%, rgba(110,168,255,0.12), transparent 50%),
    linear-gradient(180deg, #05070c, var(--bg) 35%, #0a1018);
  background-attachment: fixed;
}
.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.04;
  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='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}
.top, main, .foot { position: relative; z-index: 1; }

.top {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.1rem 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo {
  font-family: var(--font-d);
  font-weight: 800;
  font-size: 1.45rem;
  letter-spacing: -0.04em;
  color: var(--ink);
  text-decoration: none;
}
.logo span { color: var(--main); }
.top nav { display: flex; gap: 0.85rem; align-items: center; }
.top nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}
.top nav a:hover { color: var(--ink); }

.hero {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.5rem 1.2rem 2.5rem;
  display: grid;
  gap: 2rem;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
}
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--main);
  margin: 0 0 0.75rem;
}
.hero h1 {
  font-family: var(--font-d);
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  letter-spacing: -0.045em;
  line-height: 0.98;
  margin: 0 0 1rem;
}
.lede { color: var(--muted); font-size: 1.05rem; line-height: 1.5; max-width: 34rem; margin: 0 0 1.4rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 0.85rem; }
.spend-hint { font-size: 0.82rem; margin: 0; }
.muted { color: var(--muted); }

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: 600 0.9rem var(--font-b);
  padding: 0.65rem 1.1rem;
  border-radius: 999px;
  background: var(--main);
  color: #06110c;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.btn:hover { filter: brightness(1.06); }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.support { background: var(--support); color: #071018; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.hero-visual {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 1.1rem;
  background:
    linear-gradient(160deg, rgba(61,255,168,0.07), transparent 40%),
    linear-gradient(200deg, rgba(110,168,255,0.08), rgba(0,0,0,0.35));
  box-shadow: 0 30px 80px rgba(0,0,0,0.35);
}
.flow-preview { display: grid; gap: 0.35rem; justify-items: stretch; }
.lane-label {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  font-weight: 700;
  margin-top: 0.4rem;
}
.lane-label.main { color: var(--main); }
.lane-label.support { color: var(--support); }
.block {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  background: rgba(7, 10, 18, 0.75);
  font-family: ui-monospace, monospace;
  font-size: 0.82rem;
  animation: rise 0.6s ease both;
}
.block.b-read { border-color: rgba(61,255,168,0.35); }
.block.b-write { border-color: rgba(255,122,217,0.4); }
.conn {
  display: flex;
  justify-content: center;
  color: var(--muted);
  font-size: 0.7rem;
  position: relative;
  height: 1.4rem;
}
.conn::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(var(--main), var(--support));
  opacity: 0.55;
}
.conn span {
  background: var(--bg2);
  padding: 0 0.4rem;
  position: relative;
  z-index: 1;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.handoff {
  text-align: center;
  font-size: 0.72rem;
  color: var(--warn);
  letter-spacing: 0.04em;
  margin: 0.35rem 0;
}

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

.panel-grid {
  max-width: 1120px;
  margin: 0 auto 3rem;
  padding: 0 1.2rem;
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.1rem;
  background: rgba(255,255,255,0.02);
}
.card h3 { font-family: var(--font-d); margin: 0 0 0.45rem; font-size: 1.05rem; }
.card p { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.45; }

.foot {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1rem 1.2rem 2rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--line);
}

/* auth */
.auth-shell {
  max-width: 420px;
  margin: 3rem auto;
  padding: 0 1.2rem;
}
.auth-shell h1 {
  font-family: var(--font-d);
  letter-spacing: -0.03em;
  margin: 0 0 0.4rem;
}
.auth-card {
  margin-top: 1.2rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.2rem;
  background: rgba(0,0,0,0.25);
}
label { display: block; font-size: 0.75rem; color: var(--muted); margin-bottom: 0.25rem; }
input, textarea, select {
  width: 100%;
  background: #070b12;
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  font: inherit;
  margin-bottom: 0.85rem;
}
.flash {
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-bottom: 0.85rem;
  font-size: 0.88rem;
}
.flash.err { border-color: rgba(255,107,122,0.45); background: rgba(255,107,122,0.08); }
.flash.ok { border-color: rgba(61,255,168,0.35); background: rgba(61,255,168,0.08); }

/* studio */
.studio {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.5rem 1rem 2.5rem;
}
.studio-top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.spend-pill {
  border: 1px solid rgba(61,255,168,0.35);
  color: var(--main);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}
.studio-grid {
  display: grid;
  grid-template-columns: 200px 1fr 320px;
  gap: 0.85rem;
  min-height: 70vh;
}
@media (max-width: 980px) {
  .studio-grid { grid-template-columns: 1fr; }
}
.palette, .inspector, .canvas-wrap {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(0,0,0,0.22);
}
.palette, .inspector { padding: 0.85rem; }
.palette h3, .inspector h3, .canvas-head h3 {
  font-family: var(--font-d);
  font-size: 0.95rem;
  margin: 0 0 0.65rem;
}
.palette-item {
  width: 100%;
  text-align: left;
  margin-bottom: 0.4rem;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  border: 1px dashed var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: 500 0.78rem ui-monospace, monospace;
}
.palette-item:hover { border-style: solid; border-color: rgba(61,255,168,0.45); }
.palette-item.write { border-color: rgba(255,122,217,0.25); }

.canvas-wrap { display: flex; flex-direction: column; overflow: hidden; }
.canvas-head {
  padding: 0.85rem 1rem 0;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
}
.canvas {
  padding: 1rem;
  overflow: auto;
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  position: relative;
}
.swim {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.75rem;
  min-height: 420px;
  background: rgba(255,255,255,0.015);
}
.swim.main { box-shadow: inset 0 0 0 1px rgba(61,255,168,0.08); }
.swim.support { box-shadow: inset 0 0 0 1px rgba(110,168,255,0.08); }
.swim h4 {
  margin: 0 0 0.75rem;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.swim.main h4 { color: var(--main); }
.swim.support h4 { color: var(--support); }

.node {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem;
  background: #0a0f18;
  margin-bottom: 0.35rem;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.node:hover { transform: translateY(-1px); }
.node.selected { border-color: var(--main); }
.node.write { border-color: rgba(255,122,217,0.35); }
.node .act { font-family: ui-monospace, monospace; font-size: 0.82rem; font-weight: 600; }
.node .meta { color: var(--muted); font-size: 0.72rem; margin-top: 0.25rem; line-height: 1.35; }
.node-tools { display: flex; gap: 0.3rem; margin-top: 0.45rem; }
.node-tools button {
  font-size: 0.68rem;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.edge {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0.15rem 0 0.45rem;
  font-size: 0.68rem;
  color: var(--muted);
}
.edge span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  background: #070b12;
}
.shared-rail {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding: 0.55rem 0.75rem;
  border: 1px dashed rgba(255,180,84,0.35);
  border-radius: 12px;
  color: var(--warn);
  font-size: 0.78rem;
}

.ai-box textarea { min-height: 90px; }
.chat-log {
  max-height: 220px;
  overflow: auto;
  display: grid;
  gap: 0.5rem;
  margin: 0.65rem 0;
}
.bubble {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  font-size: 0.8rem;
  white-space: pre-wrap;
}
.bubble.user { border-color: rgba(61,255,168,0.25); }
.yaml-adv {
  margin-top: 0.75rem;
}
.yaml-adv details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.8rem;
}
.yaml-adv textarea {
  min-height: 180px;
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
}

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 0.55rem 0.35rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; }
