:root {
  --bg: #08111f;
  --panel: rgba(10, 22, 42, 0.88);
  --panel-soft: rgba(255,255,255,0.05);
  --line: rgba(157, 184, 255, 0.16);
  --line-strong: rgba(56, 189, 248, 0.34);
  --text: #eef4ff;
  --muted: #9fb1cf;
  --brand: #f59e0b;
  --accent: #38bdf8;
  --shadow: 0 24px 60px rgba(3, 8, 18, 0.45);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--text);
  font-family: "Inter", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.16), transparent 26%),
    radial-gradient(circle at 85% 12%, rgba(245, 158, 11, 0.18), transparent 22%),
    linear-gradient(180deg, #07101c 0%, #0c1730 58%, #0a1325 100%);
}
header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px);
  background: rgba(5, 12, 24, 0.82);
  border-bottom: 1px solid var(--line);
}
.header-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: max-content;
}
.brand-lockup {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.logo img {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: 0 10px 20px rgba(56, 189, 248, 0.12);
}
.brand {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text);
}
.brand-subtitle {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
nav {
  flex: 1;
  display: flex;
  justify-content: center;
  gap: 1.4rem;
  flex-wrap: nowrap;
  min-width: 0;
}
nav a {
  position: relative;
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.98rem;
  transition: color 0.2s ease;
}
nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -8px;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.2s ease;
}
nav a:hover,
nav a.active {
  color: var(--text);
}
nav a:hover::after,
nav a.active::after {
  transform: scaleX(1);
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: max-content;
}
.nav-login,
.docs-tool-btn,
.docs-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.58rem 1rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(157, 184, 255, 0.2);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}
.nav-login::after {
  display: none;
}
.nav-login:hover,
.nav-login.active {
  color: #fff;
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.24);
}
.docs-shell {
  max-width: 1500px;
  margin: 0 auto;
  padding: 18px 22px;
}
.docs-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.docs-legend {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 16px;
}
.docs-legend-card,
.docs-nav-card,
.docs-map,
.docs-modal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}
.docs-legend-card,
.docs-nav-card {
  padding: 22px;
}
.docs-kicker {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.12);
  color: #c5f2ff;
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
}
.docs-title {
  margin: 14px 0 10px;
  font-size: clamp(2rem, 3vw, 2.7rem);
  line-height: 1;
}
.docs-intro,
.docs-node-summary,
.docs-nav-item small,
.docs-hint,
.docs-breadcrumb {
  color: var(--muted);
  line-height: 1.65;
}
.docs-intro a {
  color: #8ed7ff;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.docs-intro a:hover {
  color: #c5f2ff;
}
.docs-hint {
  margin-top: 14px;
  font-size: .92rem;
}
.docs-nav-title {
  font-weight: 800;
  margin-bottom: 10px;
}
.docs-nav-list {
  display: grid;
  gap: 10px;
}
.docs-nav-item {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--panel-soft);
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.docs-nav-item:hover,
.docs-nav-item.is-active {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.14) inset;
}
.docs-map {
  min-height: 820px;
  padding: 20px;
  overflow: hidden;
}
.docs-map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.docs-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.docs-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: .45rem .8rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
}
.docs-breadcrumb.is-current {
  color: var(--text);
  border-color: var(--line-strong);
}
.docs-toolbar-actions {
  display: flex;
  gap: 10px;
}
.docs-map-viewport {
  position: relative;
  height: 720px;
  border-radius: 24px;
  overflow: hidden;
  background:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px),
    radial-gradient(circle at center, rgba(56, 189, 248, 0.08), transparent 36%),
    linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  background-size: 48px 48px, 48px 48px, auto, auto;
  cursor: grab;
  touch-action: none;
}
.docs-map-viewport.is-dragging { cursor: grabbing; }
.docs-map-world {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
}
.docs-map-lines,
.docs-map-root {
  position: absolute;
  top: 0;
  left: 0;
}
.docs-map-lines {
  width: 6000px;
  height: 6000px;
  overflow: visible;
  z-index: 1;
}
.docs-map-root {
  pointer-events: none;
  z-index: 2;
  width: 6000px;
  height: 6000px;
}
.docs-node {
  position: absolute;
  width: 240px;
  padding: 16px 18px;
  border-radius: 22px;
  background: rgba(10, 22, 42, 0.94);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: var(--shadow);
  pointer-events: auto;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.docs-node:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.18), var(--shadow);
}
.docs-node--root {
  width: 290px;
  background: linear-gradient(145deg, rgba(56, 189, 248, 0.18), rgba(10, 22, 42, 0.96));
}
.docs-node--branch {
  background: linear-gradient(145deg, rgba(245, 158, 11, 0.12), rgba(10, 22, 42, 0.96));
}
.docs-node-type {
  display: inline-flex;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.12);
  color: #fcd34d;
  font-size: .72rem;
  font-weight: 800;
}
.docs-node-title {
  margin-top: 10px;
  font-size: 1.08rem;
  font-weight: 800;
}
.docs-node-summary {
  margin-top: 8px;
  font-size: .95rem;
}
.docs-node-meta {
  margin-top: 12px;
  font-size: .78rem;
  color: #c5f2ff;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.docs-line {
  fill: none;
  stroke: rgba(56, 189, 248, 0.72);
  stroke-width: 3.5;
  stroke-linecap: round;
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.28));
}
.docs-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(2, 8, 16, 0.72);
  backdrop-filter: blur(10px);
  z-index: 50;
}
.docs-modal-card {
  width: min(100%, 900px);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 24px;
}
.docs-modal-close { float: right; }
.docs-article-title {
  margin: 0 0 10px;
  font-size: 2rem;
}
@media (max-width: 1100px) {
  .docs-shell { grid-template-columns: 1fr; }
  .docs-legend { position: static; }
  .docs-map-viewport { height: 640px; }
}
@media (max-width: 760px) {
  .header-container,
  .docs-shell {
    padding: 16px;
  }
  .header-container,
  .docs-map-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .logo {
    min-width: 0;
  }
  .logo img {
    width: 36px;
    height: 36px;
  }
  .brand-subtitle {
    font-size: 0.66rem;
  }
  nav {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .header-actions {
    width: 100%;
  }
  .nav-login {
    width: 100%;
  }
  .docs-legend {
    gap: 12px;
  }
  .docs-legend-card,
  .docs-nav-card,
  .docs-map,
  .docs-modal-card {
    border-radius: 22px;
  }
  .docs-legend-card,
  .docs-nav-card {
    padding: 16px;
  }
  .docs-title {
    font-size: 1.7rem;
    line-height: 1.05;
  }
  .docs-hint {
    font-size: 0.86rem;
  }
  .docs-nav-list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
  }
  .docs-nav-list::-webkit-scrollbar {
    height: 6px;
  }
  .docs-nav-item {
    min-width: 220px;
    scroll-snap-align: start;
  }
  .docs-toolbar-actions {
    justify-content: space-between;
  }
  .docs-breadcrumbs {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .docs-breadcrumb {
    white-space: nowrap;
  }
  .docs-map {
    padding: 14px;
    min-height: 0;
  }
  .docs-map-viewport {
    height: 62vh;
    min-height: 420px;
    border-radius: 18px;
  }
  .docs-node {
    width: 190px;
    padding: 12px 14px;
    border-radius: 18px;
  }
  .docs-node--root {
    width: 220px;
  }
  .docs-node-title {
    font-size: 0.95rem;
  }
  .docs-node-summary {
    font-size: 0.84rem;
    line-height: 1.45;
  }
  .docs-node-meta {
    font-size: 0.7rem;
  }
  .docs-modal {
    padding: 12px;
    align-items: flex-end;
  }
  .docs-modal-card {
    width: 100%;
    max-height: 82vh;
    padding: 18px;
    border-radius: 22px 22px 0 0;
  }
  .docs-article-title {
    font-size: 1.45rem;
  }
}
