:root {
  --color-canvas: #FFFFFF;
  --color-panel: #FAFAFB;
  --color-panel-strong: #F3F4F6;
  --color-border: #E4E6EA;
  --color-divider: #C9CDD4;
  --color-accent: #16A34A;
  --color-accent-deep: #0E7A38;
  --color-text: #17181C;
  --color-text-muted: #5B616B;
  --color-info: #2563EB;
  --color-warning: #D97706;
  --color-error: #DC2626;
  --color-overlay: rgba(23, 24, 28, 0.38);
  --color-shadow-soft: rgba(23, 24, 28, 0.05);
  --color-shadow-wide: rgba(23, 24, 28, 0.07);
  --color-shadow-button: rgba(23, 24, 28, 0.18);
  --color-accent-soft: rgba(22, 163, 74, 0.09);
  --color-info-soft: rgba(37, 99, 235, 0.08);
  --color-warning-soft: rgba(217, 119, 6, 0.09);
  --color-error-soft: rgba(220, 38, 38, 0.08);
  --color-flag-red: #C4372E;
  --color-flag-blue: #2B3F6C;
  --font-display: 'Inter', 'Noto Sans SC', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-body: 'Inter', 'Noto Sans SC', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, 'Courier New', monospace;
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;
  --shadow-card: 0 1px 2px var(--color-shadow-soft), 0 14px 36px var(--color-shadow-wide);
  --shadow-button: 0 6px 16px var(--color-shadow-button);
  --content-width: 1240px;
  --reading-width: 780px;
  --header-height: 64px;
  --toc-sticky-top: 76px;
  --gutter: clamp(16px, 3vw, 40px);
  --section-space: clamp(64px, 9vw, 116px);
  --transition-fast: 150ms ease;
  --transition-reveal: 620ms cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
  background: var(--color-canvas);
  color: var(--color-text);
  font-family: var(--font-body);
  -webkit-text-size-adjust: 100%;
}

html.nav-open {
  overflow: hidden;
}

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

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

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

img {
  height: auto;
}

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

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

button {
  border: 0;
  cursor: pointer;
}

ul,
ol {
  margin-top: 0;
}

table {
  border-collapse: collapse;
}

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

code {
  overflow-wrap: anywhere;
}

pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 20px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-panel-strong);
  line-height: 1.65;
  white-space: pre;
  -webkit-overflow-scrolling: touch;
}

pre code {
  overflow-wrap: normal;
}

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

:focus-visible {
  outline: 3px solid var(--color-info-soft);
  outline-offset: 3px;
}

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

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

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

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

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

.panel-section,
.hero-preview,
.preview-band,
.end-promo {
  overflow-x: clip;
}

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

h1,
h2,
h3,
h4 {
  margin-top: 0;
  color: var(--color-text);
  font-family: var(--font-display);
  text-wrap: balance;
}

h1,
.display-title {
  font-size: clamp(52px, 5.4vw, 72px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

h2 {
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 800;
  letter-spacing: -0.018em;
  line-height: 1.16;
}

h3 {
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 750;
  letter-spacing: -0.012em;
  line-height: 1.25;
}

h4 {
  font-size: 1.05rem;
  font-weight: 750;
}

p {
  margin-top: 0;
}

.lead {
  max-width: 720px;
  color: var(--color-text-muted);
  font-size: clamp(18px, 2vw, 22px);
  line-height: 1.72;
}

.muted {
  color: var(--color-text-muted);
}

.text-link {
  color: var(--color-info);
  font-weight: 650;
}

.text-link:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.mono {
  font-family: var(--font-mono);
}

.card,
.panel {
  min-width: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-canvas);
}

.card {
  box-shadow: 0 1px 2px var(--color-shadow-soft);
}

.panel {
  box-shadow: var(--shadow-card);
}

.btn,
.btn-primary,
.btn-secondary,
.btn-small,
.login-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-primary {
  padding: 15px 30px;
  border: 1px solid var(--color-text);
  background: var(--color-text);
  color: var(--color-canvas);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-button);
}

.btn-secondary {
  padding: 14px 26px;
  border: 1px solid var(--color-border);
  background: var(--color-canvas);
  color: var(--color-text);
}

.btn-secondary:hover,
.login-button:hover {
  border-color: var(--color-divider);
  background: var(--color-panel-strong);
}

.btn-small {
  min-height: 38px;
  padding: 9px 16px;
  border: 1px solid var(--color-border);
  background: var(--color-canvas);
  color: var(--color-text);
  font-size: 0.875rem;
}

.btn[aria-disabled="true"],
.btn-primary:disabled,
.btn-secondary:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
  box-shadow: none;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.badge,
.status-badge,
.tag {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  padding: 5px 11px;
  background: var(--color-canvas);
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.25;
}

.badge-dot,
.status-dot,
.icon-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--color-accent);
}

.badge.info .badge-dot {
  background: var(--color-info);
}

.badge.warn .badge-dot {
  background: var(--color-warning);
}

.status-badge.success {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
  color: var(--color-accent-deep);
}

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

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

.reveal.shown {
  opacity: 1;
  transform: none;
}

.site-top {
  position: relative;
  z-index: 100;
  height: var(--header-height);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-canvas);
}

.site-shell {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  gap: 28px;
  padding-inline: var(--gutter);
}

.site-brand {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 10px;
  color: var(--color-text);
  font-weight: 800;
}

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

.brand-copy {
  display: flex;
  align-items: baseline;
  gap: 7px;
  line-height: 1;
}

.brand-main {
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.brand-sub {
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: 550;
}

.desktop-nav {
  display: flex;
  align-items: center;
}

.desktop-nav a {
  color: var(--color-text-muted);
  font-size: 0.84rem;
  font-weight: 550;
  white-space: nowrap;
  transition: color var(--transition-fast);
}

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

.desktop-nav a.is-active {
  font-weight: 750;
}

.desktop-nav a + a::before {
  content: "·";
  display: inline-block;
  margin-inline: 13px;
  color: var(--color-divider);
  font-weight: 800;
}

.header-tools {
  display: flex;
  margin-left: auto;
  flex-shrink: 0;
  align-items: center;
  gap: 10px;
}

.lang-menu {
  position: relative;
}

.lang-trigger,
.menu-toggle {
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius-sm);
  background: var(--color-canvas);
  color: var(--color-text-muted);
}

.lang-trigger {
  padding-inline: 10px;
  font-size: 0.8rem;
}

.lang-trigger:hover,
.menu-toggle:hover {
  background: var(--color-panel-strong);
  color: var(--color-text);
}

.lang-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: none;
  width: 164px;
  padding: 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-canvas);
  box-shadow: var(--shadow-card);
}

.lang-menu.is-open .lang-popover {
  display: block;
}

.lang-popover a {
  display: flex;
  min-height: 40px;
  align-items: center;
  border-radius: var(--radius-xs);
  padding: 8px 10px;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.lang-popover a:hover,
.lang-popover a[aria-current="true"] {
  background: var(--color-panel-strong);
  color: var(--color-text);
}

.login-button {
  min-height: 38px;
  padding: 8px 18px;
  border: 1px solid var(--color-border);
  background: var(--color-canvas);
  color: var(--color-text);
  font-size: 0.84rem;
}

.menu-toggle {
  display: none;
  position: relative;
}

.menu-toggle span,
.menu-toggle::before,
.menu-toggle::after {
  position: absolute;
  left: 12px;
  width: 20px;
  height: 2px;
  border-radius: var(--radius-pill);
  background: var(--color-text);
  content: "";
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.menu-toggle::before {
  top: 14px;
}

.menu-toggle span {
  top: 21px;
}

.menu-toggle::after {
  top: 28px;
}

.menu-toggle[aria-expanded="true"]::before {
  top: 21px;
  transform: rotate(45deg);
}

.menu-toggle[aria-expanded="true"] span {
  opacity: 0;
}

.menu-toggle[aria-expanded="true"]::after {
  top: 21px;
  transform: rotate(-45deg);
}

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

.mobile-nav.is-open {
  display: block;
}

.mobile-nav ul {
  margin: 0;
  padding: 8px var(--gutter) 14px;
  list-style: none;
}

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

.mobile-nav a.is-active {
  color: var(--color-text);
}

.mobile-nav .mobile-language-label {
  margin: 16px 4px 5px;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
}

.nav-veil {
  position: fixed;
  z-index: 90;
  inset: var(--header-height) 0 0;
  display: none;
  background: var(--color-overlay);
}

.nav-veil.is-open {
  display: block;
}

.site-footer {
  border-top: 1px solid var(--color-border);
  background: var(--color-panel);
}

.footer-main {
  display: grid;
  grid-template-columns: minmax(240px, 1.35fr) repeat(3, minmax(150px, 1fr));
  gap: 48px;
  padding-top: 56px;
  padding-bottom: 42px;
}

.footer-brand {
  max-width: 350px;
}

.footer-brand .site-brand {
  margin-bottom: 16px;
}

.footer-brand p {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.footer-column h2 {
  margin-bottom: 14px;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.footer-links {
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-links li + li {
  margin-top: 8px;
}

.footer-links a {
  color: var(--color-text-muted);
  font-size: 0.88rem;
}

.footer-links a:hover {
  color: var(--color-text);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid var(--color-border);
  padding-top: 20px;
  padding-bottom: 24px;
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

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

.prose {
  color: var(--color-text);
  font-size: 1rem;
  line-height: 1.82;
}

.prose h2,
.prose h3 {
  scroll-margin-top: calc(var(--toc-sticky-top) + 70px);
}

.prose h2 {
  margin-top: 2.2em;
  margin-bottom: 0.7em;
}

.prose h3 {
  margin-top: 1.7em;
  margin-bottom: 0.6em;
}

.prose p,
.prose ul,
.prose ol {
  margin-bottom: 1.15em;
}

.prose a {
  color: var(--color-info);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.prose img {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.prose > table {
  max-width: 100%;
}

body:has(.toc-tabs) section[id] {
  scroll-margin-top: calc(var(--toc-sticky-top) + 72px);
}

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

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

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

@media (max-width: 820px) {
  h1,
  .display-title {
    font-size: clamp(32px, 9.5vw, 40px);
    letter-spacing: -0.018em;
  }

  h2 {
    font-size: clamp(28px, 7vw, 36px);
  }

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

  .footer-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  :root {
    --gutter: 16px;
    --toc-sticky-top: 66px;
  }

  .site-top {
    height: 58px;
  }

  .site-shell {
    gap: 8px;
  }

  .brand-sub,
  .desktop-lang-menu {
    display: none;
  }

  .header-tools {
    margin-left: auto;
    gap: 5px;
  }

  .login-button {
    min-height: 36px;
    padding-inline: 13px;
  }

  .mobile-nav {
    top: 58px;
    max-height: calc(100dvh - 58px);
  }

  .nav-veil {
    inset-block-start: 58px;
  }

  .button-row,
  .cta-row {
    align-items: stretch;
  }

  .button-row .btn-primary,
  .button-row .btn-secondary {
    flex: 1 1 140px;
  }

  .footer-main {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .footer-brand {
    grid-column: auto;
  }

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

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

  .decorative-orb,
  .decorative-disc,
  .decorative-watermark {
    display: none;
  }
}

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

  *,
  *::before,
  *::after {
    scroll-behavior: auto;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

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