@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&display=swap');

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: #000;
  color: #e9ffe9;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  font-size: 17px;
  line-height: 1.7;
  font-weight: 400;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }
a { color: inherit; }

:focus-visible {
  outline: 3px solid #00ff80;
  outline-offset: 2px;
}

main { scroll-margin-top: 82px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #000;
  border-bottom: 3px solid #00ff80;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  background: #00ff80;
  border: 2px solid #00ff80;
  color: #000;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand:hover { background: #fff; border-color: #fff; }

.menubtn {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 14px;
  background: #000;
  border: 2px solid #00ff80;
  color: #00ff80;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.menubtn:hover { background: #00ff80; color: #000; }

.reach {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-left: 2px;
  padding: 0 14px;
  background: #0000ff;
  border: 2px solid #0000ff;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  text-decoration: none;
}

.reach:hover { background: #00ff80; border-color: #00ff80; color: #000; }

.mainnav { margin-left: auto; }

.mainnav > ol {
  display: flex;
  align-items: stretch;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mainnav > ol > li { position: relative; display: flex; }

.mainnav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-left: 2px solid #191919;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}

.mainnav a:hover,
.mainnav a:focus-visible { background: #0000ff; color: #fff; outline: none; }

.has-sub > a::after {
  content: '\25BE';
  margin-left: 6px;
  color: #00ff80;
  font-size: 11px;
}

.sub {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 70;
  min-width: 190px;
  margin: 0;
  padding: 0;
  list-style: none;
  background: #000;
  border: 3px solid #00ff80;
}

.sub li { display: block; }
.sub a { display: flex; border-left: 0; border-top: 2px solid #191919; }

.has-sub:hover > .sub,
.has-sub:focus-within > .sub { display: block; }

/* ---------- 版心与栏位 ---------- */
.doc {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 14px 40px;
  display: flex;
  flex-direction: column;
}

.hero { order: 1; }
.rail { order: 2; margin: 16px 0 8px; }
.prose { order: 3; }

/* ---------- 侧栏 ---------- */
.rail { border: 3px solid #00ff80; background: #000; }

.rail h2 {
  margin: 0;
  padding: 9px 12px;
  background: #00ff80;
  color: #000;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.rail .subtitle {
  margin: 0;
  padding: 8px 12px;
  background: #031a0e;
  border-bottom: 3px solid #00ff80;
  color: #00ff80;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
}

.toc {
  display: flex;
  overflow-x: auto;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: toc;
}

.toc li { flex: 0 0 auto; border-right: 2px solid #141414; }

.toc a {
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 0 14px;
  white-space: nowrap;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
}

.toc a::before {
  counter-increment: toc;
  content: counter(toc, decimal-leading-zero);
  margin-right: 9px;
  color: #00ff80;
  font-size: 13px;
  font-weight: 800;
}

.toc a:hover { background: #0000ff; color: #fff; }

.totop {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-top: 3px solid #00ff80;
  color: #00ff80;
  font-size: 16px;
  font-weight: 800;
  text-decoration: none;
}

.totop:hover { background: #00ff80; color: #000; }

/* ---------- 头图 ---------- */
.hero {
  display: grid;
  grid-template-columns: 1fr;
  background: #000 radial-gradient(circle, rgba(0, 255, 128, 0.28) 1px, transparent 1px) 0 0 / 16px 16px;
  border-bottom: 3px solid #00ff80;
}

.hero-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 30px 18px;
  text-align: center;
}

.hero h1 {
  margin: 0;
  color: #00ff80;
  font-size: clamp(30px, 5.4vw, 54px);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.03em;
  text-shadow: 3px 3px 0 #0000ff;
  overflow-wrap: anywhere;
}

.hero .lead {
  max-width: 38ch;
  margin: 0;
  color: #cfe9da;
  font-size: 17px;
  line-height: 1.65;
}

.cta {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 20px;
  background: #00ff80;
  border: 3px solid #00ff80;
  color: #000;
  font-size: 16px;
  font-weight: 800;
  text-decoration: none;
}

.cta:hover { background: #0000ff; border-color: #0000ff; color: #fff; }

.hero-art {
  margin: 0;
  min-height: 220px;
  overflow: hidden;
  border-top: 3px solid #00ff80;
  background: repeating-linear-gradient(135deg, rgba(0, 255, 128, 0.14) 0 2px, transparent 2px 14px);
}

.hero-fill {
  height: 100%;
  min-height: 220px;
  background: repeating-linear-gradient(135deg, rgba(0, 255, 128, 0.16) 0 2px, transparent 2px 14px);
}

.hero-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: contrast(1.08) saturate(1.12);
  will-change: transform;
}

/* ---------- 正文 ---------- */
.prose { padding-top: 4px; }

.prose article {
  padding: 34px 0 8px;
  border-top: 3px solid #00ff80;
  scroll-margin-top: 86px;
}

.prose article:first-child { border-top: 0; padding-top: 20px; }

.prose h2 {
  margin: 0 0 16px;
  color: #00ff80;
  font-size: clamp(23px, 3.3vw, 36px);
  font-weight: 800;
  line-height: 1.14;
  letter-spacing: -0.02em;
}

.prose h3 {
  margin: 26px 0 10px;
  padding-left: 10px;
  border-left: 6px solid #0000ff;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.3;
}

.prose p { margin: 0 0 16px; max-width: 72ch; }

.prose ul,
.prose ol { margin: 0 0 18px; padding-left: 22px; max-width: 70ch; }

.prose li { margin-bottom: 8px; }
.prose li::marker { color: #00ff80; font-weight: 800; }

.prose a {
  color: #00ff80;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.prose a:hover { background: #0000ff; color: #fff; text-decoration-color: #0000ff; }

.prose strong { color: #00ff80; font-weight: 800; }

.prose blockquote {
  margin: 0 0 18px;
  padding: 12px 16px;
  border-left: 6px solid #00ff80;
  background: #04160c;
  color: #cfe9da;
}

.prose figure { margin: 0 0 18px; }
.prose img { width: 100%; height: auto; border: 3px solid #00ff80; }
.prose figcaption { padding-top: 6px; color: #97c8ab; font-size: 15px; }

.prose table { width: 100%; margin-bottom: 18px; border-collapse: collapse; font-size: 16px; }
.prose th,
.prose td { border: 2px solid #00ff80; padding: 8px 10px; text-align: left; }
.prose th { background: #031a0e; color: #00ff80; }

.prose code { padding: 2px 5px; background: #111; font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; }
.prose hr { margin: 24px 0; border: 0; border-top: 3px solid #0000ff; }

.js .prose article.reveal { opacity: 0; }
.js .prose article.reveal.in { opacity: 1; }

/* ---------- 页脚 ---------- */
footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 26px;
  border-top: 3px solid #00ff80;
  background: #000;
}

.fbrand a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  background: #00ff80;
  color: #000;
  font-size: 18px;
  font-weight: 800;
  text-decoration: none;
}

.fbrand a:hover { background: #fff; }

.fnav ol {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  list-style: none;
}

.fnav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  border-left: 2px solid #191919;
  color: #e9ffe9;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
}

.fnav a:hover { background: #0000ff; color: #fff; }

.fcopy {
  margin-left: auto;
  color: #7f9b8b;
  font-size: 16px;
}

/* ---------- 桌面 ---------- */
@media (min-width: 881px) {
  .topbar { padding: 10px 18px; }

  .doc {
    display: grid;
    grid-template-columns: 246px minmax(0, 1fr);
    column-gap: 34px;
    padding: 34px 24px 64px;
  }

  .rail {
    grid-column: 1;
    grid-row: 1 / span 5;
    order: 0;
    align-self: start;
    position: sticky;
    top: 82px;
    margin: 0;
  }

  .toc { display: block; overflow: visible; }
  .toc li { border-right: 0; border-top: 2px solid #141414; }
  .toc a { min-height: 44px; white-space: normal; padding: 0 12px; }

  .hero,
  .prose { grid-column: 2; order: 0; }

  .hero {
    grid-template-columns: 1fr 1fr;
    min-height: 45vh;
    border-top: 3px solid #00ff80;
  }

  .hero-text { padding: 40px 30px; }
  .hero-art { border-top: 0; border-left: 3px solid #00ff80; min-height: 45vh; }
  .hero-fill { min-height: 45vh; }

  .prose { padding-top: 10px; }
}

@media (min-width: 1100px) {
  .hero h1 { font-size: clamp(40px, 4.2vw, 58px); }
}

/* ---------- 移动 ---------- */
@media (max-width: 880px) {
  .topbar { padding: 8px 10px; gap: 8px; }

  .menubtn { display: inline-flex; margin-left: auto; }

  .mainnav {
    display: none;
    order: 4;
    width: 100%;
    margin: 6px 0 0;
    border-top: 3px solid #00ff80;
  }

  .mainnav.open { display: block; }

  .mainnav > ol { display: block; }

  .mainnav > ol > li { display: block; border-bottom: 2px solid #191919; }

  .mainnav a { display: flex; min-height: 48px; border-left: 0; }

  .has-sub > a::after { content: ''; }

  .sub {
    display: block;
    position: static;
    min-width: 0;
    border: 0;
    border-left: 4px solid #0000ff;
    background: #050505;
  }

  .sub a { min-height: 44px; padding-left: 26px; }

  footer { flex-direction: column; align-items: flex-start; }
  .fcopy { margin-left: 0; }
  .fnav a { border-left: 0; border-right: 2px solid #191919; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-art img { transform: none !important; }
}

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