:root {
  --bg: #f4f8fc;
  --bg-2: #ffffff;
  --panel: #ffffff;
  --line: #d5e3f2;
  --line-strong: #7eb0f0;
  --blue: #1f6feb;
  --blue-2: #1558c0;
  --cyan: #0d74c2;
  --text: #1c2b45;
  --muted: #5d6e8a;
  --soft: #3c4e6b;
  --danger: #e14b68;
  --warn: #b86a00;
  --ok: #0d74c2;
  --shadow: 0 10px 28px rgba(48, 92, 150, 0.08);
  --mono: "Cascadia Code", "Cascadia Mono", Consolas, "Sarasa Mono SC", monospace;
  --sans: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  font-family: var(--sans);
  background:
    radial-gradient(900px 420px at 0% -8%, rgba(90, 170, 255, 0.2), transparent 56%),
    radial-gradient(680px 360px at 100% 0%, rgba(140, 220, 255, 0.28), transparent 52%),
    var(--bg);
  overflow: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(40, 100, 180, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(40, 100, 180, 0.045) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 20% 0%, #000 0%, transparent 72%);
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.shell { height: 100%; display: flex; flex-direction: column; min-height: 0; }

.top {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 72px;
  padding: 0 22px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.top::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), var(--blue), transparent);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 190px; }
.brand img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(31, 111, 235, 0.18), 0 8px 18px rgba(47, 123, 255, 0.18);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 16px; letter-spacing: 0.08em; }
.brand-text small { margin-top: 3px; color: var(--cyan); font-size: 10px; letter-spacing: 0.22em; }

.search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7fbff;
}
.search svg { width: 16px; height: 16px; stroke: var(--muted); fill: none; stroke-width: 1.8; }
.search input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  min-width: 0;
}
.search input::placeholder { color: #8aa0bb; }
.search kbd {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}
.search:focus-within { border-color: var(--line-strong); box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.12); }

#env {
  height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #ffffff;
  outline: none;
}
.count {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: transparent;
  padding: 10px;
}
.menu-btn span {
  display: block;
  height: 2px;
  margin: 4px 0;
  background: var(--text);
  border-radius: 2px;
}

.body { flex: 1; min-height: 0; display: flex; position: relative; }
.backdrop { display: none; }

aside {
  width: 332px;
  flex: none;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: #ffffff;
}
main { flex: 1; min-width: 0; overflow: auto; }

.side-tools { padding: 14px 14px 6px; position: sticky; top: 0; z-index: 3; background: #ffffff; }
.edit-toggle {
  width: 100%;
  margin-top: 8px;
  border-radius: 10px;
  border: 1px dashed var(--line-strong);
  background: #f4f8ff;
  color: var(--blue);
  padding: 8px 10px;
  font-size: 13px;
}
.edit-toggle.on { background: #e7f1ff; }
.edit-note {
  margin: 0 14px 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f4f8ff;
  border: 1px solid var(--line);
  color: var(--soft);
  font-size: 12px;
  line-height: 1.55;
}
.edit-note code {
  font-family: var(--mono);
  color: #0d5fbe;
  background: #e8f2ff;
  padding: 1px 4px;
  border-radius: 4px;
}
.edit-note .solid { display: block; width: 100%; margin-top: 8px; }
#editCount { display: block; margin-top: 6px; color: var(--muted); }
.group-edit {
  display: flex;
  align-items: center;
  background: #f7fbff;
  border-top: 1px solid #e6eef8;
}
.group-edit .group-h { flex: 1; border-top: 0; background: transparent; }
.api-row { display: flex; align-items: flex-start; }
.api-row .api-link { flex: 1; min-width: 0; }
.api-row.is-off { opacity: 0.45; }
.tick {
  display: flex;
  align-items: center;
  padding: 11px 0 0 12px;
  cursor: pointer;
}
.tick input { width: 15px; height: 15px; accent-color: var(--blue); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--soft);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
}
.chip.on { color: #ffffff; background: var(--blue); border-color: transparent; font-weight: 650; }
.chip .n { margin-left: 4px; opacity: 0.7; }

.group-h {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 0;
  border-top: 1px solid #e6eef8;
  background: #f7fbff;
  color: var(--soft);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-align: left;
}
.group-h em { font-style: normal; color: var(--muted); }
.group-h.on { color: var(--cyan); }

.api-link {
  width: 100%;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 9px 14px 9px 12px;
  border: 0;
  border-left: 2px solid transparent;
  background: transparent;
  text-align: left;
}
.api-link:hover { background: #f3f8ff; }
.api-link.on { background: #e7f1ff; border-left-color: var(--blue); }
.api-link .t { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.api-link strong { font-size: 13px; font-weight: 600; }
.api-link em {
  font-style: normal;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m {
  flex: none;
  width: 46px;
  text-align: center;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 0;
  margin-top: 1px;
}
.m.GET { color: #086484; background: #d7f4ff; }
.m.POST { color: white; background: var(--blue); }
.m.PUT { color: #7a4b00; background: #ffe7bf; }
.m.DELETE { color: white; background: var(--danger); }
.m.PATCH { color: white; background: #7a5cff; }
.m.WS { color: #5a2d91; background: #efe3ff; }

.page { padding: 28px 36px 64px; max-width: 1080px; }
.hero { display: flex; gap: 22px; align-items: center; margin-bottom: 22px; }
.hero-logo { position: relative; width: 108px; height: 108px; flex: none; }
.hero-logo::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--cyan);
  border-right-color: var(--blue);
  transform: rotate(18deg);
}
.hero-logo img {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(31, 111, 235, 0.16), 0 12px 28px rgba(47, 123, 255, 0.16);
}
.eyebrow { margin: 0 0 6px; color: var(--cyan); letter-spacing: 0.18em; font-size: 12px; }
.hero h1 { margin: 0; font-size: 34px; letter-spacing: 0.04em; }
.lede { margin: 10px 0 0; color: var(--soft); line-height: 1.7; max-width: 640px; }

.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 8px 0 22px; }
.fact, .step, .module, .callout, .codeblock, .table {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.fact { border-radius: 16px; padding: 16px 16px 14px; }
.fact b { display: block; font-family: var(--mono); font-size: 13px; color: var(--cyan); margin-bottom: 6px; }
.fact span { color: var(--soft); font-size: 13px; line-height: 1.6; }

.panel-title { margin: 26px 0 12px; font-size: 16px; letter-spacing: 0.06em; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.step { border-radius: 16px; padding: 16px; }
.step i {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--blue);
  color: #ffffff;
  font-style: normal;
  font-weight: 700;
  margin-bottom: 10px;
}
.step strong { display: block; margin-bottom: 6px; }
.step p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.step code, .note code, .callout code, .path-sub code {
  font-family: var(--mono);
  font-size: 12px;
  color: #0d5fbe;
  background: #e8f2ff;
  padding: 1px 5px;
  border-radius: 5px;
}

.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.module {
  border-radius: 16px;
  padding: 14px 14px 12px;
  text-align: left;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.module:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.module b { display: block; margin-bottom: 4px; }
.module span { color: var(--muted); font-size: 12px; }
.module em { display: block; margin-top: 10px; font-style: normal; color: var(--cyan); font-family: var(--mono); font-size: 12px; }

.crumb { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.crumb button { border: 0; background: transparent; color: var(--cyan); padding: 0; }
.head-row { display: flex; gap: 14px; align-items: flex-start; }
.head-row h1 { margin: 0; font-size: 28px; line-height: 1.25; }
.path-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
}
.path-line code {
  font-family: var(--mono);
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 10px;
  background: #f4f8ff;
  border: 1px solid var(--line);
  color: #1a335c;
}
.ghost, .solid {
  border-radius: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: transparent;
}
.solid { color: #ffffff; background: var(--blue); border-color: transparent; }
.solid:hover { background: var(--blue-2); }
.ghost:hover { border-color: var(--line-strong); }
.path-sub { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tag {
  font-size: 12px;
  color: var(--soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  background: #f4f8ff;
}
.callout {
  margin-top: 16px;
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--soft);
  line-height: 1.65;
  box-shadow: none;
}
.callout strong { color: var(--cyan); font-weight: 650; }
.note p { margin: 0 0 8px; color: var(--soft); line-height: 1.75; }
.section { margin-top: 26px; }
.section h2 { margin: 0 0 10px; font-size: 15px; letter-spacing: 0.06em; }
.table { border-radius: 14px; overflow: hidden; box-shadow: none; }
.tr {
  display: grid;
  grid-template-columns: minmax(150px, 1.2fr) 110px 64px minmax(180px, 2fr);
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid #e6eef8;
  align-items: start;
}
.tr.th { border-top: 0; color: var(--muted); font-size: 12px; letter-spacing: 0.06em; background: #f7fbff; }
.tr .key { font-family: var(--mono); font-size: 13px; color: #1a335c; }
.tr .key small { display: block; margin-top: 3px; color: var(--muted); font-family: var(--sans); }
.tr .type { color: var(--cyan); font-family: var(--mono); font-size: 12px; word-break: break-all; }
.need { color: var(--warn); font-size: 12px; }
.opt { color: var(--muted); font-size: 12px; }
.desc { color: var(--soft); font-size: 13px; line-height: 1.55; }
.desc i { display: block; margin-top: 4px; color: var(--muted); font-style: normal; font-family: var(--mono); font-size: 12px; }
.quiet { color: var(--muted); font-size: 13px; line-height: 1.6; }

.codeblock {
  border-radius: 14px;
  overflow: hidden;
  box-shadow: none;
}
.codeblock header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 12px;
  border-bottom: 1px solid var(--line);
}
.codeblock pre {
  margin: 0;
  padding: 14px 16px 16px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  color: #1d3557;
  background: #f7fafc;
}
.stack { display: grid; gap: 12px; }

.list-row {
  width: 100%;
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 12px;
  align-items: center;
  text-align: left;
  padding: 12px 14px;
  margin-bottom: 8px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #ffffff;
}
.list-row:hover { border-color: var(--line-strong); }
.list-row b { display: block; }
.list-row span { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.list-row em { color: var(--soft); font-style: normal; font-size: 12px; }

.empty { padding: 28px 16px; color: var(--muted); text-align: center; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 10px 16px;
  box-shadow: var(--shadow);
  z-index: 30;
}
.boot-error { padding: 40px; }

aside::-webkit-scrollbar, main::-webkit-scrollbar { width: 10px; height: 10px; }
aside::-webkit-scrollbar-thumb, main::-webkit-scrollbar-thumb {
  background: rgba(70, 120, 190, 0.35);
  border-radius: 99px;
}

@media (max-width: 980px) {
  body { overflow: auto; }
  .shell { height: auto; min-height: 100%; }
  .body { display: block; }
  .menu-btn { display: inline-block; }
  .count, .search kbd { display: none; }
  .top { height: auto; flex-wrap: wrap; padding: 12px; }
  .search { order: 5; flex-basis: 100%; }
  aside {
    position: fixed;
    z-index: 20;
    top: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    width: min(86vw, 360px);
  }
  body.nav-open aside { transform: none; }
  body.nav-open .backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 15;
  }
  main { overflow: visible; }
  .page { padding: 20px 16px 48px; }
  .hero { align-items: flex-start; }
  .hero h1 { font-size: 26px; }
  .facts, .steps { grid-template-columns: 1fr; }
  .tr { grid-template-columns: 1fr 1fr; }
  .tr .desc { grid-column: 1 / -1; }
  .list-row { grid-template-columns: 54px 1fr; }
  .list-row em { display: none; }
}

.shell[hidden], .gate[hidden] { display: none !important; }

.gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.gate-card {
  width: min(420px, 100%);
  padding: 32px 28px 26px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.gate-card img {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(31, 111, 235, 0.18), 0 8px 18px rgba(47, 123, 255, 0.18);
}
.gate-card h1 { margin: 14px 0 8px; font-size: 24px; }
.gate-card p { margin: 0; color: var(--muted); line-height: 1.65; }
.gate-label {
  display: block;
  margin: 18px 0 8px;
  text-align: left;
  color: var(--soft);
  font-size: 13px;
}
.gate-card input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  color: var(--text);
  background: #f8fbff;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.gate-card input:focus {
  outline: 2px solid rgba(31, 111, 235, 0.22);
  border-color: var(--blue);
}
.gate-card button {
  width: 100%;
  height: 44px;
  margin-top: 14px;
  color: #fff;
  background: var(--blue);
  border: 0;
  border-radius: 10px;
}
.gate-card button:hover { background: var(--blue-2); }
.gate-card button:disabled { opacity: 0.65; cursor: default; }
.gate-error { margin-top: 10px !important; color: var(--danger); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
