:root {
  --color-bg: #F5F2EC;
  --color-surface: #FCFAF6;
  --color-surface-muted: #EAE5DC;
  --color-border: #DDD6CB;
  --color-accent: #7D5C8F;
  --color-accent-strong: #5F4370;
  --color-accent-soft: rgba(125, 92, 143, 0.12);
  --color-text: #2A2530;
  --color-text-muted: #6B6472;
  --color-success: #4E8B6A;
  --color-success-soft: rgba(78, 139, 106, 0.18);
  --color-warning: #C58A2E;
  --color-error: #B54A4A;
  --color-night: #262230;
  --color-night-panel: #2F2A3B;
  --color-lilac: #3B3448;
  --color-cream: #EFE9F3;
  --color-cream-80: rgba(239, 233, 243, 0.8);
  --color-cream-60: rgba(239, 233, 243, 0.6);
  --color-cream-30: rgba(239, 233, 243, 0.3);
  --color-cream-12: rgba(239, 233, 243, 0.12);
  --color-dots: rgba(239, 233, 243, 0.06);
  --color-flag-red: #C2504A;
  --color-flag-blue: #3C5A8A;
  --color-flag-white: #F7F4EE;
  --color-transparent: transparent;
  --font-display: 'Inter', 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Hiragino Sans', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --font-body: 'Inter', 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Hiragino Sans', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Menlo, Consolas, 'Liberation Mono', monospace;
  --radius-xs: 3px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-round: 999px;
  --header-height: 72px;
  --content-width: 1200px;
  --reading-width: 760px;
  --gutter: clamp(16px, 4vw, 64px);
  --section-space: clamp(64px, 9vw, 120px);
  --focus-width: 2px;
  --shadow-card: 0 1px 2px rgba(42, 37, 48, 0.05), 0 18px 40px -20px rgba(42, 37, 48, 0.2);
  --shadow-button: 0 1px 0 rgba(42, 37, 48, 0.08), 0 8px 18px -10px rgba(95, 67, 112, 0.55);
  --shadow-raised: 0 18px 60px -32px rgba(42, 37, 48, 0.35);
  --motion-fast: 150ms;
  --motion-normal: 420ms;
  --toc-offset: 132px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  margin: 0;
  padding: 0;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 16px);
}

html.nav-open {
  overflow: hidden;
}

body {
  min-width: 0;
  margin: 0;
  padding: 0;
  overflow-x: clip;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main,
section,
article,
aside,
header,
footer,
nav,
div {
  min-width: 0;
}

img,
picture,
video,
canvas,
svg {
  max-width: 100%;
}

img {
  display: block;
  height: auto;
}

svg {
  display: block;
  flex-shrink: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
summary,
[role="tab"] {
  color: inherit;
}

button,
select {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

p,
ul,
ol,
dl,
blockquote,
pre,
figure {
  margin-top: 0;
}

ul[role="list"],
ol[role="list"],
.site-nav ul,
.mobile-nav ul,
.footer-links,
.footer-keywords,
.footer-languages,
.trust,
.kit-items {
  margin: 0;
  padding: 0;
  list-style: none;
}

h1,
h2,
h3,
h4 {
  color: var(--color-text);
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.18;
  text-wrap: balance;
}

h1 {
  margin: 0;
  font-size: clamp(52px, 5.2vw, 66px);
  letter-spacing: -0.015em;
}

h2 {
  margin: 0 0 24px;
  font-size: clamp(34px, 4vw, 48px);
  letter-spacing: -0.012em;
}

h3 {
  margin: 0 0 14px;
  font-size: clamp(22px, 2.5vw, 28px);
  letter-spacing: -0.008em;
}

h4 {
  margin: 0 0 10px;
  font-size: 18px;
}

p:last-child {
  margin-bottom: 0;
}

strong {
  font-weight: 600;
}

small {
  font-size: 0.875rem;
}

code,
kbd,
samp,
pre {
  font-family: var(--font-mono);
}

code {
  overflow-wrap: anywhere;
}

pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-night);
  color: var(--color-cream);
  -webkit-overflow-scrolling: touch;
}

pre code {
  overflow-wrap: normal;
  white-space: pre;
}

::selection {
  background: var(--color-accent);
  color: var(--color-surface);
}

:where(a, button, input, select, textarea, summary, [role="tab"]):focus-visible {
  outline: var(--focus-width) solid var(--color-accent);
  outline-offset: 3px;
}

.no-break {
  white-space: nowrap;
}

.wrap {
  width: 100%;
  max-width: calc(var(--content-width) + (var(--gutter) * 2));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.reading-wrap {
  width: 100%;
  max-width: calc(var(--reading-width) + (var(--gutter) * 2));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-top: var(--section-space);
  padding-bottom: var(--section-space);
}

.section-compact {
  padding-top: clamp(44px, 6vw, 72px);
  padding-bottom: clamp(44px, 6vw, 72px);
}

.section-night {
  position: relative;
  overflow-x: clip;
  background-color: var(--color-night);
  background-image: radial-gradient(var(--color-dots) 1px, var(--color-transparent) 1.2px);
  background-size: 12px 12px;
  color: var(--color-cream);
}

.section-night h2,
.section-night h3,
.section-night h4 {
  color: var(--color-cream);
}

.section-night p {
  color: var(--color-cream-80);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-night .eyebrow {
  color: var(--color-cream-60);
}

.lede {
  max-width: 680px;
  margin: 22px 0 0;
  color: var(--color-text-muted);
  font-size: clamp(17px, 2vw, 20px);
  line-height: 1.65;
}

.lede strong {
  color: var(--color-text);
  font-weight: 500;
}

.badge,
.tag,
.fact-pill {
  display: inline-flex;
  min-height: 30px;
  max-width: 100%;
  align-items: center;
  gap: 9px;
  padding: 4px 11px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 13px;
  line-height: 1.45;
}

.badge-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: var(--radius-round);
  background: var(--color-success);
  box-shadow: 0 0 0 3px var(--color-success-soft);
}

.tag {
  min-height: 26px;
  padding: 2px 9px;
  background: var(--color-accent-soft);
  color: var(--color-accent-strong);
  font-family: var(--font-mono);
  font-size: 11px;
}

.fact-pill {
  color: var(--color-accent-strong);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

[data-counter] {
  display: inline-block;
  min-width: 3ch;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.btn {
  display: inline-flex;
  min-width: 24px;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 26px;
  border: 1px solid var(--color-transparent);
  border-radius: var(--radius-sm);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.01em;
  text-align: center;
  transition:
    color var(--motion-fast) ease,
    background-color var(--motion-fast) ease,
    border-color var(--motion-fast) ease,
    transform var(--motion-fast) ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: var(--color-surface);
  box-shadow: var(--shadow-button);
}

.btn-primary:hover {
  border-color: var(--color-accent-strong);
  background: var(--color-accent-strong);
}

.btn-secondary {
  border-color: var(--color-text);
  background: var(--color-text);
  color: var(--color-surface);
}

.btn-secondary:hover {
  background: var(--color-night-panel);
}

.btn-ghost {
  border-color: var(--color-text);
  background: var(--color-transparent);
  color: var(--color-text);
}

.btn-ghost:hover {
  background: var(--color-text);
  color: var(--color-surface);
}

.btn-light {
  border-color: var(--color-cream);
  background: var(--color-cream);
  color: var(--color-night);
}

.btn-disabled,
.btn:disabled {
  border-color: var(--color-border);
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.card,
.panel {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.card {
  padding: clamp(22px, 3vw, 34px);
}

.panel {
  padding: clamp(24px, 4vw, 42px);
}

.grid {
  display: grid;
  gap: 24px;
}

.grid > * {
  min-width: 0;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.reveal {
  transition:
    opacity var(--motion-normal) ease,
    transform var(--motion-normal) ease;
}

.reveal.pending {
  opacity: 0;
  transform: translateY(16px);
}

.reveal.shown {
  opacity: 1;
  transform: translateY(0);
}

.site-header {
  position: relative;
  z-index: 50;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}

.header-inner {
  display: flex;
  height: var(--header-height);
  align-items: center;
  gap: 40px;
  padding-inline: var(--gutter);
}

.site-brand {
  display: inline-flex;
  min-height: 44px;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.site-brand img {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
}

.brand-name {
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand-local {
  color: var(--color-text-muted);
  font-weight: 400;
}

.site-nav {
  flex: 1 1 auto;
}

.site-nav ul {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
}

.site-nav li {
  display: inline-flex;
  align-items: center;
  color: var(--color-text-muted);
  font-size: 15px;
}

.site-nav li + li::before {
  content: "·";
  margin-inline: 14px;
  color: var(--color-border);
  font-weight: 700;
}

.site-nav a {
  min-height: 32px;
  padding: 4px 2px;
  border-bottom: 1px solid var(--color-transparent);
  transition: color var(--motion-fast) ease;
}

.site-nav a:hover,
.site-nav .is-active a {
  color: var(--color-text);
}

.site-nav .is-active a {
  border-bottom-color: var(--color-accent);
  font-weight: 500;
}

.header-tools {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 16px;
}

.login-link {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 6px 18px;
  border: 1px solid var(--color-text);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 14px;
  font-weight: 500;
  transition:
    color var(--motion-fast) ease,
    background-color var(--motion-fast) ease;
}

.login-link:hover {
  background: var(--color-text);
  color: var(--color-surface);
}

.language-menu {
  position: relative;
}

.language-toggle {
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 0 6px 16px;
  border: 0;
  border-left: 1px solid var(--color-border);
  background: var(--color-transparent);
  color: var(--color-text-muted);
  font-size: 14px;
}

.language-list {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 55;
  display: none;
  width: 164px;
  margin: 0;
  padding: 7px;
  list-style: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  box-shadow: var(--shadow-raised);
}

.language-menu.is-open .language-list {
  display: block;
}

.language-list a {
  display: flex;
  min-height: 40px;
  align-items: center;
  padding: 7px 10px;
  border-radius: var(--radius-xs);
  font-size: 14px;
}

.language-list a:hover,
.language-list a[aria-current="true"] {
  background: var(--color-surface-muted);
}

.menu-toggle {
  display: none;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}

.menu-toggle svg {
  width: 20px;
  height: 20px;
}

.mobile-nav {
  display: none;
}

.mobile-nav-backdrop {
  display: none;
}

.site-footer {
  position: relative;
  overflow-x: clip;
  border-top: 1px solid var(--color-cream-12);
  background-color: var(--color-night);
  background-image: radial-gradient(var(--color-dots) 1px, var(--color-transparent) 1.2px);
  background-size: 12px 12px;
  color: var(--color-cream);
}

.footer-inner {
  padding-top: 64px;
  padding-bottom: 28px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1.2fr 1fr;
  gap: 44px;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.footer-brand img {
  width: 34px;
  height: 34px;
}

.footer-brand strong {
  font-family: var(--font-display);
  font-size: 20px;
}

.footer-copy {
  max-width: 330px;
  color: var(--color-cream-60);
  font-size: 14px;
}

.footer-heading {
  margin: 0 0 14px;
  color: var(--color-cream);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.07em;
}

.footer-links,
.footer-keywords,
.footer-languages {
  display: grid;
  gap: 7px;
}

.footer-links a,
.footer-keywords a,
.footer-languages a {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  color: var(--color-cream-60);
  font-size: 14px;
}

.footer-links a:hover,
.footer-keywords a:hover,
.footer-languages a:hover {
  color: var(--color-cream);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 46px;
  padding-top: 20px;
  border-top: 1px solid var(--color-cream-12);
  color: var(--color-cream-60);
  font-size: 13px;
}

.footer-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.footer-legal a {
  min-height: 24px;
}

@media (max-width: 1180px) {
  .header-inner {
    gap: 28px;
  }

  .site-nav li + li::before {
    margin-inline: 9px;
  }

  .site-nav li {
    font-size: 14px;
  }
}

@media (max-width: 1024px) {
  .language-menu {
    display: none;
  }

  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .site-nav {
    display: none;
  }

  .header-tools {
    margin-left: auto;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .mobile-nav {
    position: absolute;
    top: var(--header-height);
    right: 0;
    left: 0;
    z-index: 54;
    max-height: calc(100dvh - var(--header-height));
    overflow-y: auto;
    overscroll-behavior: contain;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
    box-shadow: var(--shadow-raised);
  }

  .site-header.menu-open .mobile-nav {
    display: block;
  }

  .mobile-nav ul {
    padding: 10px var(--gutter) 18px;
  }

  .mobile-nav a {
    display: flex;
    width: 100%;
    min-height: 48px;
    align-items: center;
    padding: 11px 4px;
    border-bottom: 1px solid var(--color-border);
  }

  .mobile-nav .is-active a {
    color: var(--color-accent-strong);
    font-weight: 600;
  }

  .mobile-language-label {
    margin: 18px 4px 6px;
    color: var(--color-text-muted);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.07em;
  }

  .mobile-nav-backdrop {
    position: fixed;
    inset: var(--header-height) 0 0;
    z-index: 45;
    border: 0;
    background: var(--color-cream-30);
  }

  .site-header.menu-open + .mobile-nav-backdrop {
    display: block;
  }
}

@media (max-width: 768px) {
  h1 {
    font-size: clamp(28px, 9vw, 40px);
    line-height: 1.12;
  }

  h2 {
    font-size: clamp(28px, 8vw, 38px);
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: minmax(0, 1fr);
  }

  .footer-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }

  .footer-bottom {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  :root {
    --gutter: 18px;
  }

  .header-inner {
    gap: 12px;
  }

  .brand-name {
    font-size: 17px;
  }

  .login-link {
    min-height: 40px;
    padding-inline: 13px;
  }

  .tilt,
  [class*="tilt-"] {
    transform: none;
  }

  .badge {
    height: auto;
    min-height: 30px;
    white-space: normal;
  }

  .btn {
    padding-inline: 20px;
  }
}

@media (max-width: 360px) {
  :root {
    --gutter: 16px;
  }

  .header-inner {
    gap: 8px;
  }

  .site-brand {
    gap: 7px;
  }

  .site-brand img {
    width: 28px;
    height: 28px;
  }

  .login-link {
    padding-inline: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }

  .reveal,
  .reveal.pending {
    opacity: 1;
    transform: none;
  }
}