:root {
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --accent: #ec4899;
  --accent-light: #f472b6;
  --gradient-1: linear-gradient(135deg, #6366f1 0%, #ec4899 50%, #f59e0b 100%);
  --gradient-2: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4c1d95 100%);
  --gradient-3: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.72);
  --bg-glass: rgba(255, 255, 255, 0.55);
  --bg-glass-border: rgba(255, 255, 255, 0.65);
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border-color: rgba(148, 163, 184, 0.22);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(99, 102, 241, 0.1), 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 40px rgba(99, 102, 241, 0.15), 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.25);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.35s 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;
  --max-width: 1200px;
  --header-height: 64px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: rgba(30, 41, 59, 0.72);
    --bg-glass: rgba(30, 41, 59, 0.55);
    --bg-glass-border: rgba(99, 102, 241, 0.25);
    --text-primary: #e2e8f0;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border-color: rgba(99, 102, 241, 0.18);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(99, 102, 241, 0.1);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5), 0 4px 16px rgba(99, 102, 241, 0.15);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.35);
  }
}

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

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

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(236, 72, 153, 0.08), transparent);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  animation: bodyFadeIn 0.6s ease-out;
}

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

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

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast), opacity var(--transition-fast);
  position: relative;
}

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

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

ul {
  list-style: none;
}

/* ============ HEADER ============ */
header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--bg-glass-border);
  transition: background var(--transition-smooth), box-shadow var(--transition-smooth);
  animation: slideDown 0.5s ease-out;
}

@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

header:hover {
  box-shadow: var(--shadow-md);
}

nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

nav > a:first-child {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
  transition: transform var(--transition-bounce), filter var(--transition-fast);
  position: relative;
}

nav > a:first-child::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--gradient-1);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--transition-smooth);
}

nav > a:first-child:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

nav > a:first-child:hover {
  transform: scale(1.04);
  filter: brightness(1.1);
}

nav ul {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

nav ul li a {
  display: block;
  padding: 6px 12px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  position: relative;
  white-space: nowrap;
}

nav ul li a::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-sm);
  background: var(--gradient-1);
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: -1;
}

nav ul li a:hover {
  color: #fff;
  transform: translateY(-1px);
}

nav ul li a:hover::before {
  opacity: 1;
}

/* ============ MAIN ============ */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px 60px;
}

/* ============ HERO / H1 ============ */
main > h1 {
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: -0.03em;
  text-align: center;
  padding: 60px 20px 40px;
  margin: 0 auto 20px;
  max-width: 900px;
  position: relative;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: heroReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes heroReveal {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.97);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

main > h1::after {
  content: '';
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  border-radius: 4px;
  background: var(--gradient-1);
  animation: lineExpand 1s 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes lineExpand {
  from { width: 0; opacity: 0; }
  to { width: 80px; opacity: 1; }
}

main > h1 + p {
  font-size: 1.05rem;
  line-height: 1.9;
  color: var(--text-secondary);
  text-align: center;
  max-width: 800px;
  margin: 0 auto 60px;
  padding: 0 20px;
  animation: heroReveal 0.8s 0.15s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ============ SECTIONS ============ */
section {
  margin-bottom: 56px;
  padding: 40px 32px;
  background: var(--bg-card);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-smooth), transform var(--transition-smooth), border-color var(--transition-smooth);
  position: relative;
  overflow: hidden;
  animation: sectionFadeUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-timeline: view();
  animation-range: entry 0% entry 30%;
}

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

section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-1);
  opacity: 0;
  transition: opacity var(--transition-smooth);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

section:hover {
  box-shadow: var(--shadow-lg);
  border-color: rgba(99, 102, 241, 0.3);
  transform: translateY(-2px);
}

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

/* ============ HEADINGS ============ */
section > h2 {
  font-size: clamp(1.35rem, 3.5vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 24px;
  padding-bottom: 16px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
}

section > h2::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 1.2em;
  background: var(--gradient-1);
  border-radius: 3px;
  flex-shrink: 0;
  animation: barPulse 2s ease-in-out infinite;
}

@keyframes barPulse {
  0%, 100% { transform: scaleY(1); opacity: 1; }
  50% { transform: scaleY(0.7); opacity: 0.7; }
}

section > h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 17px;
  width: 60px;
  height: 2px;
  background: var(--gradient-1);
  border-radius: 2px;
  transition: width var(--transition-smooth);
}

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

section h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 28px 0 10px;
  padding-left: 16px;
  position: relative;
  transition: color var(--transition-fast), padding-left var(--transition-fast);
}

section h3::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gradient-1);
  transition: transform var(--transition-bounce), box-shadow var(--transition-fast);
}

section h3:hover {
  padding-left: 22px;
  color: var(--primary);
}

section h3:hover::before {
  transform: translateY(-50%) scale(1.6);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.5);
}

/* ============ PARAGRAPHS ============ */
section p {
  font-size: 0.95rem;
  line-height: 1.85;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

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

/* ============ ARTICLES ============ */
article {
  padding: 24px 28px;
  margin-bottom: 20px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

article::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--gradient-1);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform var(--transition-smooth);
  border-radius: 0 3px 3px 0;
}

article:hover {
  transform: translateX(6px);
  box-shadow: var(--shadow-md);
  border-color: rgba(99, 102, 241, 0.3);
}

article:hover::before {
  transform: scaleY(1);
  transform-origin: top;
}

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

article p {
  font-size: 0.9rem;
}

article a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--primary);
  margin-top: 8px;
  transition: all var(--transition-fast);
}

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

article a:hover {
  color: var(--accent);
  gap: 8px;
}

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

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

#sitemap ul li a,
#links ul li a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

#sitemap ul li a::before,
#links ul li a::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-1);
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: -1;
}

#sitemap ul li a:hover,
#links ul li a:hover {
  color: #fff;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

/* ============ FAQ ============ */
#faq h3 {
  cursor: default;
}

#faq h3 + p {
  padding-left: 16px;
  border-left: 2px solid var(--border-color);
  margin-left: 2px;
  transition: border-color var(--transition-fast), padding-left var(--transition-fast);
}

#faq h3:hover + p {
  border-left-color: var(--primary);
  padding-left: 20px;
}

/* ============ HOWTO ============ */
#howto h3 {
  counter-increment: howto-step;
}

#howto {
  counter-reset: howto-step;
}

#howto h3::before {
  content: counter(howto-step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gradient-1);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  position: relative;
  left: 0;
  top: 0;
  transform: none;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
  transition: transform var(--transition-bounce), box-shadow var(--transition-fast);
}

#howto h3 {
  padding-left: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

#howto h3:hover {
  padding-left: 0;
}

#howto h3:hover::before {
  transform: scale(1.2) rotate(-8deg);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.5);
}

/* ============ CONTACT ============ */
#contact p {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border-color);
  transition: padding-left var(--transition-fast), border-color var(--transition-fast);
}

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

#contact p:hover {
  padding-left: 8px;
  border-color: var(--primary);
}

/* ============ LEGAL ============ */
#legal h3 {
  margin-top: 20px;
}

/* ============ FOOTER ============ */
footer {
  background: var(--bg-glass);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border-top: 1px solid var(--bg-glass-border);
  padding: 40px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-1);
}

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

footer p:hover {
  color: var(--text-secondary);
}

footer p:first-child {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

footer a {
  color: var(--text-muted);
  font-weight: 500;
  transition: color var(--transition-fast);
}

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

footer p:last-child {
  margin-bottom: 0;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

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

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

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

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--primary-dark), var(--accent-light));
}

/* ============ SELECTION ============ */
::selection {
  background: rgba(99, 102, 241, 0.25);
  color: var(--text-primary);
}

::-moz-selection {
  background: rgba(99, 102, 241, 0.25);
  color: var(--text-primary);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
  :root {
    --max-width: 100%;
  }

  nav {
    padding: 0 16px;
  }

  nav ul {
    gap: 0;
  }

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

  section {
    padding: 32px 24px;
  }

  main {
    padding: 0 16px 48px;
  }
}

@media (max-width: 768px) {
  :root {
    --header-height: 56px;
  }

  nav {
    flex-direction: column;
    height: auto;
    padding: 12px 16px;
    gap: 10px;
  }

  nav > a:first-child {
    font-size: 1.2rem;
  }

  nav ul {
    width: 100%;
    justify-content: center;
    gap: 4px;
  }

  nav ul li a {
    padding: 5px 10px;
    font-size: 0.78rem;
  }

  main > h1 {
    padding: 40px 16px 30px;
    font-size: clamp(1.4rem, 6vw, 2rem);
  }

  main > h1::after {
    bottom: 12px;
    width: 60px;
  }

  main > h1 + p {
    font-size: 0.95rem;
    margin-bottom: 40px;
    padding: 0 8px;
  }

  section {
    padding: 24px 18px;
    margin-bottom: 36px;
    border-radius: var(--radius-md);
  }

  section > h2 {
    font-size: 1.2rem;
    margin-bottom: 18px;
  }

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

  article {
    padding: 18px 18px;
  }

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

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

  footer {
    padding: 28px 16px;
  }

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

@media (max-width: 480px) {
  main > h1 {
    font-size: 1.3rem;
    padding: 30px 12px 24px;
  }

  main > h1::after {
    bottom: 8px;
    width: 50px;
    height: 3px;
  }

  main > h1 + p {
    font-size: 0.88rem;
    line-height: 1.8;
  }

  section {
    padding: 20px 14px;
    border-radius: var(--radius-sm);
  }

  section > h2 {
    font-size: 1.1rem;
    gap: 8px;
  }

  section > h2::before {
    width: 4px;
  }

  section p {
    font-size: 0.88rem;
  }

  section h3 {
    font-size: 0.95rem;
    padding-left: 12px;
  }

  nav ul li a {
    padding: 4px 7px;
    font-size: 0.72rem;
  }

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

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

  article {
    padding: 14px 14px;
  }

  article h3 {
    font-size: 0.95rem;
  }

  article p {
    font-size: 0.85rem;
  }
}

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

  section {
    animation: none;
    opacity: 1;
    transform: none;
  }

  main > h1,
  main > h1 + p {
    animation: none;
    opacity: 1;
    transform: none;
    filter: none;
  }

  header {
    animation: none;
  }
}

/* ============ PRINT ============ */
@media print {
  header,
  footer,
  nav {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 12pt;
  }

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

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

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }
}

/* ============ HIGH CONTRAST ============ */
@media (prefers-contrast: high) {
  :root {
    --border-color: rgba(0, 0, 0, 0.4);
    --text-secondary: #1e293b;
    --text-muted: #475569;
  }

  section {
    border-width: 2px;
  }

  a {
    text-decoration: underline;
  }
}