:root {
  --bg: #05070A;
  --acc: #35E0A1;
  --mute: #56606E;
  --line: #16202a;
  --edge: #223040;
  --text: #c6d3dc;
  --head: #eef8f3;
  --r: 18px;
  --pad: 28px;
  --rail: 216px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", monospace;
  font-size: 16px;
  line-height: 1.75;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
h1, h2, h3 { color: var(--head); font-weight: 500; line-height: 1.15; }
a { color: var(--acc); }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 3px; }

.skip {
  position: absolute;
  top: -80px;
  left: 16px;
  z-index: 60;
  padding: 12px 16px;
  background: #0a1218;
  border: 1px solid var(--acc);
  border-radius: 12px;
  text-decoration: none;
}
.skip:focus { top: 12px; }

/* 深度层 */
.depth {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.dl { position: absolute; inset: -25% 0; will-change: transform; }
.dl1 {
  background-image: radial-gradient(circle, rgba(53, 224, 161, .17) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: .45;
}
.dl2 {
  background-image:
    linear-gradient(to right, rgba(86, 96, 110, .13) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(86, 96, 110, .13) 1px, transparent 1px);
  background-size: 148px 148px;
  opacity: .6;
}
.dl3 {
  background: radial-gradient(ellipse 68% 48% at 64% 6%, rgba(53, 224, 161, .15), transparent 72%);
}

/* 侧栏 */
.rail {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--rail);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  border-right: 1px solid var(--line);
  background: rgba(5, 7, 10, .88);
  z-index: 20;
}
.brand {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: var(--head);
  letter-spacing: .22em;
  font-size: 1.02rem;
  text-decoration: none;
}
.brand::before {
  content: "▍";
  color: var(--acc);
  margin-right: .45em;
  font-size: .9em;
}
.navwrap > summary {
  list-style: none;
  cursor: pointer;
  padding: 8px 0;
  color: var(--mute);
  letter-spacing: .22em;
  font-size: .9rem;
}
.navwrap > summary::-webkit-details-marker { display: none; }
.navwrap > summary::after { content: "＋"; margin-left: .5em; color: var(--acc); }
.navwrap[open] > summary::after { content: "－"; }
.rail-menu {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rail-menu a {
  display: block;
  padding: 11px 10px;
  color: #9fb0be;
  font-size: 1rem;
  text-decoration: none;
  border-left: 2px solid transparent;
  border-radius: 0 10px 10px 0;
}
.rail-menu a:hover,
.rail-menu a:focus-visible {
  color: var(--acc);
  border-left-color: var(--acc);
  background: #0a1218;
}

/* 主区 */
main {
  position: relative;
  z-index: 1;
  margin-left: var(--rail);
  padding: 0 var(--pad) 72px;
}

.hero {
  position: relative;
  isolation: isolate;
  margin-inline: calc(-1 * var(--pad));
  min-height: 100vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 96px 10px 64px;
  scroll-margin-top: 0;
}
@supports (min-height: 100svh) {
  .hero { min-height: 100svh; }
}
.hero-grid {
  position: absolute;
  inset: 0;
  margin: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.hero-grid span { position: absolute; inset: -35% -10%; display: block; }
.g1 {
  background-image: repeating-linear-gradient(180deg, rgba(53, 224, 161, .11) 0 1px, transparent 1px 10px);
  opacity: .55;
}
.g2 {
  background: radial-gradient(circle at 50% 44%, transparent 0 20%, rgba(5, 7, 10, .88) 70%);
}
.hero-title {
  margin: 0;
  font-size: clamp(2.3rem, 8.2vw, 5.2rem);
  letter-spacing: -.045em;
  line-height: 1.04;
  color: #f4fdf9;
  text-shadow: 0 0 40px rgba(53, 224, 161, .16);
}
.hero-sub {
  margin: 22px auto 0;
  max-width: 46ch;
  color: #8b9aa7;
  font-size: 1rem;
}
.hero-hint {
  margin: 42px 0 0;
  font-size: .86rem;
  letter-spacing: .34em;
  color: var(--mute);
}
.hero-hint::after {
  content: "↓";
  display: block;
  margin-top: 4px;
  color: var(--acc);
  letter-spacing: 0;
  animation: bob 2.4s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0); opacity: .45; }
  50% { transform: translateY(8px); opacity: 1; }
}

/* 正文章节 */
main > div[id] {
  max-width: 820px;
  padding: 62px 0 10px;
  border-top: 1px dashed var(--line);
  scroll-margin-top: 30px;
}
main > div[id] h2 {
  margin: 0 0 18px;
  font-size: clamp(1.45rem, 3.4vw, 2.05rem);
  letter-spacing: -.02em;
}
main > div[id] h3 {
  margin: 1.6em 0 .6em;
  font-size: 1.15rem;
}
main > div[id] h2 > span,
main > div[id] h3 > span {
  position: relative;
  display: inline-block;
  padding-left: 16px;
}
main > div[id] h2 > span::before,
main > div[id] h3 > span::before {
  content: "";
  position: absolute;
  left: 0;
  top: .2em;
  bottom: .2em;
  width: 3px;
  border-radius: 2px;
  background: var(--acc);
}
main > div[id] p { margin: 0 0 1.1em; max-width: 72ch; }
main > div[id] ul,
main > div[id] ol { padding-left: 1.35em; margin: 0 0 1.1em; }
main > div[id] li { margin: .4em 0; }
main > div[id] strong { color: var(--head); }
main > div[id] a { text-decoration: underline; text-underline-offset: 3px; }
main > div[id] blockquote {
  margin: 1.4em 0;
  padding: 14px 18px;
  border-left: 3px solid var(--acc);
  border-radius: 0 var(--r) var(--r) 0;
  background: rgba(10, 18, 24, .7);
  color: #d5e2ea;
}
main > div[id] blockquote p:last-child { margin-bottom: 0; }
main > div[id] figure { margin: 1.4em 0; }
main > div[id] img,
main > div[id] figure img { border-radius: var(--r); border: 1px solid var(--edge); }
main > div[id] table { width: 100%; border-collapse: collapse; font-size: 1rem; }
main > div[id] th,
main > div[id] td { border: 1px solid var(--edge); padding: 10px 12px; text-align: left; }
main > div[id] code {
  background: #0c151b;
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 1px 5px;
}

/* 附录 */
.annex {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  grid-template-rows: auto auto;
  gap: 22px 30px;
  align-items: start;
  max-width: 1000px;
  margin: 0 auto;
  padding: 66px 0 30px;
  border-top: 1px dashed var(--line);
}
.annex > h2 {
  grid-area: 1 / 1 / 2 / 2;
  margin: 0;
  font-size: 1.35rem;
}
.annex > h2 > span {
  position: relative;
  display: inline-block;
  padding-left: 16px;
}
.annex > h2 > span::before {
  content: "";
  position: absolute;
  left: 0;
  top: .2em;
  bottom: .2em;
  width: 3px;
  border-radius: 2px;
  background: var(--acc);
}
.annex-fig {
  grid-area: 2 / 1 / 3 / 2;
  margin: 0;
  border: 1px solid var(--edge);
  border-radius: var(--r);
  overflow: hidden;
  background: #070c11;
  min-height: 1px;
}
.annex-img { width: 100%; }

.toc {
  grid-area: 1 / 2 / 3 / 3;
  border: 1px solid var(--edge);
  border-radius: var(--r);
  padding: 18px 20px;
  background: rgba(8, 14, 18, .74);
}
.toc h3 {
  margin: 0 0 12px;
  font-size: .88rem;
  letter-spacing: .16em;
  color: var(--mute);
}
.toc h3 > span { color: var(--acc); }
.toc nav { display: flex; flex-direction: column; }
.toc nav a {
  display: block;
  padding: 10px 0;
  color: #9fb0bd;
  font-size: 1rem;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.toc nav a:last-child { border-bottom: 0; }
.toc nav a:hover,
.toc nav a:focus-visible { color: var(--acc); }

/* 页脚 */
footer {
  position: relative;
  z-index: 1;
  margin-left: var(--rail);
  padding: 54px var(--pad) 44px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.f-cta-wrap { margin: 0 0 26px; }
.f-cta {
  display: inline-block;
  padding: 16px 30px;
  border-radius: var(--r);
  background: var(--acc);
  color: #04130c;
  font-size: clamp(1.15rem, 3vw, 1.6rem);
  letter-spacing: -.01em;
  text-decoration: none;
}
.f-cta:hover { background: #5ff0bb; text-decoration: none; }
.f-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 18px;
  margin: 0 0 20px;
}
.f-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 2px;
  color: #93a3b0;
  font-size: 1rem;
  text-decoration: none;
}
.f-nav a:hover,
.f-nav a:focus-visible { color: var(--acc); }
.f-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 16px;
  color: var(--mute);
  font-size: .9rem;
}
.f-brand {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 4px 2px;
  color: #dbe9e1;
  letter-spacing: .18em;
  text-decoration: none;
}
.f-copy { letter-spacing: .08em; }

/* 动效 */
.rv {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .7s ease, transform .8s cubic-bezier(.22, .8, .3, 1);
}
.rv.on { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rv { opacity: 1; transform: none; transition: none; }
  .hero-hint::after { animation: none; }
  .dl { transform: none !important; }
}

/* 平板与手机 */
@media (max-width: 1080px) {
  .annex { grid-template-columns: minmax(0, 1fr) 260px; }
}

@media (max-width: 900px) {
  :root { --pad: 16px; }
  .rail {
    inset: 0 0 auto 0;
    width: auto;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: rgba(5, 7, 10, .95);
  }
  .brand { letter-spacing: .18em; font-size: 1rem; }
  .navwrap { position: relative; margin-left: auto; }
  .navwrap > summary {
    padding: 12px 15px;
    min-height: 48px;
    display: flex;
    align-items: center;
    border: 1px solid var(--edge);
    border-radius: 12px;
    color: var(--acc);
    letter-spacing: .16em;
    font-size: .95rem;
  }
  .navwrap[open] > summary { background: #0a1218; }
  .rail-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: min(76vw, 280px);
    padding: 8px;
    gap: 2px;
    background: #080e12;
    border: 1px solid var(--edge);
    border-radius: 14px;
  }
  .rail-menu a { padding: 12px 12px; font-size: 1rem; border-left: 0; border-radius: 10px; }
  .rail-menu a:hover { border-left: 0; }
  main { margin-left: 0; padding-top: 76px; }
  .hero { margin-top: -76px; padding-top: 116px; }
  main > div[id] { scroll-margin-top: 86px; }
  footer { margin-left: 0; }
}

@media (max-width: 760px) {
  .annex {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    gap: 18px;
  }
  .annex > h2,
  .annex-fig,
  .toc { grid-area: auto; }
  .toc { padding: 14px 16px; }
  .toc nav { flex-direction: row; flex-wrap: wrap; gap: 0 16px; }
  .toc nav a { border-bottom: 0; padding: 10px 0; }
  .hero-title { letter-spacing: -.03em; }
  .hero-sub { max-width: 34ch; font-size: .95rem; }
}

button[aria-expanded]{min-width:44px;min-height:44px}
