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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  max-width: 100%;
  padding-bottom: 112px;
  background-color: #1f1726;
  background-image:
    radial-gradient(120vmax 70vmax at 82% -12%, rgba(86, 34, 139, 0.5), rgba(31, 23, 38, 0) 62%),
    radial-gradient(90vmax 60vmax at 4% 108%, rgba(139, 69, 19, 0.32), rgba(31, 23, 38, 0) 60%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.028) 1px, rgba(0, 0, 0, 0) 1.4px);
  background-size: auto, auto, 7px 7px;
  background-attachment: fixed, fixed, fixed;
  color: #f3eaf2;
  font-family: 'EB Garamond', 'Crimson Text', Georgia, 'Songti SC', 'Noto Serif SC', serif;
  font-size: 17px;
  line-height: 1.78;
  letter-spacing: 0.004em;
  overflow-x: hidden;
}

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

a {
  color: #e9bd8e;
  text-decoration-color: rgba(233, 189, 142, 0.45);
  text-underline-offset: 3px;
}

a:hover {
  color: #f6d5b3;
}

:focus-visible {
  outline: 2px solid #c07a3a;
  outline-offset: 2px;
  border-radius: 6px;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: fixed;
  top: -70px;
  left: 14px;
  z-index: 90;
  padding: 10px 18px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-radius: 16px;
  background: #2b1d3a;
  border: 1px solid rgba(200, 165, 220, 0.35);
  color: #f6ecfa;
  text-decoration: none;
  font-size: 1rem;
}

.skip:focus {
  top: 12px;
}

/* ---------- 溢出防护 ---------- */

main,
.wrap,
.wrap > *,
.content,
.content section,
.content div,
.content figure,
.side,
.dock,
.brand {
  min-width: 0;
  max-width: 100%;
}

.content,
.content p,
.content li,
.content dd,
.content dt,
.content td,
.content th,
.content figcaption,
.content blockquote,
.content strong {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.content img,
.content picture,
.content svg,
.content video,
.content iframe,
.content object,
.content embed,
.content table,
.content pre {
  max-width: 100%;
}

.content iframe {
  width: 100%;
}

.content pre {
  white-space: pre-wrap;
  overflow-x: auto;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(18, 12, 24, 0.66);
  border: 1px solid rgba(200, 165, 220, 0.18);
  font-size: 0.95rem;
  line-height: 1.6;
}

.content code,
.content kbd,
.content samp {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  min-height: 45vh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  border-radius: 0 0 46px 34px;
  background:
    linear-gradient(155deg, #3c1a5c 0%, #56228b 52%, #7a3d12 100%);
  isolation: isolate;
}

.hero-img {
  position: absolute;
  inset: -6% 0 0;
  width: 100%;
  height: 116%;
  object-fit: cover;
  transform: scale(1.06);
  will-change: transform;
  z-index: -2;
}

.hero-veil {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(92deg, rgba(31, 23, 38, 0.94) 0%, rgba(31, 23, 38, 0.7) 45%, rgba(31, 23, 38, 0.28) 100%),
    linear-gradient(0deg, rgba(31, 23, 38, 0.9) 0%, rgba(31, 23, 38, 0) 55%);
}

.hero-blob {
  position: absolute;
  right: -8%;
  top: -22%;
  width: 46vmin;
  height: 46vmin;
  z-index: -1;
  border-radius: 58% 42% 47% 53% / 46% 56% 44% 54%;
  background: radial-gradient(circle at 34% 30%, rgba(192, 122, 58, 0.5), rgba(139, 69, 19, 0) 68%);
  filter: blur(6px);
  pointer-events: none;
}

.hero-in {
  position: relative;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 64px) clamp(26px, 4vw, 42px);
}

.hero h1 {
  margin: 0;
  max-width: 22ch;
  font-size: clamp(1.95rem, 5.4vw, 3.5rem);
  line-height: 1.16;
  font-weight: 600;
  letter-spacing: 0.006em;
  overflow-wrap: anywhere;
  text-shadow: 0 2px 22px rgba(16, 8, 24, 0.55);
}

/* ---------- 正文骨架 ---------- */

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(30px, 5vw, 58px) clamp(16px, 4vw, 40px) 44px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 274px;
  gap: clamp(24px, 4vw, 46px);
  align-items: start;
}

.content {
  font-size: 1.04rem;
}

.content section > div {
  position: relative;
  padding-bottom: 34px;
  margin-bottom: 38px;
  scroll-margin-top: 26px;
}

.content section > div:last-child {
  margin-bottom: 12px;
}

.content section > div::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: min(100%, 340px);
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, rgba(192, 122, 58, 0.95), rgba(86, 34, 139, 0));
}

.content h1 {
  font-size: 2rem;
}

.content h2 {
  margin: 0 0 0.25em;
  font-size: clamp(1.42rem, 3.1vw, 1.95rem);
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: 0.008em;
  color: #f8f0fb;
}

.content h3 {
  margin: 1.7em 0 0.4em;
  font-size: clamp(1.16rem, 2.2vw, 1.34rem);
  line-height: 1.35;
  font-weight: 600;
  color: #eddcf6;
}

.content h4 {
  margin: 1.4em 0 0.35em;
  font-size: 1.06rem;
  color: #e5d3ef;
}

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

.content strong {
  color: #fbe9cf;
  font-weight: 700;
}

.content ul,
.content ol {
  margin: 0 0 1.1em;
  padding: 0 0 0 4px;
  list-style: none;
}

.content ol {
  counter-reset: step;
}

.content li {
  position: relative;
  margin: 0.5em 0;
  padding-left: 22px;
}

.content ul li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.72em;
  width: 9px;
  height: 9px;
  border-radius: 56% 44% 52% 48% / 48% 54% 46% 52%;
  background: linear-gradient(140deg, #c07a3a, #7b46b8);
}

.content ol li {
  counter-increment: step;
}

.content ol li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.18em;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50% 50% 50% 22%;
  background: rgba(139, 69, 19, 0.42);
  border: 1px solid rgba(200, 165, 220, 0.28);
  color: #fbe9cf;
  font-size: 0.82rem;
  line-height: 1;
}

.content dl {
  margin: 0 0 1.1em;
}

.content dd {
  margin: 0 0 0.9em;
  padding-left: 2px;
}

.content blockquote {
  margin: 1.3em 0;
  padding: 14px 20px;
  border-left: 4px solid #8b4513;
  border-radius: 8px 20px 20px 8px;
  background: rgba(58, 40, 72, 0.5);
  color: #eedff5;
}

.content table {
  width: 100%;
  margin: 1.2em 0;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 1rem;
}

.content th,
.content td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(200, 165, 220, 0.2);
  vertical-align: top;
}

.content th {
  color: #fbe9cf;
  font-weight: 700;
}

.content figure {
  margin: 1.3em 0;
}

.content figure img {
  border-radius: 18px;
  box-shadow: 0 16px 34px rgba(10, 6, 16, 0.45);
}

.content figcaption {
  margin-top: 0.5em;
  font-size: 1rem;
  color: #cdbcd9;
}

hr {
  border: 0;
  height: 3px;
  width: 70px;
  margin: 0 0 1.15em;
  border-radius: 3px;
  background: linear-gradient(90deg, #c07a3a, rgba(86, 34, 139, 0));
}

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

.side {
  position: sticky;
  top: 22px;
  padding: 20px 18px 16px;
  border-radius: 24px 18px 22px 20px;
  border: 1px solid rgba(200, 165, 220, 0.2);
  background:
    linear-gradient(175deg, rgba(66, 45, 84, 0.86), rgba(38, 27, 50, 0.9));
  box-shadow: 0 18px 36px rgba(10, 6, 16, 0.4);
}

.side::before {
  content: "";
  display: block;
  width: 42px;
  height: 5px;
  margin-bottom: 14px;
  border-radius: 4px;
  background: rgba(192, 122, 58, 0.8);
}

.side h2 {
  margin: 0 0 0.4em;
  font-size: 1.14rem;
  letter-spacing: 0.05em;
  font-weight: 600;
  color: #f7edfb;
}

.side hr {
  width: 54px;
  margin-bottom: 1em;
}

.search {
  display: grid;
  gap: 8px;
  margin: 0 0 18px;
}

.search input {
  font: inherit;
  font-size: 1rem;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0 13px;
  color: #f4eaf8;
  border-radius: 15px;
  border: 1px solid rgba(200, 165, 220, 0.3);
  background: rgba(20, 14, 26, 0.62);
  -webkit-appearance: none;
  appearance: none;
}

.search input::placeholder {
  color: #b8a6c6;
}

.search button {
  font: inherit;
  font-size: 1rem;
  min-height: 44px;
  border: 0;
  border-radius: 15px;
  color: #fff5ea;
  cursor: pointer;
  background: linear-gradient(140deg, #8b4513, #56228b);
  box-shadow: 0 10px 20px rgba(20, 10, 30, 0.4);
}

.search button:hover {
  background: linear-gradient(140deg, #a35518, #6a2ba8);
}

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

.side li a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 4px 10px;
  border-radius: 13px;
  color: #e9ddf2;
  text-decoration: none;
  font-size: 1rem;
  border-bottom: 1px solid rgba(200, 165, 220, 0.13);
  overflow-wrap: anywhere;
}

.side li:last-child a {
  border-bottom: 0;
}

.side li a:hover {
  background: rgba(139, 69, 19, 0.32);
  color: #fff3e6;
}

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

footer {
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px clamp(16px, 4vw, 40px) 40px;
}

.foot-brand {
  margin: 0 0 14px;
  font-size: clamp(1.9rem, 10.5vw, 4.4rem);
  line-height: 1.02;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: rgba(245, 236, 250, 0.2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.foot-meta {
  margin: 0;
  padding-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px solid rgba(200, 165, 220, 0.2);
}

.foot-meta small {
  font-size: 1rem;
  color: #bdaacb;
  letter-spacing: 0.04em;
}

.foot-meta a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 14px;
  background: rgba(86, 34, 139, 0.32);
  border: 1px solid rgba(200, 165, 220, 0.2);
  text-decoration: none;
  font-size: 1rem;
  color: #f0dfef;
}

.foot-meta a:hover {
  background: rgba(139, 69, 19, 0.4);
}

/* ---------- 底部固定条 ---------- */

.dock {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  width: min(720px, calc(100% - 24px));
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border-radius: 26px 20px 24px 22px;
  border: 1px solid rgba(200, 165, 220, 0.26);
  background: rgba(41, 29, 54, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 20px 44px rgba(8, 4, 14, 0.6);
}

.dock-menu {
  position: relative;
  flex: 0 0 auto;
}

.dock-menu > summary {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 20px 16px 18px 17px;
  cursor: pointer;
  font-size: 1rem;
  color: #f0e2f8;
  background: rgba(86, 34, 139, 0.42);
  border: 1px solid rgba(200, 165, 220, 0.24);
  list-style: none;
  user-select: none;
}

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

.dock-menu > summary:hover {
  background: rgba(139, 69, 19, 0.46);
}

.dock-menu[open] > summary {
  background: linear-gradient(140deg, #8b4513, #56228b);
  color: #fff4ea;
}

.dock-menu menu {
  position: absolute;
  bottom: calc(100% + 10px);
  margin: 0;
  padding: 10px;
  min-width: 196px;
  list-style: none;
  border-radius: 22px 18px 20px 24px;
  border: 1px solid rgba(200, 165, 220, 0.28);
  background: rgba(35, 24, 46, 0.98);
  box-shadow: 0 22px 46px rgba(8, 4, 14, 0.6);
}

.dock-menu--l menu {
  left: 0;
}

.dock-menu--r menu {
  right: 0;
}

.dock-menu:not([open]) menu {
  display: none;
}

.dock-menu[open] menu {
  display: grid;
  gap: 3px;
}

.dock-menu menu a {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 4px 12px;
  border-radius: 14px;
  color: #eee1f7;
  text-decoration: none;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.dock-menu menu a:hover {
  background: rgba(139, 69, 19, 0.4);
  color: #fff4ea;
}

.brand {
  flex: 0 1 auto;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 8px;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #fbf3ff;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ico {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 54% 46% 50% 50% / 48% 52% 48% 52%;
  background: linear-gradient(140deg, #d18a45, #7b46b8);
}

/* ---------- 动效 ---------- */

.js .rv {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.75s ease, transform 0.75s cubic-bezier(0.2, 0.7, 0.3, 1);
}

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

/* ---------- 断点 ---------- */

@media (max-width: 920px) {
  .wrap {
    grid-template-columns: minmax(0, 1fr);
  }

  .side {
    position: static;
    margin-top: 6px;
    border-radius: 22px;
  }

  .side ul {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .side li a {
    border-bottom: 0;
  }
}

@media (max-width: 560px) {
  body {
    padding-bottom: 104px;
    font-size: 17px;
  }

  .hero {
    min-height: 46vh;
    border-radius: 0 0 34px 26px;
  }

  .dock {
    padding: 7px;
    border-radius: 22px 18px 20px 20px;
  }

  .dock-menu > summary {
    padding: 0 11px;
    font-size: 1rem;
  }

  .brand {
    font-size: 1rem;
    letter-spacing: 0.03em;
  }

  .content section > div {
    padding-bottom: 28px;
    margin-bottom: 30px;
  }

  .content th,
  .content td {
    padding: 9px 9px;
  }
}

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

  .js .rv {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .hero-img {
    transform: none !important;
  }
}

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