:root {
  --bg: #0f0f1a;
  --bg-alt: #16162a;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-solid: #1c1c33;
  --border: rgba(255, 255, 255, 0.1);
  --text: #ececf5;
  --text-soft: #a8a8c0;
  --accent: #ff2d78;
  --accent-2: #7b5cff;
  --accent-3: #00d4ff;
  --gradient: linear-gradient(135deg, #ff2d78 0%, #7b5cff 50%, #00d4ff 100%);
  --gradient-soft: linear-gradient(135deg, rgba(255, 45, 120, 0.15), rgba(123, 92, 255, 0.15));
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 16px 48px rgba(123, 92, 255, 0.25);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 28px;
  --blur: saturate(180%) blur(18px);
  --maxw: 1180px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f5fb;
    --bg-alt: #ffffff;
    --surface: rgba(255, 255, 255, 0.7);
    --surface-solid: #ffffff;
    --border: rgba(20, 20, 50, 0.08);
    --text: #1a1a2e;
    --text-soft: #5a5a78;
    --shadow: 0 8px 32px rgba(60, 60, 120, 0.1);
    --shadow-hover: 0 16px 48px rgba(123, 92, 255, 0.18);
    --gradient-soft: linear-gradient(135deg, rgba(255, 45, 120, 0.08), rgba(123, 92, 255, 0.08));
  }
}

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

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

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: var(--bg);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(255, 45, 120, 0.12), transparent 42%),
    radial-gradient(circle at 88% 12%, rgba(123, 92, 255, 0.14), transparent 46%),
    radial-gradient(circle at 50% 100%, rgba(0, 212, 255, 0.08), transparent 50%);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: rgba(255, 45, 120, 0.35);
  color: #fff;
}

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

a:hover,
a:focus-visible {
  color: var(--accent);
  outline: none;
}

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

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

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

h1, h2, h3, h4 {
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 0 0 0.6em;
  font-weight: 700;
}

h1 {
  font-size: clamp(1.65rem, 4vw, 2.6rem);
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  position: relative;
  padding-left: 18px;
}

h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.18em;
  bottom: 0.18em;
  width: 6px;
  border-radius: 6px;
  background: var(--gradient);
  box-shadow: 0 0 16px rgba(255, 45, 120, 0.5);
}

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

p {
  margin: 0 0 1.1em;
  color: var(--text-soft);
}

/* ============ HEADER ============ */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}

.brand-bar {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 16px 24px 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
}

.brand-bar a {
  font-size: clamp(1.35rem, 3vw, 1.7rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  transition: filter 0.3s var(--ease), transform 0.3s var(--ease);
}

.brand-bar a:hover {
  filter: brightness(1.2) drop-shadow(0 0 12px rgba(255, 45, 120, 0.6));
  transform: translateY(-1px);
}

.brand-bar p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-soft);
  letter-spacing: 0.04em;
}

nav {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

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

nav ul {
  display: flex;
  gap: 4px;
  padding-bottom: 10px;
  white-space: nowrap;
}

nav a {
  display: inline-block;
  padding: 7px 14px;
  font-size: 0.88rem;
  color: var(--text-soft);
  border-radius: 999px;
  border: 1px solid transparent;
  transition: all 0.28s var(--ease);
}

nav a:hover,
nav a:focus-visible {
  color: var(--text);
  background: var(--gradient-soft);
  border-color: var(--border);
  transform: translateY(-2px);
}

/* ============ MAIN ============ */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 32px 24px 64px;
}

section {
  margin-bottom: 40px;
  padding: 32px clamp(20px, 4vw, 44px);
  background: var(--surface);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  animation: fadeUp 0.7s var(--ease) both;
  transition: box-shadow 0.4s var(--ease), border-color 0.4s var(--ease),
    transform 0.4s var(--ease);
}

section:hover {
  border-color: rgba(123, 92, 255, 0.28);
  box-shadow: var(--shadow-hover);
}

section > p:last-child,
section > ul:last-child {
  margin-bottom: 0;
}

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

/* ============ HERO ============ */
#hero {
  position: relative;
  overflow: hidden;
  padding: clamp(36px, 6vw, 72px) clamp(22px, 5vw, 56px);
  background: var(--gradient-soft);
  border: 1px solid var(--border);
}

#hero::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto auto;
  width: 460px;
  height: 460px;
  background: radial-gradient(circle, rgba(255, 45, 120, 0.35), transparent 65%);
  filter: blur(40px);
  animation: float 14s ease-in-out infinite;
  pointer-events: none;
}

#hero::after {
  content: "";
  position: absolute;
  inset: auto auto -50% -15%;
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(0, 212, 255, 0.3), transparent 65%);
  filter: blur(40px);
  animation: float 18s ease-in-out infinite reverse;
  pointer-events: none;
}

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

#hero p {
  position: relative;
  z-index: 1;
  max-width: 74ch;
  font-size: 1rem;
}

@keyframes float {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(-30px, 30px) scale(1.12);
  }
}

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

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

#articles article:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(255, 45, 120, 0.3);
}

#articles article:hover::before {
  opacity: 1;
}

#articles article h3 {
  margin-bottom: 6px;
  transition: color 0.3s var(--ease);
}

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

#articles article p:first-of-type {
  font-size: 0.8rem;
  color: var(--accent-3);
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

#articles article a {
  display: inline-block;
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  background: var(--gradient);
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(255, 45, 120, 0.35);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease),
    filter 0.3s var(--ease);
}

#articles article a:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 8px 24px rgba(123, 92, 255, 0.5);
  filter: brightness(1.08);
  color: #fff;
}

/* ============ FAQ ============ */
#faq h3 {
  margin-top: 26px;
  padding: 14px 18px;
  font-size: 1.02rem;
  background: var(--gradient-soft);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease),
    box-shadow 0.3s var(--ease);
}

#faq h3:hover {
  transform: translateX(6px);
  border-color: var(--accent-2);
  box-shadow: 0 6px 20px rgba(123, 92, 255, 0.2);
}

#faq h3 + p {
  padding: 0 6px;
}

/* ============ HOWTO ============ */
#howto h3 {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  font-size: 1.05rem;
  color: var(--accent-3);
}

#howto h3::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gradient);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.6);
  flex-shrink: 0;
}

/* ============ KNOWLEDGE ============ */
#knowledge h3 {
  color: var(--accent-2);
  margin-top: 24px;
}

/* ============ SITEMAP / LINKS ============ */
#sitemap ul,
#links ul {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

#sitemap li a,
#links li a {
  display: block;
  padding: 10px 16px;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.3s var(--ease);
}

#sitemap li a:hover,
#links li a:hover {
  color: #fff;
  background: var(--gradient);
  border-color: transparent;
  transform: translateY(-3px);
  box-shadow: 0 8px 22px rgba(255, 45, 120, 0.35);
}

/* ============ CONTACT ============ */
#contact p {
  padding: 10px 16px;
  margin-bottom: 10px;
  background: var(--gradient-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease);
}

#contact p:hover {
  transform: translateX(4px);
  border-color: var(--accent-3);
}

/* ============ LEGAL ============ */
#legal h3 {
  margin-top: 24px;
  color: var(--accent);
}

/* ============ FOOTER ============ */
footer {
  position: relative;
  margin-top: 20px;
  padding: 40px 24px 48px;
  text-align: center;
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
}

footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(600px, 80%);
  height: 2px;
  background: var(--gradient);
  border-radius: 2px;
  box-shadow: 0 0 20px rgba(123, 92, 255, 0.6);
}

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

footer p:first-child {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  body {
    font-size: 15px;
    line-height: 1.72;
  }

  .brand-bar {
    padding: 14px 16px 8px;
    gap: 4px 14px;
  }

  .brand-bar p {
    font-size: 0.76rem;
    width: 100%;
  }

  nav {
    padding: 0 16px;
  }

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

  main {
    padding: 20px 14px 48px;
  }

  section {
    margin-bottom: 24px;
    padding: 24px 18px;
    border-radius: var(--radius);
  }

  #hero {
    padding: 30px 20px;
  }

  #articles article {
    padding: 18px 18px;
  }

  #sitemap ul,
  #links ul {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
  }

  #sitemap li a,
  #links li a {
    padding: 9px 12px;
    font-size: 0.84rem;
  }
}

@media (max-width: 420px) {
  .brand-bar a {
    font-size: 1.25rem;
  }

  h2 {
    padding-left: 14px;
  }

  h2::before {
    width: 5px;
  }

  section {
    padding: 20px 15px;
  }
}

/* ============ MOTION PREFERENCES ============ */
@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;
  }
}

/* ============ PRINT ============ */
@media print {
  body {
    background: #fff;
    color: #000;
  }

  header,
  footer,
  nav {
    display: none;
  }

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

  h1, h2, h3 {
    color: #000;
    -webkit-text-fill-color: #000;
  }
}