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

:root {
  --ink: #0d0d0d;
  --ink-2: #140b20;
  --vio: #8000ff;
  --mag: #ff00ff;
  --txt: #ece5f9;
  --dim: #a99fc6;
  --line: rgba(128, 0, 255, 0.32);
  --rail: 228px;
  --wrap: 1180px;
  --font: "DM Sans", "Space Grotesk", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "Space Grotesk", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background-color: var(--ink);
  background-image:
    radial-gradient(620px 420px at 10% -10%, rgba(128, 0, 255, 0.24), transparent 70%),
    radial-gradient(720px 520px at 94% 0%, rgba(255, 0, 255, 0.14), transparent 72%);
  background-attachment: fixed;
  color: var(--txt);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 120;
  pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.045) 0 1px, transparent 1px 4px);
  opacity: 0.75;
}

img { display: block; max-width: 100%; height: auto; }

a { color: var(--mag); text-decoration: none; }

:focus-visible { outline: 2px solid var(--mag); outline-offset: 3px; }

h1, h2, h3 {
  font-family: var(--mono);
  line-height: 1.2;
  letter-spacing: 0.01em;
  margin: 0;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: 12px 18px;
  background: #1b1029;
  border: 1px solid var(--mag);
  border-radius: 4px;
  color: #fff;
}

.skip:focus { left: 14px; top: 14px; }

/* ---- 左侧竖排导航 ---- */
.rail {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--rail);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 16px;
  background: linear-gradient(180deg, var(--ink-2), var(--ink) 58%);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.rail::before,
.rail::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid var(--mag);
  opacity: 0.7;
  pointer-events: none;
}

.rail::before { top: 8px; left: 8px; border-right: 0; border-bottom: 0; }
.rail::after { bottom: 8px; right: 8px; border-left: 0; border-top: 0; }

.mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  min-height: 56px;
  border: 1px solid var(--vio);
  border-radius: 4px;
  background: rgba(128, 0, 255, 0.16);
  box-shadow: inset 0 0 18px rgba(128, 0, 255, 0.5), 0 0 14px rgba(255, 0, 255, 0.22);
  color: #fff;
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  overflow: hidden;
}

.mark img { width: 36px; height: 36px; object-fit: contain; }

.rail-toggle {
  display: none;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--txt);
  font: 600 16px/1 var(--mono);
  letter-spacing: 0.1em;
  cursor: pointer;
}

.rail-body { display: flex; flex-direction: column; gap: 12px; }

.finder { display: block; }

.finder-lbl {
  display: block;
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.22em;
  color: var(--vio);
  margin-bottom: 6px;
}

.finder input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  background: #100a18;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--txt);
  font: inherit;
  font-size: 16px;
}

.finder input:focus {
  border-color: var(--mag);
  box-shadow: 0 0 0 2px rgba(255, 0, 255, 0.18);
  outline: none;
}

.rail-group { position: relative; }

.rail-key {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--txt);
  font: 600 15px/1 var(--mono);
  letter-spacing: 0.18em;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.rail-key::after { content: "+"; color: var(--mag); font-size: 17px; }
.rail-key[aria-expanded="true"]::after { content: "–"; }
.rail-key:hover { border-color: var(--mag); }

.rail-drop {
  display: none;
  flex-direction: column;
  padding-top: 6px;
}

.rail-group:hover .rail-drop,
.rail-group:focus-within .rail-drop,
.rail-group[data-open="true"] .rail-drop { display: flex; }

.rail-drop a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  font-size: 16px;
  color: var(--dim);
  border-left: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.rail-drop a:hover,
.rail-drop a:focus {
  color: #fff;
  border-left-color: var(--mag);
  background: rgba(255, 0, 255, 0.09);
}

.rail-drop a.hit { color: #fff; text-shadow: 0 0 10px var(--mag); }
.rail-drop a.dim { opacity: 0.32; }

/* ---- 主体 ---- */
.page { padding-left: var(--rail); }

main { display: block; padding: 0 24px; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 32px;
  min-height: 70vh;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 56px 0 44px;
}

.hero h1 {
  font-size: clamp(34px, 5.6vw, 64px);
  color: #fff;
  margin-bottom: 18px;
  text-shadow: 0 0 22px rgba(255, 0, 255, 0.42), 0 0 64px rgba(128, 0, 255, 0.42);
  animation: glitch 7s steps(1, end) infinite;
}

@keyframes glitch {
  0%, 91%, 100% { transform: none; }
  93% { transform: skewX(-2deg) translateX(-3px); }
  95% { transform: skewX(2deg) translateX(3px); }
  97% { transform: none; }
}

.lede {
  max-width: 52ch;
  margin: 0;
  font-size: 18px;
  color: var(--dim);
}

.hero-art {
  margin: 0;
  width: 260px;
  flex: none;
}

.hero-art svg {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0 18px rgba(255, 0, 255, 0.35));
  animation: float 7s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 296px;
  gap: 48px;
  align-items: start;
  max-width: var(--wrap);
  margin: 0 auto;
  padding-bottom: 24px;
}

.prose { min-width: 0; }

main small {
  display: block;
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.22em;
  color: var(--mag);
  text-shadow: 0 0 10px rgba(255, 0, 255, 0.55);
  margin-bottom: 8px;
}

.prose section {
  padding: 38px 0;
  scroll-margin-top: 96px;
}

.prose section + section { border-top: 1px dashed rgba(128, 0, 255, 0.28); }

.prose h2 {
  font-size: clamp(24px, 3.2vw, 33px);
  color: #fff;
  margin-bottom: 14px;
}

.prose h3 {
  font-size: 21px;
  color: #fff;
  margin: 26px 0 10px;
}

.prose p, .prose li { max-width: 66ch; }
.prose p { margin: 0 0 16px; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 16px; }
.prose li { margin-bottom: 8px; }
.prose a { text-decoration: underline; text-underline-offset: 3px; }
.prose a:hover { color: #fff; }
.prose strong { color: #fff; }
.prose img, .prose figure { border-radius: 4px; }
.prose figure { margin: 20px 0; }

.prose .rv { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
.prose .rv.in { opacity: 1; transform: none; }

/* ---- 右侧栏 ---- */
.side {
  position: sticky;
  top: 28px;
  padding: 20px 18px;
  border: 1px solid var(--line);
  border-bottom: 3px solid var(--vio);
  border-radius: 4px;
  background: rgba(128, 0, 255, 0.08);
}

.side h2 { font-size: 22px; color: #fff; margin-bottom: 6px; }

.side dl { margin: 12px 0 0; }
.side dt {
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.2em;
  color: var(--vio);
  margin-bottom: 6px;
}
.side dd { margin: 0; }

.side dd a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding-left: 10px;
  font-size: 16px;
  color: var(--dim);
  border-left: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.side dd a:hover { color: #fff; border-left-color: var(--mag); }

/* ---- 页脚 ---- */
.foot {
  margin-top: 56px;
  padding: 34px 24px 26px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, transparent, rgba(128, 0, 255, 0.07));
}

.foot-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  max-width: var(--wrap);
  margin: 0 auto;
}

.foot dl { margin: 0; }

.foot dt {
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.2em;
  color: var(--vio);
  margin-bottom: 8px;
}

.foot dd { margin: 0; }

.foot-nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  font-size: 16px;
  color: var(--dim);
}

.foot-nav a:hover { color: #fff; text-shadow: 0 0 10px rgba(255, 0, 255, 0.6); }

.copy {
  max-width: var(--wrap);
  margin: 22px auto 0;
  font-family: var(--mono);
  font-size: 16px;
  color: var(--dim);
}

/* ---- 移动端 ---- */
@media (max-width: 880px) {
  .rail {
    right: 0;
    bottom: auto;
    width: auto;
    height: 64px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow: visible;
  }

  .rail::before, .rail::after { display: none; }

  .mark { width: 44px; height: 44px; min-height: 44px; font-size: 20px; }
  .mark img { width: 28px; height: 28px; }

  .rail-toggle { display: inline-flex; }

  .rail[data-open="true"] {
    height: auto;
    bottom: 0;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 14px;
    padding: 14px 14px 28px;
    overflow: auto;
  }

  .rail[data-open="true"] .rail-toggle { align-self: flex-end; }

  .rail-body { display: none; }
  .rail[data-open="true"] .rail-body { display: flex; }
  .rail[data-open="true"] .rail-drop { display: flex; }

  .page { padding-left: 0; padding-top: 64px; }
  main { padding: 0 18px; }

  .hero {
    grid-template-columns: 1fr;
    min-height: 0;
    gap: 22px;
    padding: 34px 0 28px;
  }

  .hero-art { width: 168px; order: -1; }

  .stage { grid-template-columns: 1fr; gap: 34px; padding-bottom: 8px; }
  .side { position: static; }
  .prose section { scroll-margin-top: 80px; }
}

@media (max-width: 620px) {
  .foot-nav { grid-template-columns: 1fr; gap: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

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