:root {
  --bg: #0f0f1a;
  --bg-soft: #16162a;
  --card: rgba(255, 255, 255, 0.05);
  --card-solid: #1a1a2e;
  --border: rgba(255, 255, 255, 0.1);
  --text: #e8e8f0;
  --text-soft: #a8a8bd;
  --text-dim: #7a7a92;
  --primary: #ff4d8d;
  --primary-2: #7b5cff;
  --accent: #00e5c7;
  --accent-2: #ffb347;
  --gradient: linear-gradient(135deg, #ff4d8d 0%, #7b5cff 55%, #00e5c7 100%);
  --gradient-soft: linear-gradient(135deg, rgba(255, 77, 141, 0.16), rgba(123, 92, 255, 0.16));
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.7);
  --radius: 20px;
  --radius-sm: 12px;
  --maxw: 1180px;
  --blur: saturate(160%) blur(18px);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f4fb;
    --bg-soft: #ffffff;
    --card: rgba(255, 255, 255, 0.7);
    --card-solid: #ffffff;
    --border: rgba(20, 20, 50, 0.1);
    --text: #1a1a2e;
    --text-soft: #4a4a63;
    --text-dim: #6f6f85;
    --shadow: 0 18px 50px -24px rgba(40, 30, 90, 0.35);
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 90px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  font-size: 16px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background-image:
    radial-gradient(900px 500px at 12% -8%, rgba(255, 77, 141, 0.16), transparent 60%),
    radial-gradient(800px 500px at 92% 4%, rgba(123, 92, 255, 0.18), transparent 60%),
    radial-gradient(700px 600px at 50% 110%, rgba(0, 229, 199, 0.1), transparent 65%);
  background-attachment: fixed;
}

@media (prefers-color-scheme: light) {
  body {
    background-image:
      radial-gradient(900px 500px at 12% -8%, rgba(255, 77, 141, 0.14), transparent 60%),
      radial-gradient(800px 500px at 92% 4%, rgba(123, 92, 255, 0.14), transparent 60%),
      radial-gradient(700px 600px at 50% 110%, rgba(0, 229, 199, 0.12), transparent 65%);
  }
}

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

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

a:hover {
  color: var(--accent);
}

ul {
  list-style: none;
}

::selection {
  background: rgba(255, 77, 141, 0.35);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- Header ---------- */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(15, 15, 26, 0.72);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

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

header::after {
  content: "";
  position: absolute;
  inset: auto 0 -1px 0;
  height: 1px;
  background: var(--gradient);
  opacity: 0.35;
  pointer-events: none;
}

header > a[href="#top"] {
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  white-space: nowrap;
  transition: filter 0.3s ease, transform 0.3s ease;
}

header > a[href="#top"]:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

header nav {
  flex: 1 1 auto;
  min-width: 0;
}

header nav ul {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

header nav a {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.875rem;
  color: var(--text-soft);
  font-weight: 500;
  white-space: nowrap;
  position: relative;
  transition: color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}

header nav a::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--gradient-soft);
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: -1;
}

header nav a:hover,
header nav a:focus-visible {
  color: var(--text);
  transform: translateY(-1px);
}

header nav a:hover::before,
header nav a:focus-visible::before {
  opacity: 1;
}

/* ---------- Main / Sections ---------- */
main {
  display: block;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(20px, 4vw, 40px) clamp(16px, 4vw, 32px) 60px;
}

main > section,
main > nav {
  position: relative;
  margin-bottom: clamp(22px, 3.5vw, 34px);
  padding: clamp(22px, 3.6vw, 40px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: rise 0.7s cubic-bezier(0.22, 0.8, 0.3, 1) both;
  animation-timeline: view();
  animation-range: entry 0% cover 22%;
}

@supports not (animation-timeline: view()) {
  main > section,
  main > nav {
    animation: none;
    opacity: 1;
  }
}

main > section::before,
main > nav::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(255, 77, 141, 0.35), transparent 40%, rgba(0, 229, 199, 0.28));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.6;
}

main > section:hover,
main > nav:hover {
  border-color: rgba(255, 77, 141, 0.28);
  box-shadow: 0 24px 60px -24px rgba(255, 77, 141, 0.28), var(--shadow);
}

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

/* ---------- Hero ---------- */
#hero {
  padding: clamp(30px, 6vw, 64px) clamp(22px, 5vw, 56px);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(255, 77, 141, 0.28), transparent 55%),
    radial-gradient(120% 140% at 100% 0%, rgba(123, 92, 255, 0.3), transparent 55%),
    radial-gradient(100% 120% at 50% 120%, rgba(0, 229, 199, 0.22), transparent 60%),
    var(--card);
  border-radius: calc(var(--radius) + 6px);
}

#hero::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  right: -140px;
  top: -160px;
  background: conic-gradient(from 120deg, rgba(255, 77, 141, 0.5), rgba(123, 92, 255, 0.35), rgba(0, 229, 199, 0.4), rgba(255, 77, 141, 0.5));
  filter: blur(70px);
  opacity: 0.5;
  border-radius: 50%;
  pointer-events: none;
  animation: spin 22s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

#hero h1 {
  position: relative;
  z-index: 1;
  font-size: clamp(1.6rem, 4.6vw, 2.8rem);
  line-height: 1.35;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 20px;
  background: linear-gradient(120deg, var(--text) 20%, var(--primary) 55%, var(--primary-2) 85%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

#hero p {
  position: relative;
  z-index: 1;
  max-width: 78ch;
  color: var(--text-soft);
  font-size: clamp(0.95rem, 1.6vw, 1.05rem);
}

#hero p + p {
  margin-top: 14px;
}

/* ---------- Headings ---------- */
h2 {
  font-size: clamp(1.3rem, 3vw, 1.85rem);
  line-height: 1.4;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 18px;
  padding-left: 16px;
  position: relative;
  color: var(--text);
}

h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.18em;
  bottom: 0.18em;
  width: 5px;
  border-radius: 999px;
  background: var(--gradient);
  box-shadow: 0 0 18px rgba(255, 77, 141, 0.55);
}

h3 {
  font-size: clamp(1.05rem, 2.2vw, 1.22rem);
  font-weight: 700;
  line-height: 1.5;
  margin: 22px 0 10px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

h3::before {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: var(--gradient);
  transform: rotate(45deg);
  box-shadow: 0 0 12px rgba(123, 92, 255, 0.6);
}

p {
  color: var(--text-soft);
  margin-bottom: 12px;
  font-size: clamp(0.93rem, 1.5vw, 1rem);
}

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

section > p:first-of-type {
  color: var(--text-soft);
}

/* ---------- Articles ---------- */
#articles {
  display: block;
}

#articles > p {
  margin-bottom: 18px;
}

#articles article {
  position: relative;
  margin: 16px 0;
  padding: 20px 22px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  transition: transform 0.3s cubic-bezier(0.22, 0.8, 0.3, 1), border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

#articles article::after {
  content: "";
  position: absolute;
  left: 22px;
  right: 22px;
  top: 0;
  height: 2px;
  border-radius: 999px;
  background: var(--gradient);
  opacity: 0;
  transform: scaleX(0.4);
  transform-origin: left;
  transition: opacity 0.3s ease, transform 0.4s ease;
}

#articles article:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 77, 141, 0.35);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 20px 44px -22px rgba(123, 92, 255, 0.5);
}

@media (prefers-color-scheme: light) {
  #articles article:hover {
    background: rgba(255, 255, 255, 0.95);
  }
}

#articles article:hover::after {
  opacity: 1;
  transform: scaleX(1);
}

#articles article h3 {
  margin-top: 0;
  margin-bottom: 8px;
}

#articles article h3::before {
  display: none;
}

#articles article p {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-bottom: 8px;
}

#articles article p:last-of-type {
  color: var(--text-soft);
}

#articles article a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 77, 141, 0.4);
  color: var(--primary);
  transition: all 0.25s ease;
}

#articles article a::after {
  content: "→";
  transition: transform 0.25s ease;
}

#articles article a:hover {
  background: var(--gradient);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 24px -10px rgba(255, 77, 141, 0.8);
}

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

/* ---------- Sitemap / Links nav ---------- */
#sitemap ul,
#links ul {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

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

#sitemap a,
#links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-soft);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: all 0.28s cubic-bezier(0.22, 0.8, 0.3, 1);
}

#sitemap a::before,
#links a::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gradient);
  opacity: 0.7;
  transition: transform 0.28s ease, opacity 0.28s ease;
}

#sitemap a:hover,
#links a:hover {
  color: #fff;
  transform: translateY(-3px);
  border-color: transparent;
  background: var(--gradient);
  box-shadow: 0 14px 30px -14px rgba(123, 92, 255, 0.8);
}

#sitemap a:hover::before,
#links a:hover::before {
  background: #fff;
  opacity: 1;
  transform: scale(1.3);
}

/* ---------- FAQ ---------- */
#faq h3 {
  margin-top: 18px;
  padding: 14px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  border-bottom: none;
  cursor: default;
  transition: background 0.28s ease, color 0.28s ease, border-color 0.28s ease;
}

#faq h3:hover {
  background: var(--gradient-soft);
  border-color: rgba(255, 77, 141, 0.3);
  color: var(--primary);
}

#faq h3 + p {
  padding: 14px 18px 16px;
  margin: 0 0 4px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  transition: background 0.28s ease;
}

@media (prefers-color-scheme: light) {
  #faq h3 + p {
    background: rgba(20, 20, 50, 0.02);
  }
}

#faq h3:hover + p {
  background: rgba(255, 77, 141, 0.05);
  border-color: rgba(255, 77, 141, 0.2);
}

/* ---------- HowTo ---------- */
#howto h3 {
  color: var(--accent);
}

#howto h3::before {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

#howto p {
  padding-left: 18px;
  border-left: 2px solid rgba(0, 229, 199, 0.25);
}

/* ---------- Contact ---------- */
#contact p {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
}

#contact p:nth-of-type(n + 2) {
  font-variant-numeric: tabular-nums;
}

#contact a {
  font-weight: 600;
}

/* ---------- Footer ---------- */
footer {
  position: relative;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 40px clamp(16px, 4vw, 32px) 56px;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.85rem;
}

footer::before {
  content: "";
  position: absolute;
  top: -1px;
  left: clamp(16px, 4vw, 32px);
  width: 120px;
  height: 2px;
  background: var(--gradient);
  border-radius: 999px;
}

footer section {
  margin-bottom: 24px;
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

footer h2 {
  font-size: 1.1rem;
  margin-bottom: 14px;
}

footer h3 {
  font-size: 0.95rem;
  margin: 16px 0 6px;
  color: var(--text-soft);
}

footer h3::before {
  width: 6px;
  height: 6px;
}

footer p {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 6px;
}

footer > p {
  text-align: center;
  padding: 4px 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  header {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px clamp(14px, 3vw, 24px);
  }

  header nav ul {
    justify-content: flex-start;
    gap: 2px;
  }

  header nav a {
    padding: 6px 10px;
    font-size: 0.82rem;
  }
}

@media (max-width: 768px) {
  html {
    scroll-padding-top: 120px;
  }

  body {
    font-size: 15px;
    line-height: 1.75;
  }

  header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  header > a[href="#top"] {
    text-align: center;
    font-size: 1.15rem;
  }

  header nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }

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

  header nav ul {
    flex-wrap: nowrap;
    justify-content: flex-start;
    width: max-content;
    padding: 2px;
  }

  header nav a {
    padding: 7px 12px;
    font-size: 0.82rem;
    background: rgba(255, 255, 255, 0.04);
  }

  main {
    padding: 16px 12px 40px;
  }

  main > section,
  main > nav {
    padding: 20px 16px;
    border-radius: 16px;
    margin-bottom: 18px;
  }

  #hero {
    padding: 26px 18px;
    border-radius: 20px;
  }

  #hero::after {
    width: 260px;
    height: 260px;
    right: -100px;
    top: -110px;
    filter: blur(50px);
  }

  h2 {
    padding-left: 13px;
    margin-bottom: 14px;
  }

  h2::before {
    width: 4px;
  }

  h3 {
    margin: 18px 0 8px;
  }

  #articles article {
    padding: 16px;
    border-radius: 12px;
  }

  #articles article::after {
    left: 16px;
    right: 16px;
  }

  #sitemap ul,
  #links ul {
    gap: 8px;
  }

  #sitemap a,
  #links a {
    padding: 7px 13px;
    font-size: 0.82rem;
  }

  #faq h3 {
    padding: 12px 14px;
  }

  #faq h3 + p {
    padding: 12px 14px 14px;
  }

  #howto p {
    padding-left: 14px;
  }

  footer {
    padding: 28px 12px 40px;
  }

  footer section {
    padding: 18px 16px;
    border-radius: 16px;
  }
}

@media (max-width: 420px) {
  header nav a {
    padding: 6px 10px;
    font-size: 0.78rem;
  }

  main > section,
  main > nav {
    padding: 16px 13px;
  }

  #hero {
    padding: 22px 14px;
  }

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

/* ---------- Motion & a11y ---------- */
@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;
  }

  #hero::after {
    animation: none;
  }
}

@media print {
  body {
    background: #fff;
    color: #000;
  }

  header,
  #hero::after,
  footer::before {
    display: none;
  }

  main > section,
  main > nav,
  footer section {
    box-shadow: none;
    border: 1px solid #ccc;
    background: #fff;
    backdrop-filter: none;
  }
}