:root {
  --color-dark: #271334;
  --color-paper: #E9E8EA;
  --color-text: #1D1523;
  --color-brand: #8A13DD;
  --color-accent: #9EED6E;
  
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);
  
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1120px;
  
  --font-sans: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

html {
  scroll-behavior: smooth;
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: inherit;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background-color: var(--color-paper);
  color: var(--color-text);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  padding-left: 0;
  list-style: none;
}

/* Container & Layout */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.section {
  padding: var(--section-y) 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}

.flex-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  align-items: center;
}

.flex-row > * {
  flex: 1 1 400px;
  min-width: 0;
}

/* Typography */
h1 {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  text-wrap: balance;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: var(--gap);
  text-wrap: balance;
}

h3 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

p {
  margin-bottom: 1rem;
  max-width: 38em;
}

/* Badges & Highlights */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  color: var(--color-brand);
  text-transform: uppercase;
}

.hl {
  color: var(--color-brand);
}

/* Theme Overrides for Dark Sections */
.section-dark {
  background-color: var(--color-dark);
  color: var(--color-paper);
}

.section-dark .badge {
  color: var(--color-accent);
}

.section-dark .hl {
  color: var(--color-accent);
}

.section-dark h1, 
.section-dark h2, 
.section-dark h3, 
.section-dark p, 
.section-dark li,
.section-dark td,
.section-dark th {
  color: var(--color-paper);
}

.section-dark a:not(.btn) {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* Light Card inside Dark Section */
.card-light-in-dark {
  background-color: var(--color-paper);
  color: var(--color-text);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
}

.card-light-in-dark .badge {
  color: var(--color-brand);
}

.card-light-in-dark .hl {
  color: var(--color-brand);
}

.card-light-in-dark a {
  color: var(--color-brand);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 1.5rem;
  height: 52px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  transition: transform 0.2s ease, filter 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}

.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.btn-secondary {
  background-color: transparent;
  color: var(--color-text);
  border: 2px solid var(--color-text);
}

.section-dark .btn-secondary {
  color: var(--color-paper);
  border-color: var(--color-paper);
}

.btn svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  fill: none;
  stroke: currentColor;
}

:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

/* Cards */
.card {
  background-color: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: var(--gap);
  transition: transform 0.2s ease;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-4px);
}

.card-content {
  flex-grow: 1;
}

.card-meta {
  margin-top: auto;
  padding-top: 1rem;
  font-size: 0.85rem;
  color: var(--color-text);
  opacity: 0.8;
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-text);
}

th {
  font-weight: 700;
  vertical-align: top;
}

.section-dark th, 
.section-dark td {
  border-bottom-color: var(--color-paper);
}

/* FAQ */
details {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: 0.75rem;
  overflow: hidden;
  transition: background-color 0.2s ease;
}

summary {
  padding: 1rem var(--gap);
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-left: 2rem;
  user-select: none;
}

summary::-webkit-details-marker {
  display: none;
}

summary::before {
  content: '';
  position: absolute;
  left: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  background-color: var(--color-brand);
  border-radius: 50%;
}

.section-dark summary::before {
  background-color: var(--color-accent);
}

details[open] summary::after {
  content: '−';
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  line-height: 1;
}

details > div {
  padding: 0 var(--gap) 1rem;
}

/* Steps */
.step-list {
  counter-reset: step-counter;
}

.step-list li {
  position: relative;
  padding-left: 3.5rem;
  margin-bottom: 1.5rem;
}

.step-list li::before {
  counter-increment: step-counter;
  content: "0" counter(step-counter);
  position: absolute;
  left: 0;
  top: 0;
  width: 2.5rem;
  height: 2.5rem;
  background-color: var(--color-accent);
  color: var(--color-dark);
  font-weight: 800;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

/* Header & Nav */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(233, 232, 234, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-text);
}

.section-dark header {
  background-color: rgba(39, 19, 52, 0.95);
  border-bottom-color: var(--color-paper);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
}

.logo img {
  height: 32px;
  width: auto;
}

nav ul {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

nav a {
  font-weight: 600;
  padding: 0.5rem 0;
  position: relative;
  transition: color 0.2s ease;
}

nav a:hover, 
nav a[aria-current="page"] {
  color: var(--color-brand);
}

.section-dark nav a {
  color: var(--color-paper);
}

.section-dark nav a:hover, 
.section-dark nav a[aria-current="page"] {
  color: var(--color-accent);
}

/* Footer */
footer {
  padding: var(--section-y) 0;
  background-color: var(--color-dark);
  color: var(--color-paper);
  text-align: center;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--color-paper);
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.footer-links a:hover {
  opacity: 1;
  color: var(--color-accent);
}

.footer-copy {
  font-size: 0.85rem;
  opacity: 0.6;
}

/* SVG Visuals */
.svg-visual {
  width: 100%;
  height: auto;
  max-width: 600px;
  margin: 0 auto;
}

/* Animations */
.anim-float { animation: float 6s ease-in-out infinite; }
.anim-breathe { animation: breathe 8s ease-in-out infinite; }
.anim-draw { animation: draw 4s ease-in-out infinite alternate; }
.anim-slide-in { animation: slideIn 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes breathe {
  0%, 100% { opacity: 0.4; transform: scale(0.96); }
  50% { opacity: 0.9; transform: scale(1.04); }
}

@keyframes draw {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* 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;
  }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .nav-container ul { display: none; }
  .flex-row > * { flex: 1 1 100%; }
  .step-list li { padding-left: 3rem; }
  .step-list li::before { width: 2rem; height: 2rem; font-size: 0.8rem; }
}
