:root {
  --brand: #8b1e3f;
  --brand-2: #b8325c;
  --brand-3: #f2c14e;
  --ink: #2b1b22;
  --ink-soft: #5d4a53;
  --bg: #fdf8f4;
  --bg-alt: #f7efe8;
  --card: #ffffff;
  --card-glass: rgba(255, 255, 255, 0.62);
  --border: rgba(139, 30, 63, 0.14);
  --shadow: 0 10px 30px rgba(139, 30, 63, 0.10);
  --shadow-lg: 0 18px 50px rgba(139, 30, 63, 0.16);
  --radius: 18px;
  --radius-sm: 12px;
  --maxw: 1180px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Songti SC", "STSong", "Noto Serif SC", Georgia, serif;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #e0a1b6;
    --brand-2: #f2c14e;
    --brand-3: #f2c14e;
    --ink: #f2e7ec;
    --ink-soft: #c9b6c0;
    --bg: #17101a;
    --bg-alt: #1f1522;
    --card: #241a28;
    --card-glass: rgba(36, 26, 40, 0.62);
    --border: rgba(242, 193, 78, 0.20);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.60);
  }
}

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.85;
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 10% -10%, rgba(139, 30, 63, 0.10), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(242, 193, 78, 0.12), transparent 55%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-sm);
}

a {
  color: var(--brand);
  text-decoration: none;
  transition: color 0.25s var(--ease), opacity 0.25s var(--ease);
}

a:hover,
a:focus-visible {
  color: var(--brand-2);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--brand-3);
  outline-offset: 3px;
  border-radius: 6px;
}

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  line-height: 1.35;
  color: var(--ink);
  margin: 0 0 0.6em;
  letter-spacing: 0.01em;
}

h1 { font-size: clamp(1.7rem, 4.2vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 3.1vw, 2rem); }
h3 { font-size: clamp(1.12rem, 2.2vw, 1.35rem); }
h4 { font-size: 1.05rem; }

p {
  margin: 0 0 1em;
  color: var(--ink-soft);
}

ul, ol {
  margin: 0 0 1.2em;
  padding-left: 1.4em;
  color: var(--ink-soft);
}

li {
  margin-bottom: 0.45em;
}

li::marker {
  color: var(--brand);
}

strong {
  color: var(--ink);
  font-weight: 700;
}

time {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--ink-soft);
  opacity: 0.85;
  letter-spacing: 0.02em;
}

blockquote {
  margin: 1.2em 0;
  padding: 1em 1.2em;
  border-left: 4px solid var(--brand);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--card-glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

blockquote p {
  margin: 0 0 0.7em;
  color: var(--ink);
  font-style: italic;
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* ============ 页头 ============ */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--card-glass);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 24px rgba(139, 30, 63, 0.06);
  transition: box-shadow 0.3s var(--ease);
}

header > div {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.7rem clamp(1rem, 4vw, 2rem);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1.4rem;
}

header > div > a {
  font-family: var(--font-serif);
  font-size: 1.22rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--brand);
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(139, 30, 63, 0.10), rgba(242, 193, 78, 0.16));
  border: 1px solid var(--border);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

header > div > a:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

header nav ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

header nav li {
  margin: 0;
}

header nav a {
  display: inline-block;
  padding: 0.4rem 0.75rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
  border-radius: 999px;
  transition: color 0.25s var(--ease), background 0.25s var(--ease), transform 0.25s var(--ease);
}

header nav a:hover,
header nav a:focus-visible {
  color: var(--brand);
  background: rgba(139, 30, 63, 0.08);
  text-decoration: none;
  transform: translateY(-1px);
}

/* ============ 主体 ============ */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem) clamp(1rem, 4vw, 2rem) 0;
}

main > section {
  margin-bottom: clamp(1.6rem, 4vw, 2.8rem);
  padding: clamp(1.2rem, 3.5vw, 2.2rem);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  animation: rise 0.7s var(--ease) both;
  animation-timeline: view();
  animation-range: entry 0% entry 60%;
}

@supports not (animation-timeline: view()) {
  main > section {
    animation: rise 0.6s var(--ease) both;
  }
}

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

main > section::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--brand), var(--brand-3), var(--brand-2));
  opacity: 0.85;
}

main > section:hover {
  box-shadow: var(--shadow-lg);
  border-color: rgba(139, 30, 63, 0.26);
  transition: box-shadow 0.4s var(--ease), border-color 0.4s var(--ease);
}

/* ============ Hero 渐变 Banner ============ */
#hero {
  background:
    linear-gradient(135deg, rgba(139, 30, 63, 0.94) 0%, rgba(184, 50, 92, 0.88) 48%, rgba(242, 193, 78, 0.82) 100%),
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.25), transparent 55%);
  border: none;
  color: #fff;
  padding: clamp(1.6rem, 5vw, 3rem);
  border-radius: calc(var(--radius) + 6px);
  box-shadow: 0 24px 60px rgba(139, 30, 63, 0.28);
  isolation: isolate;
}

#hero::before {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.1));
}

#hero::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  right: -120px;
  top: -160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.30), transparent 68%);
  z-index: -1;
  animation: float 9s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(18px) scale(1.05); }
}

#hero h1 {
  color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.22);
}

#hero p {
  color: rgba(255, 255, 255, 0.94);
  max-width: 62ch;
  font-size: clamp(0.96rem, 1.6vw, 1.06rem);
}

#hero figure {
  margin: 1.4rem 0 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.28);
}

#hero img {
  width: 100%;
  height: auto;
  border-radius: 0;
  transition: transform 0.7s var(--ease);
}

#hero figure:hover img {
  transform: scale(1.03);
}

#hero figcaption {
  padding: 0.7rem 1rem;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.88);
  background: rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ============ 目录导航 ============ */
main > nav[aria-label="页面目录"] {
  margin-bottom: clamp(1.6rem, 4vw, 2.8rem);
  padding: clamp(1.1rem, 3vw, 1.8rem);
  background: var(--card-glass);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

main > nav[aria-label="页面目录"] h2 {
  font-size: 1.05rem;
  color: var(--brand);
  margin-bottom: 0.8rem;
}

main > nav[aria-label="页面目录"] ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

main > nav[aria-label="页面目录"] li {
  margin: 0;
}

main > nav[aria-label="页面目录"] a {
  display: inline-block;
  padding: 0.42rem 0.9rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: all 0.28s var(--ease);
}

main > nav[aria-label="页面目录"] a:hover,
main > nav[aria-label="页面目录"] a:focus-visible {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent;
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(139, 30, 63, 0.28);
}

/* ============ 文章卡片 ============ */
#articles article {
  padding: 1.1rem 1.2rem;
  margin-bottom: 0.9rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), background 0.35s var(--ease);
}

#articles article:last-of-type {
  margin-bottom: 1.4rem;
}

#articles article:hover {
  transform: translateY(-4px);
  background: var(--card);
  box-shadow: var(--shadow-lg);
  border-color: rgba(139, 30, 63, 0.3);
}

#articles article h3 {
  margin-bottom: 0.35rem;
  font-size: 1.08rem;
  transition: color 0.25s var(--ease);
}

#articles article:hover h3 {
  color: var(--brand);
}

#articles article p {
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

#articles article a {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.28rem 0.85rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(139, 30, 63, 0.10), rgba(242, 193, 78, 0.18));
  border: 1px solid var(--border);
  transition: all 0.28s var(--ease);
}

#articles article a:hover {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent;
  text-decoration: none;
  transform: translateX(4px);
}

/* ============ 教程步骤 ============ */
#howto ol {
  counter-reset: step;
  list-style: none;
  padding-left: 0;
}

#howto ol li {
  counter-increment: step;
  position: relative;
  padding: 0.85rem 1rem 0.85rem 3.2rem;
  margin-bottom: 0.7rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

#howto ol li::before {
  content: counter(step);
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.9rem;
  height: 1.9rem;
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(139, 30, 63, 0.3);
}

#howto ol li:hover {
  transform: translateX(5px);
  box-shadow: var(--shadow);
}

/* ============ FAQ 手风琴 ============ */
#faq details {
  margin-bottom: 0.7rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
}

#faq details[open] {
  box-shadow: var(--shadow);
  border-color: rgba(139, 30, 63, 0.32);
  background: var(--card);
}

#faq summary {
  cursor: pointer;
  padding: 0.9rem 2.6rem 0.9rem 1.1rem;
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--ink);
  position: relative;
  list-style: none;
  transition: color 0.25s var(--ease), background 0.25s var(--ease);
}

#faq summary::-webkit-details-marker {
  display: none;
}

#faq summary::after {
  content: "+";
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1;
  color: var(--brand);
  transition: transform 0.3s var(--ease);
}

#faq details[open] summary::after {
  content: "−";
  transform: translateY(-50%) rotate(180deg);
}

#faq summary:hover {
  color: var(--brand);
  background: rgba(139, 30, 63, 0.05);
}

#faq details p {
  margin: 0;
  padding: 0 1.1rem 1rem;
  font-size: 0.94rem;
  animation: fadeIn 0.35s var(--ease);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ 联系信息 ============ */
#contact ul {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.7rem;
}

#contact li {
  padding: 0.75rem 1rem;
  margin: 0;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius-sm);
  font-size: 0.94rem;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

#contact li:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

/* ============ 网站地图 & 友情链接 ============ */
main > nav[aria-label="网站地图"] ul,
#links ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

main > nav[aria-label="网站地图"] {
  margin-bottom: clamp(1.6rem, 4vw, 2.8rem);
  padding: clamp(1.2rem, 3.5vw, 2rem);
  background: var(--card-glass);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

main > nav[aria-label="网站地图"] h2,
#links h2 {
  font-size: 1.1rem;
  color: var(--brand);
  margin-bottom: 0.8rem;
}

main > nav[aria-label="网站地图"] li,
#links li {
  margin: 0;
}

main > nav[aria-label="网站地图"] a,
#links a {
  display: inline-block;
  padding: 0.38rem 0.85rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: all 0.28s var(--ease);
}

main > nav[aria-label="网站地图"] a:hover,
#links a:hover {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent;
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(139, 30, 63, 0.26);
}

#links {
  margin-bottom: clamp(1.6rem, 4vw, 2.8rem);
  padding: clamp(1.2rem, 3.5vw, 2rem);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ============ 页脚 ============ */
footer {
  margin-top: clamp(2rem, 5vw, 3.5rem);
  padding: clamp(1.6rem, 4vw, 2.6rem) clamp(1rem, 4vw, 2rem);
  background:
    linear-gradient(160deg, rgba(43, 27, 34, 0.97), rgba(139, 30, 63, 0.95)),
    radial-gradient(circle at 85% 10%, rgba(242, 193, 78, 0.22), transparent 55%);
  color: rgba(255, 255, 255, 0.86);
  border-top: 4px solid var(--brand-3);
}

footer > section {
  max-width: var(--maxw);
  margin: 0 auto 1.4rem;
}

footer h2 {
  color: #fff;
  font-size: 1.08rem;
  margin-bottom: 0.6rem;
  position: relative;
  padding-left: 0.9rem;
}

footer h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.3em;
  width: 4px;
  height: 1em;
  border-radius: 2px;
  background: var(--brand-3);
}

footer p {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.9rem;
  max-width: 78ch;
}

footer > p {
  max-width: var(--maxw);
  margin: 0 auto;
  padding-top: 1.2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  text-align: center;
  font-size: 0.84rem;
  color: rgba(255, 255, 255, 0.62);
}

footer a {
  color: var(--brand-3);
}

footer a:hover {
  color: #fff;
}

/* ============ 响应式 ============ */
@media (max-width: 860px) {
  header > div {
    justify-content: center;
    text-align: center;
  }

  header nav ul {
    justify-content: center;
  }

  header nav a {
    padding: 0.35rem 0.6rem;
    font-size: 0.86rem;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
    line-height: 1.8;
  }

  main > section {
    padding: 1.1rem;
    border-radius: var(--radius-sm);
  }

  #hero {
    padding: 1.3rem 1.1rem;
  }

  header > div > a {
    font-size: 1.05rem;
  }

  header nav ul {
    gap: 0.1rem 0.15rem;
  }

  header nav a {
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
  }

  main > nav[aria-label="页面目录"] ul,
  main > nav[aria-label="网站地图"] ul,
  #links ul {
    gap: 0.4rem;
  }

  #contact ul {
    grid-template-columns: 1fr;
  }

  #howto ol li {
    padding: 0.75rem 0.85rem 0.75rem 2.9rem;
  }

  #howto ol li::before {
    left: 0.7rem;
    width: 1.7rem;
    height: 1.7rem;
    font-size: 0.85rem;
  }
}

@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;
  }
}

@media print {
  header,
  main > nav[aria-label="页面目录"],
  footer {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }

  main > section {
    box-shadow: none;
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }
}