:root {
  --bg-primary: #0b1020;
  --bg-secondary: #111830;
  --bg-tertiary: #1a2340;
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-hover: rgba(255, 255, 255, 0.1);
  --text-primary: #e8ecf5;
  --text-secondary: #a0aec8;
  --text-muted: #6b7a99;
  --accent-1: #7c3aed;
  --accent-2: #06b6d4;
  --accent-3: #f59e0b;
  --gradient-banner: linear-gradient(135deg, #1a0b2e 0%, #0f172a 30%, #0b2447 60%, #0e1a30 100%);
  --gradient-accent: linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
  --gradient-card: linear-gradient(145deg, rgba(124, 58, 237, 0.08), rgba(6, 182, 212, 0.05));
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 40px rgba(124, 58, 237, 0.2);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;
  --max-width: 1200px;
  --nav-height: 64px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg-primary: #f5f7fc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #eef1f8;
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-hover: rgba(255, 255, 255, 0.85);
    --text-primary: #1a1f36;
    --text-secondary: #4a5578;
    --text-muted: #8892b0;
    --gradient-banner: linear-gradient(135deg, #e8e0f5 0%, #dce8f5 30%, #d0e4f7 60%, #e4eaf5 100%);
    --gradient-card: linear-gradient(145deg, rgba(124, 58, 237, 0.06), rgba(6, 182, 212, 0.04));
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 40px rgba(124, 58, 237, 0.1);
  }
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 20px);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.75;
  font-size: 16px;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-smooth), color var(--transition-smooth);
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse 80% 60% at 20% 0%, rgba(124, 58, 237, 0.08), transparent),
    radial-gradient(ellipse 60% 50% at 80% 100%, rgba(6, 182, 212, 0.06), transparent);
  pointer-events: none;
  z-index: 0;
}

body > * {
  position: relative;
  z-index: 1;
}

a {
  color: var(--accent-2);
  text-decoration: none;
  transition: color var(--transition-fast), opacity var(--transition-fast);
}

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

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

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

ul, ol {
  list-style: none;
}

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

h1 {
  font-size: clamp(1.75rem, 4vw, 3rem);
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 1rem;
}

h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  position: relative;
  padding-bottom: 0.75rem;
}

h2::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 48px;
  height: 3px;
  background: var(--gradient-accent);
  border-radius: 2px;
  transition: width var(--transition-smooth);
}

section:hover > h2::after {
  width: 80px;
}

h3 {
  font-size: clamp(1.1rem, 2.2vw, 1.4rem);
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

h4 {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

p {
  color: var(--text-secondary);
  margin-bottom: 0.85rem;
}

/* ========== HEADER ========== */
header {
  position: relative;
  background: var(--gradient-banner);
  padding: clamp(3rem, 8vw, 6rem) clamp(1.25rem, 5vw, 3rem) clamp(2.5rem, 6vw, 5rem);
  text-align: center;
  overflow: hidden;
  border-bottom: 1px solid var(--glass-border);
}

header::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(circle at 30% 40%, rgba(124, 58, 237, 0.15), transparent 50%),
    radial-gradient(circle at 70% 60%, rgba(6, 182, 212, 0.1), transparent 50%),
    radial-gradient(circle at 50% 80%, rgba(245, 158, 11, 0.06), transparent 40%);
  animation: aurora 20s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes aurora {
  0% { transform: translate(0, 0) rotate(0deg) scale(1); }
  50% { transform: translate(-3%, 2%) rotate(3deg) scale(1.05); }
  100% { transform: translate(2%, -1%) rotate(-2deg) scale(1.02); }
}

header h1 {
  position: relative;
  max-width: var(--max-width);
  margin: 0 auto 1.25rem;
  animation: fadeInUp 0.8s ease-out both;
}

header p {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  font-size: clamp(0.95rem, 2vw, 1.15rem);
  color: var(--text-secondary);
  animation: fadeInUp 0.8s ease-out 0.15s both;
}

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

/* ========== NAV ========== */
nav[aria-label="主导航"] {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--glass-border);
  padding: 0 clamp(1rem, 4vw, 2rem);
  transition: background var(--transition-smooth), box-shadow var(--transition-smooth);
}

nav[aria-label="主导航"] ul {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 0.25rem;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.5rem 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

nav[aria-label="主导航"] ul::-webkit-scrollbar {
  display: none;
}

nav[aria-label="主导航"] li {
  flex-shrink: 0;
}

nav[aria-label="主导航"] a {
  display: block;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all var(--transition-fast);
  position: relative;
}

nav[aria-label="主导航"] a:hover {
  color: var(--text-primary);
  background: var(--glass-hover);
}

nav[aria-label="主导航"] a::after {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 60%;
  height: 2px;
  background: var(--gradient-accent);
  border-radius: 2px;
  transition: transform var(--transition-fast);
}

nav[aria-label="主导航"] a:hover::after {
  transform: translateX(-50%) scaleX(1);
}

/* ========== MAIN ========== */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 4vw, 2rem) clamp(3rem, 6vw, 5rem);
}

section {
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
  padding: clamp(1.25rem, 3vw, 2.5rem);
  background: var(--glass-bg);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition:
    transform var(--transition-smooth),
    box-shadow var(--transition-smooth),
    border-color var(--transition-smooth),
    background var(--transition-smooth);
  animation: sectionReveal 0.6s ease-out both;
}

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

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

section:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md), var(--shadow-glow);
  border-color: rgba(124, 58, 237, 0.25);
  background: var(--glass-hover);
}

section h3 {
  margin-top: 1.5rem;
}

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

section h4 {
  margin-top: 1rem;
}

/* ========== ARTICLES ========== */
article {
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  background: var(--gradient-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  transition:
    transform var(--transition-bounce),
    box-shadow var(--transition-smooth),
    border-color var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

article::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--gradient-accent);
  opacity: 0;
  transition: opacity var(--transition-smooth);
}

article:hover {
  transform: translateX(6px) scale(1.01);
  box-shadow: var(--shadow-md);
  border-color: rgba(6, 182, 212, 0.3);
}

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

article h3 {
  font-size: 1.1rem;
  margin-bottom: 0.4rem;
  transition: color var(--transition-fast);
}

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

article p {
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}

article p:first-of-type {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

article a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.9rem;
  margin-top: 0.5rem;
  padding: 0.35rem 0.9rem;
  border-radius: 100px;
  background: rgba(124, 58, 237, 0.12);
  border: 1px solid rgba(124, 58, 237, 0.25);
  transition: all var(--transition-fast);
}

article a:hover {
  background: var(--gradient-accent);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.35);
  transform: translateY(-1px);
}

article a::after {
  content: "→";
  transition: transform var(--transition-fast);
}

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

/* ========== HOWTO ========== */
#howto ol {
  counter-reset: step;
  padding-left: 0;
}

#howto ol li {
  counter-increment: step;
  position: relative;
  padding: 0.75rem 1rem 0.75rem 3.25rem;
  margin-bottom: 0.6rem;
  background: var(--gradient-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

#howto ol li::before {
  content: counter(step);
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

#howto ol li:hover {
  background: var(--glass-hover);
  transform: translateX(4px);
  border-color: rgba(6, 182, 212, 0.25);
}

/* ========== FAQ ========== */
#faq h3 {
  padding: 0.85rem 1rem;
  margin-top: 0.6rem;
  margin-bottom: 0;
  background: var(--gradient-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 1rem;
  position: relative;
  padding-left: 2.5rem;
}

#faq h3::before {
  content: "?";
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  border-radius: 50%;
}

#faq h3 + p {
  padding: 0.75rem 1rem;
  margin-top: 0;
  margin-bottom: 0.6rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-size: 0.92rem;
  transition: all var(--transition-fast);
}

#faq h3:hover {
  background: var(--glass-hover);
  border-color: rgba(124, 58, 237, 0.3);
  color: var(--accent-2);
}

#faq h3:hover + p {
  border-color: rgba(124, 58, 237, 0.15);
}

/* ========== CONTACT ========== */
#contact p {
  padding: 0.5rem 0;
  border-bottom: 1px dashed var(--glass-border);
  font-size: 0.95rem;
}

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

#contact p:first-of-type {
  font-weight: 600;
  color: var(--text-primary);
}

/* ========== SITEMAP & LINKS ========== */
#sitemap ul,
#links ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

#sitemap li a,
#links li a {
  display: inline-block;
  padding: 0.45rem 1rem;
  background: var(--gradient-card);
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

#sitemap li a:hover,
#links li a:hover {
  background: var(--gradient-accent);
  color: #fff;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.3);
}

/* ========== LEGAL & AUTHOR ========== */
#legal p,
#author p {
  font-size: 0.88rem;
  color: var(--text-muted);
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

#legal p:last-child,
#author p:last-child {
  border-bottom: none;
}

/* ========== FOOTER ========== */
footer {
  text-align: center;
  padding: clamp(1.5rem, 4vw, 2.5rem) clamp(1rem, 4vw, 2rem);
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--glass-border);
  font-size: 0.88rem;
  color: var(--text-muted);
}

footer p {
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

footer a {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 1rem;
  border-radius: 100px;
  background: var(--gradient-card);
  border: 1px solid var(--glass-border);
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

footer a:hover {
  background: var(--gradient-accent);
  color: #fff;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.3);
}

footer a::before {
  content: "↑";
  font-weight: 700;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--accent-1), var(--accent-2));
  border-radius: 100px;
  border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--accent-2), var(--accent-1));
}

/* ========== SELECTION ========== */
::selection {
  background: rgba(124, 58, 237, 0.35);
  color: var(--text-primary);
}

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

  header {
    padding: 2.5rem 1.25rem 2rem;
  }

  nav[aria-label="主导航"] {
    padding: 0 0.75rem;
  }

  nav[aria-label="主导航"] a {
    padding: 0.5rem 0.75rem;
    font-size: 0.82rem;
  }

  main {
    padding: 1rem 0.75rem 3rem;
  }

  section {
    padding: 1.25rem 1rem;
    border-radius: var(--radius-md);
  }

  section:hover {
    transform: translateY(-2px);
  }

  article {
    padding: 1rem 1.1rem;
  }

  article:hover {
    transform: translateX(3px) scale(1.005);
  }

  #howto ol li {
    padding: 0.65rem 0.75rem 0.65rem 2.75rem;
  }

  #howto ol li::before {
    left: 0.65rem;
    width: 24px;
    height: 24px;
    font-size: 0.72rem;
  }

  #faq h3 {
    padding: 0.75rem 0.85rem 0.75rem 2.25rem;
    font-size: 0.92rem;
  }

  #faq h3::before {
    left: 0.7rem;
    width: 20px;
    height: 20px;
    font-size: 0.65rem;
  }

  #faq h3 + p {
    padding: 0.65rem 0.85rem;
    font-size: 0.86rem;
  }

  #sitemap ul,
  #links ul {
    gap: 0.45rem;
  }

  #sitemap li a,
  #links li a {
    padding: 0.4rem 0.8rem;
    font-size: 0.82rem;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 14px;
  }

  header {
    padding: 2rem 1rem 1.75rem;
  }

  header h1 {
    font-size: 1.5rem;
  }

  nav[aria-label="主导航"] a {
    padding: 0.45rem 0.6rem;
    font-size: 0.78rem;
  }

  section {
    padding: 1rem 0.85rem;
    margin-bottom: 1.25rem;
    border-radius: var(--radius-sm);
  }

  article {
    padding: 0.85rem 0.9rem;
  }

  article h3 {
    font-size: 1rem;
  }
}

@media (min-width: 1024px) {
  section {
    padding: 2.5rem 3rem;
  }

  article {
    padding: 1.5rem 2rem;
  }
}

@media (min-width: 1440px) {
  :root {
    --max-width: 1280px;
  }
}

/* ========== REDUCED MOTION ========== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  header::before {
    animation: none;
  }
}

/* ========== HIGH CONTRAST ========== */
@media (prefers-contrast: high) {
  :root {
    --glass-border: rgba(255, 255, 255, 0.3);
    --text-secondary: #c8d0e0;
  }

  section {
    border-width: 2px;
  }

  article {
    border-width: 2px;
  }
}

/* ========== PRINT ========== */
@media print {
  body {
    background: #fff;
    color: #000;
    font-size: 12pt;
  }

  body::before {
    display: none;
  }

  nav[aria-label="主导航"],
  footer {
    display: none;
  }

  section {
    background: none;
    border: 1px solid #ccc;
    box-shadow: none;
    page-break-inside: avoid;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  section:hover {
    transform: none;
    box-shadow: none;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  h1 {
    -webkit-text-fill-color: #000;
    background: none;
  }
}