:root {
  --bg-color: #0b0f19;
  --card-bg: rgba(17, 24, 39, 0.75);
  --card-border: rgba(255, 255, 255, 0.08);
  --accent-green: #10b981;
  --accent-green-glow: rgba(16, 185, 129, 0.25);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-image:
    radial-gradient(circle at 15% 15%, rgba(59, 130, 246, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(16, 185, 129, 0.12) 0%, transparent 40%);
}

header.topbar {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem 1rem;
  backdrop-filter: blur(12px);
  background: rgba(11, 15, 25, 0.92);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: nowrap;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
}

.logo-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
  display: block;
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
  min-width: 0;
  overflow-x: auto;
  flex-wrap: nowrap;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.tabs::-webkit-scrollbar { display: none; }

.tabs a {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  padding: 0.38rem 0.72rem;
  border-radius: 999px;
  border: 1px solid transparent;
}

.tabs a:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

.tabs a.on {
  color: #d1fae5;
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.35);
}

:root {
  --shell: 1240px;
  --read: 920px;
  --pad: 28px;
  --card-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.shell {
  width: min(var(--shell), 100%);
  margin: 0 auto;
  padding: 12px var(--pad) 28px;
}

main.legal {
  width: auto;
  max-width: var(--read);
  margin: 0;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  box-shadow: var(--card-shadow);
  padding: 1.15rem 1.25rem 1.3rem;
}

main.plain { width: auto; max-width: none; }

main.legal h2, main.plain h2 { font-size: 1.45rem; letter-spacing: -0.03em; line-height: 1.25; margin-bottom: 0.45rem; }
main.legal h3 { font-size: 1rem; margin: 0.95rem 0 0.35rem; display: flex; align-items: flex-start; gap: 0.4rem; }
main.legal p, main.legal li, main.plain p, main.plain li { color: #d1d5db; line-height: 1.55; font-size: 0.94rem; }
main.legal p + p { margin-top: 0.6rem; }
main.legal ul, main.legal ol { margin: 0.6rem 0 0 1.15rem; }
main.legal li { margin: 0.3rem 0; }
main.legal code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
  padding: 0.08rem 0.35rem;
  border-radius: 6px;
}
main.legal a, main.plain a, .card a, .docs-main a { color: #6ee7b7; }
.card code, .docs-main code, main.plain code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
  padding: 0.08rem 0.35rem;
  border-radius: 6px;
}
main.legal h2 { line-height: 1.25; }
.kicker {
  color: var(--accent-green);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}
.guide-grid, .endpoint-grid, .split-2, .link-grid {
  display: grid;
  gap: 12px;
  margin-top: 0.75rem;
}
.guide-grid, .endpoint-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.endpoint-grid.pairs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.split-2, .link-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
a.guide-card, .card, .endpoint {
  display: block;
  padding: 0.85rem 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  text-decoration: none;
  background: rgba(17, 24, 39, 0.82);
  box-shadow: var(--card-shadow);
  min-width: 0;
}
a.guide-card strong::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 99px;
  background: var(--accent-green);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.16);
  flex: none;
}
a.guide-card strong { display: flex; align-items: center; gap: 0.45rem; color: var(--text-main); margin-bottom: 0.28rem; font-size: 0.98rem; font-weight: 700; }
a.guide-card span { color: var(--text-muted); font-size: 0.92rem; line-height: 1.55; }
a.guide-card:hover { border-color: rgba(16, 185, 129, 0.45); }
.table-scroll { overflow-x: auto; margin: 0.75rem 0 1rem; }
.table-scroll table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.table-scroll th, .table-scroll td {
  border: 1px solid var(--card-border);
  padding: 0.45rem 0.55rem;
  text-align: left;
  vertical-align: top;
}
.table-scroll th { color: var(--accent-green); font-weight: 600; }
.contact-form { display: grid; gap: 0.75rem; margin-top: 0.9rem; }
.contact-form label { display: grid; gap: 0.32rem; color: var(--text-main); font-size: 0.88rem; font-weight: 600; }
.contact-form input, .contact-form textarea {
  width: 100%;
  padding: 0.7rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text-main);
  font: inherit;
  font-size: 16px;
}
.contact-form button {
  justify-self: start;
  background: var(--accent-green);
  color: #04110b;
  border: 0;
  border-radius: 10px;
  padding: 0.72rem 1.05rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.form-note { font-size: 0.85rem !important; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent-green);
  outline-offset: 2px;
}

.cta-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.1rem 0 0.3rem; }
a.cta, a.cta-ghost {
  display: inline-block;
  padding: 0.7rem 1.05rem;
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
  font-size: 0.92rem;
}
main.legal a.cta,
a.cta { background: var(--accent-green); color: #04110b; }
main.legal a.cta-ghost,
a.cta-ghost { border: 1px solid var(--card-border); color: var(--text-main); }
pre.sample {
  overflow-x: auto;
  max-width: 100%;
  background: #070b14;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.08);
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  margin-top: 0.45rem;
  color: #e5e7eb;
}

.email {
  display: inline-block;
  margin-top: 0.85rem;
  padding: 0.7rem 0.95rem;
  border-radius: 10px;
  background: rgba(16, 185, 129, 0.16);
  color: var(--accent-green);
  text-decoration: none;
  font-weight: 700;
}

footer {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
  padding: 0 1rem 1.5rem;
}

footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 0.9rem;
  margin-bottom: 0.55rem;
}

footer a { color: var(--text-muted); text-decoration: none; }
footer a:hover { color: var(--text-main); }

.read-grid, .docs-shell {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  min-width: 0;
}

.read-grid main.legal { max-width: var(--read); }

.docs-shell { grid-template-columns: 210px minmax(0, 1fr); }
.docs-main { min-width: 0; display: grid; gap: 12px; }
.endpoint h3, .card h2, .card h3 { margin-top: 0; }
.sidemenu, .toc {
  position: sticky;
  top: 4.1rem;
}

.toc, .sidemenu {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background: rgba(17, 24, 39, 0.72);
  box-shadow: var(--card-shadow);
}

.toc-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-green);
}

.toc a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.82rem;
  line-height: 1.35;
}

.toc a:hover { color: var(--text-main); }

.related { margin-top: 0.9rem; }
.related h2 { font-size: 1.05rem; margin-bottom: 0.55rem; }

svg.mark {
  width: 1.25rem;
  height: 1.25rem;
  margin-right: 0.45rem;
  flex: none;
  stroke: var(--accent-green);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

main.legal h3 { align-items: flex-start; }
svg.mark { color: var(--accent-green); }
.sidemenu a, .toc a { color: var(--text-muted); text-decoration: none; font-size: 0.82rem; line-height: 1.35; }
.sidemenu a:hover, .toc a:hover { color: var(--text-main); }
.shell, .card, main.legal, .docs-main, .read-grid { min-width: 0; }
main.legal p, .card p, main.plain p { overflow-wrap: anywhere; }
main.plain a { color: var(--accent-green); }
main.plain h3 { font-size: 1rem; margin: 0.75rem 0 0.3rem; color: var(--text-main); }
.card h3:first-of-type, .card > h3:first-child { margin-top: 0; }
ol.steps { list-style: none; margin: 0.55rem 0 0.2rem; padding: 0; counter-reset: step; }
ol.steps li { position: relative; margin: 0; padding: 0.7rem 0.75rem 0.7rem 2rem; border: 1px solid rgba(255,255,255,0.1); border-radius: 12px; background: rgba(0,0,0,0.22); }
ol.steps li::before { counter-increment: step; content: counter(step); position: absolute; left: 0.7rem; top: 0.65rem; color: var(--accent-green); font-weight: 700; }
.related { margin-top: 14px; }
.related h2 { font-size: 1.05rem; margin: 0 0 0.4rem; }

details.faq {
  border-top: 1px solid var(--card-border);
  padding: 0.15rem 0;
}

details.faq:last-of-type { border-bottom: 1px solid var(--card-border); margin-bottom: 0.4rem; }

details.faq summary {
  cursor: pointer;
  color: var(--text-main);
  font-weight: 600;
  padding: 0.75rem 0.15rem;
  list-style: none;
}

details.faq summary::-webkit-details-marker { display: none; }

details.faq summary::before {
  content: "+";
  display: inline-block;
  width: 1.15rem;
  color: var(--accent-green);
  font-weight: 700;
}

details.faq[open] summary::before { content: "–"; }

details.faq p { margin: 0 0 0.85rem 1.15rem; }

@media (max-width: 980px) {
  .guide-grid, .endpoint-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  :root { --pad: 16px; }
  header.topbar { flex-wrap: wrap; padding: 0.65rem 16px 0.45rem; }
  .tabs { width: 100%; margin-left: 0; padding-bottom: 0.15rem; }
  .shell { padding: 10px 16px 22px; }
  .read-grid, .docs-shell, .split-2, .link-grid, .guide-grid, .endpoint-grid, .endpoint-grid.pairs { grid-template-columns: 1fr; }
  .toc, .sidemenu {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    gap: 0.65rem;
    scrollbar-width: none;
  }
  .toc::-webkit-scrollbar, .sidemenu::-webkit-scrollbar { display: none; }
  .toc a, .sidemenu a { white-space: nowrap; }
  .toc-label { display: none; }
  main.legal { padding: 0.95rem 0.9rem 1.05rem; max-width: none; }
  .contact-form button { width: 100%; }
  .read-grid main.legal { max-width: none; }
}
