:root {
  --brand: #5b3df5;
  --brand-2: #8f6bff;
  --brand-3: #ff5fa2;
  --accent: #22d3ee;
  --bg: #f6f5ff;
  --bg-2: #ffffff;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --border: rgba(91, 61, 245, 0.14);
  --text: #1c1730;
  --text-2: #4a4463;
  --text-3: #7a7492;
  --shadow-sm: 0 2px 8px rgba(28, 23, 48, 0.06);
  --shadow-md: 0 8px 24px rgba(28, 23, 48, 0.08);
  --shadow-lg: 0 18px 48px rgba(91, 61, 245, 0.16);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --header-h: 64px;
  --maxw: 1180px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --grad-brand: linear-gradient(135deg, #5b3df5 0%, #8f6bff 45%, #ff5fa2 100%);
  --grad-soft: linear-gradient(135deg, rgba(91, 61, 245, 0.10), rgba(255, 95, 162, 0.10));
  --glass-blur: saturate(160%) blur(16px);
}

[data-theme="dark"] {
  --bg: #0d0b18;
  --bg-2: #14112a;
  --surface: rgba(28, 24, 52, 0.62);
  --surface-solid: #171331;
  --border: rgba(143, 107, 255, 0.22);
  --text: #f1eeff;
  --text-2: #c3bce0;
  --text-3: #8f88ad;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.55);
  --grad-soft: linear-gradient(135deg, rgba(143, 107, 255, 0.16), rgba(255, 95, 162, 0.14));
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0b18;
    --bg-2: #14112a;
    --surface: rgba(28, 24, 52, 0.62);
    --surface-solid: #171331;
    --border: rgba(143, 107, 255, 0.22);
    --text: #f1eeff;
    --text-2: #c3bce0;
    --text-3: #8f88ad;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.55);
    --grad-soft: linear-gradient(135deg, rgba(143, 107, 255, 0.16), rgba(255, 95, 162, 0.14));
  }
}

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

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 10% -10%, rgba(91, 61, 245, 0.10), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(255, 95, 162, 0.10), transparent 55%),
    radial-gradient(800px 600px at 50% 120%, rgba(34, 211, 238, 0.08), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

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

a:hover,
a:focus-visible {
  color: var(--brand-3);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(91, 61, 245, 0.45);
  outline-offset: 2px;
  border-radius: 6px;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 0.6em;
  line-height: 1.3;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
}

h1 {
  font-size: clamp(1.9rem, 4.4vw, 3rem);
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  position: relative;
  padding-bottom: 0.5em;
}

h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 56px;
  height: 4px;
  border-radius: 4px;
  background: var(--grad-brand);
}

h3 {
  font-size: clamp(1.2rem, 2.2vw, 1.45rem);
}

h4 {
  font-size: 1.1rem;
  color: var(--brand);
}

p {
  margin: 0 0 1em;
  color: var(--text-2);
}

ul, ol {
  margin: 0 0 1em;
  padding-left: 1.4em;
  color: var(--text-2);
}

li {
  margin-bottom: 0.4em;
}

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

blockquote {
  margin: 1.2em 0;
  padding: 1em 1.4em;
  border-left: 4px solid var(--brand);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--grad-soft);
  color: var(--text-2);
  font-style: italic;
}

blockquote p {
  margin: 0;
}

time {
  font-size: 0.85rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

address {
  font-style: normal;
}

/* ============ Header ============ */
header[role="banner"] {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 12px clamp(16px, 4vw, 40px);
  background: var(--surface);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  transition: background 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.brand-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.92rem;
  color: var(--text-2);
  flex: 1 1 auto;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.9rem;
  color: #fff;
  background: var(--grad-brand);
  box-shadow: 0 6px 18px rgba(91, 61, 245, 0.35);
  white-space: nowrap;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}

.brand-logo:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 10px 26px rgba(91, 61, 245, 0.45);
}

header[role="banner"] > nav[aria-label="主导航"] {
  order: 3;
  width: 100%;
  flex-basis: 100%;
}

header[role="banner"] > nav[aria-label="主导航"] ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 4px 0;
  overflow-x: auto;
  scrollbar-width: none;
}

header[role="banner"] > nav[aria-label="主导航"] ul::-webkit-scrollbar {
  display: none;
}

header[role="banner"] > nav[aria-label="主导航"] a {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  transition: background 0.25s var(--ease), color 0.25s var(--ease),
    transform 0.25s var(--ease);
}

header[role="banner"] > nav[aria-label="主导航"] a:hover {
  background: var(--grad-soft);
  color: var(--brand);
  transform: translateY(-1px);
}

form[role="search"] {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 auto;
}

form[role="search"] label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

form[role="search"] input[type="search"] {
  width: clamp(140px, 22vw, 240px);
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease),
    width 0.3s var(--ease);
}

form[role="search"] input[type="search"]::placeholder {
  color: var(--text-3);
}

form[role="search"] input[type="search"]:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(91, 61, 245, 0.15);
}

form[role="search"] button[type="submit"],
#theme-toggle,
#back-to-top {
  cursor: pointer;
  border: none;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  color: #fff;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--grad-brand);
  box-shadow: 0 6px 18px rgba(91, 61, 245, 0.3);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease),
    filter 0.25s var(--ease);
  white-space: nowrap;
}

form[role="search"] button[type="submit"]:hover,
#theme-toggle:hover,
#back-to-top:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(91, 61, 245, 0.42);
  filter: brightness(1.05);
}

form[role="search"] button[type="submit"]:active,
#theme-toggle:active,
#back-to-top:active {
  transform: translateY(0) scale(0.98);
}

#theme-toggle {
  background: var(--bg-2);
  color: var(--brand);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

#theme-toggle:hover {
  background: var(--grad-soft);
  box-shadow: var(--shadow-md);
}

/* ============ Breadcrumb ============ */
body > nav[aria-label="面包屑导航"] {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px clamp(16px, 4vw, 40px) 0;
}

body > nav[aria-label="面包屑导航"] ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.85rem;
  color: var(--text-3);
}

body > nav[aria-label="面包屑导航"] li:not(:last-child)::after {
  content: "/";
  margin-left: 8px;
  color: var(--text-3);
  opacity: 0.6;
}

body > nav[aria-label="面包屑导航"] a {
  color: var(--text-2);
  padding: 2px 6px;
  border-radius: 6px;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

body > nav[aria-label="面包屑导航"] a:hover {
  background: var(--grad-soft);
  color: var(--brand);
}

body > nav[aria-label="面包屑导航"] [aria-current="page"] {
  color: var(--brand);
  font-weight: 700;
}

/* ============ Main layout ============ */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 40px) 64px;
}

section {
  margin-bottom: clamp(28px, 5vw, 48px);
  padding: clamp(22px, 4vw, 40px);
  background: var(--surface);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  animation: fadeUp 0.7s var(--ease) both;
  transition: box-shadow 0.35s var(--ease), transform 0.35s var(--ease),
    border-color 0.35s var(--ease);
}

section:hover {
  box-shadow: var(--shadow-lg);
  border-color: rgba(91, 61, 245, 0.28);
}

section::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--grad-brand);
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}

section:hover::before {
  opacity: 1;
}

/* Hero */
#hero {
  padding: clamp(28px, 5vw, 56px);
  background:
    linear-gradient(135deg, rgba(91, 61, 245, 0.92) 0%, rgba(143, 107, 255, 0.88) 45%, rgba(255, 95, 162, 0.85) 100%);
  border: none;
  color: #fff;
  box-shadow: var(--shadow-lg);
}

#hero::before {
  display: none;
}

#hero h1 {
  background: none;
  -webkit-text-fill-color: #fff;
  color: #fff;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.18);
}

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

#hero figure {
  margin: 24px 0 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
  transition: transform 0.5s var(--ease);
}

#hero figure:hover {
  transform: translateY(-4px) scale(1.005);
}

#hero figure svg {
  width: 100%;
  height: auto;
  display: block;
}

#hero figcaption {
  padding: 12px 16px;
  font-size: 0.85rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(0, 0, 0, 0.18);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

/* Page anchor nav */
main > nav[aria-label="页面内锚点导航"] {
  margin-bottom: clamp(24px, 4vw, 40px);
  padding: 14px 18px;
  background: var(--surface);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

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

main > nav[aria-label="页面内锚点导航"] a {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-2);
  background: var(--grad-soft);
  border: 1px solid transparent;
  transition: all 0.25s var(--ease);
}

main > nav[aria-label="页面内锚点导航"] a:hover {
  color: #fff;
  background: var(--grad-brand);
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(91, 61, 245, 0.32);
}

/* ============ Articles ============ */
article {
  padding: clamp(18px, 3vw, 26px);
  margin-bottom: 18px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease),
    border-color 0.35s var(--ease);
  position: relative;
  overflow: hidden;
}

article::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--grad-brand);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.35s var(--ease);
}

article:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(91, 61, 245, 0.3);
}

article:hover::after {
  transform: scaleY(1);
}

article h3 {
  margin-bottom: 0.4em;
  font-size: clamp(1.05rem, 1.9vw, 1.25rem);
}

article h3 a {
  color: var(--text);
  transition: color 0.25s var(--ease);
}

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

article p {
  margin-bottom: 0.6em;
  font-size: 0.95rem;
}

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

article p:last-child a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 6px 16px;
  border-radius: 999px;
  background: var(--grad-soft);
  color: var(--brand);
  transition: all 0.25s var(--ease);
}

article p:last-child a::after {
  content: "→";
  transition: transform 0.25s var(--ease);
}

article p:last-child a:hover {
  background: var(--grad-brand);
  color: #fff;
  box-shadow: 0 8px 20px rgba(91, 61, 245, 0.32);
}

article p:last-child a:hover::after {
  transform: translateX(4px);
}

/* ============ FAQ details ============ */
details {
  margin-bottom: 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
}

details[open] {
  border-color: rgba(91, 61, 245, 0.35);
  box-shadow: var(--shadow-md);
}

details summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 52px 16px 20px;
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--text);
  position: relative;
  transition: color 0.25s var(--ease), background 0.25s var(--ease);
  user-select: none;
}

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

details summary::after {
  content: "+";
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  background: var(--grad-brand);
  box-shadow: 0 4px 12px rgba(91, 61, 245, 0.3);
  transition: transform 0.35s var(--ease), background 0.35s var(--ease);
}

details[open] summary::after {
  transform: translateY(-50%) rotate(135deg);
}

details summary:hover {
  background: var(--grad-soft);
  color: var(--brand);
}

details p {
  margin: 0;
  padding: 0 20px 18px;
  font-size: 0.94rem;
  color: var(--text-2);
  animation: fadeIn 0.4s var(--ease);
}

/* ============ HowTo / lists ============ */
#howto h4 {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--grad-soft);
  font-size: 0.95rem;
  margin-bottom: 0.4em;
}

#howto h4 + p {
  margin-top: 0;
}

#contact address {
  padding: 18px 20px;
  margin: 0 0 18px;
  border-radius: var(--radius-md);
  background: var(--grad-soft);
  border: 1px dashed rgba(91, 61, 245, 0.35);
}

#contact address p {
  margin: 0 0 0.4em;
  font-size: 0.94rem;
}

#contact address p:last-child {
  margin-bottom: 0;
}

/* ============ Footer ============ */
footer[role="contentinfo"] {
  position: relative;
  padding: clamp(28px, 5vw, 48px) clamp(16px, 4vw, 40px);
  text-align: center;
  color: var(--text-2);
  background: var(--bg-2);
  border-top: 1px solid var(--border);
}

footer[role="contentinfo"]::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--grad-brand);
}

footer[role="contentinfo"] p {
  margin: 0 0 0.6em;
  font-size: 0.9rem;
  color: var(--text-3);
}

footer[role="contentinfo"] p:first-child {
  font-weight: 700;
  color: var(--text-2);
}

footer[role="contentinfo"] a {
  color: var(--text-2);
  padding: 2px 6px;
  border-radius: 6px;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}

footer[role="contentinfo"] a:hover {
  color: var(--brand);
  background: var(--grad-soft);
}

#back-to-top {
  margin-top: 12px;
}

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

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============ Responsive ============ */
@media (min-width: 900px) {
  header[role="banner"] {
    flex-wrap: nowrap;
  }

  header[role="banner"] > nav[aria-label="主导航"] {
    order: 2;
    width: auto;
    flex-basis: auto;
    flex: 1 1 auto;
  }

  header[role="banner"] > nav[aria-label="主导航"] ul {
    justify-content: center;
    overflow: visible;
  }

  form[role="search"] {
    order: 3;
  }

  #theme-toggle {
    order: 4;
  }

  main > nav[aria-label="页面内锚点导航"] {
    position: sticky;
    top: calc(var(--header-h) + 8px);
    z-index: 40;
  }
}

@media (max-width: 899px) {
  .brand-bar {
    font-size: 0.84rem;
  }

  .brand-bar strong {
    display: none;
  }

  form[role="search"] {
    flex: 1 1 auto;
  }

  form[role="search"] input[type="search"] {
    width: 100%;
    flex: 1 1 auto;
  }

  #theme-toggle {
    flex: 0 0 auto;
  }
}

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

  header[role="banner"] {
    padding: 10px 14px;
    gap: 10px;
  }

  .brand-bar {
    flex-basis: 100%;
    justify-content: space-between;
  }

  form[role="search"] {
    flex: 1 1 100%;
    order: 4;
  }

  #theme-toggle {
    order: 5;
    padding: 8px 14px;
    font-size: 0.82rem;
  }

  section {
    border-radius: var(--radius-md);
    padding: 18px 16px;
  }

  #hero {
    border-radius: var(--radius-md);
  }

  main > nav[aria-label="页面内锚点导航"] {
    padding: 10px 12px;
  }

  main > nav[aria-label="页面内锚点导航"] ul {
    gap: 6px;
  }

  main > nav[aria-label="页面内锚点导航"] a {
    font-size: 0.8rem;
    padding: 5px 11px;
  }

  article {
    padding: 16px;
  }

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

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

/* ============ Print ============ */
@media print {
  header[role="banner"],
  main > nav[aria-label="页面内锚点导航"],
  #theme-toggle,
  #back-to-top,
  form[role="search"] {
    display: none !important;
  }

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

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