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

:root {
  --ink: #0d0d0d;
  --violet: #8000ff;
  --magenta: #ff00ff;
  --text: #ece5f7;
  --dim: #a89bc6;
  --faint: #7b6f96;
  --line: rgba(128, 0, 255, 0.3);
  --line-soft: rgba(128, 0, 255, 0.16);
  --glass: rgba(26, 12, 40, 0.62);
  --sans: 'Noto Sans JP', system-ui, -apple-system, 'Hiragino Sans', 'Microsoft YaHei', sans-serif;
  --serif: 'Noto Serif JP', 'Songti SC', Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  overflow-x: hidden;
  background-color: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.85;
  letter-spacing: 0.01em;
  background-image:
    radial-gradient(900px 520px at 88% -8%, rgba(255, 0, 255, 0.16), transparent 62%),
    radial-gradient(760px 480px at -6% 14%, rgba(128, 0, 255, 0.2), transparent 60%),
    linear-gradient(rgba(128, 0, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(128, 0, 255, 0.055) 1px, transparent 1px);
  background-size: auto, auto, 44px 44px, 44px 44px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
  opacity: 0.42;
  mix-blend-mode: screen;
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.05) 0 1px,
    rgba(255, 255, 255, 0) 1px 3px
  );
}

a { color: #d9c9ff; text-decoration-color: rgba(255, 0, 255, 0.5); }
a:hover { color: #fff; }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--magenta);
  outline-offset: 3px;
}

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

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  background: rgba(13, 13, 13, 0.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
}

.mark {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--violet);
  border-radius: 4px;
  background: linear-gradient(150deg, rgba(128, 0, 255, 0.35), rgba(255, 0, 255, 0.12));
  color: var(--magenta);
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  text-decoration: none;
  text-shadow: 0 0 12px rgba(255, 0, 255, 0.8);
  box-shadow: 0 0 16px -6px var(--magenta) inset;
}

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

.nav {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(90deg, #000 92%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent 100%);
}

.nav::-webkit-scrollbar { height: 0; }

.nav ol {
  display: flex;
  align-items: stretch;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 13px;
  border-radius: 4px;
  border: 1px solid transparent;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 16px;
  letter-spacing: 0.04em;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s, background 0.2s, border-color 0.2s, text-shadow 0.2s;
}

.nav a:hover,
.nav a:focus-visible {
  color: #fff;
  background: rgba(128, 0, 255, 0.22);
  border-color: var(--line);
  text-shadow: 0 0 12px var(--magenta);
}

/* ---------- 头图 ---------- */

.hero {
  position: relative;
  min-height: 70vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 64px 18px 72px;
  background: radial-gradient(circle at 50% 35%, rgba(128, 0, 255, 0.28), transparent 62%), #0a0a0c;
  border-bottom: 1px solid var(--line);
}

.hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-media.is-empty {
  background:
    repeating-linear-gradient(135deg, rgba(255, 0, 255, 0.09) 0 2px, transparent 2px 12px),
    radial-gradient(circle at 30% 20%, rgba(255, 0, 255, 0.22), transparent 55%);
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.6;
  filter: saturate(1.2) contrast(1.06);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(13, 13, 13, 0.5), rgba(13, 13, 13, 0.86) 68%, var(--ink)),
    radial-gradient(circle at 50% 45%, rgba(255, 0, 255, 0.16), transparent 62%);
}

.hero-ghost {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  margin: 0;
  transform: translate(-50%, -50%);
  font-family: var(--serif);
  font-size: clamp(3.4rem, 20vw, 13rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.06em;
  white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 0, 255, 0.35);
  opacity: 0.6;
  user-select: none;
}

.hero-inner {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 42rem;
}

.hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.85rem, 6vw, 3.5rem);
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.06em;
  color: #fff;
  text-shadow: 0 0 18px rgba(255, 0, 255, 0.55), 0 0 46px rgba(128, 0, 255, 0.5);
  animation: glitch 7s steps(1, end) infinite;
}

.hero-sub {
  margin: 18px auto 0;
  max-width: 32rem;
  color: var(--dim);
  font-size: 16px;
  line-height: 1.85;
}

@keyframes glitch {
  0%, 90%, 100% {
    transform: none;
    text-shadow: 0 0 18px rgba(255, 0, 255, 0.55), 0 0 46px rgba(128, 0, 255, 0.5);
  }
  91% {
    transform: skewX(-3deg) translateX(-3px);
    text-shadow: -3px 0 var(--magenta), 3px 0 #38f5c8;
  }
  93% {
    transform: skewX(2deg) translateX(3px);
    text-shadow: 3px 0 var(--magenta), -3px 0 #38f5c8;
  }
  95% {
    transform: none;
    text-shadow: 0 0 18px rgba(255, 0, 255, 0.55), 0 0 46px rgba(128, 0, 255, 0.5);
  }
}

/* ---------- 主区骨架 ---------- */

main { display: block; }

.wrap {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 30px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 36px 18px 64px;
}

main [id] { scroll-margin-top: 94px; }

.body-col { min-width: 0; }

/* ---------- 侧栏 ---------- */

.rail {
  position: sticky;
  top: 84px;
  align-self: start;
  display: grid;
  gap: 14px;
}

.rail-block {
  padding: 14px 14px 16px;
  border: 1px solid var(--line-soft);
  border-left: 2px solid var(--violet);
  border-radius: 4px;
  background: var(--glass);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  box-shadow: 0 18px 40px -34px #000;
}

.rail-h {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--magenta);
  text-shadow: 0 0 12px rgba(255, 0, 255, 0.45);
}

.rail-h span { display: inline-block; }

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

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

.rail-ol a:hover,
.rail-ol a:focus-visible {
  color: #fff;
  background: rgba(128, 0, 255, 0.2);
  transform: translateX(3px);
}

.dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 1px;
  background: var(--magenta);
  box-shadow: 0 0 10px var(--magenta);
  transform: rotate(45deg);
}

.rail-top {
  display: grid;
  place-items: center;
  width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--magenta);
  font-family: var(--mono);
  font-size: 18px;
  text-decoration: none;
  transition: background 0.2s, box-shadow 0.2s;
}

.rail-top:hover {
  background: rgba(255, 0, 255, 0.16);
  box-shadow: 0 0 18px -6px var(--magenta);
}

/* ---------- 正文 ---------- */

.content { display: block; }

.content > article {
  position: relative;
  margin: 0 0 26px;
  padding: 24px 20px 26px;
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--violet);
  border-radius: 4px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 22px 50px -40px #000, 0 0 0 1px rgba(255, 0, 255, 0.05);
}

.content > article:last-child { margin-bottom: 0; }

.content > article::before {
  content: "";
  position: absolute;
  top: -1px;
  right: -1px;
  width: 14px;
  height: 14px;
  border-top: 1px solid var(--magenta);
  border-right: 1px solid var(--magenta);
  border-top-right-radius: 4px;
  opacity: 0.75;
}

.content h2,
.content h3 {
  font-family: var(--serif);
  color: #fff;
  line-height: 1.5;
  letter-spacing: 0.02em;
  border-left: 3px solid var(--magenta);
  padding-left: 0.62em;
  text-shadow: 0 0 16px rgba(255, 0, 255, 0.35);
}

.content h2 {
  margin: 0 0 0.7em;
  font-size: clamp(1.3rem, 3.2vw, 1.7rem);
}

.content h3 {
  margin: 1.6em 0 0.5em;
  font-size: clamp(1.1rem, 2.6vw, 1.3rem);
}

.content h2 span,
.content h3 span { display: inline-block; }

.content p { margin: 0 0 1.05em; }

.content ul,
.content ol { margin: 0 0 1.1em; padding-left: 1.4em; }

.content li { margin-bottom: 0.4em; }

.content strong,
.content b { color: #fff; font-weight: 700; }

.content blockquote {
  margin: 1.2em 0;
  padding: 0.6em 0 0.6em 1em;
  border-left: 2px solid var(--magenta);
  background: rgba(255, 0, 255, 0.06);
  color: #f0e6ff;
}

.content figure { margin: 1.2em 0; }

.content figure img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.content figcaption {
  margin-top: 0.5em;
  color: var(--faint);
  font-size: 16px;
}

.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2em 0;
}

.content th,
.content td {
  border: 1px solid var(--line-soft);
  padding: 8px 10px;
  text-align: left;
}

.content th { background: rgba(128, 0, 255, 0.16); }

.content code {
  font-family: var(--mono);
  font-size: 16px;
  background: rgba(128, 0, 255, 0.14);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

/* ---------- 页脚 ---------- */

footer {
  padding: 30px 18px 46px;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.5);
  text-align: center;
}

footer p {
  margin: 0 0 6px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 16px;
  letter-spacing: 0.1em;
}

footer small {
  display: block;
  color: var(--faint);
  font-size: 16px;
  letter-spacing: 0.08em;
}

/* ---------- 滚动浮现 ---------- */

.rv {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.rv.in {
  opacity: 1;
  transform: none;
}

.content > article.rv { transition-delay: 0.02s; }

/* ---------- 响应式 ---------- */

@media (max-width: 880px) {
  .wrap {
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
    padding: 26px 16px 54px;
  }

  .rail {
    position: static;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 12px;
  }

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

  .rail-top { margin-top: 4px; }
}

@media (max-width: 520px) {
  .hero { min-height: 62vh; padding: 46px 16px 56px; }
  .hero-ghost { font-size: clamp(2.6rem, 22vw, 6rem); }
  .content > article { padding: 20px 15px 22px; }
  .rail-ol { grid-template-columns: minmax(0, 1fr); }
  .rail { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero h1 { animation: none; }
  .rv { opacity: 1; transform: none; transition: none; }
  .rail-ol a { transition: none; }
  .rail-ol a:hover { transform: none; }
}

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