:root {
  --bg: #ffffff; --bg-soft: #f6f7fb; --bg-card: #ffffff; --bg-code: #0f1222; --fg: #161a2e; --fg-soft: #4a5072; --fg-mute: #7a809c;
  --line: #e4e6f0; --line-strong: #cfd3e3; --brand: #4f46e5; --brand-2: #7c3aed; --brand-soft: #eef0ff; --brand-fg: #ffffff;
  --ok: #059669; --ok-soft: #e7f8f1; --warn: #b45309; --warn-soft: #fff6e6; --err: #dc2626; --err-soft: #fdecec;
  --code-fg: #e6e8f5; --radius: 12px; --shadow: 0 1px 2px rgba(16, 20, 50, .05), 0 4px 16px rgba(16, 20, 50, .06);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0d18; --bg-soft: #11142a; --bg-card: #141831; --bg-code: #070912; --fg: #e8eaf6; --fg-soft: #b3b8d6; --fg-mute: #8187a8;
    --line: #232848; --line-strong: #323864; --brand: #8b85ff; --brand-2: #a78bfa; --brand-soft: #1c1f45; --brand-fg: #0b0d18;
    --ok: #34d399; --ok-soft: #0f2a22; --warn: #fbbf24; --warn-soft: #2b2310; --err: #f87171; --err-soft: #2d1414;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0d18; --bg-soft: #11142a; --bg-card: #141831; --bg-code: #070912; --fg: #e8eaf6; --fg-soft: #b3b8d6; --fg-mute: #8187a8;
  --line: #232848; --line-strong: #323864; --brand: #8b85ff; --brand-2: #a78bfa; --brand-soft: #1c1f45; --brand-fg: #0b0d18;
  --ok: #34d399; --ok-soft: #0f2a22; --warn: #fbbf24; --warn-soft: #2b2310; --err: #f87171; --err-soft: #2d1414;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25); color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.6 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); letter-spacing: -.025em; }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
code, kbd, pre { font-family: var(--mono); font-size: .9em; }
:not(pre) > code { background: var(--bg-soft); border: 1px solid var(--line); padding: .1em .35em; border-radius: 6px; word-break: break-word; }
pre { background: var(--bg-code); color: var(--code-fg); padding: 16px 18px; border-radius: var(--radius); overflow: auto; line-height: 1.55; margin: 0 0 1em; max-height: 560px; }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .container { padding: 0 28px; } }
.muted { color: var(--fg-mute); }
.soft { color: var(--fg-soft); }
.small { font-size: .875rem; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* header */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.nav { display: flex; align-items: center; gap: 18px; height: 62px; }
.logo { display: flex; align-items: center; gap: 9px; font-weight: 800; color: var(--fg); font-size: 1.12rem; letter-spacing: -.02em; }
.logo:hover { text-decoration: none; }
.logo-mark { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); display: grid; place-items: center; color: #fff; font-size: 14px; font-weight: 800; }
.nav-links { display: flex; gap: 4px; margin-left: 12px; }
.nav-links a { color: var(--fg-soft); padding: 6px 10px; border-radius: 8px; font-size: .95rem; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--fg); background: var(--bg-soft); text-decoration: none; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.nav-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; color: var(--fg); padding: 6px 9px; cursor: pointer; }
.lang-link { color: var(--fg-mute); font-size: .875rem; padding: 6px 8px; }
@media (max-width: 860px) {
  .nav-links { display: none; position: absolute; top: 62px; left: 0; right: 0; background: var(--bg); border-bottom: 1px solid var(--line); flex-direction: column; padding: 10px 16px 16px; margin: 0; }
  .nav-links.open { display: flex; }
  .nav-toggle { display: inline-block; }
  .nav-right .btn-ghost, .lang-link.hide-sm { display: none; }
}

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; padding: 10px 18px; font-weight: 600; font-size: .95rem; border: 1px solid transparent; cursor: pointer; transition: transform .05s, box-shadow .15s, background .15s; line-height: 1.2; font-family: inherit; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: var(--brand-fg); box-shadow: 0 4px 14px color-mix(in srgb, var(--brand) 35%, transparent); }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 88%, #000); }
.btn-ghost { background: transparent; color: var(--fg); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--bg-soft); }
.btn-sm { padding: 7px 12px; font-size: .875rem; border-radius: 8px; }
.btn-danger { background: var(--err-soft); color: var(--err); border-color: color-mix(in srgb, var(--err) 30%, transparent); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* hero */
.hero { padding: 64px 0 40px; position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: -40% -10% auto; height: 520px; background: radial-gradient(closest-side, color-mix(in srgb, var(--brand) 22%, transparent), transparent), radial-gradient(closest-side at 70% 40%, color-mix(in srgb, var(--brand-2) 18%, transparent), transparent); z-index: -1; filter: blur(10px); }
.hero-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 40px; align-items: center; }
@media (max-width: 920px) { .hero-grid { grid-template-columns: 1fr; } }
.badge { display: inline-flex; gap: 8px; align-items: center; background: var(--brand-soft); color: var(--brand); border-radius: 999px; padding: 5px 12px; font-size: .82rem; font-weight: 600; margin-bottom: 18px; }
.lead { font-size: 1.15rem; color: var(--fg-soft); max-width: 640px; }
.cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 26px 0 10px; }
.code-window { background: var(--bg-code); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; border: 1px solid var(--line); min-width: 0; }
.code-window .bar { display: flex; gap: 6px; padding: 11px 14px; border-bottom: 1px solid rgba(255, 255, 255, .06); align-items: center; }
.code-window .bar span { width: 11px; height: 11px; border-radius: 50%; background: #3a3f5c; }
.code-window .bar b { margin-left: 8px; color: #8a90b5; font: 500 12px var(--mono); }
.code-window pre { margin: 0; border-radius: 0; font-size: .85rem; max-height: none; }
.tok-k { color: #c792ea; } .tok-s { color: #a5e3a1; } .tok-n { color: #f7c66b; } .tok-c { color: #6b7196; } .tok-p { color: #82aaff; }

/* sections */
section { padding: 56px 0; }
.section-soft { background: var(--bg-soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-head { max-width: 720px; margin: 0 auto 32px; text-align: center; }
.section-head p { color: var(--fg-soft); }
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.card { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card h3 { margin-bottom: 6px; }
.card p { color: var(--fg-soft); margin: 0; font-size: .95rem; }
a.card { color: inherit; display: block; transition: border-color .15s, transform .15s; }
a.card:hover { text-decoration: none; border-color: var(--brand); transform: translateY(-2px); }
.api-card { display: flex; gap: 14px; align-items: flex-start; padding: 16px; }
.api-card .ic { flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font: 700 13px var(--mono); color: var(--brand); background: var(--brand-soft); }
.api-card h3 { font-size: 1rem; margin: 0 0 3px; }
.api-card p { font-size: .875rem; line-height: 1.45; }
.cat-title { margin: 30px 0 12px; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--fg-mute); font-weight: 700; }

/* pricing */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; align-items: stretch; }
.plan { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 26px; }
.plan.featured { border: 2px solid var(--brand); }
.plan .tag { position: absolute; top: -12px; left: 24px; background: var(--brand); color: var(--brand-fg); font-size: .75rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.plan .price { font-size: 2.4rem; font-weight: 800; letter-spacing: -.03em; }
.plan .price small { font-size: 1rem; font-weight: 500; color: var(--fg-mute); }
.plan ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: .95rem; }
.plan li::before { content: "✓"; color: var(--ok); font-weight: 700; margin-right: 8px; }
.plan .btn { margin-top: auto; }

/* faq */
.faq { max-width: 820px; margin: 0 auto; }
details { border: 1px solid var(--line); border-radius: 10px; padding: 0 18px; margin-bottom: 10px; background: var(--bg-card); }
summary { cursor: pointer; padding: 14px 0; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; color: var(--fg-mute); font-size: 1.2rem; line-height: 1; }
details[open] summary::after { content: "–"; }
details p { color: var(--fg-soft); }

/* docs */
.docs-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 40px; padding: 36px 0 60px; }
@media (max-width: 900px) { .docs-layout { grid-template-columns: minmax(0, 1fr); } .docs-side { display: none; } }
.docs-side { position: sticky; top: 80px; align-self: start; max-height: calc(100vh - 100px); overflow: auto; font-size: .9rem; }
.docs-side h4 { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--fg-mute); margin: 18px 0 6px; }
.docs-side a { display: block; color: var(--fg-soft); padding: 4px 8px; border-radius: 6px; }
.docs-side a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.docs-main { min-width: 0; }
.docs-main h2 { margin-top: 1.8em; padding-top: .3em; }
.endpoint { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font: 600 .95rem var(--mono); background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; overflow-wrap: anywhere; }
.method { font: 700 .72rem var(--mono); padding: 3px 7px; border-radius: 6px; background: var(--ok-soft); color: var(--ok); }
.method.post { background: var(--brand-soft); color: var(--brand); }
.method.delete { background: var(--err-soft); color: var(--err); }
.method.patch { background: var(--warn-soft); color: var(--warn); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 1em; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--bg-soft); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td code { white-space: nowrap; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 0; flex-wrap: wrap; }
.tabs button { background: none; border: 0; padding: 8px 12px; cursor: pointer; color: var(--fg-mute); font: 600 .85rem var(--font); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--brand); border-color: var(--brand); }
.tab-panels pre { border-top-left-radius: 0; border-top-right-radius: 0; }
.crumbs { font-size: .85rem; color: var(--fg-mute); margin-bottom: 12px; }
.crumbs a { color: var(--fg-mute); }
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 18px; }
.pill { font-size: .8rem; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--fg-soft); background: var(--bg-card); }
.callout { border: 1px solid var(--line); border-left: 4px solid var(--brand); background: var(--bg-soft); padding: 12px 16px; border-radius: 8px; margin: 1em 0; font-size: .95rem; }

/* tools */
.tool-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 960px) { .tool-wrap { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: .9rem; }
.field-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], select, textarea {
  width: 100%; font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line-strong); border-radius: 9px; padding: 9px 11px; outline: none; transition: border-color .15s, box-shadow .15s; }
textarea { font-family: var(--mono); font-size: .86rem; line-height: 1.5; resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent); }
input[type=color] { width: 100%; height: 40px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--bg); padding: 3px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500 !important; cursor: pointer; }
.result-box { min-height: 200px; }
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.result-img { background: repeating-conic-gradient(var(--bg-soft) 0 25%, var(--bg) 0 50%) 50% / 20px 20px; border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: grid; place-items: center; min-height: 200px; }
.result-html { border: 1px solid var(--line); border-radius: 10px; padding: 16px; background: var(--bg); overflow: auto; max-height: 560px; }
.status { font-size: .85rem; padding: 8px 12px; border-radius: 8px; margin-bottom: 10px; }
.status.err { background: var(--err-soft); color: var(--err); }
.status.ok { background: var(--ok-soft); color: var(--ok); }
.mon-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--muted, #8a90a0); vertical-align: middle; }
.mon-up { background: var(--ok); } .mon-down { background: var(--err); } .mon-pending { background: var(--warn); }
.status.info { background: var(--brand-soft); color: var(--brand); }
.ad-slot { margin: 32px 0; text-align: center; clear: both; }
.ad-slot::before { content: attr(data-label); display: block; font-size: .7rem; color: var(--fg-mute); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; }
/* reserve the height of a responsive display unit so the page does not jump when the ad loads (CLS) */
.ad-slot.ad-display { min-height: 120px; }
@media (max-width: 640px) { .ad-slot.ad-display { min-height: 280px; } }
.ad-slot.ad-inarticle, .ad-slot.ad-multiplex { min-height: 100px; }
/* AdSense marks units it could not fill: collapse them instead of leaving a gap */
.ad-slot:has(ins[data-ad-status="unfilled"]) { display: none; }
/* ADSENSE_PREVIEW=1: labelled boxes to review the positions */
.ad-preview { border: 2px dashed var(--brand); border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--fg-mute); background: var(--brand-soft); }
.ad-preview::after { content: attr(data-pos); font: 600 .85rem/1.4 ui-monospace, monospace; }
.ad-preview.ad-multiplex { min-height: 220px; }
.prose { max-width: 780px; }
.prose h2 { margin-top: 1.6em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: .35em; }

/* footer */
.site-footer { border-top: 1px solid var(--line); padding: 44px 0 28px; margin-top: 30px; background: var(--bg-soft); font-size: .92rem; }
.footer-grid { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 28px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.site-footer h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--fg-mute); margin-bottom: 10px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.site-footer a { color: var(--fg-soft); }
.copyright { margin-top: 30px; color: var(--fg-mute); font-size: .85rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

/* dashboard */
.dash { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; padding: 28px 0 60px; min-height: 70vh; }
@media (max-width: 860px) { .dash { grid-template-columns: 1fr; } }
.dash-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 80px; align-self: start; }
@media (max-width: 860px) { .dash-nav { flex-direction: row; overflow-x: auto; position: static; border-bottom: 1px solid var(--line); padding-bottom: 8px; } }
.dash-nav a { color: var(--fg-soft); padding: 8px 12px; border-radius: 8px; white-space: nowrap; }
.dash-nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat .label { font-size: .8rem; color: var(--fg-mute); text-transform: uppercase; letter-spacing: .06em; }
.stat .value { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; }
.meter { height: 8px; background: var(--bg-soft); border-radius: 99px; overflow: hidden; margin-top: 8px; border: 1px solid var(--line); }
.meter > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.chart { display: flex; align-items: flex-end; gap: 3px; height: 160px; padding-top: 10px; }
.chart > div { flex: 1; background: color-mix(in srgb, var(--brand) 75%, transparent); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.chart > div:hover { background: var(--brand-2); }
.chart > div:hover::after { content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--fg); color: var(--bg); font-size: .75rem; padding: 3px 7px; border-radius: 6px; white-space: nowrap; margin-bottom: 4px; z-index: 2; }
.auth-box { max-width: 420px; margin: 50px auto; }
.key-reveal { font: 600 .9rem var(--mono); background: var(--ok-soft); color: var(--ok); padding: 12px; border-radius: 8px; word-break: break-all; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.tag-s { font-size: .75rem; padding: 2px 8px; border-radius: 99px; background: var(--bg-soft); border: 1px solid var(--line); }
.tag-s.paid { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.tag-s.pending { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tag-s.needs_review { background: var(--err-soft); color: var(--err); border-color: transparent; }
.qr-pay { display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: start; }
@media (max-width: 640px) { .qr-pay { grid-template-columns: 1fr; } }
.qr-pay img { width: 100%; border-radius: 10px; background: #fff; padding: 6px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: .95rem; }
.kv dt { color: var(--fg-mute); }
.kv dd { margin: 0; font-weight: 600; word-break: break-word; }
.hook-list { display: flex; flex-direction: column; gap: 6px; max-height: 640px; overflow: auto; }
.hook-item { text-align: left; background: var(--bg-card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; cursor: pointer; font: inherit; color: inherit; display: flex; gap: 8px; align-items: center; }
.hook-item.active { border-color: var(--brand); background: var(--brand-soft); }
.hook-item time { margin-left: auto; color: var(--fg-mute); font-size: .78rem; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: .9rem; z-index: 100; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.turnstile-box { margin: 10px 0; min-height: 0; }
