:root {
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --accent: #f59e0b;
  --accent-light: #fbbf24;
  --bg-body: #f1f5f9;
  --bg-card: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.72);
  --bg-glass-border: rgba(255, 255, 255, 0.45);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.18);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-xl: 32px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #818cf8;
    --primary-light: #a5b4fc;
    --primary-dark: #6366f1;
    --accent: #fbbf24;
    --accent-light: #fcd34d;
    --bg-body: #0b1120;
    --bg-card: #1e293b;
    --bg-glass: rgba(30, 41, 59, 0.78);
    --bg-glass-border: rgba(99, 102, 241, 0.18);
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border-color: #334155;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(129, 140, 248, 0.12);
  }
}

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

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

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

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse 80% 60% at 10% 5%, rgba(99, 102, 241, 0.10) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 95%, rgba(245, 158, 11, 0.07) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(129, 140, 248, 0.05) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

@media (prefers-color-scheme: dark) {
  body::before {
    background:
      radial-gradient(ellipse 80% 60% at 10% 5%, rgba(129, 140, 248, 0.08) 0%, transparent 60%),
      radial-gradient(ellipse 60% 50% at 90% 95%, rgba(251, 191, 36, 0.05) 0%, transparent 60%),
      radial-gradient(ellipse 50% 40% at 50% 50%, rgba(99, 102, 241, 0.04) 0%, transparent 70%);
  }
}

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

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* ========== HEADER ========== */
header {
  position: relative;
  z-index: 10;
  padding: 80px 24px 60px;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 30%, #a855f7 60%, #ec4899 100%);
  color: #fff;
  text-align: center;
  overflow: hidden;
  isolation: isolate;
}

header::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.08) 0%, transparent 50%);
  z-index: -1;
}

header::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 80px;
  background: var(--bg-body);
  clip-path: ellipse(75% 100% at 50% 100%);
  z-index: 1;
  transition: background-color 0.4s ease;
}

header h1 {
  position: relative;
  z-index: 2;
  font-size: clamp(1.5rem, 4vw, 2.6rem);
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.02em;
  max-width: 900px;
  margin: 0 auto 20px;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.15);
  animation: fadeInUp 0.8s ease-out both;
}

header > p {
  position: relative;
  z-index: 2;
  font-size: clamp(0.9rem, 1.8vw, 1.05rem);
  line-height: 1.85;
  max-width: 820px;
  margin: 0 auto 36px;
  opacity: 0.92;
  font-weight: 400;
  animation: fadeInUp 0.8s ease-out 0.15s both;
}

/* ========== NAV ========== */
nav {
  position: relative;
  z-index: 3;
  animation: fadeInUp 0.8s ease-out 0.3s both;
}

nav ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  list-style: none;
  max-width: 960px;
  margin: 0 auto;
}

nav ul li a {
  display: inline-block;
  padding: 10px 20px;
  font-size: 0.88rem;
  font-weight: 500;
  color: #fff;
  text-decoration: none;
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  transition: all var(--transition);
  white-space: nowrap;
}

nav ul li a:hover,
nav ul li a:focus-visible {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  outline: none;
}

/* ========== MAIN ========== */
main {
  position: relative;
  z-index: 2;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

main > section {
  margin-bottom: 48px;
  padding: 36px 32px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition), background-color 0.4s ease, border-color 0.4s ease;
  animation: fadeInUp 0.6s ease-out both;
  animation-timeline: view();
  animation-range: entry 0% entry 40%;
}

main > section:hover {
  box-shadow: var(--shadow-md);
}

main > section:nth-child(1) { animation-delay: 0s; }
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; }
main > section:nth-child(8) { animation-delay: 0.35s; }
main > section:nth-child(9) { animation-delay: 0.4s; }
main > section:nth-child(10) { animation-delay: 0.45s; }
main > section:nth-child(11) { animation-delay: 0.5s; }

/* ========== TYPOGRAPHY ========== */
main h2 {
  font-size: clamp(1.25rem, 2.8vw, 1.65rem);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 24px;
  padding-bottom: 14px;
  position: relative;
  letter-spacing: -0.01em;
  transition: color 0.4s ease;
}

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

main > section:hover h2::after {
  width: 88px;
}

main h3 {
  font-size: clamp(1.02rem, 2.2vw, 1.2rem);
  font-weight: 600;
  color: var(--primary-dark);
  margin: 28px 0 12px;
  letter-spacing: -0.005em;
  transition: color 0.4s ease;
}

@media (prefers-color-scheme: dark) {
  main h3 {
    color: var(--primary-light);
  }
}

main h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 20px 0 8px;
  padding-left: 14px;
  position: relative;
  transition: color 0.4s ease;
}

main h4::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 18px;
  background: linear-gradient(180deg, var(--primary), var(--accent));
  border-radius: 4px;
}

main p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.9;
  margin-bottom: 12px;
  transition: color 0.4s ease;
}

main a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  position: relative;
  transition: color var(--transition);
}

main a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transition: width var(--transition);
}

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

main a:hover::after {
  width: 100%;
}

@media (prefers-color-scheme: dark) {
  main a:hover {
    color: var(--primary-light);
  }
}

/* ========== LISTS ========== */
main ul {
  list-style: none;
  padding: 0;
}

main ul li {
  position: relative;
  padding: 8px 0 8px 26px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.8;
  transition: color 0.4s ease, transform var(--transition);
}

main ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 16px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  transition: transform var(--transition), box-shadow var(--transition);
}

main ul li:hover {
  transform: translateX(4px);
  color: var(--text-primary);
}

main ul li:hover::before {
  transform: scale(1.4);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.5);
}

/* ========== ARTICLES ========== */
main article {
  padding: 24px;
  margin-bottom: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

main article::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 0;
  background: linear-gradient(180deg, var(--primary), var(--accent));
  border-radius: 0 4px 4px 0;
  transition: height var(--transition);
}

main article:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

main article:hover::before {
  height: 100%;
}

main article h3 {
  margin-top: 0;
  font-size: 1.05rem;
}

main article p {
  font-size: 0.9rem;
  margin-bottom: 10px;
}

main article p a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary);
  padding: 6px 16px;
  border-radius: 50px;
  background: rgba(99, 102, 241, 0.08);
  transition: all var(--transition);
}

main article p a::after {
  display: none;
}

main article p a:hover {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
  transform: translateX(3px);
}

@media (prefers-color-scheme: dark) {
  main article p a {
    background: rgba(129, 140, 248, 0.12);
  }
  main article p a:hover {
    background: var(--primary);
    color: #0b1120;
  }
}

/* ========== FAQ ========== */
#faq h3 {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin: 16px 0 0;
  cursor: default;
  transition: all var(--transition);
  position: relative;
}

#faq h3::before {
  content: "Q";
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  margin-top: 2px;
}

#faq h3:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
  transform: translateX(4px);
}

#faq p {
  padding: 14px 20px 14px 56px;
  margin-bottom: 8px;
  font-size: 0.92rem;
  border-left: 3px solid var(--border-color);
  margin-left: 12px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: all var(--transition);
}

#faq p:hover {
  border-left-color: var(--accent);
  background: rgba(245, 158, 11, 0.04);
}

@media (prefers-color-scheme: dark) {
  #faq p:hover {
    background: rgba(251, 191, 36, 0.06);
  }
}

/* ========== HOWTO ========== */
#howto h4 {
  padding: 14px 18px 14px 44px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin: 12px 0 0;
  position: relative;
  transition: all var(--transition);
}

#howto h4::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

#howto h4:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
  transform: translateX(4px);
}

#howto p {
  padding: 10px 18px 10px 44px;
  font-size: 0.9rem;
  margin-bottom: 4px;
  border-left: 2px solid transparent;
  margin-left: 12px;
  transition: all var(--transition);
}

#howto p:hover {
  border-left-color: var(--primary-light);
}

/* ========== CONTACT ========== */
#contact p {
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 0.92rem;
  transition: all var(--transition);
}

#contact p:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
  transform: translateX(4px);
}

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

#sitemap ul li,
#links ul li {
  padding: 0;
}

#sitemap ul li::before,
#links ul li::before {
  display: none;
}

#sitemap ul li a,
#links ul li a {
  display: block;
  padding: 12px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

#sitemap ul li a::after,
#links ul li a::after {
  display: none;
}

#sitemap ul li a::before,
#links ul li a::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  opacity: 0;
  transition: opacity var(--transition);
  z-index: -1;
}

#sitemap ul li a:hover,
#links ul li a:hover {
  color: #fff;
  border-color: transparent;
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

#sitemap ul li a:hover::before,
#links ul li a:hover::before {
  opacity: 1;
}

/* ========== LEGAL ========== */
#legal h3 {
  font-size: 1rem;
  color: var(--text-primary);
  margin-top: 24px;
}

#legal p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.9;
}

/* ========== FOOTER ========== */
footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 48px 24px 32px;
  margin-top: 20px;
  background: linear-gradient(180deg, transparent 0%, rgba(99, 102, 241, 0.05) 100%);
  border-top: 1px solid var(--border-color);
  transition: border-color 0.4s ease, background 0.4s ease;
}

@media (prefers-color-scheme: dark) {
  footer {
    background: linear-gradient(180deg, transparent 0%, rgba(129, 140, 248, 0.04) 100%);
  }
}

footer p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  line-height: 1.7;
  transition: color 0.4s ease;
}

footer p:first-child {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

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

/* ========== ANIMATIONS ========== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.3); }
  50% { box-shadow: 0 0 0 12px rgba(99, 102, 241, 0); }
}

/* Fallback for browsers without animation-timeline */
@supports not (animation-timeline: view()) {
  main > section {
    animation: fadeInUp 0.6s ease-out both;
  }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
  header {
    padding: 60px 20px 48px;
  }

  header::after {
    height: 60px;
  }

  main > section {
    padding: 28px 24px;
    margin-bottom: 32px;
  }

  main article {
    padding: 20px;
  }
}

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

  header {
    padding: 48px 16px 40px;
  }

  header::after {
    height: 44px;
  }

  header h1 {
    font-size: 1.35rem;
    margin-bottom: 14px;
  }

  header > p {
    font-size: 0.88rem;
    margin-bottom: 24px;
    line-height: 1.8;
  }

  nav ul {
    gap: 6px;
  }

  nav ul li a {
    padding: 8px 14px;
    font-size: 0.8rem;
  }

  main {
    padding: 0 12px 32px;
  }

  main > section {
    padding: 22px 16px;
    margin-bottom: 24px;
    border-radius: var(--radius-md);
  }

  main h2 {
    font-size: 1.15rem;
    margin-bottom: 18px;
    padding-bottom: 12px;
  }

  main h3 {
    font-size: 1rem;
    margin-top: 22px;
  }

  main h4 {
    font-size: 0.92rem;
  }

  main p {
    font-size: 0.88rem;
    line-height: 1.82;
  }

  main article {
    padding: 16px;
    border-radius: var(--radius-sm);
  }

  main article h3 {
    font-size: 0.95rem;
  }

  #faq h3 {
    padding: 14px 14px;
    font-size: 0.92rem;
  }

  #faq h3::before {
    width: 22px;
    height: 22px;
    font-size: 0.68rem;
  }

  #faq p {
    padding: 12px 14px 12px 46px;
    font-size: 0.85rem;
    margin-left: 8px;
  }

  #howto h4 {
    padding: 12px 14px 12px 38px;
    font-size: 0.9rem;
  }

  #howto h4::before {
    left: 14px;
    width: 7px;
    height: 7px;
  }

  #howto p {
    padding: 8px 14px 8px 38px;
    font-size: 0.85rem;
    margin-left: 8px;
  }

  #contact p {
    padding: 10px 12px;
    font-size: 0.86rem;
  }

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

  #sitemap ul li a,
  #links ul li a {
    padding: 10px 12px;
    font-size: 0.82rem;
  }

  footer {
    padding: 36px 16px 24px;
  }

  footer p {
    font-size: 0.78rem;
  }

  footer p:first-child {
    font-size: 0.84rem;
  }
}

@media (max-width: 380px) {
  header h1 {
    font-size: 1.15rem;
  }

  nav ul li a {
    padding: 6px 10px;
    font-size: 0.75rem;
  }

  main > section {
    padding: 18px 12px;
  }

  #sitemap ul,
  #links ul {
    grid-template-columns: 1fr;
  }
}

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

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

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

/* ========== PRINT ========== */
@media print {
  body::before,
  header::before,
  header::after {
    display: none;
  }

  header {
    background: none;
    color: var(--text-primary);
    padding: 20px 0;
  }

  nav {
    display: none;
  }

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

  main a::after {
    display: none;
  }

  footer {
    border-top: 1px solid #ccc;
  }
}