:root {
  --bg: #070a0c;
  --bg-1: #0b1115;
  --bg-2: #0f161b;
  --panel: #11181e;
  --panel-2: #0c1217;
  --line: #1c2730;
  --line-2: #283540;
  --ink: #e7f0f5;
  --ink-soft: #aab8c2;
  --ink-mute: #6b7b86;
  --accent: #4ef2c4;
  --accent-2: #2bd6a8;
  --accent-dim: #1a3b34;
  --warn: #f0c869;
  --signal: #6fb6ff;
  --grid: rgba(78, 242, 196, 0.045);
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px;
  --shadow: 0 24px 64px rgba(0,0,0,.5);
  --maxw: 1180px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 44px 44px;
  background-position: -1px -1px;
}
a { color: inherit; text-decoration: none; }
h1,h2,h3 { line-height: 1.08; letter-spacing: -0.01em; font-weight: 720; margin: 0; }
h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); }
h2 { font-size: clamp(1.8rem, 3.4vw, 2.9rem); }
h3 { font-size: 1.25rem; }
p { margin: 0; color: var(--ink-soft); }
code, .mono { font-family: var(--mono); }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.mute { color: var(--ink-mute); }
.accent { color: var(--accent); }

/* nav */
header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(7,10,12,.78); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
nav { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 760; letter-spacing: -0.02em; }
.brand .mark { width: 26px; height: 26px; }
.navlinks { display: flex; align-items: center; gap: 26px; font-size: 0.86rem; color: var(--ink-mute); }
.navlinks a { transition: color .12s; }
.navlinks a:hover, .navlinks a.active { color: var(--ink); }
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 18px;
  border-radius: var(--r-md); border: 1px solid var(--accent-dim); color: var(--accent);
  background: rgba(78,242,196,.06); font-weight: 700; font-size: 0.9rem;
  transition: background .12s, transform .08s; cursor: pointer;
}
.btn:hover { background: rgba(78,242,196,.14); transform: translateY(-1px); }
.btn.solid { background: var(--accent); color: #04201a; border-color: var(--accent); }
.btn.solid:hover { background: var(--accent-2); }
.btn.ghost { border-color: var(--line-2); color: var(--ink-soft); background: transparent; }

/* hero */
.hero { padding: clamp(48px, 9vw, 104px) 0 56px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono);
  font-size: 0.72rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); border: 1px solid var(--accent-dim);
  padding: 6px 12px; border-radius: 999px; background: rgba(78,242,196,.05);
}
.eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.hero h1 { margin-top: 22px; max-width: 16ch; }
.hero .sub { margin-top: 18px; max-width: 46ch; font-size: 1.12rem; color: var(--ink-soft); }
.hero .ctas { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: start; margin-top: 48px; }
@media (max-width: 880px) { .hero-grid { grid-template-columns: 1fr; } }

/* panels */
.panel {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow); overflow: hidden;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-head .t { font-family: var(--mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-mute); }
.panel-head .s { font-family: var(--mono); font-size: .72rem; color: var(--accent); }
.panel-body { padding: 18px; }

/* mini studio */
.studio-mini { display: flex; flex-direction: column; gap: 16px; }
.qasm { font-family: var(--mono); font-size: .8rem; color: var(--ink-soft); white-space: pre-wrap; word-break: break-word; }
.runbar { display: flex; gap: 10px; align-items: center; }
.runbar select, .runbar input { height: 38px; background: var(--bg-1); border: 1px solid var(--line-2); color: var(--ink); border-radius: var(--r-md); padding: 0 10px; font-family: var(--mono); font-size: .82rem; }
.runbar .shots { width: 96px; }
.histo { display: flex; align-items: end; gap: 6px; min-height: 160px; padding: 12px; background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-md); }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.bar { width: 100%; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, var(--accent), var(--accent-2)); transition: height .3s cubic-bezier(.2,.8,.2,1); }
.bar-label { font-family: var(--mono); font-size: .68rem; color: var(--ink-mute); }
.bar-val { font-family: var(--mono); font-size: .66rem; color: var(--ink-soft); }

/* sections */
.section { padding: clamp(56px, 9vw, 96px) 0; border-top: 1px solid var(--line); }
.section-head { max-width: 60ch; }
.section-head .kicker { font-family: var(--mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.section-head h2 { margin-top: 12px; }
.section-head p { margin-top: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 36px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
@media (max-width: 880px) { .grid-3 { grid-template-columns: 1fr; } .grid-2 { grid-template-columns: 1fr; } }
.card { padding: 22px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel-2); }
.card h3 { color: var(--ink); }
.card p { margin-top: 10px; font-size: .94rem; }
.card .num { font-family: var(--mono); color: var(--accent); font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; }

/* read surfaces (5 charts) */
.surfaces { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 28px; }
@media (max-width: 880px) { .surfaces { grid-template-columns: repeat(2,1fr); } }
.surface { padding: 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-1); }
.surface .name { font-weight: 700; font-size: .92rem; }
.surface .d { margin-top: 6px; font-size: .78rem; color: var(--ink-mute); }

/* footer */
footer { border-top: 1px solid var(--line); padding: 48px 0 64px; color: var(--ink-mute); font-size: .86rem; }
.foot-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; }
@media (max-width: 880px) { .foot-grid { grid-template-columns: 1fr 1fr; } }
.foot-grid h4 { color: var(--ink-soft); font-size: .76rem; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 12px; }
.foot-grid a { display: block; margin-bottom: 8px; }
.foot-grid a:hover { color: var(--accent); }
.foot-bottom { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; font-family: var(--mono); font-size: .74rem; }

/* studio page */
.circuit-scroll { overflow: auto; max-height: 420px; background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 6px; }
.composer { display: block; min-width: 100%; user-select: none; }
.composer .qwire { stroke: var(--line-2); stroke-width: 1.5; }
.composer .cgrid-v { stroke: var(--grid); stroke-width: 1; }
.composer .qw-label { fill: var(--accent); font-family: var(--mono); font-size: 11px; font-weight: 600; }
.composer .hit { cursor: pointer; }
.composer .hit-pending { fill: rgba(78,242,196,.12); }
.composer .gs-box { fill: rgba(78,242,196,.10); stroke: var(--accent); stroke-width: 1.4; }
.composer .gs-reset { fill: rgba(240,200,105,.12); stroke: var(--warn); }
.composer .gs-txt { fill: var(--accent); font-family: var(--mono); font-size: 11px; font-weight: 700; }
.composer .gs-link { stroke: var(--signal); stroke-width: 1.6; }
.composer .gs-ctrl { fill: var(--signal); }
.composer .gs-tgt { fill: var(--bg-1); stroke: var(--signal); stroke-width: 1.6; }
.composer .gs-tgt-x { stroke: var(--signal); stroke-width: 1.6; }
.composer .gs-swap-x { stroke: var(--signal); stroke-width: 2; }
.composer .gs-cp { fill: var(--bg-2); stroke: var(--signal); stroke-width: 1.4; }
.composer .gs-cp-txt { fill: var(--signal); font-family: var(--mono); font-size: 9px; font-weight: 600; }
.composer .gs-meas { fill: var(--bg-2); stroke: var(--ink-mute); stroke-width: 1.2; }
.composer .gs-meas-arc, .composer .gs-meas-needle { fill: none; stroke: var(--ink-mute); stroke-width: 1.2; }
.composer .gs-barrier { stroke: var(--ink-mute); stroke-width: 1.6; stroke-dasharray: 4 4; }
.composer .gate-g { transition: filter .2s; }
.composer .gate-g.fired { animation: gfire .55s ease; }
@keyframes gfire { 0% { filter: none; } 25% { filter: drop-shadow(0 0 7px var(--accent)); } 100% { filter: none; } }
.playhead { mix-blend-mode: screen; }
.palette { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.gate-btn { height: 38px; min-width: 42px; padding: 0 8px; border: 1px solid var(--line-2); background: var(--bg-1); color: var(--ink); border-radius: var(--r-sm); font-family: var(--mono); font-weight: 700; font-size: .82rem; cursor: pointer; transition: all .12s; }
.gate-btn:hover { border-color: var(--accent); color: var(--accent); }
.gate-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(78,242,196,.10); box-shadow: 0 0 0 1px rgba(78,242,196,.25); }
.qasm-edit-wrap { }
.qasm-edit { width: 100%; min-height: 120px; background: var(--bg-1); border: 1px solid var(--line-2); color: var(--ink-soft); border-radius: var(--r-md); padding: 12px; font-family: var(--mono); font-size: .78rem; line-height: 1.5; resize: vertical; tab-size: 2; }
.qasm-edit:focus { outline: none; border-color: var(--accent); color: var(--ink); }

/* marginals */
.marginals { display: flex; flex-direction: column; gap: 5px; }
.marg { display: grid; grid-template-columns: 1fr; gap: 3px; }
.marg-bar { height: 6px; background: var(--bg-2); border-radius: 3px; overflow: hidden; }
.marg-fill { height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .5s cubic-bezier(.2,.8,.2,1); }
.marg-lbl { font-family: var(--mono); font-size: .66rem; color: var(--ink-mute); }

/* agent copilot */
.copilot { margin-top: 22px; padding: 16px 16px 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: linear-gradient(180deg, rgba(78,242,196,.05), transparent); }
.copilot-label { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.copilot-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .5; } 50% { opacity: 1; } }
.copilot-row { display: flex; gap: 8px; }
.copilot-input { flex: 1; height: 40px; background: var(--bg-1); border: 1px solid var(--line-2); color: var(--ink); border-radius: var(--r-md); padding: 0 12px; font-family: var(--sans); font-size: .92rem; }
.copilot-input:focus { outline: none; border-color: var(--accent); }
.copilot-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.chip { height: 28px; padding: 0 10px; border: 1px solid var(--line-2); background: var(--bg-1); color: var(--ink-soft); border-radius: 999px; font-family: var(--mono); font-size: .72rem; cursor: pointer; transition: all .12s; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.copilot-bubble { margin-top: 12px; padding: 12px 14px; border-left: 2px solid var(--accent); background: var(--bg-1); border-radius: 0 var(--r-md) var(--r-md) 0; font-size: .86rem; color: var(--ink-soft); font-family: var(--sans); }
.copilot-bubble.loading { color: var(--ink-mute); font-style: italic; }
.copilot-bubble.err { border-left-color: #ff8a8a; color: #ff8a8a; }

/* shared proof banner */
.shared-banner { display: flex; align-items: center; gap: 10px; margin-top: 18px; padding: 12px 16px; border: 1px solid var(--accent); border-radius: var(--r-md); background: rgba(78,242,196,.07); font-family: var(--mono); font-size: .82rem; }
.shared-banner .sb-icon { color: var(--accent); font-size: 1rem; }
.shared-banner .sb-ok { color: var(--accent); }
.shared-banner .sb-bad { color: #ff8a8a; }

/* qer card */
.qer { font-family: var(--mono); font-size: .8rem; }
.qer-row { display: flex; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line); }
.qer-row span { color: var(--ink-mute); }
.qer-row strong { color: var(--accent); font-weight: 600; }

/* records list */
.record-item { padding: 14px; border: 1px solid var(--line); border-radius: var(--r-md); margin-bottom: 10px; background: var(--bg-1); }
.record-item .head { display: flex; justify-content: space-between; align-items: center; }
.record-item .id { font-family: var(--mono); color: var(--accent); font-size: .82rem; }
.record-item .sig { font-family: var(--mono); font-size: .7rem; color: var(--ink-mute); }

/* proof */
.proof-input { width: 100%; min-height: 96px; background: var(--bg-1); border: 1px solid var(--line-2); color: var(--ink); border-radius: var(--r-md); padding: 14px; font-family: var(--sans); font-size: .96rem; resize: vertical; }
.proof-input:focus { outline: none; border-color: var(--accent); }
.pill { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; font-family: var(--mono); font-size: .72rem; }
.pill.fit { background: rgba(240,200,105,.14); color: var(--warn); }
.pill.notfit { background: rgba(78,242,196,.1); color: var(--accent); }
.pill.neutral { background: var(--bg-1); color: var(--ink-soft); }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; font-family: var(--mono); font-size: .82rem; }
.kv span { color: var(--ink-mute); }
.kv b { color: var(--ink); font-weight: 600; }

/* docs */
table.api { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: .82rem; }
table.api th, table.api td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.api th { color: var(--ink-mute); font-weight: 500; text-transform: uppercase; font-size: .68rem; letter-spacing: .08em; }
table.api td.m { color: var(--accent); }
table.api td.d { color: var(--ink-soft); font-family: var(--sans); font-size: .86rem; }

/* misc */
.spinner { width: 18px; height: 18px; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.err { color: #ff8a8a; font-family: var(--mono); font-size: .84rem; }
.fade { animation: fade .4s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.lead { font-size: 1.12rem; color: var(--ink-soft); max-width: 60ch; }
.tagrow { display: flex; gap: 8px; flex-wrap: wrap; }
.tag { font-family: var(--mono); font-size: .7rem; color: var(--ink-mute); border: 1px solid var(--line); padding: 4px 8px; border-radius: var(--r-sm); }
.metric { font-family: var(--mono); font-size: 2.2rem; color: var(--accent); font-weight: 700; letter-spacing: -0.02em; }
.metric-l { font-family: var(--mono); font-size: .74rem; color: var(--ink-mute); text-transform: uppercase; letter-spacing: .1em; }
