:root {
  --color-bg: #E9F4F6;
  --color-panel: #F6FBFC;
  --color-panel-strong: #DCEDF0;
  --color-border: #C6DDE3;
  --color-accent: #6C4FE0;
  --color-accent-dark: #5238BF;
  --color-accent-light: #8A6FF0;
  --color-text: #1E2A44;
  --color-text-muted: #5A6B85;
  --color-success: #1F9D6C;
  --color-warning: #DE8F1F;
  --color-error: #D8434E;
  --color-white: #FFFFFF;
  --color-teal: #2E9C8F;
  --color-direct: #3FA08F;
  --color-relay: #D9A15B;
  --color-dedicated: #9B85EA;
  --color-flag-red: #D0342C;
  --color-flag-blue: #2F4C9B;
  --color-flag-navy: #27367A;
  --color-overlay: rgba(30, 42, 68, .34);
  --color-accent-soft: rgba(108, 79, 224, .12);
  --color-accent-glow: rgba(108, 79, 224, .26);
  --color-teal-glow: rgba(46, 156, 143, .14);
  --color-shadow: rgba(30, 42, 68, .12);
  --color-shadow-soft: rgba(30, 42, 68, .07);
  --font-display: 'Inter', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-body: 'Inter', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Courier New', monospace;
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 30px;
  --radius-pill: 999px;
  --shadow-low: 0 6px 14px var(--color-shadow-soft);
  --shadow-mid: 0 14px 30px var(--color-shadow);
  --shadow-accent: 0 12px 24px rgba(108, 79, 224, .32);
  --content-width: 1224px;
  --prose-width: 780px;
  --header-height: 68px;
  --gutter: 32px;
  --section-space: 96px;
  --focus-ring: 2px solid var(--color-accent);
  --motion-fast: 180ms;
  --motion-base: 420ms;
  --line-body: 1.75;
  --toc-offset: 92px;
}

*,
*::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: 320px;
  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: var(--line-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

img {
  height: auto;
}

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

button,
summary,
[role="tab"] {
  cursor: pointer;
}

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

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

p:last-child,
ul:last-child,
ol:last-child {
  margin-bottom: 0;
}

ul,
ol {
  padding-inline-start: 1.35em;
}

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

:not(pre) > code {
  max-width: 100%;
  padding: .12em .38em;
  overflow-wrap: anywhere;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xs);
  background: var(--color-panel-strong);
  font-size: .9em;
}

pre {
  max-width: 100%;
  margin: 24px 0;
  padding: 20px;
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-text);
  color: var(--color-panel);
  -webkit-overflow-scrolling: touch;
}

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

hr {
  margin: 48px 0;
  border: 0;
  border-top: 1px solid var(--color-border);
}

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

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

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

.prose {
  width: 100%;
  max-width: var(--prose-width);
  margin-inline: auto;
}

.prose p,
.prose li {
  color: var(--color-text-muted);
}

.prose a:not(.btn):not(.btn-primary):not(.btn-secondary) {
  color: var(--color-accent-dark);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: .08em;
  text-underline-offset: .2em;
}

.prose h2 {
  margin: 64px 0 18px;
}

.prose h3 {
  margin: 38px 0 14px;
}

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

h1 {
  margin: 0;
  font-size: clamp(52px, 5.2vw, 72px);
  font-weight: 800;
  letter-spacing: -.015em;
  line-height: 1.12;
}

h2 {
  margin: 0;
  font-size: clamp(34px, 4vw, 50px);
  font-weight: 800;
  letter-spacing: -.012em;
  line-height: 1.16;
}

h3 {
  margin: 0;
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 780;
  line-height: 1.28;
}

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

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

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.grad-word {
  background: linear-gradient(98deg, var(--color-accent-light), var(--color-accent-dark));
  background-clip: text;
  color: transparent;
  -webkit-background-clip: text;
}

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

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

.section-head {
  max-width: 760px;
  margin-bottom: 38px;
}

.section-kicker {
  margin-bottom: 10px;
  color: var(--color-accent-dark);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.section-intro {
  margin-top: 16px;
  color: var(--color-text-muted);
  font-size: 18px;
  line-height: 1.75;
}

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

.panel-strong {
  background: var(--color-panel-strong);
}

.badge,
.fact-chip,
.tag {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 5px 12px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-panel);
  color: var(--color-text);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

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

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

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

.btn,
.btn-primary,
.btn-secondary,
.btn-login {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 26px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-weight: 750;
  line-height: 1.2;
  text-align: center;
  transition:
    transform var(--motion-fast) ease,
    box-shadow var(--motion-fast) ease,
    background-color var(--motion-fast) ease,
    border-color var(--motion-fast) ease,
    color var(--motion-fast) ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
  box-shadow: var(--shadow-accent);
  color: var(--color-white);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(108, 79, 224, .38);
}

.btn-secondary {
  border-color: var(--color-border);
  background: var(--color-white);
  box-shadow: var(--shadow-low);
  color: var(--color-text);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  border-color: var(--color-accent);
}

.btn-login {
  min-height: 38px;
  padding: 8px 20px;
  border-color: var(--color-accent);
  color: var(--color-accent);
  font-size: 14px;
}

.btn-login:hover {
  background: var(--color-accent);
  color: var(--color-white);
}

.btn-small {
  min-height: 38px;
  padding: 8px 18px;
  font-size: 14px;
}

.icon-inline {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.site-nav {
  position: relative;
  z-index: 90;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
}

.site-nav__inner {
  display: flex;
  min-height: var(--header-height);
  align-items: center;
  gap: 26px;
}

.site-brand {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 820;
  letter-spacing: .01em;
}

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

.site-brand__local {
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: 620;
}

.site-nav__links {
  display: flex;
  align-items: center;
  gap: 25px;
  margin-left: auto;
}

.site-nav__links a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
}

.site-nav__links a:hover,
.site-nav__links a.is-active,
.site-nav__links a[aria-current="page"] {
  color: var(--color-text);
  font-weight: 800;
}

.site-nav__tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.language-control {
  position: relative;
}

.language-button,
.menu-toggle {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--color-text-muted);
  font-weight: 700;
}

.language-button {
  padding: 8px;
  white-space: nowrap;
}

.language-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 102;
  display: none;
  width: 180px;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-white);
  box-shadow: var(--shadow-mid);
}

.language-control.is-open .language-menu {
  display: grid;
}

.language-menu a {
  display: flex;
  min-height: 44px;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: 650;
}

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

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

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

.mobile-nav {
  position: absolute;
  top: 100%;
  right: var(--gutter);
  left: var(--gutter);
  z-index: 101;
  display: none;
  max-height: calc(100dvh - var(--header-height));
  padding: 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--color-border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  background: var(--color-panel);
  box-shadow: var(--shadow-mid);
}

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

.mobile-nav a {
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-weight: 700;
}

.mobile-nav a:hover,
.mobile-nav a.is-active {
  background: var(--color-panel-strong);
  color: var(--color-text);
}

.mobile-nav__languages {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--color-border);
}

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

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

.site-footer {
  margin-top: 80px;
  padding-top: 58px;
  padding-bottom: 28px;
  border-top: 1px solid var(--color-border);
  background: var(--color-panel-strong);
}

.site-footer__grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1.25fr;
  gap: 48px;
}

.site-footer__brand p {
  max-width: 380px;
  margin-top: 18px;
  color: var(--color-text-muted);
}

.site-footer__title {
  margin-bottom: 14px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .08em;
}

.site-footer__links,
.site-footer__hot,
.site-footer__languages {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.site-footer__links {
  flex-direction: column;
  align-items: flex-start;
}

.site-footer a {
  min-height: 28px;
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: 620;
}

.site-footer a:hover {
  color: var(--color-accent-dark);
}

.site-footer__hot a,
.site-footer__languages a {
  display: inline-flex;
  align-items: center;
}

.site-footer__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 40px;
  padding-top: 22px;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 13px;
}

.site-footer__legal {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

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

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

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

.motion-ticker {
  max-width: 100%;
  overflow: hidden;
}

.motion-ticker-track {
  display: flex;
  width: max-content;
  align-items: center;
  will-change: transform;
}

@media (max-width: 640px) {
  .no-break {
    white-space: normal;
  }

  .badge,
  .fact-chip,
  .tag {
    overflow: visible;
    white-space: normal;
  }

  .motion-ticker {
    padding-inline: var(--gutter);
    overflow: visible;
  }

  .motion-ticker-track {
    width: 100%;
    flex-wrap: wrap;
    transform: none !important;
  }
}

.tilt-card {
  transform: rotate(-.35deg);
}

body:has(.toc-tabs) section[id] {
  scroll-margin-top: var(--toc-offset);
}

@media (max-width: 1080px) {
  .site-nav__inner {
    gap: 16px;
  }

  .site-nav__links {
    gap: 15px;
  }

  .site-nav__links a {
    font-size: 13px;
  }

  .site-footer__grid {
    grid-template-columns: 1fr 1fr;
  }

  .site-footer__brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  :root {
    --header-height: 64px;
    --section-space: 72px;
  }

  .site-nav__links,
  .language-control {
    display: none;
  }

  .site-nav__tools {
    margin-left: auto;
  }

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

  .btn-login {
    min-width: 64px;
    padding-inline: 15px;
  }

  .site-footer__grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .site-footer__brand {
    grid-column: auto;
  }
}

@media (max-width: 768px) {
  h1 {
    font-size: clamp(32px, 9vw, 40px);
    line-height: 1.14;
    letter-spacing: -.01em;
  }

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

  .section-intro {
    font-size: 16px;
  }

  .site-footer__bottom {
    align-items: flex-start;
    flex-direction: column;
  }
}

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

  body {
    font-size: 15px;
  }

  .wrap {
    padding-inline: var(--gutter);
  }

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

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

  .btn,
  .btn-primary,
  .btn-secondary {
    min-height: 46px;
    padding-inline: 21px;
  }

  .site-brand__local {
    display: none;
  }

  .site-nav__tools {
    gap: 6px;
  }

  .mobile-nav {
    right: var(--gutter);
    left: var(--gutter);
  }

  .site-footer {
    margin-top: 56px;
  }
}

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

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

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

  .btn-login {
    min-width: 58px;
    padding-inline: 12px;
  }
}

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

  *,
  *::before,
  *::after {
    scroll-duration: 0s;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }

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