:root {
  color-scheme: light;
  --bg: #F6F2EA;
  --bg-hero-a: #FBF8F1;
  --bg-hero-b: #F1EBDF;
  --panel: #FDFBF6;
  --panel-0: rgba(253,251,246,0);
  --panel-2: #EEE7DA;
  --border: #E2D9C8;
  --accent: #1B1915;
  --accent-dark: #0B0A08;
  --text: #2B251D;
  --muted: #6E6355;
  --success: #3F7A4F;
  --success-ring: rgba(63,122,79,.16);
  --warn: #A8741E;
  --error: #B3412E;
  --on-accent: #FDFBF6;
  --white: #FFFFFF;
  --white-0: rgba(255,255,255,0);
  --ink-shadow: #000000;
  --hi: rgba(255,255,255,.75);
  --hi-12: rgba(255,255,255,.12);
  --hi-14: rgba(255,255,255,.14);
  --hi-18: rgba(255,255,255,.18);
  --plus-a: #2B261F;
  --plus-b: #0F0D0A;
  --plus-side: #4A3E31;
  --plus-side-deep: #3B3127;
  --sh-0: rgba(90,70,45,0);
  --sh-08: rgba(90,70,45,.08);
  --sh-10: rgba(90,70,45,.10);
  --sh-14: rgba(90,70,45,.14);
  --sh-22: rgba(90,70,45,.22);
  --veil: rgba(43,37,29,.32);
  --flag-red: #D52B1E;
  --flag-blue: #2E3B6B;
  --flag-white: #FFFFFF;
  --flag-black: #1C1B19;
  --flag-gold: #E5B227;
  --flag-edge: rgba(43,37,29,.2);
  --font-display: 'Inter', 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans', 'Apple SD Gothic Neo', 'Microsoft YaHei', system-ui, sans-serif;
  --font-body: 'Inter', 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans', 'Malgun Gothic', 'Microsoft YaHei', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --r-pill: 999px;
  --r-card: 12px;
  --r-sm: 8px;
  --r-tiny: 6px;
  --container: 1328px;
  --gutter: 56px;
  --header-height: 64px;
  --anchor-offset: 80px;
  --toc-offset: 144px;
  --shadow-paper: 0 1px 0 var(--hi) inset, 0 2px 6px var(--sh-08), 0 22px 48px var(--sh-10);
  --grain-opacity: .03;
  --grain-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 .35 0 0 0 0 .27 0 0 0 0 .18 0 0 0 1 0'/%3E%3C/filter%3E%3Cpath filter='url(%23p)' d='M0 0h160v160H0z'/%3E%3C/svg%3E");
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-strong: 600;
  --size-small: 14px;
  --size-body: 16px;
  --size-h1: clamp(52px,4.6vw,66px);
  --size-h2: clamp(32px,3.5vw,48px);
  --size-h3: 24px;
  --tracking-display: -.035em;
  --tracking-heading: -.02em;
  --ease-time: .2s;
}
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: var(--anchor-offset);
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--size-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  background-image: var(--grain-image);
  opacity: var(--grain-opacity);
  mix-blend-mode: multiply;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button, input, select, textarea { max-width: 100%; }
button { border: 0; }
img { max-width: 100%; height: auto; }
svg { flex-shrink: 0; }
p { margin: 0; }
h1, h2, h3 { font-family: var(--font-display); color: var(--accent); text-wrap: balance; }
h1 { margin: 0; font-size: var(--size-h1); font-weight: var(--weight-medium); line-height: 1.1; letter-spacing: var(--tracking-heading); }
h2 { margin: 0 0 24px; font-size: var(--size-h2); font-weight: var(--weight-regular); line-height: 1.18; letter-spacing: var(--tracking-heading); }
h3 { margin: 0 0 16px; font-size: var(--size-h3); font-weight: var(--weight-medium); line-height: 1.3; }
ul, ol { padding-left: 24px; }
nav ul { list-style: none; margin: 0; padding: 0; }
figure, blockquote { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--r-sm); }
::selection { background: var(--panel-2); color: var(--accent); }
.wrap {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  padding-inline: var(--gutter);
  margin-inline: auto;
}
.section { padding-top: 80px; padding-bottom: 80px; }
.section-head { max-width: 780px; margin-bottom: 40px; }
.section-head p { color: var(--muted); }
.reading-wrap { max-width: 920px; }
.stack > * + * { margin-top: 24px; }
.grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 24px; }
.grid > *, .hero-grid > *, .footer-grid > *, .feature-browser > * { min-width: 0; }
.no-break { white-space: nowrap; }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); }
.small { font-size: var(--size-small); }
.line { display: block; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip {
  position: absolute; left: 16px; top: -80px; z-index: 100;
  padding: 8px 16px; border-radius: var(--r-pill);
  background: var(--accent); color: var(--on-accent); font-size: var(--size-small);
}
.skip:focus { top: 12px; }
.icon { display: inline-block; width: 20px; height: 20px; vertical-align: middle; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 26px; border: 0; border-radius: var(--r-pill);
  font-size: 15px; font-weight: var(--weight-medium); white-space: nowrap; flex-shrink: 0;
  transition: background-color var(--ease-time), box-shadow var(--ease-time);
}
.btn-primary {
  background: var(--accent); color: var(--on-accent);
  box-shadow: 0 1px 0 var(--hi-14) inset,0 2px 4px var(--sh-14),0 14px 28px var(--sh-22);
}
.btn-primary:hover, .btn-primary.is-hover { background: var(--accent-dark); }
.btn-secondary {
  background: var(--panel); color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--border),0 2px 6px var(--sh-08);
}
.btn-secondary:hover, .btn-secondary.is-hover { box-shadow: inset 0 0 0 1px var(--accent),0 2px 6px var(--sh-08); }
.btn:active, .btn.is-active { box-shadow: inset 0 0 0 2px var(--muted); }
.btn:disabled, .btn[aria-disabled="true"] { cursor: not-allowed; opacity: .5; }
.btn.is-focus { outline: 2px solid var(--accent); outline-offset: 3px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.text-link { display: inline-flex; align-items: center; min-height: 24px; text-decoration: underline; text-underline-offset: 4px; }
.panel, .card { padding: 28px; border: 1px solid var(--border); border-radius: var(--r-card); background: var(--panel); box-shadow: var(--shadow-paper); }
.prose { line-height: 1.85; overflow-wrap: break-word; }
.prose > * + * { margin-top: 24px; }
.prose h2 { margin-top: 56px; }
.prose h3 { margin-top: 32px; }
.prose a { text-decoration: underline; text-underline-offset: 3px; }
code { font-family: var(--font-mono); font-size: .9em; overflow-wrap: anywhere; }
pre { max-width: 100%; padding: 24px; overflow-x: auto; background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--r-sm); }
pre code { white-space: pre; overflow-wrap: normal; }
input, select, textarea { padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--panel); }
.reveal { transition: opacity .35s ease, transform .35s ease; }
.reveal.pending { opacity: 0; transform: translateY(16px); }
.reveal.shown { opacity: 1; transform: none; }
#server-status { display: block; position: static; min-width: 0; max-width: 100%; overflow: hidden; margin-block: 32px; }
#server-status + * { margin-top: 32px; }
[data-counter] { display: inline-block; min-width: 3ch; font-variant-numeric: tabular-nums; font-family: var(--font-mono); }
.stage, .decor-region { max-width: 100%; overflow-x: clip; }
.stage { background: linear-gradient(180deg,var(--bg-hero-a) 0,var(--bg-hero-b) 800px,var(--bg) 980px); }

/* Header */
#site-header { position: relative; z-index: 80; min-height: var(--header-height); }
.topbar { display: flex; align-items: center; gap: 24px; height: var(--header-height); flex-wrap: nowrap; position: relative; z-index: 84; }
.brand { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; min-height: 28px; }
.brand-mark { display: block; width: 28px; height: 28px; }
.brand-en { font-family: var(--font-display); font-size: 17px; font-weight: var(--weight-strong); letter-spacing: -.015em; color: var(--accent); }
.brand-zh { font-size: var(--size-small); font-weight: var(--weight-regular); color: var(--muted); }
.nav { flex: 1; min-width: 0; margin-left: 16px; }
.nav ul { display: flex; align-items: center; list-style: none; margin: 0; padding: 0; gap: 2px; }
.nav a { display: block; padding: 7px 14px; border-radius: var(--r-pill); font-size: var(--size-small); color: var(--muted); white-space: nowrap; transition: color var(--ease-time),background-color var(--ease-time); }
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--border); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.btn-login { display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 0 18px; border-radius: var(--r-pill); background: var(--accent); color: var(--on-accent); font-size: var(--size-small); font-weight: var(--weight-medium); box-shadow: 0 1px 0 var(--hi-12) inset,0 4px 12px var(--sh-14); white-space: nowrap; }
.btn-login:hover { background: var(--accent-dark); }
.language-picker { position: relative; }
.lang { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; min-width: 44px; width: auto; border: 0; background: transparent; cursor: pointer; padding: 7px 12px; border-radius: var(--r-pill); font: inherit; font-size: var(--size-small); color: var(--muted); white-space: nowrap; }
.lang:hover { background: var(--panel-2); color: var(--text); }
.lang-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 180px; z-index: 90; background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-paper); padding: 8px; }
.lang-panel a { display: flex; align-items: center; min-height: 40px; padding: 8px 12px; border-radius: var(--r-sm); font-size: var(--size-small); }
.lang-panel a:hover, .lang-panel a[aria-current] { background: var(--panel-2); }
.menu-toggle { display: none; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; border-radius: var(--r-pill); background: var(--panel-2); color: var(--accent); }
.menu-toggle svg { display: block; width: 20px; height: 20px; }
.menu-line { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.mobile-drawer { display: none; }
.nav-veil { display: none; }
html.nav-open { overflow: hidden; }
.drawer-languages { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 16px; }

/* Footer */
.site-footer { margin-top: 64px; border-top: 1px solid var(--border); background: var(--panel-2); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 48px; padding-top: 56px; padding-bottom: 40px; }
.footer-brand p { max-width: 350px; margin-top: 20px; color: var(--muted); font-size: var(--size-small); }
.footer-title { font-size: var(--size-small); font-weight: var(--weight-medium); margin: 0 0 16px; }
.footer-links { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px 16px; list-style: none; padding: 0; margin: 0; }
.footer-links a { display: inline-flex; align-items: center; min-height: 28px; font-size: var(--size-small); color: var(--text); }
.footer-links a:hover { text-decoration: underline; text-underline-offset: 4px; }
.footer-languages { display: flex; flex-wrap: wrap; gap: 12px 24px; padding-top: 20px; padding-bottom: 20px; border-top: 1px solid var(--border); font-size: var(--size-small); }
.footer-languages a { display: inline-flex; align-items: center; min-height: 28px; }
.footer-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; border-top: 1px solid var(--border); padding-top: 20px; padding-bottom: 28px; font-size: 13px; color: var(--muted); }
.footer-legal { display: flex; flex-wrap: wrap; gap: 20px; }
.footer-legal a { min-height: 24px; display: inline-flex; align-items: center; }
@media (max-width: 1400px) { :root { --gutter: 40px; } .topbar { gap: 16px; } .nav { margin-left: 8px; } .nav a { padding-inline: 11px; } }
@media (max-width: 1180px) {
  .nav { display: none; }
  .top-actions { margin-left: auto; }
  .menu-toggle { display: inline-flex; }
  .mobile-drawer:not([hidden]) { display: block; position: fixed; inset-inline: 0; top: var(--header-height); height: calc(100dvh - var(--header-height)); max-height: calc(100dvh - var(--header-height)); overflow-y: auto; overscroll-behavior: contain; z-index: 82; background: var(--panel); padding: 20px var(--gutter) 32px; }
  .mobile-drawer a { display: flex; align-items: center; width: 100%; min-height: 44px; padding: 12px 16px; border-radius: var(--r-sm); }
  .mobile-drawer a[aria-current], .mobile-drawer a:hover { background: var(--panel-2); }
  .nav-veil:not([hidden]) { display: block; position: fixed; inset-inline: 0; top: var(--header-height); bottom: 0; background: var(--veil); z-index: 81; }
}
@media (max-width: 768px) {
  :root { --gutter: 20px; --size-h1: clamp(28px,6vw,40px); --size-h2: 32px; }
  .section { padding-top: 48px; padding-bottom: 48px; }
  .grid { grid-template-columns: minmax(0,1fr); }
  .footer-grid { grid-template-columns: minmax(0,1fr); gap: 32px; }
  .topbar { gap: 12px; }
}
@media (max-width: 640px) {
  .no-break { white-space: normal; }
  .tilt, [data-tilt] { transform: none; }
  .decor-region { max-width: 100%; }
  .brand-zh { display: none; }
  .panel, .card { padding: 20px; }
  .topbar { gap: 8px; }
  .top-actions { gap: 4px; margin-left: auto; }
  .lang { padding-inline: 8px; font-size: 12px; }
  .btn-login { padding-inline: 14px; font-size: 13px; }
  .brand { gap: 7px; }
  .brand-en { font-size: 16px; }
  .brand-mark { width: 25px; height: 25px; }
}
@media (max-width: 350px) {
  :root { --gutter: 16px; }
  .brand-en { font-size: 14px; }
  .brand-mark { width: 22px; height: 22px; }
  .brand { gap: 5px; }
  .lang { padding-inline: 5px; }
  .btn-login { padding-inline: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
  .reveal, .reveal.pending, .reveal.shown { opacity: 1; transform: none; }
}