:root {
  --color-dark: #141838;
  --color-paper: #FCFCFD;
  --color-body: #151723;
  --color-brand: #142CEB;
  --color-accent: #6EAFED;
  --color-card-bg: #F4F5F7;
  --color-card-dark: rgba(255, 255, 255, 0.06);
  --radius-card: 8px;
  --radius-btn: 6px;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 960px;
  --card-border: 0;
  --card-shadow: none;
  --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-body); line-height: 1.75; font-size: 16px; -webkit-font-smoothing: antialiased; }
img, svg { max-width: 100%; display: block; }
a { color: var(--color-brand); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { padding-left: 1.25rem; }
li { margin-bottom: 0.5rem; }

/* Surface Color Scoping */
.paper-surface { --text-title: var(--color-body); --text-body: var(--color-body); --text-muted: #4B5563; --surface-accent: var(--color-brand); }
.dark-surface { --text-title: var(--color-paper); --text-body: rgba(252, 252, 253, 0.9); --text-muted: rgba(252, 252, 253, 0.6); --surface-accent: var(--color-accent); }

/* Typography */
h1, h2, h3, h4 { font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; color: var(--text-title); }
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); margin-bottom: 1rem; text-wrap: balance; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: var(--gap); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); margin-bottom: 0.75rem; }
p { margin-bottom: 1.25rem; max-width: 38em; color: var(--text-body); }
.eyebrow { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 0.75rem; display: block; color: var(--surface-accent); }
.hl { font-weight: 800; color: var(--surface-accent); }
.long-string { overflow-wrap: anywhere; }

/* Layout */
.container { max-width: var(--content-max); margin-inline: auto; padding-inline: clamp(1rem, 5%, 2rem); }
section { padding-block: var(--section-y); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }
.grid-col { min-width: 0; }
.magazine-layout { display: grid; grid-template-columns: 1fr 240px; gap: var(--gap); align-items: start; }
.toc-sidebar { position: sticky; top: 80px; }
.toc-list { list-style: none; padding: 0; }
.toc-list li { margin-bottom: 0.75rem; }
.toc-list a { color: var(--text-muted); font-size: 0.9rem; font-weight: 500; }
.toc-list a:hover { color: var(--surface-accent); text-decoration: none; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.85rem 1.75rem; border-radius: var(--radius-btn); font-weight: 600; font-size: 1rem; cursor: pointer; transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease; border: none; }
.btn:focus-visible { outline: 2px solid var(--surface-accent); outline-offset: 2px; }
.btn-primary { background: var(--color-accent); color: var(--color-dark); }
.btn-primary:hover { transform: translateY(-1px); background: #5a9bd6; }
.btn-secondary { background: transparent; border: 1px solid var(--text-body); color: var(--text-body); }
.paper-surface .btn-secondary { border-color: var(--color-body); }
.dark-surface .btn-secondary { border-color: var(--color-paper); color: var(--color-paper); }
.btn-secondary:hover { transform: translateY(-1px); opacity: 0.85; }

/* Cards & Panels */
.card { background: var(--color-card-bg); border-radius: var(--radius-card); padding: 1.5rem; border: var(--card-border); box-shadow: var(--card-shadow); }
.dark-surface .card { background: var(--color-card-dark); }
.feature-group { margin-bottom: var(--gap); }
.feature-group:last-child { margin-bottom: 0; }
.feature-group h3 { color: var(--text-title); }

/* Table */
table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; min-width: 0; }
th, td { text-align: left; padding: 0.75rem 1rem; border-bottom: 1px solid #E5E7EB; color: var(--text-body); min-width: 0; word-break: break-all; }
th { font-weight: 600; }
.dark-surface th, .dark-surface td { border-bottom-color: rgba(255,255,255,0.1); }

/* FAQ */
details { border-bottom: 1px solid #E5E7EB; padding: 1rem 0; }
summary { font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; color: var(--text-title); }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-weight: 300; }
details[open] summary::after { content: "−"; }
details p { margin-top: 0.75rem; margin-bottom: 0; color: var(--text-body); }

/* News */
.news-card { background: var(--color-card-bg); border-radius: var(--radius-card); padding: 1.25rem; }
.news-date { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.5rem; display: block; }
.news-card h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.news-card p { font-size: 0.95rem; margin-bottom: 0; }

/* Header & Footer */
header { position: sticky; top: 0; z-index: 100; background: var(--color-paper); border-bottom: 1px solid #E5E7EB; backdrop-filter: blur(8px); }
.header-inner { display: flex; justify-content: space-between; align-items: center; height: 64px; }
nav { display: flex; gap: 1.5rem; }
nav a { font-weight: 500; color: var(--color-body); }
nav a[aria-current="page"] { color: var(--color-brand); font-weight: 700; }
footer { background: var(--color-dark); color: var(--color-paper); padding: 3rem 0; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 2rem; }
.footer-links a { display: block; color: rgba(252,252,253,0.8); margin-bottom: 0.5rem; transition: color 0.2s; }
.footer-links a:hover { color: var(--color-accent); text-decoration: none; }
.footer-copy { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid rgba(255,255,255,0.1); font-size: 0.85rem; color: rgba(252,252,253,0.5); }

/* SVG Mockup */
.hero-svg { width: 100%; height: auto; max-width: 600px; }
.mockup-panel { fill: var(--color-dark); stroke: rgba(255,255,255,0.1); stroke-width: 1; rx: 12; }
.win { fill: #1E224A; stroke: rgba(255,255,255,0.15); stroke-width: 1; rx: 8; }
.bar { fill: #2A2F5A; rx: 4; }
.list-item { fill: #33386A; rx: 4; }
.chat-bubble { fill: #3A407A; rx: 8; }
.input-field { fill: #2A2F5A; rx: 6; }
.dot { fill: var(--color-accent); }
.notif { fill: #2A2F5A; stroke: var(--color-accent); stroke-width: 1.5; rx: 6; }
.line { stroke: var(--color-accent); stroke-width: 2; fill: none; pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; }

/* Animations */
.anim-line { animation: draw-line 5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-float { animation: float-bubble 4.5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-pulse { animation: pulse-dot 3s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-slide { animation: slide-notif 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-fade { animation: fade-in-up 0.8s ease-out forwards; }

@keyframes draw-line { 0% { stroke-dashoffset: 1; } 50% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 1; } }
@keyframes float-bubble { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
@keyframes slide-notif { 0%, 100% { transform: translateX(0); opacity: 1; } 80% { transform: translateX(0); opacity: 1; } 90%, 100% { transform: translateX(20px); opacity: 0; } }
@keyframes fade-in-up { 0% { opacity: 0; transform: translateY(10px); } 100% { opacity: 1; transform: translateY(0); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

@media (max-width: 768px) {
  .magazine-layout { grid-template-columns: 1fr; }
  .toc-sidebar { display: none; }
  .header-inner { padding: 0; }
  nav { display: none; }
}

/* 兜底：裁掉横向溢出 */
div.card {
  overflow-x: clip;
}
