@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&display=swap');

:root {
  --ink: #001e3c;
  --ink-2: #012a50;
  --ink-3: #013459;
  --mint: #99ffcc;
  --neon: #00ff41;
  --text: #ddf3ec;
  --dim: #9cbccd;
  --line: rgba(153, 255, 204, 0.2);
  --line-soft: rgba(153, 255, 204, 0.1);
  --radius: 4px;
  --rail: 250px;
}

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

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

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--ink);
  color: var(--text);
  font-family: "IBM Plex Sans", "Noto Sans SC", "PingFang SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.75;
  font-weight: 400;
  letter-spacing: 0.01em;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(153, 255, 204, 0.16) 1px, transparent 1.4px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(120% 78% at 22% 0%, #000 18%, transparent 76%);
  mask-image: radial-gradient(120% 78% at 22% 0%, #000 18%, transparent 76%);
  opacity: 0.75;
  animation: drift 34s linear infinite;
}

body::after {
  content: "";
  position: fixed;
  inset: auto -10% -20% -10%;
  height: 60vh;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(60% 70% at 30% 100%, rgba(0, 255, 65, 0.12), transparent 70%),
              radial-gradient(50% 60% at 85% 100%, rgba(153, 255, 204, 0.1), transparent 72%);
  filter: blur(18px);
  animation: breathe 12s ease-in-out infinite;
}

@keyframes drift {
  from { background-position: 0 0; }
  to { background-position: 22px 88px; }
}

@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.07); opacity: 1; }
}

@keyframes slide {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@keyframes slowspin {
  to { transform: rotate(360deg); }
}

a { color: var(--neon); }

:focus-visible {
  outline: 2px solid var(--neon);
  outline-offset: 2px;
  border-radius: var(--radius);
}

/* 顶部细条 */
.ticker {
  position: sticky;
  top: 0;
  z-index: 50;
  margin: 0;
  overflow: hidden;
  padding: 0;
  font-size: 14px;
  letter-spacing: 0.1em;
  color: var(--mint);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(0, 255, 65, 0.16), rgba(153, 255, 204, 0.05) 62%, rgba(0, 30, 60, 0.9));
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.ticker-run {
  display: inline-flex;
  gap: 3em;
  white-space: nowrap;
  padding: 7px 20px;
  animation: slide 30s linear infinite;
}

/* 骨架 */
.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  grid-template-areas:
    "rail main"
    "foot foot";
}

/* 左侧竖排导航 */
.rail {
  grid-area: rail;
  position: sticky;
  top: 34px;
  align-self: start;
  height: calc(100vh - 34px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px 16px 18px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(1, 42, 80, 0.7), rgba(0, 30, 60, 0.25));
}

.stamp {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 4px 2px;
  color: var(--mint);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.stamp-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, var(--neon), rgba(0, 255, 65, 0.15) 70%);
  box-shadow: 0 0 0 4px rgba(0, 255, 65, 0.12);
  animation: breathe 6s ease-in-out infinite;
}

.branch > summary {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 10px 14px;
  list-style: none;
  cursor: pointer;
  font-size: 15px;
  letter-spacing: 0.14em;
  color: var(--mint);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 255, 65, 0.05);
}

.branch > summary::-webkit-details-marker { display: none; }

.branch-bar {
  width: 14px;
  height: 2px;
  background: var(--neon);
  box-shadow: 0 5px 0 var(--neon), 0 -5px 0 var(--mint);
}

.branch-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.branch-list a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 15.5px;
  text-decoration: none;
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius) var(--radius) 0;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.branch-list a:hover,
.branch-list a:focus-visible {
  color: var(--mint);
  background: rgba(153, 255, 204, 0.09);
  border-left-color: var(--neon);
}

.rail-top {
  margin-top: auto;
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  color: var(--dim);
  font-size: 14.5px;
  letter-spacing: 0.1em;
  text-decoration: none;
  border-top: 1px dashed var(--line-soft);
}

.rail-top:hover { color: var(--mint); }

/* 主区 */
.board {
  grid-area: main;
  min-width: 0;
}

.stage {
  position: relative;
  display: grid;
  grid-template-columns: 196px minmax(0, 1fr);
  gap: 30px;
  align-items: start;
  padding: 46px 40px 40px;
  border-bottom: 1px dashed var(--line);
  background:
    radial-gradient(70% 120% at 100% 0%, rgba(153, 255, 204, 0.09), transparent 62%),
    radial-gradient(50% 90% at 0% 100%, rgba(0, 255, 65, 0.07), transparent 70%);
}

.toc h2 {
  margin: 0;
  font-size: 0.94rem;
  letter-spacing: 0.2em;
  color: var(--mint);
  font-weight: 600;
}

.subtitle {
  margin: 4px 0 14px;
  font-size: 13.5px;
  letter-spacing: 0.14em;
  color: var(--dim);
  line-height: 1.5;
}

.toc ol {
  counter-reset: sec;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.toc li { counter-increment: sec; }

.toc a {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-height: 40px;
  padding: 6px 0;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.toc a::before {
  content: counter(sec, decimal-leading-zero);
  color: var(--neon);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  opacity: 0.8;
}

.toc a:hover,
.toc a:focus-visible {
  color: var(--mint);
  border-bottom-color: var(--line);
}

.stage-copy h1 {
  margin: 0;
  font-size: clamp(1.85rem, 4.4vw, 2.9rem);
  line-height: 1.18;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #f0fff9;
  text-wrap: balance;
}

.stage-copy h1::after {
  content: "";
  display: block;
  width: 64px;
  height: 3px;
  margin-top: 16px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--neon), rgba(153, 255, 204, 0));
}

.lead {
  margin: 18px 0 0;
  max-width: 46ch;
  color: var(--dim);
  font-size: 16.5px;
  font-weight: 300;
}

.cell {
  position: absolute;
  top: 14px;
  right: 22px;
  width: 172px;
  height: 172px;
  margin: 0;
  opacity: 0.42;
  pointer-events: none;
  will-change: transform;
}

.cell svg {
  width: 100%;
  height: 100%;
  animation: slowspin 48s linear infinite;
}

.cell svg circle:first-child { animation: breathe 7s ease-in-out infinite; transform-origin: 100px 100px; }

/* 正文 */
.prose {
  padding: 34px 40px 70px;
  max-width: 860px;
}

.prose > div {
  padding: 30px 0 34px;
  border-bottom: 1px dashed var(--line-soft);
}

.prose > div:last-child {
  border-bottom: 0;
  padding-bottom: 8px;
}

.prose [id] { scroll-margin-top: 96px; }

.prose h2 {
  margin: 0 0 14px;
  font-size: 1.42rem;
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--mint);
}

.prose h3 {
  margin: 26px 0 10px;
  font-size: 1.12rem;
  line-height: 1.5;
  font-weight: 600;
  color: #eefff7;
}

.prose h2 + .subtitle { margin: -6px 0 16px; }

.prose p {
  margin: 0 0 15px;
  max-width: 66ch;
}

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

.prose li { margin-bottom: 7px; }

.prose li::marker { color: var(--neon); }

.prose a {
  color: var(--neon);
  text-underline-offset: 3px;
}

.prose blockquote {
  margin: 20px 0;
  padding: 14px 18px;
  border-left: 3px solid var(--neon);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: rgba(0, 255, 65, 0.06);
  color: #e6fff4;
}

.prose blockquote p:last-child { margin-bottom: 0; }

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}

.prose figure { margin: 20px 0; }

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 18px;
  font-size: 15.5px;
}

.prose th,
.prose td {
  padding: 9px 12px;
  border: 1px solid var(--line-soft);
  text-align: left;
}

.prose th { background: rgba(153, 255, 204, 0.08); color: var(--mint); }

.prose strong { color: #f2fffa; font-weight: 600; }

/* 页脚 */
.foot {
  grid-area: foot;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 30px;
  padding: 42px 40px 26px;
  border-top: 1px solid var(--line);
  background:
    radial-gradient(70% 100% at 50% 0%, rgba(0, 255, 65, 0.08), transparent 70%),
    rgba(0, 20, 42, 0.6);
}

.foot div { min-width: 0; }

.foot h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--mint);
}

.foot .subtitle { margin: 4px 0 14px; }

.foot-desc {
  margin: 0;
  color: var(--dim);
  font-size: 15px;
  line-height: 1.7;
}

.foot ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 12px;
}

.foot ul a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 7px 0;
  color: var(--text);
  font-size: 15px;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.foot ul a:hover,
.foot ul a:focus-visible {
  color: var(--neon);
  border-bottom-color: var(--line);
}

.to-top {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 18px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-decoration: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--mint), var(--neon));
}

.copy {
  grid-column: 1 / -1;
  margin: 8px 0 0;
  padding-top: 18px;
  text-align: center;
  color: var(--dim);
  font-size: 14px;
  letter-spacing: 0.06em;
  border-top: 1px dashed var(--line-soft);
}

/* 移动端 */
@media (max-width: 860px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "rail"
      "main"
      "foot";
  }

  .rail {
    position: sticky;
    top: 0;
    height: auto;
    overflow: visible;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 9px 14px;
    z-index: 60;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: rgba(0, 30, 60, 0.94);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }

  .stamp {
    flex: 1 1 auto;
    font-size: 1rem;
  }

  .branch { position: relative; margin-left: auto; }

  .branch > summary { font-size: 14px; padding: 10px 13px; }

  .branch-list {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    width: min(76vw, 290px);
    max-height: 62vh;
    overflow-y: auto;
    padding: 8px;
    background: #01294a;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 22px 44px rgba(0, 10, 25, 0.65);
    z-index: 70;
  }

  .rail-top { display: none; }

  .stage {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    padding: 22px 18px 26px;
  }

  .stage-copy { order: -1; }

  .stage-copy h1 { font-size: clamp(1.7rem, 8vw, 2.3rem); }

  .lead { font-size: 16px; margin-top: 14px; }

  .toc ol {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 14px;
  }

  .toc a { font-size: 14.5px; }

  .cell {
    width: 104px;
    height: 104px;
    top: auto;
    bottom: -6px;
    right: 10px;
    opacity: 0.3;
  }

  .prose { padding: 22px 18px 56px; }

  .prose [id] { scroll-margin-top: 120px; }

  .foot {
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
    padding: 30px 18px 22px;
  }

  .foot ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ticker-run,
  .cell svg,
  .cell svg circle:first-child,
  body::before,
  body::after,
  .stamp-dot { animation: none !important; }
}

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