:root {
  --bg: #080405;
  --panel: #14090b;
  --border: rgba(255, 70, 80, 0.18);
  --text: #fff3f3;
  --muted: #a8989a;
  --red: #e11d2e;
  --red2: #9f1239;
  --ok: #4ade80;
  --font: Inter, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(1000px 500px at 0% 0%, rgba(225, 29, 46, 0.18), transparent 50%),
    radial-gradient(800px 400px at 100% 20%, rgba(80, 0, 20, 0.25), transparent 45%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  padding-left: var(--safe-l);
  padding-right: var(--safe-r);
}
a { color: #ff8a93; text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { width: min(1180px, calc(100% - 1.5rem)); margin: 0 auto; }
.muted { color: var(--muted); }
code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: #0d0608;
  border: 1px solid var(--border);
  padding: 0.1em 0.35em;
  border-radius: 6px;
  word-break: break-word;
}

.top {
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(8, 4, 5, 0.92);
  border-bottom: 1px solid var(--border);
}
.top-inner {
  display: flex; justify-content: space-between; align-items: center;
  gap: 0.75rem; padding: calc(0.7rem + var(--safe-t)) 0 0.7rem; flex-wrap: wrap;
}
.brand { display: flex; gap: 0.65rem; align-items: center; min-width: 0; flex: 1; order: 1; }
.brand strong { display: block; font-size: 0.98rem; }
.brand span { color: var(--muted); font-size: 0.8rem; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 900;
  background: linear-gradient(135deg, var(--red), var(--red2)); color: #fff;
  box-shadow: 0 8px 22px rgba(225, 29, 46, 0.35);
}
.top-actions { display: flex; align-items: center; gap: 0.45rem; flex-shrink: 0; order: 3; }
.top-nav {
  display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center;
  font-size: 0.9rem; order: 2; flex: 1 1 auto; justify-content: flex-end;
}
.top-nav a { color: var(--muted); }
.top-nav a:hover { color: #fff; text-decoration: none; }

.btn-menu {
  display: none; width: 44px; height: 44px; border-radius: 12px;
  border: 1px solid var(--border); background: #1a0b0e; color: var(--text);
  font-size: 1.25rem; place-items: center; cursor: pointer; padding: 0;
}
.btn-dash {
  background: linear-gradient(180deg, #ef233c, #b91c1c);
  color: #fff !important;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.86rem;
  white-space: nowrap;
  text-decoration: none !important;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}
.btn-copy {
  border: 1px solid rgba(225, 29, 46, 0.45);
  background: rgba(225, 29, 46, 0.12);
  color: #ffc9cd; font: inherit; font-weight: 700; font-size: 0.86rem;
  padding: 0.45rem 0.8rem; border-radius: 999px; cursor: pointer;
  min-height: 40px; white-space: nowrap;
}
.btn-copy:hover { background: rgba(225, 29, 46, 0.22); }
.btn-copy.copied { background: rgba(74, 222, 128, 0.15); border-color: rgba(74,222,128,0.4); color: #bbf7d0; }
.btn-copy.big { width: 100%; border-radius: 12px; padding: 0.75rem 1rem; white-space: normal; }

.nav-backdrop {
  display: none; position: fixed; inset: 0; z-index: 40;
  background: rgba(0,0,0,0.55); border: 0; margin: 0; padding: 0;
}
body.nav-open .nav-backdrop { display: block; }
body.nav-open { overflow: hidden; }
.nav-drawer {
  display: none; flex-direction: column; gap: 0.3rem;
  position: fixed; top: 0; right: 0; bottom: 0; width: min(320px, 88vw);
  z-index: 50; background: #100608; border-left: 1px solid var(--border);
  padding: calc(0.85rem + var(--safe-t)) 0.85rem calc(1rem + var(--safe-b));
  transform: translateX(105%); transition: transform 0.22s ease;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
body.nav-open .nav-drawer { transform: translateX(0); box-shadow: -12px 0 40px rgba(0,0,0,0.5); }
.nav-drawer a {
  color: var(--muted); padding: 0.65rem 0.55rem; border-radius: 10px;
  font-size: 0.95rem; min-height: 44px; display: flex; align-items: center;
}
.nav-drawer a:hover { background: #1a0b0e; color: #fff; text-decoration: none; }

.layout {
  display: grid; grid-template-columns: 230px 1fr; gap: 1.5rem;
  padding: 1.5rem 0 calc(3rem + var(--safe-b)); align-items: start;
}
.side {
  position: sticky; top: 72px; background: rgba(20, 9, 11, 0.75);
  border: 1px solid var(--border); border-radius: 14px; padding: 0.9rem;
  display: flex; flex-direction: column; gap: 0.3rem;
  max-height: calc(100dvh - 90px); overflow-y: auto;
}
.side-title {
  margin: 0 0 0.4rem; font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted);
}
.side a {
  color: var(--muted); padding: 0.45rem 0.5rem; border-radius: 8px;
  font-size: 0.9rem; min-height: 40px; display: flex; align-items: center;
}
.side a:hover { background: #1a0b0e; color: #fff; text-decoration: none; }

.content { min-width: 0; width: 100%; }
.content section {
  background: linear-gradient(180deg, rgba(24,10,12,0.95), rgba(12,6,8,0.95));
  border: 1px solid var(--border); border-radius: 16px;
  padding: 1.25rem; margin-bottom: 0.9rem; overflow: hidden;
}
.content h1 {
  margin: 0 0 0.55rem; font-size: clamp(1.35rem, 5vw, 1.8rem);
  letter-spacing: -0.02em; line-height: 1.25;
}
.content h2 { margin: 0 0 0.7rem; font-size: clamp(1.1rem, 4vw, 1.28rem); }
.content h3 { margin: 1rem 0 0.45rem; font-size: 1rem; color: #ffc9cd; }
.lead { font-size: 1rem; color: #d8c5c7; }

.hero-actions {
  display: flex; flex-wrap: wrap; gap: 0.65rem; align-items: center;
  margin-bottom: 1rem; padding: 0.85rem;
  background: rgba(225, 29, 46, 0.08);
  border: 1px solid rgba(225, 29, 46, 0.28);
  border-radius: 14px;
}
.badge {
  display: inline-block; font-size: 0.72rem; font-weight: 800;
  padding: 0.2rem 0.5rem; border-radius: 999px;
  background: rgba(225,29,46,0.18); color: #ffb4b9;
  border: 1px solid rgba(225,29,46,0.35);
}

.callout {
  background: #0d0608; border: 1px solid var(--border);
  border-radius: 12px; padding: 0.85rem; margin-top: 0.9rem;
}
pre.code, .callout pre {
  font-family: var(--mono); font-size: 0.78rem;
  background: #080304; border: 1px solid var(--border);
  border-radius: 12px; padding: 0.85rem;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  line-height: 1.5; white-space: pre; max-width: 100%;
}
.callout pre { margin: 0.45rem 0 0; border: 0; background: transparent; padding: 0; white-space: pre-wrap; word-break: break-word; }

.endpoint {
  display: flex; align-items: center; gap: 0.5rem;
  margin: 0.5rem 0 0.75rem; flex-wrap: wrap;
}
.method {
  font-family: var(--mono); font-size: 0.72rem; font-weight: 800;
  padding: 0.25rem 0.5rem; border-radius: 6px; flex-shrink: 0;
}
.method.post { background: rgba(225,29,46,0.2); color: #ffb4b9; }
.method.get { background: rgba(74,222,128,0.12); color: #86efac; }

.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0.5rem 0; border-radius: 10px; }
table { width: 100%; min-width: 480px; border-collapse: collapse; font-size: 0.86rem; margin: 0; }
th, td { text-align: left; padding: 0.55rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; }
.tip {
  background: rgba(225,29,46,0.08); border-left: 3px solid var(--red);
  padding: 0.55rem 0.75rem; border-radius: 0 10px 10px 0;
  color: #ffd4d7; font-size: 0.9rem;
}
.steps { margin: 0; padding-left: 1.15rem; }
.steps li { margin: 0.4rem 0; }
.checklist { padding-left: 1.1rem; }
.checklist li { margin: 0.35rem 0; }

.toast {
  position: fixed; bottom: calc(1.2rem + var(--safe-b)); left: 50%;
  transform: translateX(-50%) translateY(12px); z-index: 100;
  background: #120608; border: 1px solid rgba(74,222,128,0.45);
  color: #bbf7d0; font-weight: 700; padding: 0.75rem 1.1rem;
  border-radius: 12px; opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s; max-width: calc(100vw - 2rem);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.foot {
  margin-top: 1.25rem; padding: 1rem 0 0.5rem;
  border-top: 1px solid var(--border); color: var(--muted); font-size: 0.88rem;
}

@media (max-width: 900px) {
  .wrap { width: calc(100% - 1rem); }
  .btn-menu { display: grid; }
  .top-nav.desktop-only { display: none !important; }
  .top-inner { flex-wrap: nowrap; }
  .layout { grid-template-columns: 1fr; gap: 0.85rem; padding: 0.85rem 0 calc(2rem + var(--safe-b)); }
  .side { display: none; }
  .nav-drawer { display: flex; }
  .content section { padding: 1rem 0.9rem; border-radius: 14px; }
  .grid2 { grid-template-columns: 1fr; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  pre.code { font-size: 0.72rem; }
  table { min-width: 420px; font-size: 0.8rem; }
}
@media (max-width: 420px) {
  .brand span { display: none; }
}
