:root {
  --primary: #c2185b;
  --primary-light: #e91e63;
  --primary-dark: #880e4f;
  --accent: #ff6f00;
  --accent-light: #ffa726;
  --secondary: #7b1fa2;
  --secondary-light: #ab47bc;
  --bg: #fdf2f8;
  --bg-alt: #fff5f9;
  --surface: #ffffff;
  --surface-glass: rgba(255, 255, 255, 0.72);
  --surface-glass-border: rgba(255, 255, 255, 0.45);
  --text: #2d1b2e;
  --text-secondary: #6b4c6e;
  --text-muted: #9e7da3;
  --border: #f0d6e4;
  --shadow-sm: 0 2px 8px rgba(194, 24, 91, 0.08);
  --shadow-md: 0 8px 24px rgba(194, 24, 91, 0.12);
  --shadow-lg: 0 16px 48px rgba(194, 24, 91, 0.16);
  --shadow-glow: 0 0 32px rgba(233, 30, 99, 0.25);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-full: 9999px;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --max-width: 1200px;
  --nav-height: 64px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #f06292;
    --primary-light: #ff80ab;
    --primary-dark: #c2185b;
    --accent: #ffb74d;
    --accent-light: #ffcc80;
    --secondary: #ce93d8;
    --secondary-light: #e1bee7;
    --bg: #1a0e1a;
    --bg-alt: #231425;
    --surface: #2a1a2e;
    --surface-glass: rgba(42, 26, 46, 0.78);
    --surface-glass-border: rgba(240, 98, 146, 0.15);
    --text: #f5e6f0;
    --text-secondary: #d4b8d0;
    --text-muted: #a888a4;
    --border: #3d2640;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 32px rgba(240, 98, 146, 0.2);
  }
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 16px);
  -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);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse at 0% 0%, rgba(233, 30, 99, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 100% 0%, rgba(123, 31, 162, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 100%, rgba(255, 111, 0, 0.04) 0%, transparent 50%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@media (prefers-color-scheme: dark) {
  body {
    background-image:
      radial-gradient(ellipse at 0% 0%, rgba(240, 98, 146, 0.08) 0%, transparent 50%),
      radial-gradient(ellipse at 100% 0%, rgba(206, 147, 216, 0.06) 0%, transparent 50%),
      radial-gradient(ellipse at 50% 100%, rgba(255, 183, 77, 0.04) 0%, transparent 50%);
  }
}

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

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

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

::-webkit-scrollbar-thumb {
  background: var(--primary-light);
  border-radius: var(--radius-full);
}

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

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

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

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

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

ul,
ol {
  list-style: none;
}

header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--surface-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--surface-glass-border);
  transition: background var(--transition-base), box-shadow var(--transition-base);
}

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

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

nav > a:first-child {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: opacity var(--transition-fast);
}

nav > a:first-child:hover {
  opacity: 0.8;
  -webkit-text-fill-color: transparent;
}

nav ul {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 4px 0;
  flex-wrap: nowrap;
}

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

nav ul li {
  flex-shrink: 0;
}

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

nav ul li a::after {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 60%;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: var(--radius-full);
  transition: transform var(--transition-base);
}

nav ul li a:hover {
  color: var(--primary);
  background: rgba(194, 24, 91, 0.06);
}

nav ul li a:hover::after {
  transform: translateX(-50%) scaleX(1);
}

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px 60px;
}

h1 {
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin: 0 -20px 32px;
  padding: 48px 20px 40px;
  text-align: center;
  color: #fff;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 30%, var(--secondary) 65%, var(--accent) 100%);
  background-size: 200% 200%;
  animation: gradientShift 8s ease infinite;
  position: relative;
  overflow: hidden;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

h1::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.1) 0%, transparent 40%);
  pointer-events: none;
}

h1::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(to top, var(--bg), transparent);
  pointer-events: none;
}

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

h2 {
  font-size: clamp(1.35rem, 3.5vw, 1.85rem);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  padding-bottom: 12px;
  position: relative;
  letter-spacing: -0.01em;
}

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

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

h3 {
  font-size: clamp(1.05rem, 2.5vw, 1.25rem);
  font-weight: 600;
  color: var(--primary-dark);
  margin: 24px 0 12px;
  letter-spacing: -0.01em;
}

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

section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  margin-bottom: 28px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base), transform var(--transition-base), border-color var(--transition-base);
  position: relative;
  overflow: hidden;
}

section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
  opacity: 0;
  transition: opacity var(--transition-base);
}

section:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: rgba(194, 24, 91, 0.2);
}

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

section > p {
  color: var(--text-secondary);
  margin-bottom: 14px;
  font-size: 0.95rem;
}

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

section ul,
section ol {
  padding-left: 0;
  margin: 12px 0;
}

section ul li {
  position: relative;
  padding: 8px 0 8px 28px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  transition: color var(--transition-fast), transform var(--transition-fast);
}

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

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

section ul li:hover::before {
  transform: scale(1.3);
  box-shadow: 0 0 8px rgba(194, 24, 91, 0.4);
}

section ol {
  counter-reset: ol-counter;
}

section ol li {
  position: relative;
  padding: 10px 0 10px 40px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  counter-increment: ol-counter;
  transition: color var(--transition-fast), transform var(--transition-fast);
}

section ol li::before {
  content: counter(ol-counter);
  position: absolute;
  left: 0;
  top: 10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

section ol li:hover {
  color: var(--primary);
  transform: translateX(4px);
}

section ol li:hover::before {
  transform: scale(1.15);
  box-shadow: 0 0 10px rgba(194, 24, 91, 0.4);
}

article {
  background: var(--bg-alt);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

article::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(to bottom, var(--primary), var(--accent));
  opacity: 0;
  transition: opacity var(--transition-base);
}

article:hover {
  background: var(--surface);
  box-shadow: var(--shadow-md);
  transform: translateX(4px);
  border-color: rgba(194, 24, 91, 0.2);
}

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

article h3 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 1.05rem;
  transition: color var(--transition-fast);
}

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

article > p:first-of-type {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

article > p:first-of-type::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

article > p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 10px;
}

article > p:last-child {
  margin-bottom: 0;
}

article a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: rgba(194, 24, 91, 0.08);
  transition: all var(--transition-fast);
}

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

article a:hover {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

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

blockquote {
  background: linear-gradient(135deg, rgba(194, 24, 91, 0.04), rgba(123, 31, 162, 0.04));
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 18px 22px;
  margin: 16px 0;
  position: relative;
  transition: all var(--transition-base);
}

blockquote::before {
  content: "\201C";
  position: absolute;
  top: 6px;
  left: 12px;
  font-size: 3rem;
  line-height: 1;
  color: var(--primary);
  opacity: 0.15;
  font-family: Georgia, serif;
}

blockquote:hover {
  background: linear-gradient(135deg, rgba(194, 24, 91, 0.07), rgba(123, 31, 162, 0.07));
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

blockquote p {
  color: var(--text-secondary);
  font-style: italic;
  font-size: 0.95rem;
  margin: 0;
  position: relative;
  z-index: 1;
}

footer {
  background: var(--surface-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--surface-glass-border);
  padding: 32px 20px;
  text-align: center;
  margin-top: 20px;
}

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

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

footer a {
  color: var(--text-secondary);
  font-size: 0.85rem;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all var(--transition-fast);
}

footer a:hover {
  color: var(--primary);
  background: rgba(194, 24, 91, 0.06);
}

section[id] {
  animation: fadeInUp 0.6s ease both;
  animation-timeline: view();
  animation-range: entry 0% entry 30%;
}

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

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

@media (max-width: 900px) {
  nav {
    padding: 0 14px;
  }

  nav ul {
    gap: 2px;
  }

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

  main {
    padding: 0 14px 48px;
  }

  h1 {
    margin: 0 -14px 24px;
    padding: 36px 14px 32px;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  }

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

  article {
    padding: 16px 18px;
  }

  blockquote {
    padding: 14px 18px;
  }
}

@media (max-width: 600px) {
  :root {
    --nav-height: 56px;
  }

  body {
    font-size: 15px;
  }

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

  h1 {
    font-size: 1.45rem;
    padding: 28px 12px 26px;
  }

  h2 {
    font-size: 1.2rem;
    margin-bottom: 16px;
  }

  h3 {
    font-size: 1rem;
    margin: 18px 0 10px;
  }

  section {
    padding: 20px 16px;
    border-radius: var(--radius-md);
  }

  section ul li {
    padding: 6px 0 6px 24px;
    font-size: 0.9rem;
  }

  section ul li::before {
    left: 4px;
    top: 14px;
    width: 7px;
    height: 7px;
  }

  section ol li {
    padding: 8px 0 8px 34px;
    font-size: 0.9rem;
  }

  section ol li::before {
    width: 22px;
    height: 22px;
    font-size: 0.7rem;
  }

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

  article h3 {
    font-size: 0.95rem;
  }

  blockquote {
    padding: 12px 16px;
    border-left-width: 3px;
  }

  blockquote::before {
    font-size: 2.2rem;
    top: 4px;
    left: 8px;
  }

  blockquote p {
    font-size: 0.88rem;
  }

  footer {
    padding: 24px 14px;
  }
}

@media (max-width: 380px) {
  nav ul li a {
    padding: 4px 8px;
    font-size: 0.75rem;
  }

  h1 {
    font-size: 1.25rem;
  }

  section {
    padding: 16px 12px;
  }
}

@supports (backdrop-filter: blur(1px)) {
  header,
  footer {
    background: var(--surface-glass);
  }
}

@supports not (backdrop-filter: blur(1px)) {
  header,
  footer {
    background: var(--surface);
  }
}

@media print {
  header,
  footer,
  nav {
    display: none;
  }

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

  section {
    box-shadow: none;
    border: 1px solid #ddd;
    break-inside: avoid;
  }

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