:root {
  --primary: #4a3aff;
  --primary-dark: #3728d6;
  --primary-light: #7a6dff;
  --accent: #ff5c8a;
  --accent-2: #ffb347;
  --bg: #f5f6fb;
  --bg-alt: #ffffff;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --text: #1c1d2b;
  --text-soft: #4d4f63;
  --text-muted: #7b7e93;
  --border: rgba(74, 58, 255, 0.12);
  --shadow-sm: 0 2px 10px rgba(28, 29, 43, 0.06);
  --shadow-md: 0 10px 30px rgba(28, 29, 43, 0.1);
  --shadow-lg: 0 20px 50px rgba(74, 58, 255, 0.16);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --header-h: 64px;
  --maxw: 1180px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #8b7dff;
    --primary-dark: #6a5bff;
    --primary-light: #b3a9ff;
    --accent: #ff7aa2;
    --accent-2: #ffc46b;
    --bg: #0e0f1a;
    --bg-alt: #161826;
    --surface: rgba(30, 32, 48, 0.66);
    --surface-solid: #1a1c2b;
    --text: #eceefb;
    --text-soft: #c2c5da;
    --text-muted: #8f93ad;
    --border: rgba(139, 125, 255, 0.2);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.55);
  }
}

*,
*::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;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", 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(74, 58, 255, 0.1),
      transparent 42%
    ),
    radial-gradient(circle at 88% 4%, rgba(255, 92, 138, 0.09), transparent 40%),
    radial-gradient(circle at 50% 100%, rgba(255, 179, 71, 0.07), transparent 45%);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

a:hover {
  color: var(--primary-dark);
}

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

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

/* ============ Header / Nav ============ */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

header nav {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  overflow-x: auto;
  scrollbar-width: none;
}

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

header nav a {
  position: relative;
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-soft);
  white-space: nowrap;
  transition: color 0.25s var(--ease), background 0.25s var(--ease),
    transform 0.25s var(--ease);
}

header nav a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 0;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transform: translateX(-50%);
  transition: width 0.3s var(--ease);
}

header nav a:hover,
header nav a:focus-visible {
  color: var(--primary);
  background: rgba(74, 58, 255, 0.08);
  transform: translateY(-1px);
}

header nav a:hover::after {
  width: 60%;
}

/* ============ Main Layout ============ */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 40px 20px 80px;
}

section {
  margin-bottom: 40px;
  padding: 36px 32px;
  background: var(--surface);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  backdrop-filter: blur(14px) saturate(150%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  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-md);
  border-color: rgba(74, 58, 255, 0.22);
}

/* ============ Banner / Hero (#home) ============ */
#home {
  position: relative;
  overflow: hidden;
  padding: 72px 40px;
  margin-bottom: 48px;
  border: none;
  color: #ffffff;
  background: linear-gradient(
    135deg,
    #4a3aff 0%,
    #6a4bff 30%,
    #9a4bff 55%,
    #ff5c8a 100%
  );
  background-size: 200% 200%;
  animation: gradientShift 14s ease infinite, fadeUp 0.7s var(--ease) both;
  box-shadow: var(--shadow-lg);
}

#home::before,
#home::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(10px);
}

#home::before {
  width: 340px;
  height: 340px;
  top: -140px;
  right: -80px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.35), transparent 70%);
  animation: floatY 9s ease-in-out infinite;
}

#home::after {
  width: 260px;
  height: 260px;
  bottom: -120px;
  left: -60px;
  background: radial-gradient(circle, rgba(255, 179, 71, 0.4), transparent 70%);
  animation: floatY 11s ease-in-out infinite reverse;
}

#home h1 {
  position: relative;
  z-index: 1;
  margin: 0 0 20px;
  font-size: clamp(1.7rem, 4.2vw, 2.8rem);
  line-height: 1.3;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.18);
}

#home p {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: 860px;
  font-size: clamp(0.95rem, 1.6vw, 1.08rem);
  line-height: 1.9;
  color: rgba(255, 255, 255, 0.94);
}

/* ============ Typography ============ */
h2 {
  position: relative;
  margin: 0 0 24px;
  padding-bottom: 14px;
  font-size: clamp(1.3rem, 2.6vw, 1.7rem);
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
  letter-spacing: 0.3px;
}

h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 64px;
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

#home h2::after {
  display: none;
}

h3 {
  margin: 28px 0 12px;
  font-size: clamp(1.05rem, 2vw, 1.22rem);
  font-weight: 650;
  line-height: 1.5;
  color: var(--primary);
}

h4 {
  margin: 20px 0 8px;
  font-size: 1rem;
  font-weight: 650;
  color: var(--text);
}

p {
  margin: 0 0 14px;
  color: var(--text-soft);
}

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

/* ============ Lists (sitemap) ============ */
#sitemap ul {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

#sitemap ul li {
  margin: 0;
}

#sitemap ul li a {
  display: block;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  font-size: 0.92rem;
  color: var(--text-soft);
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease),
    color 0.25s var(--ease), border-color 0.25s var(--ease);
}

#sitemap ul li a:hover {
  transform: translateY(-3px);
  color: var(--primary);
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
}

/* ============ 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-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease),
    border-color 0.3s var(--ease);
}

#articles article::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--primary), var(--accent));
  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(74, 58, 255, 0.24);
}

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

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

#articles article a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 18px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  box-shadow: 0 6px 16px rgba(74, 58, 255, 0.28);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease),
    filter 0.25s var(--ease);
}

#articles article a::after {
  content: "\2192";
  transition: transform 0.25s var(--ease);
}

#articles article a:hover {
  color: #fff;
  transform: translateY(-2px);
  filter: brightness(1.06);
  box-shadow: 0 10px 22px rgba(74, 58, 255, 0.38);
}

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

/* ============ FAQ ============ */
#faq h3 {
  margin: 0 0 6px;
  padding: 16px 20px 6px;
  font-size: 1rem;
  color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  transition: color 0.25s var(--ease);
}

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

#faq h3 + p {
  margin: 0 0 14px;
  padding: 0 20px 16px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  font-size: 0.94rem;
  transition: background 0.25s var(--ease);
}

#faq h3 + p:hover {
  background: rgba(74, 58, 255, 0.04);
}

/* ============ HowTo ============ */
#howto h4 {
  position: relative;
  padding-left: 34px;
}

#howto h4::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  transform: translateY(-50%);
  box-shadow: 0 4px 12px rgba(74, 58, 255, 0.3);
}

#howto h4::after {
  content: "\2713";
  position: absolute;
  left: 0;
  top: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  transform: translateY(-50%);
}

#howto h4 + p {
  padding-left: 34px;
}

/* ============ Contact ============ */
#contact h3 {
  margin-top: 24px;
}

#contact p {
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 0.95rem;
}

#contact p:last-child {
  border-bottom: none;
}

#contact a {
  font-weight: 600;
}

/* ============ Legal ============ */
#legal h2 {
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  margin-top: 28px;
}

#legal h2:first-child {
  margin-top: 0;
}

/* ============ Footer ============ */
footer {
  position: relative;
  margin-top: 20px;
  padding: 40px 20px 48px;
  text-align: center;
  color: var(--text-muted);
  background: var(--surface);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}

footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: min(680px, 80%);
  height: 2px;
  transform: translateX(-50%);
  background: linear-gradient(
    90deg,
    transparent,
    var(--primary),
    var(--accent),
    transparent
  );
}

footer p {
  margin: 0 auto 6px;
  max-width: var(--maxw);
  font-size: 0.88rem;
  color: var(--text-muted);
}

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

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

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

@keyframes floatY {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-22px);
  }
}

/* Staggered entrance for sections */
section:nth-of-type(1) { animation-delay: 0.02s; }
section:nth-of-type(2) { animation-delay: 0.05s; }
section:nth-of-type(3) { animation-delay: 0.08s; }
section:nth-of-type(4) { animation-delay: 0.11s; }
section:nth-of-type(5) { animation-delay: 0.14s; }
section:nth-of-type(6) { animation-delay: 0.17s; }
section:nth-of-type(7) { animation-delay: 0.2s; }
section:nth-of-type(8) { animation-delay: 0.23s; }
section:nth-of-type(9) { animation-delay: 0.26s; }
section:nth-of-type(10) { animation-delay: 0.29s; }
section:nth-of-type(11) { animation-delay: 0.32s; }
section:nth-of-type(12) { animation-delay: 0.35s; }

/* ============ Responsive ============ */
@media (max-width: 900px) {
  main {
    padding: 28px 16px 60px;
  }

  section {
    padding: 28px 22px;
    margin-bottom: 28px;
    border-radius: var(--radius-md);
  }

  #home {
    padding: 48px 24px;
    border-radius: var(--radius-md);
  }

  header nav {
    padding: 8px 14px;
    gap: 4px;
  }

  header nav a {
    padding: 7px 11px;
    font-size: 0.84rem;
  }
}

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

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

  section {
    padding: 22px 16px;
    margin-bottom: 20px;
    border-radius: 14px;
  }

  #home {
    padding: 36px 18px;
    margin-bottom: 24px;
  }

  #home h1 {
    font-size: 1.5rem;
    line-height: 1.35;
  }

  h2 {
    margin-bottom: 18px;
    padding-bottom: 12px;
  }

  h2::after {
    width: 48px;
    height: 3px;
  }

  h3 {
    margin-top: 22px;
  }

  #sitemap ul {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  #sitemap ul li a {
    padding: 9px 12px;
    font-size: 0.85rem;
  }

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

  #faq h3 {
    padding: 14px 16px 6px;
    font-size: 0.95rem;
  }

  #faq h3 + p {
    padding: 0 16px 14px;
    font-size: 0.9rem;
  }

  #howto h4,
  #howto h4 + p {
    padding-left: 30px;
  }

  footer {
    padding: 32px 16px 40px;
  }

  footer p {
    font-size: 0.82rem;
  }
}

@media (max-width: 380px) {
  #sitemap ul {
    grid-template-columns: 1fr;
  }
}

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

@media print {
  header,
  footer {
    display: none;
  }

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

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

  #home {
    background: #f0f0f0 !important;
    color: #000;
  }

  #home h1,
  #home p {
    color: #000;
    text-shadow: none;
  }
}