:root {
  --bg: #f6f7fb;
  --bg-soft: #eef0f8;
  --panel: #ffffff;
  --panel-alt: #f8f9fd;
  --text: #0f1424;
  --muted: #5a6480;
  --border: #e2e6f0;
  --border-strong: #c7cfe2;
  --accent: #4f46e5;
  --accent-ink: #ffffff;
  --accent-soft: rgba(79, 70, 229, 0.08);
  --warm: #b45309;
  --code-bg: #0b1020;
  --code-text: #c7d2fe;
  --shadow-sm: 0 1px 2px rgba(15, 20, 36, 0.05);
  --shadow-md: 0 12px 32px rgba(15, 20, 36, 0.1);
  --radius: 14px;
  --topbar-h: 64px;
  color-scheme: light;
}

html[data-theme='dark'] {
  --bg: #070912;
  --bg-soft: #05070e;
  --panel: #0f1424;
  --panel-alt: #0b1020;
  --text: #e6e9f6;
  --muted: #94a0be;
  --border: rgba(148, 160, 190, 0.22);
  --border-strong: rgba(148, 160, 190, 0.42);
  --accent: #818cf8;
  --accent-ink: #0a0f1e;
  --accent-soft: rgba(129, 140, 248, 0.12);
  --warm: #fbbf24;
  --code-bg: #05070e;
  --code-text: #c7d2fe;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 18px 44px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + 16px); }

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(1000px 480px at 8% -8%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%),
    radial-gradient(900px 420px at 96% 0%, color-mix(in srgb, var(--warm) 10%, transparent), transparent 58%),
    var(--bg);
  font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12.5px;
  overflow-wrap: break-word;
}

.skip-link { position: absolute; left: -9999px; top: 0; z-index: 100; padding: 10px 16px; background: var(--accent); color: var(--accent-ink); }
.skip-link:focus { left: 12px; top: 12px; border-radius: 8px; }

/* 顶栏 */
.topbar { position: sticky; top: 0; z-index: 50; height: var(--topbar-h); background: var(--bg); background: color-mix(in srgb, var(--bg) 86%, transparent); border-bottom: 1px solid var(--border); backdrop-filter: saturate(160%) blur(14px); }
.topbar-inner { display: flex; align-items: center; gap: 24px; max-width: 1180px; height: 100%; margin: 0 auto; padding: 0 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-size: 17px; font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(145deg, #818cf8, #fbbf24); color: #0a0f1e; font-size: 11px; font-weight: 800; }
.brand-mark.small { width: 22px; height: 22px; margin-right: 6px; border-radius: 6px; font-size: 9px; vertical-align: -5px; }
.brand-ver { padding: 1px 7px; border: 1px solid var(--border); border-radius: 999px; background: var(--panel-alt); color: var(--muted); font-family: ui-monospace, monospace; font-size: 11px; }
.nav { flex: 1; display: flex; align-items: center; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { flex: none; padding: 6px 11px; border-radius: 8px; color: var(--muted); font-size: 14px; white-space: nowrap; }
.nav a:hover, .nav a.active { color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn { width: 34px; height: 34px; padding: 0; border: 1px solid var(--border); border-radius: 9px; background: var(--panel); color: var(--muted); font-size: 15px; cursor: pointer; }
.gh-btn { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel); color: var(--text); font-size: 13px; font-weight: 600; }
.gh-btn:hover { text-decoration: none; border-color: var(--border-strong); }
.nav-toggle { display: none; }

/* Hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.06fr) minmax(0, 0.94fr); gap: 56px; align-items: center; max-width: 1180px; margin: 0 auto; padding: 72px 24px 56px; }
.eyebrow, .kicker { margin: 0 0 12px; color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; }
.hero h1 { margin: 0; font-size: clamp(40px, 5.6vw, 62px); line-height: 1.05; letter-spacing: -0.035em; font-weight: 800; background: linear-gradient(92deg, var(--accent), var(--warm)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tagline { margin: 18px 0 10px; font-size: 19px; font-weight: 600; }
.sub { max-width: 34em; margin: 0; color: var(--muted); font-size: 15px; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 26px 0 22px; }
.btn { display: inline-flex; align-items: center; justify-content: center; height: 42px; padding: 0 20px; border: 1px solid transparent; border-radius: 10px; font-size: 14px; font-weight: 600; }
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-md); }
.btn.ghost { background: var(--panel); color: var(--text); border-color: var(--border); }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.badges li { padding: 4px 11px; border: 1px solid var(--border); border-radius: 999px; background: var(--panel-alt); color: var(--muted); font-family: ui-monospace, monospace; font-size: 12px; }
.hero-card { padding: 18px 20px 20px; border: 1px solid var(--border); border-radius: 18px; background: linear-gradient(180deg, var(--panel), var(--panel-alt)); box-shadow: var(--shadow-md); }
.hero-card-head { display: flex; align-items: center; gap: 6px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); }
.hero-card-title { margin-left: 8px; color: var(--muted); font-family: ui-monospace, monospace; font-size: 11px; }
.wasm-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 16px 0 0; }
.wasm-stats div { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-alt); }
.wasm-stats dt { color: var(--muted); font-size: 11px; }
.wasm-stats dd { margin: 4px 0 0; font-family: ui-monospace, monospace; font-size: 14px; font-weight: 600; }
.hero-meta { margin: 12px 0 0; color: var(--muted); font-family: ui-monospace, monospace; font-size: 11.5px; }
.hero-envelope { margin: 14px 0 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--code-bg); color: var(--code-text); font-family: ui-monospace, monospace; font-size: 11.5px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 220px; overflow: auto; }

/* 分节 */
.section { max-width: 1180px; margin: 0 auto; padding: 64px 24px; border-top: 1px solid var(--border); }
.section-head { max-width: 820px; margin-bottom: 32px; }
.section-head h2 { margin: 0 0 10px; font-size: clamp(26px, 3.2vw, 34px); line-height: 1.2; letter-spacing: -0.025em; }
.lede { margin: 0; color: var(--muted); font-size: 15px; }

/* 能力 */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 16px; }
.feature { position: relative; display: block; padding: 20px 20px 34px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); color: inherit; transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease; }
.feature:hover, .feature:focus-visible { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow-md); text-decoration: none; }
.feature-no { display: inline-block; margin-bottom: 10px; color: var(--accent); font-family: ui-monospace, monospace; font-size: 11px; font-weight: 700; letter-spacing: 0.12em; }
.feature h3 { margin: 0 0 8px; font-size: 16px; }
.feature p { margin: 0 0 12px; color: var(--muted); font-size: 13.5px; }
.feature > code, .pkg-link code, .card-head code { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: 11.5px; font-family: ui-monospace, monospace; }
.feature::after { content: '文档 ↗'; position: absolute; right: 18px; bottom: 14px; color: var(--accent); font-size: 11px; font-weight: 600; opacity: 0; transform: translateX(-4px); transition: opacity 0.18s ease, transform 0.18s ease; pointer-events: none; }
.feature:hover::after, .feature:focus-visible::after { opacity: 1; transform: none; }
.pkg-link { color: inherit; }

/* 演示 */
.demo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(430px, 1fr)); gap: 18px; }
.card { display: flex; flex-direction: column; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.card-head h3 { margin: 0; font-size: 16px; }
.card .hint { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 14px; }
label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; }
.grow { flex: 1 1 180px; }
input, select, textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--panel-alt); color: var(--text); font: inherit; font-size: 13.5px; }
textarea { min-height: 88px; resize: vertical; font-family: ui-monospace, monospace; font-size: 12.5px; }
.row label:not(.grow) { flex: 0 1 120px; }
button { padding: 9px 16px; border: 1px solid var(--accent); border-radius: 9px; background: var(--accent-soft); color: var(--accent); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
button:hover { background: color-mix(in srgb, var(--accent) 18%, var(--panel)); }
.chip-btn { border-color: var(--border); background: var(--panel-alt); color: var(--muted); }
.out { margin-top: 14px; min-height: 44px; padding: 12px 14px; border: 1px dashed var(--border-strong); border-radius: 10px; background: var(--panel-alt); color: var(--muted); font-family: ui-monospace, monospace; font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto; }
.out.ok { border-color: color-mix(in srgb, #16a34a 55%, var(--border)); background: color-mix(in srgb, #16a34a 8%, var(--panel)); color: color-mix(in srgb, #16a34a 70%, var(--text)); }
.out.bad { border-color: color-mix(in srgb, #dc2626 55%, var(--border)); background: color-mix(in srgb, #dc2626 8%, var(--panel)); color: color-mix(in srgb, #dc2626 70%, var(--text)); }

/* 代码 */
.start-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 18px; }
.start-col { display: grid; gap: 16px; align-content: start; }
.code { overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--code-bg); }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); background: rgba(255, 255, 255, 0.06); color: #94a0be; font-family: ui-monospace, monospace; font-size: 11.5px; }
.code-head .copy { padding: 3px 9px; border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 6px; background: transparent; color: #94a0be; font-size: 11px; font-weight: 500; }
.code-head .copy:hover { color: #fff; }
.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; color: var(--code-text); font-family: ui-monospace, monospace; font-size: 12.8px; line-height: 1.7; }
.code pre code { padding: 0; background: transparent; color: inherit; }

/* 表 */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th { padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--panel-alt); color: var(--muted); font-size: 12px; text-align: left; white-space: nowrap; }
tbody td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--panel-alt); }

/* 质量 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat { padding: 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); }
.stat strong { display: block; font-size: clamp(22px, 3vw, 30px); line-height: 1.1; letter-spacing: -0.03em; }
.stat span { display: block; margin-top: 6px; color: var(--muted); font-size: 12.5px; }
.quality-notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-top: 20px; }
.quality-notes p { margin: 0; padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-alt); color: var(--muted); font-size: 13px; }
.quality-notes strong { color: var(--text); }

/* 文档 */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.doc-card { display: block; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); color: var(--text); }
.doc-card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow-md); text-decoration: none; }
.doc-card h3 { margin: 0 0 6px; color: var(--accent); font-size: 15.5px; }
.doc-card p { margin: 0; color: var(--muted); font-size: 13px; }

/* 步骤 */
.steps { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.steps li { display: flex; gap: 14px; padding: 16px 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); }
.step-no { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 700; }
.steps p { margin: 0; color: var(--muted); font-size: 13.5px; }

/* 页脚 */
.footer { border-top: 1px solid var(--border); background: var(--bg-soft); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; max-width: 1180px; margin: 0 auto; padding: 26px 24px; }
.footer-brand { margin: 0; color: var(--muted); font-size: 12.5px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 16px; }
.footer-links a { color: var(--muted); font-size: 12.5px; }

/* 响应式 */
@media (max-width: 960px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 36px; padding-top: 52px; }
  .hero-card { max-width: 560px; }
  .nav-toggle { display: inline-grid; }
  .nav {
    display: none;
    position: absolute;
    top: var(--topbar-h);
    left: 0;
    right: 0;
    z-index: 60;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 10px 18px 14px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
  }
  .nav.open { display: flex; }
  .topbar:has(.nav.open) { backdrop-filter: none; background: var(--bg); }
  .nav a { padding: 10px 12px; font-size: 15px; border-radius: 8px; }
}
@media (max-width: 720px) {
  .topbar-inner, .hero, .section, .footer-inner { padding-left: 18px; padding-right: 18px; }
  .section { padding-top: 48px; padding-bottom: 48px; }
  .hero { padding-top: 40px; }
  .demo-grid, .start-grid { grid-template-columns: minmax(0, 1fr); }
  .feature-grid, .doc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .feature, .doc-card { padding: 16px 16px 30px; }
  .row { flex-direction: column; align-items: stretch; }
  .row label, .row button { width: 100%; flex: none; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 520px) {
  .wasm-stats { grid-template-columns: minmax(0, 1fr); }
  .hero h1 { font-size: clamp(34px, 10vw, 46px); }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}