:root {
  --red: #ff0000;
  --pink: #ff1493;
  --ink: #261717;
  --deep: #17100f;
  --paper: #fdf4f1;
  --muted: rgba(253, 244, 241, 0.64);
  --line: rgba(255, 20, 147, 0.18);
  --card: rgba(43, 26, 26, 0.62);
  --rail: 248px;
}

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

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

body {
  margin: 0;
  padding-left: var(--rail);
  background: var(--deep);
  color: var(--paper);
  font-family: "Poppins", "Open Sans", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-size: 17px;
  line-height: 1.78;
  overflow-x: hidden;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
  text-decoration: none;
}

/* 背景极光层 */
.aurora {
  position: fixed;
  inset: -22% -12%;
  z-index: -2;
  pointer-events: none;
  background-image: radial-gradient(38% 44% at 16% 20%, rgba(255, 20, 147, 0.55), transparent 70%),
    radial-gradient(44% 48% at 84% 6%, rgba(255, 0, 0, 0.42), transparent 72%),
    radial-gradient(52% 56% at 66% 92%, rgba(146, 22, 74, 0.52), transparent 74%),
    conic-gradient(
      from 205deg at 52% 46%,
      rgba(255, 0, 0, 0.24),
      rgba(255, 20, 147, 0.3),
      rgba(88, 16, 46, 0.26),
      rgba(255, 0, 0, 0.24)
    );
  background-size: 200% 200%, 185% 185%, 225% 225%, 200% 200%;
  filter: blur(46px) saturate(1.25);
  opacity: 0.85;
  animation: aurora 11s ease-in-out infinite alternate;
}

@keyframes aurora {
  0% {
    background-position: 0% 0%, 100% 0%, 50% 100%, 0% 0%;
    transform: scale(1.02) translate3d(0, 0, 0);
  }
  50% {
    background-position: 40% 30%, 60% 40%, 30% 60%, 55% 45%;
    transform: scale(1.08) translate3d(0, -1.5%, 0);
  }
  100% {
    background-position: 80% 65%, 20% 80%, 70% 20%, 100% 100%;
    transform: scale(1.03) translate3d(0, 1.5%, 0);
  }
}

.veil {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(90% 70% at 50% 20%, #000 0%, transparent 88%);
  -webkit-mask-image: radial-gradient(90% 70% at 50% 20%, #000 0%, transparent 88%);
}

/* 左侧固定导航 */
.rail {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--rail);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 26px 16px 22px;
  background: linear-gradient(180deg, rgba(28, 18, 18, 0.88), rgba(23, 16, 15, 0.72));
  border-right: 1px solid rgba(255, 20, 147, 0.14);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(140deg, rgba(255, 0, 0, 0.9), rgba(255, 20, 147, 0.9));
  box-shadow: 0 10px 26px rgba(255, 20, 147, 0.28);
}

.brand-logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  object-fit: cover;
}

.brand-mark {
  font-size: 21px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
}

.rail-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.rail-nav li {
  animation: slide-in 0.55s cubic-bezier(0.22, 0.9, 0.3, 1) both;
}

.rail-nav li:nth-child(1) { animation-delay: 0.04s; }
.rail-nav li:nth-child(2) { animation-delay: 0.09s; }
.rail-nav li:nth-child(3) { animation-delay: 0.14s; }
.rail-nav li:nth-child(4) { animation-delay: 0.19s; }
.rail-nav li:nth-child(5) { animation-delay: 0.24s; }
.rail-nav li:nth-child(6) { animation-delay: 0.29s; }
.rail-nav li:nth-child(7) { animation-delay: 0.34s; }

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateX(-14px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.rail-link {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 9px 11px;
  border-radius: 12px;
  font-size: 15px;
  color: var(--muted);
  border: 1px solid transparent;
  transition: color 0.25s ease, background 0.25s ease, border-color 0.25s ease;
}

.rail-link .ico {
  flex: none;
  color: rgba(255, 20, 147, 0.7);
  transition: color 0.25s ease, transform 0.35s ease;
}

.rail-link:hover,
.rail-link:focus-visible {
  color: #fff;
  background: rgba(255, 20, 147, 0.14);
  border-color: rgba(255, 20, 147, 0.32);
  outline: none;
}

.rail-link:hover .ico,
.rail-link:focus-visible .ico {
  color: var(--red);
  transform: rotate(45deg);
}

/* Hero */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-end;
  text-align: right;
  padding: 0 clamp(20px, 5vw, 78px) 13vh;
  overflow: hidden;
}

.ghost {
  position: absolute;
  top: 13vh;
  right: -2vw;
  font-size: clamp(3rem, 17vw, 15rem);
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: -0.03em;
  white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: 1.2px rgba(255, 20, 147, 0.3);
  opacity: 0.7;
  pointer-events: none;
  animation: drift 12s ease-in-out infinite alternate;
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(-2.5%, 2.5%, 0);
  }
}

.hero h1 {
  position: relative;
  margin: 0;
  max-width: 15em;
  font-size: clamp(2.1rem, 6.1vw, 5rem);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.025em;
  background: linear-gradient(104deg, #ffffff 0%, #ffd9e7 34%, var(--pink) 68%, var(--red) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-wrap: balance;
}

.hero h1::after {
  content: "";
  display: block;
  width: clamp(64px, 12vw, 132px);
  height: 3px;
  margin: 26px 0 0 auto;
  border-radius: 3px;
  background: linear-gradient(90deg, transparent, var(--pink), var(--red));
}

/* 主栅格 */
.wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 236px;
  gap: clamp(22px, 3vw, 54px);
  align-items: start;
  max-width: 1180px;
  padding: 0 clamp(16px, 3.6vw, 60px) 96px;
}

.col {
  min-width: 0;
}

.prose-title {
  margin: 0 0 6px;
  font-size: clamp(1.55rem, 3vw, 2.1rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  background: linear-gradient(96deg, #fff, #ff9dc6 60%, var(--pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle {
  margin: 0 0 30px;
  font-size: 16px;
  line-height: 1.8;
  color: var(--muted);
  max-width: 46em;
  border-left: 2px solid rgba(255, 20, 147, 0.45);
  padding-left: 14px;
}

/* 正文 */
.prose > div {
  position: relative;
  scroll-margin-top: 92px;
  margin: 0 0 26px;
  padding: 30px 26px 38px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  backdrop-filter: blur(8px);
  overflow-x: auto;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
}

.prose > div::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--red), var(--pink) 55%, rgba(255, 20, 147, 0.15));
  opacity: 0.9;
}

.prose h2 {
  margin: 0 0 12px;
  font-size: clamp(1.35rem, 2.6vw, 1.75rem);
  line-height: 1.32;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #fff;
}

.prose h3 {
  margin: 26px 0 8px;
  font-size: 1.15rem;
  line-height: 1.45;
  font-weight: 600;
  color: #ffd9e7;
}

.prose p {
  margin: 0 0 1em;
}

.prose ul,
.prose ol {
  margin: 0 0 1em;
  padding-left: 1.3em;
}

.prose li {
  margin: 0.35em 0;
}

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

.prose a {
  color: #ff77b3;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(255, 20, 147, 0.5);
}

.prose a:hover {
  color: #fff;
}

.prose strong {
  color: #ffd9e7;
}

.prose blockquote {
  margin: 1.2em 0;
  padding: 4px 0 4px 16px;
  border-left: 3px solid var(--pink);
  color: var(--muted);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2em 0;
  font-size: 15px;
}

.prose th,
.prose td {
  padding: 9px 12px;
  border: 1px solid rgba(255, 20, 147, 0.22);
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: rgba(255, 20, 147, 0.12);
  color: #ffd9e7;
  font-weight: 600;
}

.prose img {
  border-radius: 14px;
  margin: 0.6em 0;
}

/* 侧栏目录 */
.toc {
  position: sticky;
  top: 96px;
  padding: 22px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(38, 23, 23, 0.55);
  backdrop-filter: blur(8px);
}

.toc-h {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: #ff9dc6;
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: none;
}

.toc-list li + li {
  margin-top: 2px;
}

.toc-list a {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 8px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--muted);
  transition: background 0.22s ease, color 0.22s ease;
}

.toc-list b {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: rgba(255, 20, 147, 0.75);
}

.toc-list a:hover,
.toc-list a:focus-visible {
  background: rgba(255, 20, 147, 0.14);
  color: #fff;
  outline: none;
}

/* 页脚 */
.foot {
  position: relative;
  background: linear-gradient(180deg, rgba(23, 16, 15, 0.4), rgba(30, 18, 18, 0.95));
  border-top: 1px solid rgba(255, 20, 147, 0.2);
}

.foot-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr;
  gap: 32px;
  padding: 58px clamp(16px, 3.6vw, 60px) 30px;
  max-width: 1180px;
}

.foot-giant {
  margin: 0 0 14px;
  font-size: clamp(1.55rem, 3.2vw, 2.35rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  background: linear-gradient(100deg, #fff, var(--pink) 55%, var(--red));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.foot-addr {
  font-style: normal;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
  color: var(--muted);
}

.foot-addr .host {
  font-size: 13px;
  letter-spacing: 0.04em;
  color: rgba(255, 154, 200, 0.7);
}

.foot-nav dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 10px;
  margin: 0;
}

.foot-nav dt a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  font-size: 14px;
  color: rgba(253, 244, 241, 0.78);
}

.foot-nav dt a:hover {
  color: var(--pink);
}

.foot-nav dd {
  margin: 0;
  display: flex;
  justify-content: flex-end;
}

.foot-nav dd a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: rgba(255, 20, 147, 0.7);
}

.foot-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.foot-links a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  font-size: 14px;
  color: rgba(253, 244, 241, 0.78);
}

.foot-links a:hover {
  color: var(--pink);
}

.foot-base {
  border-top: 1px solid rgba(255, 20, 147, 0.14);
  padding: 16px 20px 26px;
  text-align: center;
}

.foot-base p {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.05em;
  color: rgba(253, 244, 241, 0.48);
}

/* 回到顶部 */
.to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 20, 147, 0.4);
  border-radius: 50%;
  background: linear-gradient(140deg, rgba(255, 0, 0, 0.9), rgba(255, 20, 147, 0.9));
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.to-top.show {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* 滚动显现 */
html.js .prose > div {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.8, 0.3, 1);
}

html.js .prose > div.in {
  opacity: 1;
  transform: none;
}

/* 移动端 */
@media (max-width: 900px) {
  body {
    padding-left: 0;
    padding-top: 62px;
  }

  .rail {
    inset: 0 0 auto 0;
    width: auto;
    height: 62px;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 20, 147, 0.16);
    scrollbar-width: none;
  }

  .rail::-webkit-scrollbar {
    display: none;
  }

  .brand {
    flex: none;
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .brand-mark {
    font-size: 17px;
  }

  .rail-nav ul {
    flex-direction: row;
    gap: 4px;
  }

  .rail-link {
    min-height: 40px;
    padding: 8px 12px;
    white-space: nowrap;
    font-size: 14px;
  }

  .rail-link .ico {
    display: none;
  }

  .wrap {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
    padding-bottom: 74px;
  }

  .toc {
    position: static;
    order: 2;
  }

  .toc-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 8px;
  }

  .hero {
    min-height: 88svh;
    padding-bottom: 9vh;
  }

  .prose > div {
    padding: 24px 18px 32px;
    scroll-margin-top: 78px;
  }

  .foot-grid {
    grid-template-columns: 1fr;
    gap: 22px;
    padding-top: 44px;
  }
}

@media (max-width: 420px) {
  .toc-list {
    grid-template-columns: 1fr;
  }

  .ghost {
    top: 9vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .aurora,
  .ghost,
  .rail-nav li {
    animation: none;
  }

  html.js .prose > div {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

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