:root {
  color-scheme: dark;
  --bg: #030712;
  --bg-deep: #01030A;
  --panel: #080D18;
  --line: #1E293B;
  --muted: #94A3B8;
  --signal: #3B82F6;
  --steel: #5A7D9A;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
html, body { background: var(--bg); overflow-x: clip; }

/* ---------- Header ---------- */
[data-header].is-scrolled { background: rgba(3, 7, 18, 0.82); backdrop-filter: blur(12px); border-color: var(--line); }
.nav-link { font-size: 13.5px; color: var(--muted); transition: color .15s; }
.nav-link:hover { color: #fff; }
.mobile-link { padding: 12px 0; border-bottom: 1px solid var(--line); color: #cbd5e1; font-size: 15px; }

/* ---------- Buttons ---------- */
.btn-primary, .btn-ghost {
  display: inline-flex; align-items: center; gap: .5rem;
  height: 34px; padding: 0 14px; font-size: 13.5px; font-weight: 600;
  transition: background-color .15s, border-color .15s, color .15s, transform .1s;
  white-space: nowrap;
}
.btn-primary { background: #fff; color: #030712; border: 1px solid #fff; }
.btn-primary:hover { background: #dbe4ef; border-color: #dbe4ef; }
.btn-ghost { background: transparent; color: #fff; border: 1px solid var(--line); }
.btn-ghost:hover { border-color: #334155; background: rgba(148,163,184,.06); }
.btn-primary:active, .btn-ghost:active, .btn-exec:active { transform: translateY(1px); }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; justify-content: center; }
:is(.btn-primary,.btn-ghost,.btn-exec,a,button):focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

/* ---------- Hero ---------- */
.hero-h1 {
  font-size: clamp(42px, 7.6vw, 112px);
  line-height: .94;
  font-weight: 800;
  letter-spacing: -0.055em;
  max-width: 15ch;
  text-wrap: balance;
}
.hero-grid {
  background-image:
    linear-gradient(to right, rgba(30,41,59,.45) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(30,41,59,.45) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(ellipse 70% 60% at 70% 20%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 70% 20%, #000 20%, transparent 75%);
}
.hero-glow { background: radial-gradient(600px 380px at 78% 62%, rgba(59,130,246,.12), transparent 70%); }
.hero-noise {
  opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* typing: invisible copy reserves height, typed copy overlays it */
.type-host { position: relative; }
.type-out { position: absolute; inset: 0; }
.type-out.is-typing::after, .caret {
  content: ""; display: inline-block; width: 7px; height: 1.05em; vertical-align: -2px;
  background: var(--signal); margin-left: 2px; animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Playground console ---------- */
.console { box-shadow: 0 40px 120px -50px rgba(59,130,246,.35); }
.pg-tab {
  padding: 11px 16px; font-family: var(--mono); font-size: 12px; color: var(--muted);
  border-right: 1px solid var(--line); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
  transition: color .15s, background-color .15s;
}
.pg-tab:hover { color: #fff; }
.pg-tab.is-active { color: #fff; background: var(--panel); border-bottom-color: var(--signal); }
.pg-code, .pg-out, .code-block {
  margin: 0; overflow-x: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.7; color: #cbd5e1; tab-size: 2;
}
.pg-code { padding: 16px 18px; height: 262px; overflow-y: auto; }
.pg-out { padding: 14px 18px; height: 230px; overflow-y: auto; white-space: pre; background: var(--bg-deep); }
.pg-out .ln { animation: lnIn .2s ease-out; }
.btn-exec {
  display: inline-flex; align-items: center; gap: 10px; height: 34px; padding: 0 14px;
  font-family: var(--mono); font-size: 12.5px; font-weight: 600; color: #030712; background: #fff; border: 1px solid #fff;
  transition: background-color .15s, opacity .15s;
}
.btn-exec:hover { background: #dbe4ef; }
.btn-exec[disabled] { opacity: .6; cursor: progress; }
.exec-dot { width: 7px; height: 7px; background: #10b981; }
.btn-exec[disabled] .exec-dot { animation: blink .5s steps(1) infinite; }
@keyframes lnIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.pg-code::-webkit-scrollbar, .pg-out::-webkit-scrollbar, .code-block::-webkit-scrollbar { width: 8px; height: 8px; }
.pg-code::-webkit-scrollbar-thumb, .pg-out::-webkit-scrollbar-thumb, .code-block::-webkit-scrollbar-thumb { background: var(--line); }

/* syntax tokens */
.tk-k { color: #93c5fd; }
.tk-s { color: #86efac; }
.tk-n { color: #fbbf24; }
.tk-c { color: #64748b; font-style: italic; }
.tk-p { color: #c4b5fd; }
.tk-f { color: #8FA9BF; }
.tk-t { color: #475569; }
.tk-ok { color: #34d399; }
.tk-warn { color: #fbbf24; }
.dim { color: #64748b; }

/* ---------- Section primitives ---------- */
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: .2em; color: var(--steel); }
.section-title { margin-top: 12px; font-size: clamp(32px, 4.6vw, 60px); line-height: 1; font-weight: 800; letter-spacing: -0.045em; }

/* ---------- Bento ---------- */
.bento-cell { background: var(--bg); padding: 28px; display: flex; flex-direction: column; min-width: 0; transition: background-color .2s; }
.bento-cell:hover { background: #050A16; }
.bento-head { display: flex; justify-content: space-between; gap: 12px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; color: #64748b; }
.bento-head span:first-child { color: var(--signal); }
.bento-metric { font-size: clamp(56px, 6.5vw, 88px); line-height: .9; font-weight: 800; letter-spacing: -0.06em; }
.bento-metric span { margin-left: 6px; font-family: var(--mono); font-size: 14px; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.bento-title { margin-top: 18px; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; }
.bento-text { margin-top: 8px; font-size: 14px; line-height: 1.6; color: var(--muted); max-width: 46ch; }
.bento-code {
  margin-top: 20px; padding: 14px 16px; border: 1px solid var(--line); background: var(--bg-deep);
  font-family: var(--mono); font-size: 12px; line-height: 1.7; color: #cbd5e1; overflow-x: auto;
}
.bento-code.route { color: #64748b; }
.bento-code.diff { margin-top: 0; }
.bento-code .add { color: #86efac; }
.bento-code .del { color: #fca5a5; }
.bento-spec { margin-top: auto; padding-top: 28px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bento-spec > div { border-top: 1px solid var(--line); padding-top: 10px; padding-right: 8px; }
.bento-spec dt { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; color: #64748b; text-transform: uppercase; }
.bento-spec dd { margin-top: 4px; font-family: var(--mono); font-size: 12px; color: #cbd5e1; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 96px; min-width: 0; flex: 1; max-width: 300px; }
.bars i { flex: 1; height: 100%; background: #1E3A5F; min-width: 2px; transform-origin: bottom; transition: transform .6s cubic-bezier(.2,.8,.2,1); }
.bars i.hi { background: var(--signal); }

/* ---------- Architecture ---------- */
.arch-node { background: var(--bg-deep); padding: 20px 18px; position: relative; }
.arch-node h3 { margin-top: 14px; font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.arch-node p { margin-top: 6px; font-size: 13.5px; color: var(--muted); line-height: 1.5; min-height: 40px; }
.arch-node code { display: block; margin-top: 14px; font-family: var(--mono); font-size: 11px; color: #8FA9BF; border-top: 1px dashed var(--line); padding-top: 10px; }
.arch-step { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; color: var(--signal); border: 1px solid rgba(59,130,246,.4); padding: 2px 6px; }

/* ---------- API docs ---------- */
.endpoint { display: flex; width: 100%; align-items: center; gap: 12px; background: var(--bg-deep); padding: 14px 16px; font-family: var(--mono); font-size: 13px; color: var(--muted); text-align: left; transition: background-color .15s, color .15s; border-left: 2px solid transparent; }
.endpoint:hover { color: #fff; }
.endpoint.is-active { background: var(--panel); color: #fff; border-left-color: var(--signal); }
.endpoint .method { font-size: 10.5px; font-weight: 600; color: #34d399; background: rgba(52,211,153,.1); padding: 2px 6px; }
.lang-tab { padding: 12px 18px; font-family: var(--mono); font-size: 12px; color: var(--muted); border-right: 1px solid var(--line); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s; }
.lang-tab:hover { color: #fff; }
.lang-tab.is-active { color: #fff; border-bottom-color: var(--signal); background: var(--panel); }
.code-block { padding: 18px 20px; }

/* ---------- Pricing ---------- */
.bill-btn { padding: 8px 14px; color: var(--muted); transition: background-color .15s, color .15s; }
.bill-btn.is-active { background: var(--panel); color: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.price-card { background: var(--bg); padding: 32px; display: flex; flex-direction: column; min-height: 500px; }
.price-list { margin: 28px 0 32px; display: grid; gap: 12px; font-size: 14.5px; color: #cbd5e1; }
.price-list li { display: flex; gap: 12px; align-items: flex-start; }
.price-list li::before { content: "→"; flex: none; font-family: var(--mono); font-size: 12px; color: var(--signal); margin-top: 2px; }

/* ---------- Form ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line); color: #fff; padding: 10px 12px; font-size: 14px; outline: none; transition: border-color .15s; border-radius: 0;
}
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #94A3B8 50%), linear-gradient(135deg, #94A3B8 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--signal); }
.field input::placeholder, .field textarea::placeholder { color: #475569; }
.field input.is-invalid { border-color: #f87171; }
.step-num { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border: 1px solid var(--line); font-family: var(--mono); font-size: 12px; color: var(--signal); }

/* ---------- Footer ---------- */
.foot-cell { background: var(--bg-deep); padding: 22px 20px; }
.foot-k { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--steel); margin-bottom: 10px; }
.foot-a, .foot-v { display: block; font-size: 12.5px; color: var(--muted); padding: 3px 0; }
a.foot-a:hover { color: #fff; }
.status-badge { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); padding: 6px 10px; font-size: 11px; color: #cbd5e1; }
.status-dot { width: 7px; height: 7px; background: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,.15); }

/* legacy footer classes (legal pages) */
.footer-a { display: block; font-size: 14px; color: var(--muted); padding: 4px 0; }

/* ---------- Modal ---------- */
[data-signin-modal].is-open { display: flex; }
[data-signin-modal].is-open [data-modal-panel] { animation: modalIn .18s ease-out; }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }

/* ---------- Legal pages ---------- */
.prose-legal h2 { margin-top: 40px; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.prose-legal p, .prose-legal li { margin-top: 12px; color: var(--muted); line-height: 1.75; font-size: 15px; }
.prose-legal ul { list-style: square; padding-left: 20px; }
.prose-legal a { color: #fff; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--line); }

@media (max-width: 640px) {
  .bento-cell { padding: 22px 18px; }
  .bento-head span:last-child { display: none; }
  .bento-spec { grid-template-columns: 1fr; gap: 8px; }
  .pg-code { height: 230px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
}
