:root {
  --bg: #0c0d12;
  --surface: #141620;
  --surface-2: #1b1e2c;
  --border: #272c40;
  --border-hi: #3f4766;
  --ink: #eef0f6;
  --muted: #98a0b8;
  --accent: #34d399;
  --accent-dim: rgba(52, 211, 153, 0.14);
  --violet: #a78bfa;
  --violet-dim: rgba(167, 139, 250, 0.14);
  --amber: #fbbf24;
  --sky: #38bdf8;
  --rose: #fb7185;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1100px 550px at 85% -10%, rgba(167, 139, 250, 0.09), transparent 60%),
              radial-gradient(900px 500px at 10% 0%, rgba(52, 211, 153, 0.08), transparent 55%),
              var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: var(--mono);
  font-size: 0.87em;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.12em 0.38em;
  border-radius: 4px;
  color: #f3f5fb;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  background: rgba(12, 13, 18, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--ink);
  white-space: nowrap;
}
.brand span { color: var(--accent); }
.brand:hover { text-decoration: none; }

.nav { display: flex; flex-wrap: wrap; gap: 1.1rem; font-size: 0.9rem; }
.nav a { color: var(--muted); }
.nav a:hover { color: var(--ink); text-decoration: none; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 2.5rem 1.25rem 4rem; }

.hero { padding: 1.5rem 0 2.75rem; border-bottom: 1px solid var(--border); }

.kicker, .eyebrow {
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--accent);
  margin: 0 0 0.65rem;
}

h1 {
  font-size: clamp(2rem, 4.4vw, 3.35rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0 0 1.1rem;
}
h1 em { font-style: normal; color: var(--accent); }
h2 { font-size: clamp(1.35rem, 2.4vw, 1.85rem); letter-spacing: -0.02em; margin: 0 0 0.6rem; }
h3 { font-size: 1.05rem; margin: 0 0 0.6rem; }

.lede { max-width: 72ch; color: #c7cde0; font-size: 1.05rem; margin: 0 0 1.75rem; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.75rem;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
}
.stat-val { font-family: var(--mono); font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.stat-lbl { font-size: 0.88rem; color: var(--accent); font-weight: 600; margin-top: 0.2rem; }
.stat-sub { font-size: 0.78rem; color: var(--muted); margin-top: 0.25rem; }

.cta-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.62rem 1.1rem;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid var(--border-hi);
  background: var(--surface);
  color: var(--ink);
}
.btn:hover { border-color: var(--violet); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #09130f; }
.btn.primary:hover { background: #4ade80; border-color: #4ade80; }

.section { padding: 2.75rem 0 0; }
.section-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.section-note { max-width: 52ch; color: var(--muted); font-size: 0.92rem; margin: 0; }

.panel-grid { display: grid; gap: 1rem; margin-top: 2rem; }
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.3rem 1.4rem;
}
.card p { margin: 0; color: #c7cde0; font-size: 0.95rem; }

.explorer-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}

.toggle-row { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-bottom: 1.1rem; }
.chip {
  font-family: var(--mono);
  font-size: 0.82rem;
  padding: 0.48rem 0.85rem;
  border-radius: 7px;
  border: 1px solid var(--border-hi);
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.chip.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

.metrics-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.2rem;
}
.m-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
}
.m-box span { display: block; font-size: 0.74rem; font-family: var(--mono); color: var(--muted); }
.m-box strong { display: block; font-family: var(--mono); font-size: 1rem; margin-top: 0.2rem; color: var(--ink); }

.bar-block { margin-bottom: 1.1rem; }
.bar-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.bar-label strong { font-family: var(--mono); color: var(--ink); }

.stacked-bar {
  display: flex;
  width: 100%;
  height: 28px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-hi);
  background: var(--surface-2);
}
.bar-seg { height: 100%; transition: width 0.25s ease; }

.legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  font-family: var(--mono);
}
.leg-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--surface-2);
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.leg-val { margin-left: auto; color: var(--muted); }

.callout {
  padding: 0.9rem 1rem;
  border-radius: 8px;
  font-size: 0.88rem;
  color: #dce2f2;
}
.callout.info {
  background: rgba(167, 139, 250, 0.09);
  border: 1px solid rgba(167, 139, 250, 0.35);
}

.stage-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}
.stage-btn {
  text-align: left;
  padding: 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.stage-btn span { font-family: var(--mono); font-size: 0.74rem; color: var(--violet); }
.stage-btn strong { font-size: 0.88rem; }
.stage-btn.active { border-color: var(--accent); background: var(--surface-2); box-shadow: 0 0 0 1px var(--accent); }

.stage-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.4rem;
}
.stage-panel h3 { color: var(--accent); }
.stage-badges { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0.7rem 0; }
.s-badge {
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: var(--violet-dim);
  color: var(--violet);
  border: 1px solid rgba(167, 139, 250, 0.35);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
th, td { text-align: left; padding: 0.65rem 0.8rem; border-bottom: 1px solid var(--border); }
th {
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
}
tr:last-child td { border-bottom: none; }
tr.hi-row td { background: rgba(52, 211, 153, 0.05); }

.code-stack { display: flex; flex-direction: column; gap: 0.85rem; }
.code-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.code-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.95rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 0.84rem;
  color: var(--muted);
}
.copy-btn {
  font-family: var(--mono);
  font-size: 0.76rem;
  padding: 0.25rem 0.65rem;
  border-radius: 5px;
  border: 1px solid var(--border-hi);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  flex-shrink: 0;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }
pre { margin: 0; padding: 0.9rem 1rem; overflow-x: auto; font-family: var(--mono); font-size: 0.84rem; }
pre code { background: none; padding: 0; }

.plain-list { margin: 0; padding-left: 1.15rem; color: #c7cde0; font-size: 0.92rem; }
.plain-list li { margin-bottom: 0.55rem; }

.constellation-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.75rem; }
.c-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.95rem 1.05rem;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
}
.c-card strong { font-family: var(--mono); color: var(--violet); font-size: 0.92rem; }
.c-card span { font-size: 0.82rem; color: var(--muted); }
.c-card:hover { border-color: var(--violet); text-decoration: none; }
.c-card.current { border-color: var(--accent); background: var(--surface-2); }
.c-card.current strong { color: var(--accent); }

.footer {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.84rem;
  color: var(--muted);
}

@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: minmax(0, 1fr); }
  .metrics-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stage-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 540px) {
  .topbar { padding: 0.75rem 1rem; }
  .nav { gap: 0.7rem; font-size: 0.82rem; }
  .stat-grid, .metrics-strip, .stage-row { grid-template-columns: minmax(0, 1fr); }
  .wrap { padding: 1.5rem 0.95rem 3rem; }
}

/* Live passkey studio & Devnet inspector */
.studio-tier { display: inline-flex; gap: .5rem; align-items: center; color: var(--muted); font-size: .9rem; }
.studio-tier select { background: var(--surface-2); color: var(--ink); border: 1px solid var(--border-hi); border-radius: 6px; padding: .35rem .5rem; }
.studio-log { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: .75rem; min-height: 4rem; max-height: 13rem; overflow: auto; font-family: var(--mono); font-size: .8rem; color: var(--muted); white-space: pre-wrap; word-break: break-all; }
.studio-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.studio-four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.studio-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.1rem; }
.studio-subcard { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 1rem 1.1rem; }
.studio-subcard h3 { color: var(--accent); font-size: .95rem; margin-bottom: .65rem; }
.studio-note { color: var(--muted); font-size: .84rem; margin: 0 0 .7rem; }
.studio-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; margin-bottom: .8rem; }
.studio-fields label { display: flex; flex-direction: column; gap: .25rem; font-size: .78rem; font-family: var(--mono); color: var(--muted); }
.studio-fields label.wide { grid-column: 1 / -1; }
.studio-fields input { background: var(--surface); color: var(--ink); border: 1px solid var(--border-hi); border-radius: 6px; padding: .42rem .55rem; font-family: var(--mono); font-size: .82rem; }
.devnet-bar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.devnet-bar label.wide { grid-column: auto; }
.studio-kv-readout { display: flex; flex-direction: column; gap: .38rem; font-size: .8rem; color: #c7cde0; border-top: 1px solid var(--border); padding-top: .65rem; }
.studio-kv-readout span { color: var(--muted); font-family: var(--mono); }
#studio button:disabled, #devnet button:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 900px) {
  .studio-grid, .studio-three, .studio-four, .devnet-bar { grid-template-columns: minmax(0, 1fr); }
}
