:root {
  --bg: #0f0f1a;
  --bg-alt: #16162a;
  --bg-card: rgba(30, 30, 55, 0.55);
  --bg-glass: rgba(26, 26, 46, 0.65);
  --border: rgba(120, 120, 200, 0.18);
  --border-strong: rgba(140, 140, 230, 0.35);
  --text: #e8e8f4;
  --text-soft: #b4b4cc;
  --text-muted: #8a8aa8;
  --primary: #7c5cff;
  --primary-2: #b06cff;
  --accent: #22d3ee;
  --accent-2: #f472b6;
  --grad-hero: linear-gradient(135deg, #1a1a2e 0%, #2d1b69 35%, #6d28d9 70%, #db2777 100%);
  --grad-text: linear-gradient(120deg, #a78bfa, #22d3ee 55%, #f472b6);
  --grad-btn: linear-gradient(135deg, #7c5cff, #b06cff);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 0 1px rgba(124, 92, 255, 0.25), 0 12px 40px rgba(124, 92, 255, 0.22);
  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 26px;
  --maxw: 1180px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3f2fb;
    --bg-alt: #eae8f7;
    --bg-card: rgba(255, 255, 255, 0.72);
    --bg-glass: rgba(255, 255, 255, 0.62);
    --border: rgba(90, 70, 180, 0.14);
    --border-strong: rgba(110, 90, 210, 0.28);
    --text: #1c1a2e;
    --text-soft: #4a4766;
    --text-muted: #6f6c8a;
    --grad-hero: linear-gradient(135deg, #e0d9ff 0%, #c9b8ff 30%, #a78bfa 65%, #f9a8d4 100%);
    --shadow-sm: 0 2px 8px rgba(80, 60, 160, 0.1);
    --shadow-md: 0 10px 30px rgba(80, 60, 160, 0.15);
    --shadow-glow: 0 0 0 1px rgba(124, 92, 255, 0.2), 0 12px 40px rgba(124, 92, 255, 0.18);
  }
}

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(124, 92, 255, 0.16), transparent 42%),
    radial-gradient(circle at 88% 18%, rgba(34, 211, 238, 0.12), transparent 40%),
    radial-gradient(circle at 50% 100%, rgba(244, 114, 182, 0.1), transparent 45%);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--primary-2);
  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,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

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

h1 {
  font-size: clamp(1.75rem, 4.2vw, 3rem);
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  font-weight: 800;
}

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

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

h3 {
  font-size: clamp(1.08rem, 1.9vw, 1.32rem);
  color: var(--text);
}

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

ul {
  margin: 0 0 1em;
  padding-left: 1.3em;
}

li {
  margin-bottom: 0.45em;
  color: var(--text-soft);
}

li::marker {
  color: var(--primary-2);
}

header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.6rem clamp(1rem, 4vw, 2rem);
  background: var(--bg-glass);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-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;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

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

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

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

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

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

main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2rem) 3rem;
}

section {
  margin: 2.4rem 0;
  padding: clamp(1.4rem, 3.5vw, 2.6rem);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: var(--shadow-md);
  animation: fadeUp 0.7s var(--ease) both;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease), transform 0.3s var(--ease);
}

section:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-glow);
}

#hero {
  margin-top: 1.6rem;
  padding: clamp(2rem, 6vw, 4.5rem) clamp(1.4rem, 4vw, 3rem);
  background: var(--grad-hero);
  background-size: 200% 200%;
  border: 1px solid var(--border-strong);
  position: relative;
  overflow: hidden;
  animation: fadeUp 0.7s var(--ease) both, heroShift 14s ease infinite;
}

#hero::before {
  content: "";
  position: absolute;
  width: 520px;
  height: 520px;
  top: -220px;
  right: -160px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22), transparent 65%);
  border-radius: 50%;
  pointer-events: none;
}

#hero::after {
  content: "";
  position: absolute;
  width: 380px;
  height: 380px;
  bottom: -180px;
  left: -120px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.28), transparent 65%);
  border-radius: 50%;
  pointer-events: none;
}

#hero h1 {
  position: relative;
  z-index: 1;
  -webkit-text-fill-color: #fff;
  color: #fff;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
  margin-bottom: 0.8em;
}

#hero p {
  position: relative;
  z-index: 1;
  color: rgba(255, 255, 255, 0.9);
  max-width: 72ch;
  font-size: 1.02rem;
}

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

#articles article {
  padding: 1.3rem 1.5rem;
  margin-bottom: 1rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
  animation: fadeUp 0.6s var(--ease) both;
}

#articles article:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-glow);
}

#articles article h3 {
  margin-bottom: 0.35em;
}

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

#articles article a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  background: var(--grad-btn);
  color: #fff;
  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 {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(124, 92, 255, 0.4);
  filter: brightness(1.08);
  color: #fff;
}

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

#faq h3 {
  margin-top: 1.4rem;
  padding-left: 1rem;
  position: relative;
  color: var(--text);
}

#faq h3::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.28em;
  bottom: 0.28em;
  width: 4px;
  border-radius: 4px;
  background: var(--grad-btn);
}

#faq h3:first-of-type {
  margin-top: 0.4rem;
}

#faq p {
  padding-left: 1rem;
  border-left: 1px dashed var(--border-strong);
  margin-left: 0.1rem;
}

#howto h3 {
  color: var(--primary-2);
  margin-top: 1.3rem;
}

#contact ul,
#sitemap ul,
#links ul {
  list-style: none;
  padding-left: 0;
  display: grid;
  gap: 0.55rem;
}

#contact li {
  padding: 0.7rem 1rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), background 0.25s var(--ease);
}

#contact li:hover {
  transform: translateX(4px);
  border-color: var(--border-strong);
  background: var(--bg-card);
}

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

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

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

#sitemap a:hover,
#links a:hover {
  transform: translateY(-2px);
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

footer {
  margin-top: 2rem;
  padding: 0 clamp(1rem, 4vw, 2rem) 3rem;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, transparent, rgba(124, 92, 255, 0.08));
}

footer section {
  max-width: var(--maxw);
  margin: 2rem auto 0;
}

footer h2 {
  font-size: 1.15rem;
}

footer p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 0.7em;
}

footer p:last-child {
  color: var(--text-soft);
  font-weight: 600;
  margin-top: 1.2rem;
}

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

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

@supports (animation-timeline: view()) {
  section {
    animation: fadeUp linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 55%;
  }
  #hero {
    animation: heroShift 14s ease infinite;
  }
}

@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;
  }
}

@media (max-width: 720px) {
  html {
    scroll-padding-top: 76px;
  }
  body {
    font-size: 15px;
  }
  header {
    padding: 0.5rem 0.8rem;
  }
  header nav a {
    padding: 0.45rem 0.75rem;
    font-size: 0.86rem;
  }
  section {
    margin: 1.4rem 0;
    padding: 1.2rem 1.1rem;
    border-radius: var(--radius);
  }
  #hero {
    padding: 1.6rem 1.2rem;
  }
  #articles article {
    padding: 1.1rem 1.1rem;
  }
  #sitemap ul {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
  #links ul {
    grid-template-columns: 1fr;
  }
  h2::after {
    width: 48px;
    height: 3px;
  }
}

@media (max-width: 400px) {
  header nav a {
    padding: 0.4rem 0.6rem;
    font-size: 0.82rem;
  }
  section {
    padding: 1rem 0.9rem;
  }
}

@media print {
  header, footer, #articles article a {
    display: none;
  }
  body {
    background: #fff;
    color: #000;
  }
  section {
    box-shadow: none;
    border: 1px solid #ccc;
    animation: none;
  }
  #hero {
    background: #eee;
  }
  #hero h1, #hero p, h1 {
    color: #000;
    -webkit-text-fill-color: #000;
    text-shadow: none;
  }
}