:root {
  --bg: #ffffff;
  --bg-panel: #f6f6f7;
  --bg-panel-2: #ededef;
  --border: #e4e4e7;
  --border-strong: #d6d6db;
  --accent: #8a2fc4;
  --accent-dark: #66208f;
  --accent-wash: #efe4f8;
  --accent-ring: rgba(138, 47, 196, 0.14);
  --accent-line: rgba(138, 47, 196, 0.30);
  --text: #0f0f12;
  --text-muted: #6b6b73;
  --text-faint: #a3a3ab;
  --success: #1c8a4a;
  --success-ink: #176d3b;
  --warn: #b26a00;
  --warn-ink: #875000;
  --error: #c8322b;
  --on-accent: #ffffff;
  --mask-solid: #000000;
  --clear: transparent;
  --veil: rgba(15, 15, 18, 0.18);

  --shadow-slab: 0 1px 2px rgba(15, 15, 18, 0.04), 0 10px 28px -8px rgba(15, 15, 18, 0.07), 0 40px 90px -28px rgba(15, 15, 18, 0.12);
  --shadow-cta: 0 1px 2px rgba(102, 32, 143, 0.20), 0 8px 18px -8px rgba(138, 47, 196, 0.45);
  --shadow-chip: 0 1px 1px rgba(15, 15, 18, 0.03);
  --shadow-key: inset 0 -1px 0 rgba(15, 15, 18, 0.06);
  --shadow-card: 0 1px 2px rgba(15, 15, 18, 0.04);
  --shadow-menu: 0 12px 32px rgba(15, 15, 18, 0.08);

  --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", "Hiragino Kaku Gothic ProN", "Apple SD Gothic Neo", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-strong: 600;
  --size-h1: clamp(34px, 3.2vw + 14px, 48px);
  --size-h2: clamp(22px, 1.4vw + 14px, 30px);
  --size-h3: 21px;
  --size-body: 16px;
  --size-small: 14px;
  --size-label: 13px;
  --track-tight: -0.02em;
  --track-brand: -0.01em;
  --track-code: 0.02em;
  --track-poster: -0.045em;
  --leading-body: 1.6;
  --leading-title: 1.12;
  --leading-copy: 1.8;

  --r-pill: 999px;
  --r-circle: 50%;
  --r-slab: 24px;
  --r-panel: 28px;
  --r-card: 20px;
  --r-mark: 8px;
  --r-shot: 10px;
  --r-small: 12px;
  --r-dot: 1px;
  --gutter: 32px;
  --reading-width: 800px;
  --content-width: 1120px;
  --header-width: 1376px;
  --header-height: 64px;
  --section-space: 96px;
  --touch-size: 44px;
  --focus-width: 2px;
  --focus-offset: 3px;
  --stroke: 1px;
  --motion-fast: 0.2s;
  --motion-reveal: 0.65s;
  --ease: ease;
  --reveal-distance: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}
html.nav-open { overflow: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--size-body);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
[hidden] { display: none !important; }
img, svg { max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button, a { -webkit-tap-highlight-color: var(--accent-ring); }
a { color: inherit; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, summary:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible,
[tabindex]:focus-visible {
  outline: var(--focus-width) solid var(--accent);
  outline-offset: var(--focus-offset);
}
button:disabled { cursor: not-allowed; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: var(--weight-regular);
  letter-spacing: var(--track-tight);
  text-wrap: balance;
  overflow-wrap: break-word;
}
h1 { margin: 0 0 28px; font-size: var(--size-h1); line-height: var(--leading-title); }
h2 { margin: 0 0 24px; font-size: var(--size-h2); line-height: 1.25; }
h3 { margin: 0 0 16px; font-size: var(--size-h3); line-height: 1.4; }
h4 { font-size: 18px; }
p { margin: 0 0 20px; }
strong { font-weight: var(--weight-strong); }
figure { margin: 0; }
code, pre, kbd { font-family: var(--font-mono); }
code { overflow-wrap: anywhere; font-size: 0.9em; }
pre {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  padding: 22px;
  border: var(--stroke) solid var(--border);
  border-radius: var(--r-small);
  background: var(--bg-panel);
  color: var(--text);
  line-height: 1.8;
  overscroll-behavior-inline: contain;
}
pre code { white-space: pre; overflow-wrap: normal; word-break: normal; font-size: 14px; }
hr { border: 0; border-top: var(--stroke) solid var(--border); margin-block: 40px; }
section[id], article[id], h2[id], h3[id] { scroll-margin-top: 24px; }
.nowrap { white-space: nowrap; }
.muted { color: var(--text-muted); }
.accent-text { color: var(--accent); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  inset-inline-start: 16px;
  top: 10px;
  opacity: 0;
  pointer-events: none;
  z-index: 100;
  padding: 12px 20px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--on-accent);
}
.skip-link:focus { opacity: 1; pointer-events: auto; }
.wrap {
  width: 100%;
  max-width: calc(var(--content-width) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.wrap-reading { max-width: calc(var(--reading-width) + var(--gutter) * 2); }
.section { padding-top: var(--section-space); padding-bottom: var(--section-space); }
.section-heading { max-width: 720px; margin-bottom: 40px; }
.grid-two, .grid-three {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}
.grid-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-two > *, .grid-three > *, .wrap > *, .prose > * { min-width: 0; }
.stack > * + * { margin-top: 24px; }
.prose { min-width: 0; line-height: var(--leading-copy); }
.prose :where(div, section, article, figure) { min-width: 0; max-width: 100%; }
.prose h2 { margin-top: 64px; }
.prose h3 { margin-top: 36px; }
.prose li + li { margin-top: 8px; }
.prose a:not(.btn):not(.app-store-button) { color: var(--accent-dark); }
.prose img { max-width: 100%; }
.prose blockquote { margin-inline: 0; }
.prose :where(ul, ol) { padding-inline-start: 24px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 24px;
  border: var(--stroke) solid var(--clear);
  border-radius: var(--r-pill);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: var(--weight-medium);
  line-height: 1.6;
  text-decoration: none;
  text-align: center;
  transition: background-color var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);
}
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-cta); }
.btn-primary:hover, .btn-primary.is-hover { background: var(--accent-dark); color: var(--on-accent); }
.btn-secondary { background: var(--bg-panel); color: var(--text); }
.btn-secondary:hover, .btn-secondary.is-hover { background: var(--bg-panel-2); color: var(--text); }
.btn-outline { border-color: var(--border); background: var(--bg); color: var(--text); }
.btn-outline:hover { background: var(--bg-panel); color: var(--text); }
.btn:disabled, .btn[aria-disabled="true"] {
  background: var(--bg-panel-2);
  color: var(--text-muted);
  border-color: var(--border);
  box-shadow: none;
}
.btn.is-focus { outline: var(--focus-width) solid var(--accent); outline-offset: var(--focus-offset); }
.cta { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-bottom: 22px; }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }

#site-header { position: relative; z-index: 50; }
.topbar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  max-width: min(100%, calc(var(--header-width) + var(--gutter) * 2));
  min-height: var(--header-height);
  margin-inline: auto;
  padding-inline: var(--gutter);
  background: var(--bg);
  color: var(--text);
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: var(--weight-medium);
  letter-spacing: var(--track-brand);
  text-decoration: none;
}
.brand-icon { display: block; width: 28px; height: 28px; border-radius: var(--r-circle); flex-shrink: 0; }
.wordmark-mark {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: var(--r-mark);
  border: var(--stroke) solid var(--border);
  background: linear-gradient(160deg, var(--bg-panel), var(--bg-panel-2));
  color: var(--text);
}
.routes { min-width: 0; margin-left: auto; }
.routes ul {
  display: flex;
  align-items: center;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}
.routes li { display: flex; align-items: center; }
.routes li + li::before {
  content: "·";
  padding-inline: 2px;
  color: var(--text-faint);
  font-size: 14px;
}
.routes a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  color: var(--text-muted);
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--motion-fast) var(--ease), background-color var(--motion-fast) var(--ease);
}
.routes a:hover { color: var(--text); }
.routes a[aria-current="page"] { background: var(--bg-panel); color: var(--text); }
.header-tools { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.language-picker { position: relative; }
.lang {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 5px 14px;
  border: var(--stroke) solid var(--border);
  border-radius: var(--r-pill);
  background: var(--bg);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 13px;
  white-space: nowrap;
}
.lang:hover { color: var(--text); border-color: var(--border-strong); }
.lang-short { display: none; }
.language-menu {
  position: absolute;
  z-index: 6;
  top: calc(100% + 10px);
  right: 0;
  width: 190px;
  margin: 0;
  padding: 8px;
  list-style: none;
  border: var(--stroke) solid var(--border);
  border-radius: var(--r-small);
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-menu);
}
.language-menu a {
  display: flex;
  align-items: center;
  min-height: var(--touch-size);
  padding: 10px 14px;
  border-radius: var(--r-mark);
  text-decoration: none;
}
.language-menu a:hover, .language-menu a[aria-current="true"] { background: var(--bg-panel); color: var(--text); }
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: var(--touch-size);
  min-height: var(--touch-size);
  padding: 10px;
  border: var(--stroke) solid var(--border);
  border-radius: var(--r-pill);
  background: var(--bg);
  color: var(--text);
}
.menu-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.mobile-drawer {
  position: absolute;
  top: 100%;
  inset-inline: 0;
  z-index: 5;
  max-height: calc(100dvh - var(--header-height));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px var(--gutter) 24px;
  border-block: var(--stroke) solid var(--border);
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-menu);
}
.mobile-drawer ul { list-style: none; margin: 0; padding: 0; }
.mobile-drawer li + li { border-top: var(--stroke) solid var(--border); }
.mobile-drawer a {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  color: var(--text-muted);
  text-decoration: none;
}
.mobile-drawer a:hover, .mobile-drawer a[aria-current] { background: var(--bg-panel); color: var(--text); }
.drawer-label { margin: 24px 14px 8px; color: var(--text-muted); font-size: var(--size-label); }
.menu-veil {
  position: fixed;
  inset: var(--header-height) 0 0;
  z-index: 1;
  border: 0;
  background: var(--veil);
  color: var(--text);
}

.card, .panel {
  min-width: 0;
  padding: 28px;
  border: var(--stroke) solid var(--border);
  border-radius: var(--r-card);
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-card);
}
.panel { border-radius: var(--r-panel); background: var(--bg-panel); color: var(--text); }
.card p:last-child, .panel p:last-child { margin-bottom: 0; }
.card > a.card-title { display: block; font-size: var(--size-h3); text-decoration: none; margin-bottom: 14px; }
.card > a.card-title:hover { color: var(--accent-dark); }
.grouped-list { list-style: none; margin: 0; padding: 0; border: var(--stroke) solid var(--border); border-radius: var(--r-card); background: var(--bg); color: var(--text); }
.grouped-list li + li { border-top: var(--stroke) solid var(--border); }
.grouped-list a { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 60px; padding: 18px 24px; text-decoration: none; }
.grouped-list a::after { content: "›"; flex-shrink: 0; color: var(--text-muted); }
.grouped-list a:hover { color: var(--accent-dark); }

.site-footer { border-top: var(--stroke) solid var(--border); padding-top: 64px; padding-bottom: 32px; background: var(--bg); color: var(--text); }
.footer-grid { display: grid; grid-template-columns: 1.35fr 0.8fr 1.4fr 0.7fr; gap: 40px; }
.footer-grid > * { min-width: 0; }
.footer-brand p { max-width: 300px; margin-top: 20px; color: var(--text-muted); font-size: 14px; }
.footer-heading { margin-bottom: 16px; font-size: 14px; font-weight: var(--weight-medium); }
.footer-links { margin: 0; padding: 0; list-style: none; }
.footer-links a { display: block; padding-block: 6px; color: var(--text-muted); text-decoration: none; overflow-wrap: break-word; font-size: 14px; }
.footer-links a:hover { color: var(--accent-dark); }
.footer-links a[aria-current="true"] { color: var(--text); }
.footer-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; margin-top: 48px; padding-top: 24px; border-top: var(--stroke) solid var(--border); color: var(--text-muted); font-size: 12px; }
.footer-bottom p { margin: 0; }
.footer-legal { display: flex; flex-wrap: wrap; gap: 16px; }
.footer-legal a { text-decoration: none; }

.reveal { opacity: 1; }
.reveal-ready .reveal:not(.shown) { opacity: 0; transform: translateY(var(--reveal-distance)); }
.reveal-ready .reveal { transition: opacity var(--motion-reveal) var(--ease), transform var(--motion-reveal) var(--ease); }
.reveal-ready .reveal.shown { opacity: 1; transform: none; }
.decorated, .graphic-panel, .lede, .slab-panel { overflow-x: clip; }

@media (max-width: 1100px) {
  .topbar { gap: 16px; }
  .topbar > .routes { display: none; }
  .header-tools { margin-left: auto; }
  .menu-toggle { display: inline-flex; }
  .lang { min-height: var(--touch-size); }
  .preview-topbar { flex-wrap: wrap; padding-top: 14px; padding-bottom: 8px; }
  .preview-topbar > .routes { display: block; order: 4; width: 100%; flex-basis: 100%; overflow-x: auto; margin-left: 0; }
  .preview-topbar .routes ul { width: max-content; }
}
@media (max-width: 900px) {
  :root { --gutter: 24px; --section-space: 72px; }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  h1, .lede h1 { font-size: clamp(24px, 4vw, 30px); }
}
@media (max-width: 640px) {
  :root { --gutter: 20px; --section-space: 56px; }
  .grid-two, .grid-three, .footer-grid { grid-template-columns: minmax(0, 1fr); }
  .card, .panel { padding: 22px; }
  .topbar { gap: 8px; }
  .wordmark { gap: 7px; font-size: 13px; }
  .header-tools { gap: 6px; margin-left: auto; }
  .lang { padding-inline: 10px; }
  .lang-full { display: none; }
  .lang-short { display: inline; }
  .tilt, [data-tilt] { transform: none !important; }
  .footer-grid { gap: 28px; }
  .footer-bottom { align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal-ready .reveal:not(.shown) { opacity: 1; transform: none; }
}
@media print {
  .header-tools, .mobile-drawer, .menu-veil, .dl-fab { display: none !important; }
  .reveal-ready .reveal:not(.shown) { opacity: 1; transform: none; }
}