:root {
  --bg: #0b0f14;
  --card: #141a22;
  --border: #243041;
  --text: #e8eef6;
  --muted: #8b9bb0;
  --accent: #0052ff;
  --accent-soft: rgba(0, 82, 255, 0.15);
  --ok: #22c55e;
  --ok-soft: rgba(34, 197, 94, 0.12);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.12);
  --manual: #a78bfa;
  --manual-soft: rgba(167, 139, 250, 0.14);
  --gaslite: #14b8a6;
  --gaslite-soft: rgba(20, 184, 166, 0.14);
  --auth: #f472b6;
  --auth-soft: rgba(244, 114, 182, 0.14);
  --danger: #ef4444;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--sans);
  background: radial-gradient(1200px 600px at 20% -10%, #132038 0%, var(--bg) 55%);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}
.page { max-width: 960px; margin: 0 auto; padding: 2rem 1.25rem 3rem; }

.hero h1 { margin: 0.4rem 0 0.35rem; font-size: 1.7rem; letter-spacing: -0.02em; }
.sub { color: var(--muted); margin: 0 0 1rem; font-size: 0.95rem; }
.badge-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.pill {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.pill.sandbox { background: var(--accent-soft); color: #8eb6ff; border-color: #2a4a8a; }
.pill.poc { background: var(--warn-soft); color: #fbbf24; border-color: #6b4e12; }
.pill.gaslite { background: var(--gaslite-soft); color: #5eead4; border-color: #0f766e; }

.banner {
  background: var(--warn-soft);
  border: 1px solid #6b4e12;
  color: #fde68a;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  margin: 1rem 0;
  font-size: 0.92rem;
}
.banner code { font-family: var(--mono); font-size: 0.85em; }

.tabs {
  display: flex;
  gap: 0.4rem;
  margin: 1.5rem 0 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.35rem;
  flex-wrap: wrap;
}
.tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 0.55rem 0.9rem;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
}
.tab:hover { color: var(--text); background: #1a2230; }
.tab.active {
  color: var(--text);
  background: var(--card);
  border-color: var(--border);
  border-bottom-color: var(--card);
}

.panel { display: none; }
.panel.active { display: block; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.15rem;
}
.panel-head h2 { margin: 0 0 0.35rem; font-size: 1.15rem; }
.doc-link { color: #8eb6ff; font-size: 0.88rem; text-decoration: none; }
.doc-link:hover { text-decoration: underline; }
.flow { color: var(--muted); font-size: 0.9rem; margin: 0.55rem 0 0; }

.diagram-wrap { margin: 1rem 0; overflow-x: auto; }
.arch-svg { width: 100%; min-width: 640px; height: auto; display: block; }
.arch-svg .box { fill: #0f1520; stroke-width: 1.5; }
.arch-svg .box.auth { stroke: var(--auth); }
.arch-svg .box.db { stroke: var(--manual); }
.arch-svg .box.cdp { stroke: var(--accent); }
.arch-svg .box.wallet { stroke: #8eb6ff; }
.arch-svg .box.sender { stroke: var(--accent); }
.arch-svg .box.gaslite { stroke: var(--gaslite); }
.arch-svg .box.chain { stroke: #fbbf24; }
.arch-svg .box.recip { stroke: #64748b; }
.arch-svg .box-title { fill: var(--text); font-size: 13px; font-weight: 700; font-family: var(--sans); }
.arch-svg .box-sub { fill: var(--muted); font-size: 11px; font-family: var(--sans); }
.arch-svg .arrow { stroke: #7398db; stroke-width: 2; fill: none; marker-end: url(#arrowhead); }

.process-flow {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: flex;
  align-items: stretch;
  gap: 1.1rem;
  flex-wrap: wrap;
}
.process-node {
  position: relative;
  flex: 1 1 7rem;
  min-width: 6.5rem;
  min-height: 6.8rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 0.45rem;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: 10px;
}
.process-node::after {
  content: "→";
  position: absolute;
  top: 50%;
  right: -0.95rem;
  transform: translateY(-58%);
  color: #7398db;
  font-size: 1.1rem;
  font-weight: 700;
}
.process-node:last-child::after { content: none; }
.auth-node { border-color: var(--auth); background: linear-gradient(135deg, var(--auth-soft), var(--card)); }
.gaslite-node { border-color: var(--gaslite); background: linear-gradient(135deg, var(--gaslite-soft), var(--card)); }
.process-number {
  display: grid; place-items: center;
  width: 1.5rem; height: 1.5rem; border-radius: 50%;
  background: var(--accent-soft); color: #a9c6ff;
  font-family: var(--mono); font-size: 0.75rem; font-weight: 700;
}
.auth-node .process-number { background: var(--auth-soft); color: #f9a8d4; }
.gaslite-node .process-number { background: var(--gaslite-soft); color: #5eead4; }
.process-label { font-size: 0.82rem; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.process-kind {
  border-radius: 999px; padding: 0.12rem 0.4rem;
  font-size: 0.66rem; font-weight: 700; line-height: 1.25;
}
.sdk-kind { background: var(--accent-soft); color: #93c5fd; }
.auth-kind { background: var(--auth-soft); color: #f9a8d4; }
.gaslite-kind { background: var(--gaslite-soft); color: #5eead4; }

.sim-controls {
  display: flex; flex-wrap: wrap; gap: 0.85rem 1rem;
  align-items: flex-end; margin: 1rem 0;
}
.field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 7rem; }
.field label { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.field select, .field input {
  background: #0a1018; border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 0.45rem 0.6rem; font: inherit; font-size: 0.92rem;
}
.btn-primary {
  background: var(--accent); color: #fff; border: none;
  border-radius: 8px; padding: 0.55rem 1.1rem;
  font: inherit; font-weight: 700; cursor: pointer;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: 0.55; cursor: wait; }

.checklist {
  list-style: none; margin: 1rem 0 0; padding: 0;
  display: flex; flex-direction: column; gap: 0.65rem;
  counter-reset: step;
}
.step {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 0.9rem 1rem;
  counter-increment: step;
  opacity: 0.45; transition: opacity 0.25s, border-color 0.25s;
}
.step.visible { opacity: 1; }
.step.done { border-color: #166534; }
.step-top {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0.45rem 0.7rem; margin-bottom: 0.35rem;
}
.step-n {
  font-family: var(--mono); font-size: 0.75rem; font-weight: 700;
  color: #8eb6ff; background: var(--accent-soft);
  padding: 0.12rem 0.4rem; border-radius: 6px;
}
.step-n::before { content: "Step " counter(step); }
.step h3 { margin: 0; font-size: 0.95rem; flex: 1 1 10rem; }
.chip {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.03em; padding: 0.15rem 0.4rem; border-radius: 999px;
}
.chip.ok { background: var(--ok-soft); color: #86efac; }
.chip.sdk { background: var(--accent-soft); color: #93c5fd; }
.chip.auth { background: var(--auth-soft); color: #f9a8d4; }
.chip.gaslite { background: var(--gaslite-soft); color: #5eead4; }
.chip.pending { background: #1e293b; color: var(--muted); }

.sdk-line {
  font-family: var(--mono); font-size: 0.76rem;
  background: #0a1018; border: 1px solid var(--border);
  border-radius: 8px; padding: 0.5rem 0.65rem;
  color: #d1e0f5; margin: 0.4rem 0; white-space: pre-wrap; word-break: break-word;
}
.mock-box {
  margin-top: 0.4rem; border-left: 3px solid var(--ok); padding-left: 0.7rem;
}
.mock-box summary { cursor: pointer; color: #86efac; font-size: 0.84rem; font-weight: 600; }
.mock-box pre {
  font-family: var(--mono); font-size: 0.72rem;
  background: #0a1018; border: 1px solid var(--border);
  border-radius: 8px; padding: 0.55rem 0.65rem;
  overflow-x: auto; color: #c8d6e8; margin: 0.35rem 0 0;
}

.sim-result { margin-top: 1.25rem; }
.sim-result h3 { margin: 0 0 0.6rem; font-size: 1.05rem; }
.meta-pills { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.75rem; }
.meta-pills span {
  font-family: var(--mono); font-size: 0.72rem;
  background: #0a1018; border: 1px solid var(--border);
  border-radius: 6px; padding: 0.25rem 0.5rem; color: #cbd5e1;
}
.recip-table {
  width: 100%; border-collapse: collapse; font-size: 0.82rem;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
}
.recip-table th, .recip-table td {
  text-align: left; padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--border);
}
.recip-table th { color: var(--muted); font-weight: 600; font-size: 0.75rem; background: #0f1520; }
.recip-table td code { font-family: var(--mono); font-size: 0.75em; color: #93c5fd; }
.recip-table tr:last-child td { border-bottom: none; }

.roles-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem; margin: 1rem 0;
}
.role h3 { margin: 0 0 0.35rem; font-size: 0.98rem; }
.role p { margin: 0; color: var(--muted); font-size: 0.88rem; }
.role code { font-family: var(--mono); font-size: 0.85em; color: #cbd5e1; }
.source-list {
  list-style: none; margin: 0; padding: 1rem 1.15rem;
  display: flex; flex-direction: column; gap: 0.45rem; font-size: 0.9rem;
}
.source-list a { color: #8eb6ff; }

@media (max-width: 700px) {
  .process-flow { flex-direction: column; gap: 0.7rem; }
  .process-node {
    min-height: 4.8rem; flex-direction: row; justify-content: flex-start; padding: 0.65rem;
  }
  .process-node::after {
    content: "↓"; top: auto; right: auto; bottom: -0.75rem;
    left: 50%; transform: translateX(-50%);
  }
  .process-node:last-child::after { content: none; }
  .process-label { text-align: left; flex: 1; }
}

.foot {
  margin-top: 2rem; padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted); font-size: 0.85rem;
}
.foot code { font-family: var(--mono); font-size: 0.85em; }
