:root {
  --bg: #fafbfb;
  --surface: #ffffff;
  --bg-panel: #f1edfc;
  --bg-panel-2: #f3f4f4;
  --border: #e2e5e4;
  --border-strong: #cfd4d2;
  --line-dash: #c4c9c7;
  --accent: #8466e6;
  --accent-dark: #4f3aa8;
  --accent-06: rgba(132, 102, 230, 0.06);
  --accent-14: rgba(132, 102, 230, 0.14);
  --accent-30: rgba(132, 102, 230, 0.30);
  --accent-62: rgba(132, 102, 230, 0.62);
  --text: #121413;
  --text-soft: #353a38;
  --text-muted: #5d6462;
  --text-faint: #9ba2a0;
  --ink-hover: #2c302e;
  --success: #2f8a5b;
  --warn: #b7791f;
  --error: #c8412f;
  --transparent: transparent;
  --veil: rgba(18, 20, 19, 0.24);

  --font-display: 'Inter', 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, 'Liberation Mono', monospace;

  --r-btn: 2px;
  --r-tag: 3px;
  --r-card: 6px;
  --r-mark: 8px;
  --r-win: 10px;
  --r-shot: 10px;
  --r-pill: 999px;
  --r-round: 50%;
  --shadow-win: 0 1px 0 rgba(18, 20, 19, 0.02), 0 2px 6px rgba(18, 20, 19, 0.04), 0 18px 40px -12px rgba(18, 20, 19, 0.10), 0 64px 120px -40px rgba(79, 58, 168, 0.24);
  --shadow-panel: 0 2px 6px rgba(18, 20, 19, 0.03), 0 20px 48px -24px rgba(18, 20, 19, 0.16);
  --header-h: 64px;
  --wrap: 1200px;
  --reading: 820px;
  --header-wrap: 1280px;
  --gutter: 32px;
  --gutter-w: 52px;
  --note-w: 212px;
  --row-h: 25px;
  --field-row: 22px;
  --section-space: 140px;
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lede: 17px;
  --text-h1: clamp(34px, calc(16px + 2.25vw), 48px);
  --text-h2: clamp(24px, calc(14px + 1.4vw), 32px);
  --text-h3: 21px;
  --weight-normal: 400;
  --weight-medium: 500;
  --tracking-heading: -0.02em;
  --tracking-mono: 0.06em;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --duration-fast: 150ms;
  --duration-reveal: 500ms;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 24px); }
html.nav-open { overflow: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-underline-offset: 0.22em; }
a:hover { text-decoration-thickness: 2px; }
button, a { -webkit-tap-highlight-color: var(--accent-14); }
:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: var(--weight-normal);
  letter-spacing: var(--tracking-heading);
  text-wrap: balance;
  overflow-wrap: break-word;
}
h1 { font-size: var(--text-h1); line-height: 1.1; }
h2 { font-size: var(--text-h2); line-height: 1.2; }
h3 { font-size: var(--text-h3); line-height: 1.4; }
strong { font-weight: var(--weight-medium); }
p, li, dd { overflow-wrap: break-word; }
code { font-family: var(--font-mono); overflow-wrap: anywhere; }
pre {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  padding: 20px;
  background: var(--bg-panel-2);
  color: var(--text-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.8;
  tab-size: 2;
}
pre code { overflow-wrap: normal; word-break: normal; white-space: pre; }
figure { margin: 0; }
.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.reading { max-width: calc(var(--reading) + var(--gutter) * 2); }
.wrap > *, .grid > *, .split > *, .hero__top > *, .footer-grid > * { min-width: 0; }
.section { padding-top: var(--section-space); padding-bottom: var(--section-space); }
.section--lavender { background: var(--bg-panel); color: var(--text); }
.section--neutral { background: var(--bg-panel-2); color: var(--text); }
.section-head { max-width: 700px; margin-bottom: 48px; }
.section-head h2 { margin: 0; }
.section-head p { color: var(--text-muted); }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 64px; align-items: start; }
.stack > * + * { margin-top: 24px; }
.nowrap { white-space: nowrap; }
.muted { color: var(--text-muted); }
.mono { font-family: var(--font-mono); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.skip {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 50;
  padding: 8px 12px;
  background: var(--text);
  color: var(--surface);
  border-radius: var(--r-btn);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  text-decoration: none;
}
.skip:focus { top: 12px; }

.btn-primary, .btn-secondary {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  max-width: 100%;
  padding: 10px 22px;
  border: 1px solid var(--text);
  border-radius: var(--r-btn);
  background: var(--text);
  color: var(--surface);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-normal);
  letter-spacing: var(--tracking-mono);
  text-decoration: none;
  text-align: center;
  transition: background-color var(--duration-fast) ease;
}
.btn-primary:hover, .btn-primary.is-hover { background: var(--ink-hover); color: var(--surface); text-decoration: none; }
.btn-primary:active { background: var(--text-soft); color: var(--surface); }
.btn-primary svg, .btn-secondary svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--bg-panel-2); color: var(--text); text-decoration: none; }
.btn-link {
  display: inline-block;
  max-width: 100%;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--text);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: var(--tracking-mono);
  text-decoration: none;
}
.btn-link:hover { color: var(--accent-dark); border-color: var(--accent-dark); text-decoration: none; }
.btn-primary:disabled, .btn-secondary:disabled, [aria-disabled="true"].btn-primary {
  background: var(--bg-panel-2);
  color: var(--text-muted);
  border-color: var(--border);
  cursor: not-allowed;
}
.card, .panel {
  min-width: 0;
  padding: 28px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
}
.panel { box-shadow: var(--shadow-panel); }
.card h3, .panel h3 { margin-top: 0; }
.card p, .panel p { color: var(--text-muted); }
.card > :last-child, .panel > :last-child { margin-bottom: 0; }

.masthead, #site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--surface);
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.masthead__in {
  position: relative;
  width: 100%;
  max-width: min(100%, calc(var(--header-wrap) + var(--gutter) * 2));
  padding-inline: var(--gutter);
  height: var(--header-h);
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  gap: 10px;
  color: var(--text);
  font-size: 15px;
  font-weight: var(--weight-medium);
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}
.brand__mark { display: block; width: 28px; height: 28px; border-radius: var(--r-mark); flex-shrink: 0; }
.brand__mark--placeholder {
  background: var(--bg-panel);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--accent-14);
}
.topnav { margin-left: auto; min-width: 0; }
.topnav ul {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
}
.topnav li { display: flex; align-items: center; white-space: nowrap; }
.topnav li + li::before { content: "·"; color: var(--text-faint); margin-inline: 11px; flex-shrink: 0; }
.topnav a {
  display: block;
  padding-block: 12px;
  color: var(--text-muted);
  font-size: var(--text-sm);
  text-decoration: none;
}
.topnav a:hover, .topnav a[aria-current="page"] { color: var(--text); }
.header-tools { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.lang-switch { position: relative; }
.lang {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-btn);
  background: var(--surface);
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 12.5px;
  white-space: nowrap;
}
.lang:hover { border-color: var(--border-strong); }
.lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 12px);
  width: 200px;
  padding: 6px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-panel);
}
.lang-menu a { display: flex; align-items: center; min-height: 44px; padding: 8px 12px; text-decoration: none; }
.lang-menu a:hover, .lang-menu a[aria-current] { background: var(--bg-panel); color: var(--accent-dark); }
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-btn);
  background: var(--surface);
  color: var(--text);
}
.menu-toggle svg { width: 20px; height: 20px; }
.mobile-drawer { display: none; }
.nav-veil {
  position: fixed;
  inset: var(--header-h) 0 0;
  z-index: -1;
  border: 0;
  background: var(--veil);
  color: var(--text);
}
.footer {
  padding-top: 80px;
  padding-bottom: 40px;
  background: var(--bg-panel-2);
  color: var(--text);
}
.footer-grid { display: grid; grid-template-columns: 1.2fr 1fr 1.3fr; gap: 64px; }
.footer .brand { white-space: normal; }
.footer h2 { font-size: var(--text-sm); margin-top: 0; font-family: var(--font-mono); }
.footer p { max-width: 32em; color: var(--text-muted); font-size: var(--text-sm); }
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 10px 20px; }
.footer a:not(.brand) { color: var(--text-muted); font-size: var(--text-sm); text-decoration: none; }
.footer a:hover { color: var(--text); text-decoration: underline; }
.footer-bottom { margin-top: 56px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; }
.footer-bottom p { margin: 0; }
.prose { min-width: 0; }
.prose h2 { margin-top: 72px; }
.prose h3 { margin-top: 36px; }
.prose p, .prose li { line-height: 1.9; }
.prose a:not(.btn-primary):not(.btn-secondary) { color: var(--accent-dark); }
.prose > :first-child { margin-top: 0; }
.reveal { opacity: 1; transform: none; }
html.reveal-ready .reveal:not(.shown) { opacity: 0; transform: translateY(16px); }
html.reveal-ready .reveal { transition: opacity var(--duration-reveal) var(--ease), transform var(--duration-reveal) var(--ease); }
.hero, .stage, .decorated-section { overflow-x: clip; }

@media (max-width: 1080px) {
  #site-header .topnav { display: none; }
  #site-header .header-tools { margin-left: auto; }
  .menu-toggle { display: inline-flex; }
  .mobile-drawer:not([hidden]) {
    display: block;
    position: absolute;
    inset: 100% 0 auto;
    padding: 16px var(--gutter) 28px;
    max-height: calc(100dvh - var(--header-h));
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--surface);
    color: var(--text);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-panel);
  }
  .mobile-drawer ul { list-style: none; margin: 0; padding: 0; }
  .mobile-drawer a { display: flex; align-items: center; width: 100%; min-height: 48px; padding: 10px 12px; text-decoration: none; }
  .mobile-drawer a[aria-current] { background: var(--bg-panel); color: var(--accent-dark); }
  .mobile-drawer h2 { margin: 24px 12px 8px; font-size: var(--text-sm); color: var(--text-muted); }
}
@media (max-width: 1080px) {
  .topnav li + li::before { margin-inline: 8px; }
  .footer-grid { gap: 32px; }
}
@media (max-width: 768px) {
  :root { --text-h1: clamp(24px, 4.2vw, 30px); --section-space: 140px; }
  .split, .grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .footer-grid { grid-template-columns: minmax(0, 1fr); }
  .preview-header .masthead__in { height: auto; min-height: var(--header-h); flex-wrap: wrap; padding-block: 12px; gap: 10px; }
  .preview-header .header-tools { margin-left: auto; }
  .preview-header .topnav { order: 3; width: 100%; overflow-x: auto; margin-left: 0; }
}
@media (max-width: 640px) {
  :root { --gutter: 20px; --gutter-w: 40px; }
  .masthead__in { gap: 12px; }
  .brand { font-size: var(--text-sm); gap: 8px; }
  .header-tools { margin-left: auto; gap: 8px; }
  .lang { padding-inline: 8px; }
  .card, .panel { padding: 22px; }
  .tilt, [data-tilt] { transform: none !important; }
  .footer { padding-top: 64px; padding-bottom: 32px; }
}
@media (max-width: 360px) {
  :root { --gutter: 16px; }
  .masthead__in { gap: 8px; }
  .brand { gap: 6px; }
  .header-tools { gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html.reveal-ready .reveal:not(.shown) { opacity: 1; transform: none; }
}