:root {
  --bg: #0f1220;
  --bg-soft: #161a2e;
  --bg-elev: rgba(255, 255, 255, 0.04);
  --glass: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.12);
  --text: #eef1f8;
  --text-soft: #b6bcd0;
  --text-dim: #8a91a8;
  --brand: #4f7cff;
  --brand-2: #7a5cff;
  --accent: #22d3ee;
  --accent-2: #f472b6;
  --grad-banner: linear-gradient(135deg, #1a1a2e 0%, #232a54 45%, #3b2f6b 100%);
  --grad-brand: linear-gradient(135deg, #4f7cff 0%, #7a5cff 50%, #22d3ee 100%);
  --grad-line: linear-gradient(90deg, transparent, rgba(122, 92, 255, 0.6), transparent);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 8px 40px rgba(79, 124, 255, 0.28);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --maxw: 1180px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6fc;
    --bg-soft: #ffffff;
    --bg-elev: rgba(255, 255, 255, 0.72);
    --glass: rgba(255, 255, 255, 0.62);
    --glass-border: rgba(20, 30, 60, 0.08);
    --text: #141a2e;
    --text-soft: #3d4763;
    --text-dim: #6b7488;
    --shadow-sm: 0 4px 16px rgba(20, 30, 60, 0.08);
    --shadow-md: 0 14px 36px rgba(20, 30, 60, 0.12);
    --shadow-glow: 0 8px 40px rgba(79, 124, 255, 0.18);
  }
}

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

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

body {
  margin: 0;
  font-family: "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(900px 500px at 12% -8%, rgba(79, 124, 255, 0.18), transparent 60%),
    radial-gradient(800px 460px at 92% 4%, rgba(122, 92, 255, 0.16), transparent 62%),
    radial-gradient(700px 420px at 50% 108%, rgba(34, 211, 238, 0.1), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

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

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

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

::selection {
  background: rgba(79, 124, 255, 0.35);
  color: #fff;
}

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

header nav {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.7rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

header nav > a {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--text);
  padding: 0.3rem 0.2rem;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  flex-shrink: 0;
}

header nav > a:hover {
  filter: brightness(1.15);
}

header nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-wrap: wrap;
  margin-left: auto;
}

header nav ul li a {
  display: inline-block;
  padding: 0.4rem 0.7rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-soft);
  border-radius: 999px;
  position: relative;
  transition: color 0.25s var(--ease), background 0.25s var(--ease), transform 0.25s var(--ease);
}

header nav ul li a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--grad-brand);
  transform: translateX(-50%);
  transition: width 0.3s var(--ease);
}

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

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

/* ============ Main layout ============ */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

main > section {
  margin-top: 2.5rem;
  padding: 2rem 1.75rem;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  animation: rise 0.7s var(--ease) both;
}

main > section::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: var(--grad-line);
  opacity: 0.8;
}

main > section:nth-child(2) { animation-delay: 0.05s; }
main > section:nth-child(3) { animation-delay: 0.1s; }
main > section:nth-child(4) { animation-delay: 0.15s; }
main > section:nth-child(5) { animation-delay: 0.2s; }
main > section:nth-child(6) { animation-delay: 0.25s; }
main > section:nth-child(7) { animation-delay: 0.3s; }

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

/* ============ Hero / Banner ============ */
#home {
  margin-top: 2rem;
  padding: 3.5rem 2.5rem;
  background: var(--grad-banner);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glow);
  isolation: isolate;
}

#home::after {
  content: "";
  position: absolute;
  inset: -40% -10% auto auto;
  width: 460px;
  height: 460px;
  background: radial-gradient(circle, rgba(122, 92, 255, 0.55), transparent 65%);
  filter: blur(10px);
  z-index: -1;
  animation: float 12s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-24px, 18px, 0) scale(1.06); }
}

#home h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  line-height: 1.28;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #fff;
}

#home p {
  margin: 0;
  max-width: 62ch;
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(0.95rem, 1.6vw, 1.08rem);
}

/* ============ Typography ============ */
h2 {
  margin: 0 0 1.1rem;
  font-size: clamp(1.3rem, 2.6vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.35;
  color: var(--text);
  position: relative;
  padding-left: 0.9rem;
}

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

h3 {
  margin: 1.5rem 0 0.6rem;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.005em;
  transition: color 0.25s var(--ease);
}

h3:first-of-type {
  margin-top: 0.5rem;
}

p {
  margin: 0 0 0.9rem;
  color: var(--text-soft);
}

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

/* ============ Articles ============ */
#articles {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

#articles > h2 {
  grid-column: 1 / -1;
}

#articles article {
  padding: 1.35rem 1.4rem;
  background: var(--bg-elev);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s var(--ease), background 0.35s var(--ease);
  position: relative;
  overflow: hidden;
}

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

#articles article:hover {
  transform: translateY(-6px);
  border-color: rgba(122, 92, 255, 0.45);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(122, 92, 255, 0.18);
  background: var(--glass);
}

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

#articles article h3 {
  margin-top: 0;
  font-size: 1.06rem;
}

#articles article p:nth-of-type(1) {
  font-size: 0.8rem;
  color: var(--text-dim);
  letter-spacing: 0.02em;
  margin-bottom: 0.45rem;
}

#articles article p:nth-of-type(2) {
  font-size: 0.94rem;
  color: var(--text-soft);
  margin-bottom: 0.85rem;
}

#articles article a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  color: var(--text);
  background: var(--grad-brand);
  box-shadow: 0 4px 14px rgba(79, 124, 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: "→";
  transition: transform 0.25s var(--ease);
}

#articles article a:hover,
#articles article a:focus-visible {
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(79, 124, 255, 0.45);
  filter: brightness(1.06);
}

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

/* ============ FAQ ============ */
#faq h3 {
  position: relative;
  padding: 0.85rem 1rem 0.85rem 2.4rem;
  margin: 0.6rem 0 0;
  background: var(--bg-elev);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  cursor: default;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), transform 0.3s var(--ease);
}

#faq h3::before {
  content: "Q";
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.25rem;
  height: 1.25rem;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 800;
  color: #fff;
  border-radius: 50%;
  background: var(--grad-brand);
}

#faq h3:hover {
  background: var(--glass);
  border-color: rgba(122, 92, 255, 0.4);
  transform: translateX(3px);
}

#faq p {
  margin: 0.5rem 0 1.1rem;
  padding-left: 2.4rem;
  font-size: 0.94rem;
  color: var(--text-soft);
  border-left: 2px solid transparent;
  transition: border-color 0.3s var(--ease);
}

#faq h3:hover + p {
  border-left-color: var(--accent);
}

/* ============ HowTo ============ */
#howto {
  background: linear-gradient(160deg, rgba(79, 124, 255, 0.12), rgba(122, 92, 255, 0.06)), var(--glass);
}

#howto h3 {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  font-size: 0.92rem;
  background: var(--bg-elev);
  border: 1px solid var(--glass-border);
}

#howto h3::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

#howto p {
  font-size: 0.95rem;
}

/* ============ Contact ============ */
#contact p {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.55rem 0.9rem;
  margin: 0 0 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  border: 1px solid var(--glass-border);
  font-size: 0.93rem;
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), background 0.25s var(--ease);
}

#contact p:hover {
  transform: translateX(4px);
  border-color: rgba(34, 211, 238, 0.4);
  background: var(--glass);
}

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

/* ============ Sitemap ============ */
#sitemap ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

#sitemap ul li a {
  display: inline-block;
  padding: 0.45rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-soft);
  background: var(--bg-elev);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  transition: color 0.25s var(--ease), background 0.25s var(--ease), transform 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

#sitemap ul li a:hover,
#sitemap ul li a:focus-visible {
  color: #fff;
  background: var(--grad-brand);
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(79, 124, 255, 0.32);
}

/* ============ Footer ============ */
#footer {
  background: linear-gradient(180deg, transparent, rgba(122, 92, 255, 0.08)), var(--glass);
}

#footer h3 {
  font-size: 0.98rem;
  color: var(--text);
  margin-top: 1.3rem;
}

#footer h3:first-of-type {
  margin-top: 1rem;
}

#footer p {
  font-size: 0.9rem;
  color: var(--text-dim);
}

#footer p:first-of-type {
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  border: 1px solid var(--glass-border);
  color: var(--text-soft);
}

/* ============ Responsive ============ */
@media (min-width: 640px) {
  #articles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  #articles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  main > section {
    padding: 2.4rem 2.2rem;
    margin-top: 3rem;
  }

  #home {
    padding: 4.5rem 3.5rem;
  }
}

@media (max-width: 860px) {
  header nav {
    padding: 0.6rem 1rem;
  }

  header nav ul {
    width: 100%;
    margin-left: 0;
    gap: 0.1rem;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 0.25rem;
  }

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

  header nav ul li {
    flex: 0 0 auto;
  }

  header nav ul li a {
    font-size: 0.85rem;
    padding: 0.35rem 0.6rem;
    white-space: nowrap;
  }
}

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

  main {
    padding: 0 0.9rem 3rem;
  }

  main > section {
    padding: 1.5rem 1.15rem;
    margin-top: 1.5rem;
    border-radius: var(--radius);
  }

  #home {
    margin-top: 1.25rem;
    padding: 2.4rem 1.35rem;
    border-radius: var(--radius);
  }

  #home::after {
    width: 280px;
    height: 280px;
    inset: -30% -20% auto auto;
  }

  h2 {
    padding-left: 0.75rem;
    margin-bottom: 0.9rem;
  }

  h2::before {
    width: 3px;
  }

  #articles {
    gap: 1rem;
  }

  #articles article {
    padding: 1.15rem 1.1rem;
  }

  #faq h3 {
    padding-left: 2.2rem;
  }

  #faq p {
    padding-left: 0.2rem;
    margin-bottom: 0.9rem;
  }

  #contact p {
    font-size: 0.88rem;
  }
}

/* ============ 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 {
  header,
  #sitemap,
  #footer {
    display: none;
  }

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

  main > section,
  #articles article {
    box-shadow: none;
    border: 1px solid #ddd;
    background: #fff;
  }
}