:root {
  --bg: #0a0c10;
  --bg-card: #131620;
  --bg-elev: #1a1e2a;
  --bg-deep: #06080c;
  --fg: #e8e9ee;
  --fg-dim: #8b8e9a;
  --fg-faint: #5a5d6a;
  --nav-fg: #d4d8e2;
  --accent: #4a90e2;
  --accent-bright: #6aa8ff;
  --accent-purple: #9d7ce6;
  --accent-warm: #f59797;
  --accent-dim: #4a90e220;
  --accent-glow: #4a90e215;
  --line: #1f2330;
  --line-bright: #2c3140;
  --good: #4ade80;
  --warn: #fbbf24;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 90% 45% at 50% 0%, rgba(74,144,226,0.08), transparent 62%),
    radial-gradient(ellipse 55% 35% at 86% 28%, rgba(157,124,230,0.05), transparent 70%),
    var(--bg);
  color: var(--fg);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

code,
pre,
.mono {
  font-family: "JetBrains Mono", "Cascadia Mono", Consolas, ui-monospace, monospace;
}

a { color: var(--fg); text-decoration: none; }
a:hover { color: var(--accent-bright); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 60px;
  border-bottom: 1px solid var(--line);
  background: rgba(10,12,16,0.88);
  backdrop-filter: blur(12px);
}

.topbar-inner {
  width: min(1520px, calc(100vw - 48px));
  height: 60px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.logo svg {
  width: 22px;
  height: 22px;
}

.logo span { color: var(--accent); }

.top-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.top-links a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--nav-fg);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.top-links a:hover,
.top-links a.active {
  color: var(--accent-bright);
  border-color: var(--line-bright);
  background: var(--bg-card);
}

.top-links .button-link {
  border-color: var(--line);
  background: var(--bg-card);
}

.shell {
  width: min(1520px, calc(100vw - 48px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  gap: 36px;
  padding: 34px 0 72px;
}

.home-shell {
  width: min(1180px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 34px 0 72px;
}

.sidebar {
  position: sticky;
  top: 84px;
  height: calc(100vh - 108px);
  overflow: auto;
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    radial-gradient(ellipse 80% 40% at 0% 0%, rgba(74,144,226,0.10), transparent 64%),
    var(--bg-card);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.045),
    0 10px 30px -18px rgba(0,0,0,0.55);
  scrollbar-width: thin;
  scrollbar-color: var(--line-bright) transparent;
}

.sidebar::-webkit-scrollbar,
.toc::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.sidebar::-webkit-scrollbar-track,
.toc::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb,
.toc::-webkit-scrollbar-thumb {
  background: var(--line-bright);
  border-radius: 999px;
}

.sidebar-head {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.sidebar-title,
.nav-label,
.section-tag,
.eyebrow,
.topic-number,
.code-title {
  font-family: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
}

.sidebar-title {
  color: var(--accent-bright);
  font-size: 12px;
  letter-spacing: 0.08em;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.search {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line-bright);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  padding: 0 12px;
  font: inherit;
  outline: none;
}

.search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.nav-group {
  padding: 16px 12px 4px;
}

.nav-label {
  color: var(--fg-faint);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0 8px 7px;
}

.toc a {
  display: flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--nav-fg);
  font-size: 13px;
  font-weight: 600;
}

.toc a:hover,
.toc a.active {
  color: var(--accent-bright);
  border-color: var(--line-bright);
  background: rgba(74,144,226,0.08);
}

[hidden] { display: none !important; }

.content {
  min-width: 0;
}

.hero,
.doc-header {
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    radial-gradient(ellipse 55% 70% at 18% 0%, rgba(74,144,226,0.18), transparent 62%),
    radial-gradient(ellipse 45% 70% at 100% 20%, rgba(157,124,230,0.12), transparent 66%),
    var(--bg-card);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.05),
    0 18px 44px -24px rgba(0,0,0,0.65);
  padding: 34px;
  margin-bottom: 24px;
}

.hero {
  text-align: left;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 0 12px;
  border: 1px solid var(--line-bright);
  border-radius: 100px;
  color: var(--fg-dim);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 18px;
}

.eyebrow::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-bright);
}

h1 {
  font-size: clamp(34px, 4.2vw, 58px);
  line-height: 1.04;
  letter-spacing: -0.035em;
  font-weight: 850;
  margin-bottom: 16px;
}

h1 em {
  font-style: normal;
  background: linear-gradient(120deg, #6aa8ff 0%, #9d7ce6 55%, #f59797 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  max-width: 820px;
  color: var(--fg-dim);
  font-size: 17px;
  line-height: 1.62;
  margin-bottom: 0;
}

.quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.quick-row a,
.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 9px 13px;
  border: 1px solid var(--line-bright);
  border-radius: 8px;
  background: rgba(10,12,16,0.42);
  color: var(--fg);
  font-size: 13px;
  font-weight: 700;
}

.quick-row a.primary {
  background: linear-gradient(135deg, #4a90e2, #6aa8ff);
  border-color: rgba(106,168,255,0.38);
  color: #fff;
}

.topic-grid,
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.topic-card,
.card,
.doc-section,
details {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(19,22,32,0.86);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.045),
    0 10px 30px -18px rgba(0,0,0,0.55);
}

.topic-card,
.card {
  padding: 18px;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.topic-card:hover,
.card:hover {
  transform: translateY(-2px);
  border-color: rgba(157,124,230,0.32);
  background: var(--bg-elev);
}

.topic-number {
  color: var(--accent-bright);
  font-size: 12px;
  letter-spacing: 0.08em;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.topic-card h2,
.card h3 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.topic-card p,
.card p {
  color: var(--fg-dim);
  font-size: 13px;
  line-height: 1.55;
  margin: 0;
}

.doc-section {
  scroll-margin-top: 84px;
  padding: 28px;
  margin-bottom: 18px;
}

.doc-section.deep {
  background:
    radial-gradient(ellipse 70% 70% at 100% 0%, rgba(74,144,226,0.10), transparent 64%),
    var(--bg-deep);
  border-color: var(--line-bright);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 18px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.section-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--accent-dim);
  color: var(--accent-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.section-icon svg {
  width: 23px;
  height: 23px;
}

.section-tag {
  color: var(--accent-bright);
  font-size: 12px;
  letter-spacing: 0.08em;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 3px;
}

h2 {
  font-size: clamp(24px, 2.5vw, 34px);
  line-height: 1.12;
  letter-spacing: -0.025em;
  font-weight: 800;
}

h3 {
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: -0.015em;
  font-weight: 750;
  margin: 26px 0 10px;
}

p {
  color: var(--fg-dim);
  margin-bottom: 12px;
}

.intro {
  color: var(--fg-dim);
  font-size: 16px;
  max-width: 880px;
}

ul,
ol {
  color: var(--fg-dim);
  padding-left: 20px;
  margin: 10px 0 0;
}

li + li {
  margin-top: 8px;
}

li strong {
  color: var(--fg);
}

code {
  color: var(--fg);
  background: rgba(6,8,12,0.84);
  border: 1px solid rgba(44,49,64,0.78);
  border-radius: 5px;
  padding: 0.08rem 0.3rem;
  font-size: 0.9em;
}

.code-block {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.045) 0 34px, transparent 34px),
    var(--bg-deep);
  overflow: hidden;
}

.code-title {
  height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  color: var(--fg-faint);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.window-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 13px 0 0 var(--accent-purple), 26px 0 0 var(--accent-warm);
  margin-right: 28px;
}

pre {
  overflow-x: auto;
  padding: 18px;
  color: var(--fg);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

pre code {
  display: block;
  background: transparent;
  border: 0;
  padding: 0;
  font-size: 12.5px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  color: var(--fg-dim);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

tr:last-child td {
  border-bottom: 0;
}

th {
  color: var(--fg);
  background: rgba(74,144,226,0.08);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.note {
  margin-top: 18px;
  padding: 15px 16px;
  border: 1px solid var(--line-bright);
  border-left: 3px solid var(--accent-bright);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-glow), transparent 60%), var(--bg-card);
  color: var(--fg-dim);
  font-size: 14px;
}

.note strong {
  color: var(--fg);
}

.screenshot-needed {
  margin: 18px 0;
  min-height: 210px;
  border: 1px dashed rgba(106,168,255,0.48);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(74,144,226,0.10), transparent 58%),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.035) 0 1px, transparent 1px 24px),
    var(--bg-deep);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 22px;
  color: var(--fg-dim);
}

.screenshot-needed strong {
  color: var(--accent-bright);
  font-family: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.screenshot-needed span {
  max-width: 720px;
}

.workflow-shot {
  margin: 18px 0;
  border: 1px solid var(--line-bright);
  border-radius: 12px;
  background: var(--bg-deep);
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.045),
    0 14px 36px -24px rgba(0,0,0,0.7);
}

.workflow-shot img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--bg-deep);
}

.workflow-shot-link {
  display: block;
  cursor: zoom-in;
}

.workflow-shot-link:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: -2px;
}

.workflow-shot figcaption {
  border-top: 1px solid var(--line);
  padding: 12px 14px;
  color: var(--fg-dim);
  font-size: 13px;
  line-height: 1.5;
}

.workflow-shot figcaption strong {
  color: var(--fg);
}

.workflow-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.workflow-preview {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(19,22,32,0.86);
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.045),
    0 10px 30px -18px rgba(0,0,0,0.55);
}

.workflow-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: center;
  background: var(--bg-deep);
}

.workflow-preview-body {
  padding: 16px;
}

.workflow-preview-body h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.workflow-preview-body p {
  margin: 0;
  color: var(--fg-dim);
  font-size: 13px;
}

.step-list {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
}

.step-list li {
  counter-increment: step;
  position: relative;
  padding: 14px 16px 14px 48px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(10,12,16,0.28);
  color: var(--fg-dim);
}

.step-list li + li {
  margin-top: 10px;
}

.step-list li::before {
  content: counter(step);
  position: absolute;
  left: 14px;
  top: 14px;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--accent-dim);
  color: var(--accent-bright);
  display: grid;
  place-items: center;
  font-family: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
}

details {
  margin-top: 10px;
  padding: 0 18px;
}

details[open] {
  border-color: var(--line-bright);
}

summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 0;
  color: var(--fg);
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

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

summary::after {
  content: "+";
  color: var(--accent-bright);
  font-size: 22px;
  line-height: 1;
}

details[open] summary::after {
  transform: rotate(45deg);
}

details p {
  padding-bottom: 16px;
  font-size: 14px;
}

.footer {
  color: var(--fg-faint);
  font-size: 12px;
  padding-top: 20px;
}

@media (max-width: 1040px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 70px;
    z-index: 10;
    height: auto;
    max-height: 330px;
    margin-bottom: 4px;
    overflow: hidden;
  }

  .sidebar-head {
    padding: 14px;
  }

  .toc {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 12px 12px;
    scroll-snap-type: x proximity;
  }

  .nav-group {
    min-width: 190px;
    padding: 12px 0 0;
    scroll-snap-align: start;
  }

  .topic-grid,
  .grid,
  .grid.two,
  .workflow-preview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .top-links {
    display: none;
  }

  .topbar-inner,
  .shell,
  .home-shell {
    width: min(100vw - 28px, 1520px);
  }

  .shell,
  .home-shell {
    padding-top: 20px;
  }

  .hero,
  .doc-header,
  .doc-section {
    padding: 20px;
  }

  .topic-grid,
  .grid,
  .grid.two,
  .workflow-preview-grid {
    grid-template-columns: 1fr;
  }

  .section-title {
    align-items: flex-start;
  }
}
