:root {
  --color-dark: #141838;
  --color-paper: #F7F5F3;
  --color-text: #151723;
  --color-brand: #142CEB;
  --color-accent: #6EAFED;
  --color-bg-card: rgba(255, 255, 255, 0.65);
  --color-border-subtle: rgba(0, 0, 0, 0.08);
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 960px;
  --header-h: 64px;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--color-paper);
  color: var(--color-text);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--color-brand); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--color-accent); }

/* Typography */
h1, h2, h3, h4 { font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; color: inherit; }
h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: var(--gap); }
h3 { font-size: 1.125rem; margin-bottom: 0.5rem; }
p { margin-bottom: var(--gap); max-width: 38em; }
.text-balance { text-wrap: balance; }
.hl { color: var(--color-brand); }
.surface-dark .hl { color: var(--color-accent); }

.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  background: rgba(20, 44, 235, 0.08);
}
.surface-paper .badge { color: var(--color-brand); background: rgba(20, 44, 235, 0.06); }
.surface-dark .badge { color: var(--color-accent); background: rgba(110, 175, 237, 0.15); }

/* Layout */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); position: relative; }
section { padding: var(--section-y) 0; border-bottom: 1px solid var(--color-border-subtle); position: relative; }
section:last-of-type { border-bottom: none; }

/* Main vertical line layout */
.timeline-line {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-border-subtle);
  transform: translateX(-50%);
  z-index: 0;
  display: none;
}
@media (min-width: 769px) { .timeline-line { display: block; } }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); align-items: center; position: relative; z-index: 1; }
.stagger-left { grid-column: 1; }
.stagger-right { grid-column: 2; }
@media (max-width: 768px) {
  .stagger-left, .stagger-right { grid-column: 1; }
}

.magazine-layout { display: grid; grid-template-columns: 1fr 240px; gap: var(--gap); position: relative; z-index: 1; }
@media (max-width: 768px) { .magazine-layout { grid-template-columns: 1fr; } }
.toc-nav { position: sticky; top: calc(var(--header-h) + 1rem); }
.toc-nav ul { list-style: none; border-left: 2px solid var(--color-border-subtle); padding-left: 1rem; }
.toc-nav li { margin-bottom: 0.75rem; }
.toc-nav a { font-size: 0.9rem; color: var(--color-text); opacity: 0.7; }
.toc-nav a:hover, .toc-nav a.active { opacity: 1; color: var(--color-brand); }
.surface-dark .toc-nav a { color: var(--color-text-on-dark); }

/* Components */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0 1.25rem; height: 48px; font-size: 1rem; font-weight: 600;
  border-radius: var(--radius-btn); cursor: pointer; transition: transform 0.2s, background 0.2s;
  border: none; text-decoration: none;
}
.btn-primary { background: var(--color-accent); color: var(--color-dark); }
.btn-primary:hover { background: #5a9bd6; transform: translateY(-1px); }
.btn-secondary { background: transparent; border: 1px solid var(--color-text); color: var(--color-text); }
.surface-dark .btn-secondary { border-color: var(--color-text-on-dark); color: var(--color-text-on-dark); }
.btn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

.card {
  background: var(--color-bg-card);
  border-radius: var(--radius-card);
  padding: var(--gap);
  position: relative;
  border: var(--card-border);
  box-shadow: var(--card-shadow);
}
.surface-dark .card { background: rgba(255, 255, 255, 0.05); }
.card-light { background: rgba(255, 255, 255, 0.8); }

.table-wrapper { overflow-x: auto; margin-bottom: var(--gap); }
table { width: 100%; border-collapse: collapse; min-width: 320px; }
th, td { padding: 0.75rem; text-align: left; border-bottom: 1px solid var(--color-border-subtle); }
th { font-weight: 600; }

/* FAQ */
details { margin-bottom: var(--gap); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-card); overflow: hidden; background: var(--color-bg-card); }
summary { padding: 1rem; cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-weight: 400; }
details[open] summary::after { content: "-"; }
details p { padding: 0 1rem 1rem; margin: 0; color: var(--color-text); }

/* Header & Footer */
header { position: sticky; top: 0; z-index: 100; background: var(--color-paper); border-bottom: 1px solid var(--color-border-subtle); height: var(--header-h); display: flex; align-items: center; backdrop-filter: blur(8px); }
.nav-inner { display: flex; justify-content: space-between; align-items: center; width: 100%; }
nav ul { display: flex; gap: 1.5rem; list-style: none; }
nav a { font-weight: 500; font-size: 0.95rem; }
nav a[aria-current="page"] { color: var(--color-brand); font-weight: 700; }
footer { background: var(--color-dark); color: var(--color-text-on-dark); padding: var(--section-y) 0; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--gap); }
.footer-col h4 { margin-bottom: 0.75rem; font-size: 1rem; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 0.5rem; }
.footer-col a { color: var(--color-accent); opacity: 0.85; }
.footer-col a:hover { opacity: 1; }
.copyright { margin-top: var(--gap); padding-top: var(--gap); border-top: 1px solid rgba(255,255,255,0.1); font-size: 0.85rem; opacity: 0.7; text-align: center; }

/* SVG & Animations */
.svg-container { width: 100%; height: auto; }
.svg-icon-box { width: 64px; height: 64px; }
.svg-icon-box svg { width: 100%; height: 100%; }
.step-icon { width: 24px; height: 24px; flex-shrink: 0; }
.star { fill: var(--color-accent); opacity: 0.6; }
.line { stroke: var(--color-accent); stroke-width: 1.5; fill: none; pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; }
.bubble { fill: var(--color-accent); opacity: 0.85; }
.notification { fill: var(--color-paper); stroke: var(--color-accent); stroke-width: 1; }
.dot-input { fill: var(--color-accent); }

@keyframes twinkle { 0%, 100% { opacity: 0.3; transform: scale(0.8); } 50% { opacity: 0.9; transform: scale(1.1); } }
@keyframes drawLine { 0%, 100% { stroke-dashoffset: 1; } 50% { stroke-dashoffset: 0; } }
@keyframes floatBubble { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes breatheDots { 0%, 100% { opacity: 0.2; } 50% { opacity: 0.9; } }
@keyframes slideIn { 0%, 100% { transform: translateX(10px); opacity: 0; } 50% { transform: translateX(0); opacity: 1; } }

.anim-star { animation: twinkle 4s ease-in-out infinite; }
.anim-line { animation: drawLine 6s ease-in-out infinite; }
.anim-float { animation: floatBubble 5s ease-in-out infinite; }
.anim-breathe { animation: breatheDots 2s ease-in-out infinite; }
.anim-slide { animation: slideIn 4s ease-in-out infinite; }

[class^="anim-"], [class*=" anim-"] { transform-box: fill-box; transform-origin: center; }

@media (prefers-reduced-motion: reduce) {
  [class^="anim-"], [class*=" anim-"] { animation: none !important; }
}

/* 兜底：裁掉横向溢出 */
div.magazine-layout {
  overflow-x: clip;
}
