:root {
  --primary: #6C5CE7;
  --primary-light: #a29bfe;
  --primary-dark: #4834d4;
  --secondary: #fd79a8;
  --accent: #00cec9;
  --gradient-1: linear-gradient(135deg, #6C5CE7 0%, #a29bfe 50%, #fd79a8 100%);
  --gradient-2: linear-gradient(135deg, #00cec9 0%, #6C5CE7 100%);
  --gradient-3: linear-gradient(135deg, #fd79a8 0%, #6C5CE7 50%, #00cec9 100%);
  --bg: #f8f9fe;
  --bg-card: rgba(255, 255, 255, 0.75);
  --bg-glass: rgba(255, 255, 255, 0.55);
  --text: #2d3436;
  --text-secondary: #636e72;
  --text-light: #b2bec3;
  --border: rgba(108, 92, 231, 0.12);
  --shadow-sm: 0 2px 8px rgba(108, 92, 231, 0.08);
  --shadow-md: 0 8px 32px rgba(108, 92, 231, 0.12);
  --shadow-lg: 0 16px 48px rgba(108, 92, 231, 0.18);
  --shadow-glow: 0 0 32px rgba(108, 92, 231, 0.25);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #0f0e17;
  --bg-card: rgba(30, 28, 50, 0.75);
  --bg-glass: rgba(30, 28, 50, 0.55);
  --text: #e8e6f0;
  --text-secondary: #a8a4c0;
  --text-light: #6b6785;
  --border: rgba(162, 155, 254, 0.15);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 32px rgba(108, 92, 231, 0.4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0e17;
    --bg-card: rgba(30, 28, 50, 0.75);
    --bg-glass: rgba(30, 28, 50, 0.55);
    --text: #e8e6f0;
    --text-secondary: #a8a4c0;
    --text-light: #6b6785;
    --border: rgba(162, 155, 254, 0.15);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 32px rgba(108, 92, 231, 0.4);
  }
}

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

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

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

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(108, 92, 231, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 20%, rgba(253, 121, 168, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse 50% 60% at 50% 100%, rgba(0, 206, 201, 0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

[data-theme="dark"] body::before {
  background:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(108, 92, 231, 0.15) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 20%, rgba(253, 121, 168, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse 50% 60% at 50% 100%, rgba(0, 206, 201, 0.08) 0%, transparent 50%);
}

::selection {
  background: rgba(108, 92, 231, 0.25);
  color: var(--text);
}

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

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

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary-light), var(--primary));
  border-radius: 4px;
}

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

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

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

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

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

ul, ol {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

/* ===== HEADER ===== */
header[role="banner"] {
  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(--border);
  transition: background var(--transition), box-shadow var(--transition);
}

header[role="banner"]:hover {
  box-shadow: var(--shadow-sm);
}

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

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

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

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

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

header nav ul {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

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

header nav ul li a:hover {
  color: var(--primary);
  background: rgba(108, 92, 231, 0.08);
  transform: translateY(-1px);
}

header nav ul li a:active {
  transform: translateY(0) scale(0.97);
}

/* ===== MAIN ===== */
main {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

section {
  margin-top: 48px;
  scroll-margin-top: 80px;
}

section:first-of-type {
  margin-top: 32px;
}

/* ===== HERO ===== */
#hero {
  position: relative;
  padding: 80px 48px;
  border-radius: var(--radius-xl);
  background: var(--gradient-1);
  background-size: 200% 200%;
  animation: heroGradient 8s ease infinite;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  color: #fff;
  text-align: center;
}

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

#hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 40%, rgba(255,255,255,0.15) 0%, transparent 50%),
              radial-gradient(circle at 70% 60%, rgba(255,255,255,0.1) 0%, transparent 40%);
  animation: heroShine 6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes heroShine {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(-5%, -5%) rotate(3deg); }
}

#hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60%;
  background: linear-gradient(to top, rgba(0,0,0,0.1), transparent);
  pointer-events: none;
}

#hero h1 {
  position: relative;
  z-index: 2;
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 800;
  color: #fff;
  margin-bottom: 24px;
  line-height: 1.25;
  text-shadow: 0 2px 20px rgba(0,0,0,0.15);
  letter-spacing: -0.02em;
}

#hero p {
  position: relative;
  z-index: 2;
  max-width: 800px;
  margin: 0 auto;
  font-size: clamp(0.95rem, 1.5vw, 1.1rem);
  line-height: 1.9;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 8px rgba(0,0,0,0.1);
}

/* ===== SECTION HEADINGS ===== */
section > h2 {
  font-size: clamp(1.4rem, 2.5vw, 1.85rem);
  font-weight: 800;
  margin-bottom: 32px;
  padding-bottom: 16px;
  position: relative;
  display: inline-block;
  letter-spacing: -0.02em;
}

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

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

section > h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 28px;
  margin-bottom: 12px;
  color: var(--text);
  position: relative;
  padding-left: 18px;
}

section > h3::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 18px;
  background: var(--gradient-2);
  border-radius: 2px;
}

section > h4 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 20px;
  margin-bottom: 8px;
  color: var(--primary);
}

section p {
  color: var(--text-secondary);
  margin-bottom: 12px;
  font-size: 0.95rem;
  line-height: 1.9;
}

/* ===== CARDS ===== */
section > h3 ~ p,
section article,
section > p {
  background: var(--bg-card);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

section > h3 ~ p:hover,
section article:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(108, 92, 231, 0.2);
}

/* ===== ARTICLES ===== */
article {
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

article::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--gradient-1);
  border-radius: 4px 0 0 4px;
  opacity: 0;
  transition: opacity var(--transition);
}

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

article h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
  transition: color var(--transition);
}

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

article time {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 8px;
  padding: 2px 10px;
  background: rgba(108, 92, 231, 0.08);
  border-radius: 20px;
  font-weight: 500;
}

article p {
  margin-bottom: 10px;
}

article a[href^="#"] {
  display: inline-block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
  padding: 4px 0;
  position: relative;
  transition: color var(--transition), transform var(--transition);
}

article a[href^="#"]::after {
  content: ' →';
  transition: transform var(--transition);
  display: inline-block;
}

article a[href^="#"]:hover {
  color: var(--primary-dark);
  transform: translateX(4px);
}

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

#faq h3 + p {
  border-left: 3px solid transparent;
  transition: border-color var(--transition);
}

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

/* ===== HOWTO ===== */
#howto h4 {
  display: flex;
  align-items: center;
  gap: 10px;
}

#howto h4::before {
  content: '';
  display: inline-block;
  width: 24px;
  height: 24px;
  background: var(--gradient-2);
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}

#howto h4 {
  counter-increment: step-counter;
  position: relative;
}

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

#howto h4::before {
  content: counter(step-counter);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--gradient-2);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ===== CONTACT ===== */
#contact p {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

#contact p:has(> :first-child) {
  padding: 8px 16px;
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  transition: transform var(--transition), box-shadow var(--transition);
}

#contact p:has(> :first-child):hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

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

#sitemap ul li a,
#links ul li a {
  display: inline-block;
  padding: 8px 18px;
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
  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);
  border-radius: 50px;
  z-index: -1;
}

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

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

/* ===== LEGAL ===== */
#legal h2 {
  font-size: 1.15rem;
  margin-top: 24px;
  margin-bottom: 12px;
  padding-bottom: 8px;
}

#legal h2::after {
  width: 32px;
  height: 3px;
}

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

/* ===== FOOTER ===== */
footer[role="contentinfo"] {
  position: relative;
  z-index: 1;
  margin-top: 64px;
  padding: 48px 24px;
  background: var(--bg-card);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border-top: 1px solid var(--border);
  text-align: center;
}

footer[role="contentinfo"] p {
  font-size: 0.8rem;
  color: var(--text-light);
  line-height: 2;
  margin-bottom: 4px;
}

footer[role="contentinfo"] p:first-child {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 12px;
}

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

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

section {
  animation: fadeInUp 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; }

article {
  animation: fadeInUp 0.5s ease-out both;
}

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

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  header nav {
    padding: 0 16px;
    height: 64px;
  }

  header nav ul {
    gap: 2px;
  }

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

  main {
    padding: 0 16px 64px;
  }

  #hero {
    padding: 60px 32px;
    border-radius: var(--radius-lg);
  }
}

@media (max-width: 768px) {
  header nav {
    flex-wrap: wrap;
    height: auto;
    padding: 12px 16px;
    gap: 8px;
  }

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

  header nav ul {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    gap: 0;
  }

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

  header nav ul li a {
    padding: 6px 10px;
    font-size: 0.78rem;
    white-space: nowrap;
  }

  main {
    padding: 0 12px 48px;
  }

  section {
    margin-top: 32px;
  }

  #hero {
    padding: 48px 20px;
    border-radius: var(--radius-md);
  }

  #hero h1 {
    font-size: 1.5rem;
  }

  #hero p {
    font-size: 0.9rem;
  }

  section > h2 {
    font-size: 1.3rem;
    margin-bottom: 24px;
  }

  section > h3 {
    font-size: 1.05rem;
    margin-top: 20px;
  }

  section > h3 ~ p,
  section article,
  section > p {
    padding: 16px;
    border-radius: var(--radius-sm);
  }

  #sitemap ul li a,
  #links ul li a {
    padding: 6px 14px;
    font-size: 0.8rem;
  }

  footer[role="contentinfo"] {
    padding: 32px 16px;
    margin-top: 48px;
  }
}

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

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

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

  #hero {
    padding: 36px 16px;
  }

  #hero h1 {
    font-size: 1.25rem;
    margin-bottom: 16px;
  }

  #hero p {
    font-size: 0.85rem;
    line-height: 1.8;
  }

  section > h2 {
    font-size: 1.15rem;
  }

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

  section > h3::before {
    width: 3px;
    height: 14px;
  }

  section > h3 ~ p,
  section article,
  section > p {
    padding: 14px;
    font-size: 0.88rem;
  }

  article h3 {
    font-size: 0.95rem;
  }

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

  #howto h4::before {
    width: 22px;
    height: 22px;
    font-size: 0.7rem;
  }
}

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

  #hero {
    animation: none;
  }

  #hero::before {
    animation: none;
  }
}

/* ===== PRINT ===== */
@media print {
  header[role="banner"],
  footer[role="contentinfo"] {
    display: none;
  }

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

  #hero {
    background: #f0f0f0;
    color: #000;
    box-shadow: none;
  }

  #hero h1,
  #hero p {
    color: #000;
    text-shadow: none;
  }

  section > h3 ~ p,
  section article,
  section > p {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* ===== HIGH CONTRAST ===== */
@media (prefers-contrast: high) {
  :root {
    --border: rgba(108, 92, 231, 0.4);
    --text-secondary: #444;
  }

  [data-theme="dark"] {
    --border: rgba(162, 155, 254, 0.5);
    --text-secondary: #ccc;
  }
}

/* ===== FOCUS VISIBLE ===== */
:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
  border-radius: 4px;
}

a:focus:not(:focus-visible) {
  outline: none;
}

/* ===== TOUCH DEVICE OPTIMIZATIONS ===== */
@media (hover: none) {
  section > h3 ~ p:hover,
  section article:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
  }

  #sitemap ul li a:hover,
  #links ul li a:hover {
    transform: none;
  }

  article a[href^="#"]:hover {
    transform: none;
  }
}

/* ===== LANDSCAPE MOBILE ===== */
@media (max-height: 500px) and (orientation: landscape) {
  #hero {
    padding: 32px 24px;
  }

  #hero h1 {
    font-size: 1.25rem;
  }

  header nav {
    height: 56px;
  }
}

/* ===== WIDE SCREENS ===== */
@media (min-width: 1440px) {
  main {
    max-width: 1360px;
  }

  header nav {
    max-width: 1360px;
  }
}