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

:root {
  --neon: #ff0000;
  --mag: #ff006e;
  --ink: #1a1a2e;
  --ink-deep: #12102a;
  --paper: #f2efff;
  --dim: #a9a6cc;
  --line: #302d58;
  --r: 18px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  padding: 0 0 130px;
  min-height: 100vh;
  font-family: 'Space Mono', ui-monospace, 'Courier New', monospace;
  font-size: 17px;
  line-height: 1.66;
  color: var(--paper);
  background:
    radial-gradient(1100px 560px at 88% -12%, rgba(255, 0, 110, .20), transparent 62%),
    radial-gradient(820px 480px at -6% 18%, rgba(255, 0, 0, .15), transparent 60%),
    linear-gradient(180deg, #14122c 0%, #17152f 42%, #12102a 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, .045) 0 1px,
    rgba(0, 0, 0, 0) 1px 3px
  );
  mix-blend-mode: screen;
  opacity: .8;
}

img { max-width: 100%; }

a { color: #ff8fba; }

/* ---------- 顶部固定底栏 ---------- */
.bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  padding: 9px 14px calc(9px + env(safe-area-inset-bottom, 0px));
  background: rgba(16, 14, 40, .95);
  border-top: 1px solid var(--line);
  box-shadow: 0 -2px 0 rgba(255, 0, 110, .30), 0 -14px 34px rgba(0, 0, 0, .55);
  backdrop-filter: blur(8px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 2px 4px;
  font-weight: 700;
  letter-spacing: .07em;
  color: #fff;
  text-decoration: none;
  text-shadow: 0 0 12px rgba(255, 0, 110, .85);
  white-space: nowrap;
}

.brand-mark { width: 26px; height: 26px; border-radius: 6px; }

.bar-nav { margin-left: auto; }

.bar-nav p {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0 2px;
}

.bar-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 3px 7px;
  font-size: 16px;
  color: var(--dim);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color .18s ease, border-color .18s ease, text-shadow .18s ease;
}

.bar-nav a:hover,
.bar-nav a:focus-visible {
  color: #fff;
  border-bottom-color: var(--mag);
  text-shadow: 0 0 10px var(--mag);
}

/* ---------- 首屏 ---------- */
.hero {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 70vh;
  overflow: hidden;
  background: #100e26;
  border-bottom: 1px solid var(--line);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background-image:
    linear-gradient(rgba(255, 0, 110, .12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 0, 110, .12) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(120% 90% at 20% 30%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(120% 90% at 20% 30%, #000 0%, transparent 78%);
}

.hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .42;
  filter: saturate(1.2) contrast(1.05);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(90deg, rgba(16, 14, 40, .96) 0%, rgba(16, 14, 40, .62) 52%, rgba(255, 0, 110, .30) 100%);
}

.hero-inner {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 110px 22px 78px;
  text-align: left;
}

h1 {
  margin: 0 0 16px;
  font-size: clamp(29px, 5.6vw, 56px);
  line-height: 1.14;
  letter-spacing: -.01em;
  color: #fff;
  text-shadow: 0 0 14px rgba(255, 0, 110, .9), 0 0 44px rgba(255, 0, 0, .5);
  animation: glitch 6s steps(1, end) infinite;
}

@keyframes glitch {
  0%, 91%, 100% { transform: none; text-shadow: 0 0 14px rgba(255, 0, 110, .9), 0 0 44px rgba(255, 0, 0, .5); }
  92% { transform: skewX(-3deg) translateX(-2px); text-shadow: -3px 0 var(--mag), 3px 0 #00e5ff; }
  94% { transform: skewX(2deg) translateX(2px); text-shadow: 3px 0 var(--mag), -3px 0 #00e5ff; }
  96% { transform: none; text-shadow: -2px 0 var(--mag), 2px 0 #00e5ff; }
  98% { transform: skewX(-1deg); }
}

.subtitle {
  margin: 0;
  max-width: 48ch;
  font-size: 17px;
  color: var(--dim);
}

.hero .subtitle {
  color: #ece7ff;
  text-shadow: 0 0 18px rgba(16, 14, 40, .95);
}

/* ---------- 主体 ---------- */
main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 44px 22px 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 256px;
  gap: 42px;
  align-items: start;
}

.doc { min-width: 0; }

.doc div {
  scroll-margin-top: 26px;
  margin: 0 0 24px;
  padding: 24px 22px 28px;
  border-radius: var(--r);
  background: rgba(255, 255, 255, .045);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05);
  animation: rise .55s ease both;
}

.doc div:nth-child(odd) { background: rgba(255, 255, 255, .045); }
.doc div:nth-child(even) { background: rgba(255, 0, 110, .085); }

.doc div:nth-child(1) { animation-delay: .04s; }
.doc div:nth-child(2) { animation-delay: .08s; }
.doc div:nth-child(3) { animation-delay: .12s; }
.doc div:nth-child(4) { animation-delay: .16s; }
.doc div:nth-child(5) { animation-delay: .20s; }
.doc div:nth-child(6) { animation-delay: .24s; }
.doc div:nth-child(7) { animation-delay: .28s; }
.doc div:nth-child(n+8) { animation-delay: .32s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.doc h2 {
  margin: 0 0 14px;
  padding-left: 12px;
  font-size: clamp(21px, 2.9vw, 27px);
  line-height: 1.3;
  color: #fff;
  border-left: 6px solid var(--neon);
  text-shadow: 0 0 14px rgba(255, 0, 0, .55);
  scroll-margin-top: 26px;
}

.doc h3 {
  margin: 20px 0 10px;
  font-size: 19px;
  line-height: 1.4;
  color: #ffd7e5;
}

.doc p { margin: 0 0 14px; }
.doc p:last-child, .doc ul:last-child, .doc ol:last-child { margin-bottom: 0; }

.doc ul, .doc ol { margin: 0 0 16px; padding-left: 22px; }
.doc li { margin: 0 0 8px; }

.doc a {
  color: #ffa3c6;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.doc a:hover { color: #fff; text-shadow: 0 0 10px var(--mag); }

.doc strong { color: #fff; }

.doc blockquote {
  margin: 0 0 16px;
  padding: 12px 16px;
  border-left: 4px solid var(--mag);
  border-radius: 0 12px 12px 0;
  background: rgba(255, 0, 110, .12);
}

.doc img { border-radius: 12px; display: block; margin: 0 0 16px; }

.doc table { width: 100%; border-collapse: collapse; margin: 0 0 16px; font-size: 16px; }
.doc th, .doc td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }

/* ---------- 右侧目录 ---------- */
.rail {
  position: sticky;
  top: 24px;
  padding: 18px 16px 22px;
  border-radius: var(--r);
  background: rgba(8, 7, 24, .55);
  box-shadow: inset 0 0 0 1px rgba(255, 0, 110, .22);
}

.rail h2 {
  margin: 0 0 6px;
  font-size: 19px;
  letter-spacing: .12em;
  color: #fff;
  text-shadow: 0 0 12px rgba(255, 0, 110, .8);
}

.rail .subtitle { font-size: 16px; color: #8a87b3; }

.rail ol {
  counter-reset: rail;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.rail li { counter-increment: rail; margin: 0 0 2px; }

.rail a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 4px 8px;
  border-radius: 10px;
  font-size: 16px;
  color: var(--dim);
  text-decoration: none;
  transition: background .18s ease, color .18s ease;
}

.rail a::before {
  content: counter(rail, decimal-leading-zero);
  font-size: 13px;
  color: var(--mag);
  letter-spacing: .06em;
}

.rail a:hover,
.rail a[aria-current] {
  background: rgba(255, 0, 110, .18);
  color: #fff;
}

/* ---------- 页脚 ---------- */
.foot {
  max-width: 1120px;
  margin: 26px auto 0;
  padding: 34px 22px 26px;
  border-top: 1px solid var(--line);
}

.foot-cols {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 24px;
  align-items: start;
}

.foot-brand {
  font-style: normal;
  font-weight: 700;
  letter-spacing: .07em;
  color: #fff;
  text-shadow: 0 0 12px rgba(255, 0, 110, .8);
}

.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.foot-links a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  font-size: 16px;
  color: var(--dim);
  text-decoration: none;
}

.foot-links a:hover { color: #fff; text-shadow: 0 0 10px var(--mag); }

.foot-copy {
  margin: 18px 0 0;
  text-align: center;
  font-size: 16px;
  color: #8481ab;
}

/* ---------- 断点 ---------- */
@media (max-width: 860px) {
  body { padding-bottom: 190px; }

  .bar { gap: 2px 10px; }
  .bar-nav { flex: 1 1 100%; margin-left: 0; }

  main {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
    padding-top: 32px;
  }

  .rail { position: static; }

  .foot-cols { grid-template-columns: 1fr; gap: 10px; }

  .hero-inner { padding: 92px 18px 64px; }
}

@media (max-width: 430px) {
  .bar-nav a { padding: 3px 6px; }
  .doc div { padding: 20px 16px 24px; }
  .doc h2 { border-left-width: 5px; padding-left: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  h1 { animation: none; }
  .doc div { animation: none; }
  * { transition-duration: .01ms !important; }
}

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