:root {
  --bg: #050a10;
  --surface: #0d1520;
  --surface-2: #121d2a;
  --surface-3: #162437;
  --ink: #f4f8fc;
  --muted: #a7b5c7;
  --line: rgba(104, 143, 194, 0.34);
  --brand: #4d82ff;
  --accent: #83c8ff;
  --good: #79dda8;
  --warn: #f2b869;
  --radius: 10px;
  --max: 1280px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 92px; }
body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(255,255,255,.016) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255,255,255,.014) 1px, transparent 1px),
    var(--bg);
  background-size: 88px 88px, 88px 88px, auto;
  color: var(--ink);
  font-family: "Manrope", sans-serif;
  line-height: 1.65;
}

a { color: inherit; }
img { max-width: 100%; }
code {
  padding: .12em .38em;
  border: 1px solid rgba(131,200,255,.2);
  border-radius: 5px;
  background: rgba(5,10,16,.72);
  color: #d8edff;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .9em;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 9px 13px;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  transform: translateY(-140%);
}
.skip-link:focus { transform: none; }

.topbar {
  position: sticky;
  z-index: 50;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(5,10,16,.91);
  backdrop-filter: blur(18px);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  width: min(calc(100% - 32px), var(--max));
  min-height: 70px;
  margin: 0 auto;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  text-decoration: none;
}
.brand img { border-radius: 8px; }
.topnav { display: flex; gap: 20px; margin-left: auto; }
.topnav a, .footer-links a {
  color: var(--muted);
  font-size: .86rem;
  font-weight: 700;
  text-decoration: none;
}
.topnav a:hover, .footer-links a:hover { color: var(--accent); }

.button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid rgba(131,200,255,.38);
  border-radius: 8px;
  font-weight: 800;
  white-space: nowrap;
  text-decoration: none;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.button:hover { transform: translateY(-1px); }
.button-primary { border-color: var(--brand); background: var(--brand); color: #fff; box-shadow: 0 12px 30px rgba(77,130,255,.2); }
.button-secondary { background: rgba(13,21,32,.8); color: var(--ink); }
.button-secondary:hover { border-color: var(--accent); }
.button-compact { min-height: 38px; padding: 0 14px; font-size: .84rem; }

.docs-hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 17% 40%, rgba(77,130,255,.19), transparent 34%),
    linear-gradient(135deg, rgba(18,29,42,.8), rgba(5,10,16,.4));
}
.docs-hero::after {
  content: "";
  position: absolute;
  right: -140px;
  bottom: -240px;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: rgba(24,104,224,.1);
  filter: blur(80px);
}
.docs-hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, .65fr);
  gap: clamp(34px, 6vw, 84px);
  align-items: end;
  width: min(calc(100% - 32px), var(--max));
  margin: 0 auto;
  padding: clamp(64px, 9vw, 112px) 0;
}
.kicker, .section-index, .toc-label, .hero-card-label {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}
h1, h2, h3 { margin: 0; font-family: "Nunito Sans", "Manrope", sans-serif; line-height: 1.12; }
h1 { max-width: 800px; font-size: clamp(2.8rem, 6.3vw, 5.3rem); }
h2 { font-size: clamp(2rem, 4vw, 3.3rem); }
h3 { font-size: 1.28rem; }
.hero-lead, .lead { color: #d2dfeb; font-size: clamp(1.05rem, 1.8vw, 1.3rem); }
.hero-copy { max-width: 800px; }
.hero-meta, .hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.hero-meta span {
  padding: 7px 10px;
  border: 1px solid rgba(131,200,255,.28);
  border-radius: 6px;
  background: rgba(6,18,32,.7);
  color: #d8edff;
  font-size: .8rem;
  font-weight: 700;
}
.hero-card {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(18,29,42,.92), rgba(7,14,23,.92));
  box-shadow: 0 22px 60px rgba(0,0,0,.35), 0 0 0 1px rgba(121,170,234,.06);
}
.hero-card strong { display: block; font: 800 1.25rem "Nunito Sans", sans-serif; }
.hero-card p { color: var(--muted); }
.hero-card code { display: block; overflow-wrap: anywhere; }

.docs-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: clamp(38px, 6vw, 86px);
  width: min(calc(100% - 32px), var(--max));
  margin: 0 auto;
  padding: 50px 0 100px;
}
.toc {
  position: sticky;
  top: 98px;
  align-self: start;
  max-height: calc(100vh - 120px);
  padding: 18px 0;
  overflow: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.toc a {
  display: block;
  padding: 5px 0;
  color: var(--muted);
  font-size: .82rem;
  text-decoration: none;
}
.toc a:hover { color: var(--accent); }
.docs-content { min-width: 0; max-width: 930px; }
.doc-section {
  padding: 74px 0;
  border-bottom: 1px solid var(--line);
}
.doc-section:first-child { padding-top: 18px; }
.doc-section > h2 { margin-bottom: 24px; }
.doc-section > h3 { margin: 42px 0 18px; }
.doc-section > p { color: var(--muted); font-size: 1rem; }

.mode-grid, .definition-grid, .troubleshooting-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}
.mode-card, .definition-grid > div, .troubleshooting-grid article {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(13,21,32,.76);
}
.mode-card h3 { margin-top: 14px; }
.mode-card p, .definition-grid p, .troubleshooting-grid p { margin-bottom: 0; color: var(--muted); }
.mode-tag {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.mode-tag-review { background: rgba(77,130,255,.15); color: var(--accent); }
.mode-tag-merge { background: rgba(121,221,168,.13); color: var(--good); }
.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 18px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}
.facts div { padding: 15px; background: var(--surface); }
.facts strong, .facts span { display: block; }
.facts span { margin-top: 4px; color: var(--muted); font-size: .82rem; }

.callout {
  display: grid;
  grid-template-columns: max-content minmax(0,1fr);
  gap: 16px;
  margin-top: 22px;
  padding: 16px 18px;
  border: 1px solid;
  border-radius: 8px;
  background: rgba(13,21,32,.8);
}
.callout strong { font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; }
.callout p { margin: 0; color: #d6e0eb; }
.callout-info { border-color: rgba(77,130,255,.58); }
.callout-info strong { color: var(--accent); }
.callout-success { border-color: rgba(121,221,168,.52); }
.callout-success strong { color: var(--good); }
.callout-warning { border-color: rgba(242,184,105,.52); }
.callout-warning strong { color: var(--warn); }

.steps { padding: 0; margin: 30px 0; list-style: none; counter-reset: steps; }
.steps li {
  display: grid;
  grid-template-columns: 42px 160px minmax(0,1fr);
  gap: 14px;
  align-items: baseline;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  counter-increment: steps;
}
.steps li::before {
  content: counter(steps, decimal-leading-zero);
  color: var(--accent);
  font: 800 .78rem "Manrope", sans-serif;
}
.steps span { font-weight: 800; }
.steps p { margin: 0; color: var(--muted); }

figure {
  margin: 28px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(16,24,36,.96), rgba(8,13,21,.96));
  box-shadow: 0 18px 60px rgba(0,0,0,.3), 0 0 0 1px rgba(121,170,234,.06);
}
figure img { display: block; width: 100%; height: auto; border-radius: 7px; }
.screenshot-trigger {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  cursor: zoom-in;
  text-align: left;
}
.screenshot-trigger img { transition: filter .18s ease; }
.screenshot-trigger:hover img { filter: brightness(1.08); }
.screenshot-trigger::after {
  content: "Click to zoom";
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 6px 9px;
  border: 1px solid rgba(131,200,255,.35);
  border-radius: 6px;
  background: rgba(5,10,16,.82);
  color: var(--ink);
  font-size: .72rem;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity .18s ease, transform .18s ease;
}
.screenshot-trigger:hover::after,
.screenshot-trigger:focus-visible::after { opacity: 1; transform: none; }
.screenshot-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
figcaption { padding: 11px 4px 2px; color: var(--muted); font-size: .82rem; }
figcaption span {
  display: inline-grid;
  place-items: center;
  width: 21px;
  height: 21px;
  margin: 0 4px 0 10px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: .7rem;
  font-weight: 800;
}
figcaption span:first-child { margin-left: 0; }

.image-lightbox {
  width: min(96vw, 1800px);
  max-width: none;
  max-height: 96vh;
  margin: auto;
  padding: 16px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(5,10,16,.98);
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(0,0,0,.62);
}
.image-lightbox::backdrop { background: rgba(1,4,8,.9); backdrop-filter: blur(8px); }
.image-lightbox-image {
  display: block;
  width: auto;
  max-width: calc(96vw - 32px);
  max-height: calc(90vh - 64px);
  margin: auto;
  border-radius: 6px;
  object-fit: contain;
}
.image-lightbox-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(131,200,255,.38);
  border-radius: 50%;
  background: rgba(13,21,32,.92);
  color: var(--ink);
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
}
.image-lightbox-close:hover { border-color: var(--accent); }
.image-lightbox-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.image-lightbox-caption {
  margin: 12px 52px 0;
  color: var(--muted);
  font-size: .82rem;
  text-align: center;
}

.number-list { padding-left: 1.35rem; }
.number-list li { margin: 9px 0; padding-left: 8px; color: #dce5ee; }
.number-list li::marker { color: var(--accent); font-weight: 800; }
.number-list.compact li { margin: 5px 0; }
.check-list { padding: 0; list-style: none; }
.check-list li { position: relative; margin: 10px 0; padding-left: 26px; color: #dce5ee; }
.check-list li::before { content: ""; position: absolute; top: .66em; left: 0; width: 8px; height: 8px; border: 2px solid var(--accent); border-radius: 2px; transform: translateY(-50%); }
.split-figure { display: grid; grid-template-columns: minmax(0,1.45fr) minmax(230px,.55fr); gap: 24px; align-items: center; }
.split-figure > div { padding: 22px; border-left: 1px solid var(--line); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; min-width: 700px; }
th, td { padding: 15px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--surface-2); font-size: .82rem; }
td { color: #d7e1eb; font-size: .9rem; }
tbody tr:last-child td { border-bottom: 0; }

.download-card {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  align-items: center;
  margin-top: 70px;
  padding: 34px;
  border: 1px solid rgba(77,130,255,.55);
  border-radius: 12px;
  background: radial-gradient(circle at left, rgba(77,130,255,.18), transparent 48%), var(--surface);
}
.download-card h2 { font-size: clamp(1.7rem,3vw,2.5rem); }
.download-card p:not(.section-index) { margin-bottom: 0; color: var(--muted); }
.footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  width: min(calc(100% - 32px), var(--max));
  margin: 0 auto;
  padding: 36px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.footer p { margin: 6px 0 0; font-size: .82rem; }
.footer-links { display: flex; gap: 20px; }

@media (max-width: 980px) {
  .topnav { display: none; }
  .topbar-inner .button { margin-left: auto; }
  .docs-hero-inner { grid-template-columns: 1fr; }
  .docs-layout { grid-template-columns: 1fr; }
  .toc { position: static; display: flex; gap: 10px; overflow-x: auto; max-height: none; white-space: nowrap; }
  .toc-label { display: none; }
  .toc a { padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; }
}

@media (max-width: 700px) {
  .topbar-inner { gap: 10px; }
  .brand span { display: none; }
  .docs-hero-inner { padding: 56px 0; }
  h1 { font-size: 2.65rem; }
  .mode-grid, .definition-grid, .troubleshooting-grid, .facts, .split-figure { grid-template-columns: 1fr; }
  .steps li { grid-template-columns: 34px minmax(0,1fr); }
  .steps p { grid-column: 2; }
  .callout { grid-template-columns: 1fr; gap: 5px; }
  .split-figure > div { border-top: 1px solid var(--line); border-left: 0; }
  .download-card, .footer { align-items: flex-start; flex-direction: column; }
  .footer-links { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
