:root {
  --bg: #0f0f1a;
  --bg-alt: #16162a;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-strong: rgba(255, 255, 255, 0.1);
  --border: rgba(255, 255, 255, 0.12);
  --text: #e8e8f0;
  --text-dim: #a0a0b8;
  --text-faint: #6c6c85;
  --primary: #e94560;
  --primary-soft: rgba(233, 69, 96, 0.15);
  --accent: #5b8def;
  --accent-2: #9b5de5;
  --gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 45%, #0f3460 100%);
  --gradient-hero: linear-gradient(135deg, #1a1a2e 0%, #2d1b4e 35%, #0f3460 70%, #1a1a2e 100%);
  --gradient-text: linear-gradient(120deg, #e94560 0%, #9b5de5 55%, #5b8def 100%);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.45);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-xl: 32px;
  --header-h: 68px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --blur: saturate(160%) blur(18px);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f5fa;
    --bg-alt: #ffffff;
    --surface: rgba(255, 255, 255, 0.72);
    --surface-strong: rgba(255, 255, 255, 0.9);
    --border: rgba(20, 20, 50, 0.1);
    --text: #1c1c2e;
    --text-dim: #4a4a63;
    --text-faint: #7a7a92;
    --primary-soft: rgba(233, 69, 96, 0.1);
    --gradient-hero: linear-gradient(135deg, #e8ecff 0%, #f3e8ff 35%, #e0f0ff 70%, #f4f5fa 100%);
    --shadow-sm: 0 2px 8px rgba(30, 30, 70, 0.08);
    --shadow-md: 0 8px 24px rgba(30, 30, 70, 0.12);
    --shadow-lg: 0 16px 48px rgba(30, 30, 70, 0.16);
  }
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(233, 69, 96, 0.1), transparent 42%),
    radial-gradient(circle at 88% 12%, rgba(91, 141, 239, 0.1), transparent 40%),
    radial-gradient(circle at 50% 100%, rgba(155, 93, 229, 0.08), transparent 45%);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img,
svg {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

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

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

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

h1, h2, h3, h4 {
  margin: 1.4em 0 0.6em;
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
}

h1 {
  font-size: clamp(1.6rem, 4.2vw, 2.6rem);
  margin-top: 0;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

h2 {
  font-size: clamp(1.35rem, 2.8vw, 1.9rem);
  position: relative;
  padding-left: 18px;
}

h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.18em;
  bottom: 0.18em;
  width: 5px;
  border-radius: 4px;
  background: var(--gradient-text);
}

h3 {
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  color: var(--text);
}

p {
  margin: 0.85em 0;
  color: var(--text-dim);
}

ul,
ol {
  padding-left: 1.4em;
  color: var(--text-dim);
}

li {
  margin: 0.35em 0;
}

strong {
  color: var(--text);
}

::selection {
  background: var(--primary);
  color: #fff;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(150, 150, 180, 0.35);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(233, 69, 96, 0.6);
  background-clip: content-box;
}

/* ===== Header ===== */
#site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(15, 15, 26, 0.62);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

@media (prefers-color-scheme: light) {
  #site-header {
    background: rgba(255, 255, 255, 0.7);
  }
}

.header-inner {
  max-width: 1240px;
  height: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.02em;
  flex-shrink: 0;
  transition: transform 0.3s var(--ease);
}

.logo:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.logo svg {
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(233, 69, 96, 0.35);
  transition: transform 0.45s var(--ease), box-shadow 0.45s var(--ease);
}

.logo:hover svg {
  transform: rotate(-6deg) scale(1.06);
  box-shadow: 0 6px 20px rgba(233, 69, 96, 0.55);
}

.logo span {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

#site-header nav ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

#site-header nav a {
  display: inline-block;
  padding: 8px 12px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  position: relative;
  transition: color 0.25s var(--ease), background 0.25s var(--ease);
}

#site-header nav a::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 4px;
  height: 2px;
  border-radius: 2px;
  background: var(--gradient-text);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}

#site-header nav a:hover,
#site-header nav a:focus-visible {
  color: var(--text);
  background: var(--surface);
  text-decoration: none;
}

#site-header nav a:hover::after,
#site-header nav a:focus-visible::after {
  transform: scaleX(1);
}

/* ===== Main layout ===== */
main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

main > section,
main > nav {
  margin: 0 0 28px;
  padding: 30px clamp(18px, 3.2vw, 40px);
  background: var(--surface);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease), border-color 0.4s var(--ease);
  animation: fadeUp 0.7s var(--ease) both;
}

main > section:hover,
main > nav:hover {
  border-color: rgba(233, 69, 96, 0.3);
  box-shadow: var(--shadow-md);
}

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

/* ===== Hero ===== */
#hero {
  position: relative;
  margin-top: 28px;
  padding: clamp(36px, 6vw, 72px) clamp(20px, 4vw, 56px);
  background: var(--gradient-hero);
  background-size: 200% 200%;
  animation: heroShift 18s ease infinite, fadeUp 0.7s var(--ease) both;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

#hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 85% 20%, rgba(233, 69, 96, 0.28), transparent 45%),
    radial-gradient(circle at 10% 90%, rgba(91, 141, 239, 0.28), transparent 45%);
  pointer-events: none;
}

#hero::after {
  content: "";
  position: absolute;
  top: -60%;
  right: -20%;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  pointer-events: none;
}

#hero > * {
  position: relative;
  z-index: 1;
}

#hero p {
  max-width: 880px;
  color: var(--text-dim);
  font-size: clamp(0.95rem, 1.6vw, 1.05rem);
}

@keyframes heroShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ===== Breadcrumb ===== */
main > nav[aria-label="面包屑导航"] {
  padding: 14px 22px;
  animation-delay: 0.05s;
}

main > nav[aria-label="面包屑导航"] ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.88rem;
}

main > nav[aria-label="面包屑导航"] li {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-faint);
}

main > nav[aria-label="面包屑导航"] li + li::before {
  content: "/";
  color: var(--text-faint);
  opacity: 0.6;
}

main > nav[aria-label="面包屑导航"] li[aria-current="page"] {
  color: var(--text);
  font-weight: 600;
}

/* ===== Anchor nav ===== */
main > nav[aria-label="页面内锚点导航"] {
  animation-delay: 0.1s;
}

main > nav[aria-label="页面内锚点导航"] ul {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

main > nav[aria-label="页面内锚点导航"] li {
  margin: 0;
}

main > nav[aria-label="页面内锚点导航"] a {
  display: inline-block;
  padding: 7px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: all 0.3s var(--ease);
}

main > nav[aria-label="页面内锚点导航"] a:hover,
main > nav[aria-label="页面内锚点导航"] a:focus-visible {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(233, 69, 96, 0.4);
}

/* ===== Articles ===== */
#articles article {
  margin: 0 0 18px;
  padding: 22px 24px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s var(--ease);
  position: relative;
  overflow: hidden;
}

#articles article::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--gradient-text);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.35s var(--ease);
}

#articles article:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(155, 93, 229, 0.4);
}

#articles article:hover::before {
  transform: scaleY(1);
}

#articles article h3 {
  margin-top: 0;
  font-size: 1.12rem;
  transition: color 0.3s var(--ease);
}

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

#articles article p {
  margin: 0.5em 0;
  font-size: 0.94rem;
}

#articles article p:first-of-type {
  font-size: 0.8rem;
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

#articles article a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  transition: all 0.3s var(--ease);
}

#articles article a::after {
  content: "→";
  transition: transform 0.3s var(--ease);
}

#articles article a:hover {
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(233, 69, 96, 0.4);
}

#articles article a:hover::after {
  transform: translateX(4px);
}

/* ===== FAQ details ===== */
#faq details {
  margin: 0 0 12px;
  padding: 0;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease), background 0.3s var(--ease);
}

#faq details:hover {
  border-color: rgba(91, 141, 239, 0.4);
  box-shadow: var(--shadow-sm);
}

#faq details[open] {
  border-color: rgba(233, 69, 96, 0.45);
  box-shadow: var(--shadow-md);
  background: var(--surface);
}

#faq summary {
  position: relative;
  padding: 16px 52px 16px 22px;
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: color 0.25s var(--ease);
}

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

#faq summary::after {
  content: "+";
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  transition: transform 0.35s var(--ease), background 0.35s var(--ease), color 0.35s var(--ease);
}

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

#faq summary:hover {
  color: var(--primary);
}

#faq details p {
  margin: 0;
  padding: 0 22px 20px;
  font-size: 0.94rem;
  animation: fadeUp 0.4s var(--ease) both;
}

/* ===== Contact ===== */
#contact ul {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

#contact li {
  margin: 0;
  padding: 14px 18px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  color: var(--text-dim);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
  word-break: break-word;
}

#contact li:hover {
  transform: translateY(-3px);
  border-color: rgba(91, 141, 239, 0.45);
  box-shadow: var(--shadow-sm);
}

#contact li a {
  font-weight: 600;
}

/* ===== Sitemap & Links ===== */
#sitemap ul,
#links ul {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

#sitemap li,
#links li {
  margin: 0;
}

#sitemap a,
#links a {
  display: inline-block;
  padding: 6px 15px;
  font-size: 0.86rem;
  color: var(--text-dim);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.28s var(--ease);
}

#sitemap a:hover,
#links a:hover,
#sitemap a:focus-visible,
#links a:focus-visible {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(91, 141, 239, 0.35);
}

#links a {
  border-style: dashed;
}

#links a:hover {
  background: var(--accent-2);
  border-color: var(--accent-2);
  box-shadow: 0 6px 16px rgba(155, 93, 229, 0.35);
}

/* ===== Author info ===== */
#author-info {
  border-left: 4px solid var(--accent-2);
}

#author-info p {
  font-size: 0.92rem;
}

/* ===== Footer ===== */
#site-footer {
  margin-top: 40px;
  padding: 48px 20px 32px;
  background: var(--gradient);
  background-size: 180% 180%;
  animation: heroShift 22s ease infinite;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
}

#site-footer > section {
  max-width: 1240px;
  margin: 0 auto 24px;
  padding: 22px 26px;
  background: rgba(255, 255, 255, 0.04);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}

#site-footer > section:hover {
  border-color: rgba(233, 69, 96, 0.35);
  background: rgba(255, 255, 255, 0.07);
}

#site-footer h2 {
  font-size: 1.05rem;
  margin: 0 0 10px;
  padding-left: 14px;
  color: var(--text);
}

#site-footer h2::before {
  width: 4px;
  background: var(--primary);
}

#site-footer p {
  margin: 0.4em 0;
  font-size: 0.88rem;
  line-height: 1.7;
}

#site-footer > p {
  max-width: 1240px;
  margin: 28px auto 0;
  text-align: center;
}

#site-footer > p a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 26px;
  font-weight: 600;
  font-size: 0.9rem;
  color: #fff;
  background: var(--primary);
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(233, 69, 96, 0.4);
  transition: all 0.3s var(--ease);
}

#site-footer > p a::before {
  content: "↑";
  transition: transform 0.3s var(--ease);
}

#site-footer > p a:hover {
  text-decoration: none;
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(233, 69, 96, 0.6);
}

#site-footer > p a:hover::before {
  transform: translateY(-3px);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .header-inner {
    padding: 0 16px;
  }

  #site-header nav a {
    padding: 7px 9px;
    font-size: 0.84rem;
  }

  main {
    padding: 0 16px 48px;
  }
}

@media (max-width: 860px) {
  :root {
    --header-h: 60px;
  }

  .header-inner {
    flex-wrap: wrap;
    height: auto;
    min-height: var(--header-h);
    padding: 10px 16px;
    gap: 10px;
    justify-content: center;
  }

  #site-header {
    height: auto;
  }

  #site-header nav {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  #site-header nav::-webkit-scrollbar {
    display: none;
  }

  #site-header nav ul {
    flex-wrap: nowrap;
    justify-content: flex-start;
  }

  #site-header nav a {
    white-space: nowrap;
  }

  main > section,
  main > nav {
    padding: 24px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
  }

  #hero {
    margin-top: 18px;
    border-radius: var(--radius-lg);
  }

  #articles article {
    padding: 18px;
  }

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

  #site-footer {
    padding: 36px 16px 28px;
  }

  #site-footer > section {
    padding: 18px;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 15px;
  }

  h2 {
    padding-left: 14px;
  }

  h2::before {
    width: 4px;
  }

  .logo span {
    font-size: 1rem;
  }

  #hero {
    padding: 30px 20px;
  }

  main > nav[aria-label="页面内锚点导航"] a,
  #sitemap a,
  #links a {
    padding: 6px 12px;
    font-size: 0.8rem;
  }

  #faq summary {
    padding: 14px 46px 14px 16px;
    font-size: 0.92rem;
  }

  #faq details p {
    padding: 0 16px 16px;
  }

  #articles article a {
    padding: 5px 12px;
    font-size: 0.82rem;
  }
}

/* ===== Motion preferences ===== */
@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;
  }
}

/* ===== Print ===== */
@media print {
  #site-header,
  main > nav,
  #site-footer > p,
  #hero::before,
  #hero::after {
    display: none !important;
  }

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

  main > section,
  #hero,
  #site-footer {
    box-shadow: none;
    border: 1px solid #ccc;
    background: #fff;
    animation: none;
  }

  a {
    color: #000;
    text-decoration: underline;
  }
}