:root {
  --color-bg: #0C2018;
  --color-panel: #12291F;
  --color-panel-raised: #183226;
  --color-border: #26453A;
  --color-border-hover: #315647;
  --color-accent: #E97E3C;
  --color-accent-dark: #C05F24;
  --color-text: #EEF4EE;
  --color-text-muted: #9DB3A6;
  --color-success: #55C98A;
  --color-warning: #E3B341;
  --color-error: #E0604F;
  --color-flag-red: #CE3B30;
  --color-flag-white: #F2F5F1;
  --color-flag-navy: #2C3E76;
  --color-flag-blue: #2F4FA2;
  --color-transparent: transparent;
  --shadow-panel: 0 22px 48px -18px rgb(0 0 0 / 55%), 0 6px 18px -8px rgb(0 0 0 / 40%);
  --shadow-float: 0 12px 30px -10px rgb(0 0 0 / 60%);
  --glow-accent: 0 0 18px rgb(233 126 60 / 20%);
  --font-display: Georgia, "Times New Roman", "Noto Serif SC", "Songti SC", "SimSun", serif;
  --font-body: "Inter", "Noto Sans SC", -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Courier New", monospace;
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-pill: 999px;
  --header-height: 64px;
  --content-max: 1248px;
  --wide-max: 1360px;
  --reading-max: 800px;
  --gutter: clamp(16px, 3vw, 32px);
  --section-space: clamp(64px, 9vw, 112px);
  --focus-width: 2px;
  --transition-fast: 180ms ease;
  --transition-medium: 280ms ease;
  --toc-offset: 92px;
  color-scheme: dark;
}

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

html {
  min-width: 320px;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 16px);
  background: var(--color-bg);
}

html.nav-open {
  overflow: hidden;
}

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

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

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

img {
  height: auto;
}

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

button {
  border: 0;
}

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

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

p {
  margin-bottom: 1.15em;
}

ul,
ol {
  padding-left: 1.35em;
}

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

:not(pre) > code {
  overflow-wrap: anywhere;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xs);
  background: var(--color-panel);
  padding: 0.12em 0.38em;
  color: var(--color-text);
  font-size: 0.88em;
}

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

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

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

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

h1,
h2 {
  font-family: var(--font-display);
  font-weight: 400;
}

h1 {
  margin: 0 0 20px;
  font-size: clamp(52px, 5vw, 72px);
  line-height: 1.12;
  letter-spacing: 0.01em;
}

h2 {
  margin: 0 0 18px;
  font-size: clamp(34px, 4vw, 50px);
  line-height: 1.18;
}

h3 {
  margin: 0 0 12px;
  font-size: clamp(21px, 2vw, 27px);
  line-height: 1.3;
}

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

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

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

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

.text-accent,
.hero-highlight {
  color: var(--color-accent);
}

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

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

.wrap,
.wrap-wide,
.reading-wrap {
  width: 100%;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wrap {
  max-width: calc(var(--content-max) + (var(--gutter) * 2));
}

.wrap-wide {
  max-width: calc(var(--wide-max) + (var(--gutter) * 2));
}

.reading-wrap {
  max-width: calc(var(--reading-max) + (var(--gutter) * 2));
}

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

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

.section-head {
  max-width: 760px;
  margin-bottom: clamp(30px, 5vw, 54px);
}

.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 14px;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.section-kicker::before {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  content: "";
}

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

.panel-raised {
  background: var(--color-panel-raised);
  box-shadow: var(--shadow-panel);
}

.card {
  padding: clamp(22px, 3vw, 32px);
  transition: transform var(--transition-medium), border-color var(--transition-fast), background var(--transition-fast);
}

.card:hover {
  border-color: var(--color-border-hover);
  transform: translateY(-3px);
}

[data-tilt-card] {
  transform-style: preserve-3d;
  will-change: transform;
}

.badge,
.chip,
.tag {
  display: inline-flex;
  min-height: 28px;
  max-width: 100%;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-panel);
  padding: 5px 12px;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
}

.badge-dot,
.status-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: var(--radius-pill);
  background: var(--color-success);
}

.tag {
  border-radius: var(--radius-xs);
  background: var(--color-panel-raised);
}

.btn {
  display: inline-flex;
  min-width: 24px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 11px 25px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  cursor: pointer;
  transition: transform var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

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

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

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

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

.btn-secondary:hover {
  border-color: var(--color-text-muted);
  background: var(--color-panel-raised);
}

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

.btn-quiet:hover {
  border-color: var(--color-text-muted);
  background: var(--color-panel);
}

.btn[aria-disabled="true"],
.btn:disabled {
  opacity: 0.52;
  pointer-events: none;
}

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

.head-in {
  width: 100%;
  max-width: var(--wide-max);
  height: var(--header-height);
  margin-inline: auto;
  padding-inline: 28px;
  display: flex;
  align-items: center;
  gap: 28px;
}

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

.brand-logo {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
}

.brand-name {
  color: var(--color-text);
  font-size: 16.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

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

.top-nav {
  display: flex;
  height: 100%;
  min-width: 0;
  flex: 1 1 auto;
  align-items: center;
  gap: 2px;
}

.top-nav a {
  position: relative;
  display: inline-flex;
  height: 100%;
  min-width: 24px;
  align-items: center;
  justify-content: center;
  padding-inline: 9px;
  color: var(--color-text-muted);
  font-size: 13px;
  white-space: nowrap;
  transition: color var(--transition-fast);
}

.top-nav a:hover,
.top-nav a[aria-current="page"] {
  color: var(--color-text);
}

.top-nav a[aria-current="page"]::after {
  position: absolute;
  right: 9px;
  bottom: -1px;
  left: 9px;
  height: 2px;
  border-radius: var(--radius-pill) var(--radius-pill) 0 0;
  background: var(--color-text);
  content: "";
}

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

.lang-menu {
  position: relative;
}

.lang-trigger {
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-sm);
  background: var(--color-transparent);
  padding: 8px 10px;
  color: var(--color-text-muted);
  cursor: pointer;
}

.lang-trigger:hover {
  color: var(--color-text);
}

.lang-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 120;
  width: 168px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-panel-raised);
  padding: 6px;
  box-shadow: var(--shadow-panel);
}

.lang-popover[hidden] {
  display: none;
}

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

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

.btn-login {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-panel);
  padding: 7px 19px;
  color: var(--color-text);
  font-size: 13.5px;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.btn-login:hover {
  border-color: var(--color-text-muted);
  background: var(--color-panel-raised);
}

.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--color-transparent);
  color: var(--color-text);
  cursor: pointer;
}

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

.mobile-nav {
  display: none;
}

.mobile-nav[hidden] {
  display: none;
}

.nav-veil {
  display: none;
}

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

.footer-main {
  display: grid;
  grid-template-columns: minmax(240px, 1.2fr) repeat(3, minmax(150px, 1fr));
  gap: clamp(28px, 5vw, 72px);
  padding-top: 64px;
  padding-bottom: 46px;
}

.footer-brand p {
  max-width: 33em;
  margin-top: 18px;
  color: var(--color-text-muted);
  font-size: 14px;
}

.footer-title {
  margin: 0 0 16px;
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

.footer-links a {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  color: var(--color-text-muted);
  font-size: 13.5px;
}

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

.footer-bottom {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 12.5px;
}

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

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

.reveal {
  transition: opacity 600ms ease, transform 600ms ease;
}

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

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

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

.prose h2,
.prose h3,
.prose h4,
.prose strong {
  color: var(--color-text);
}

.prose h2 {
  margin-top: 2em;
}

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

.prose a:not(.btn) {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-color: var(--color-accent-dark);
  text-underline-offset: 3px;
}

.prose li {
  margin-bottom: 0.5em;
}

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

@media (max-width: 1120px) {
  .top-nav a {
    padding-inline: 6px;
    font-size: 12.5px;
  }

  .head-in {
    gap: 16px;
  }

  .brand-local {
    display: none;
  }
}

@media (max-width: 900px) {
  .desktop-nav,
  .lang-menu {
    display: none;
  }

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

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

  .mobile-nav {
    position: fixed;
    top: var(--header-height);
    right: 0;
    left: 0;
    z-index: 115;
    display: block;
    max-height: calc(100dvh - var(--header-height));
    overflow-y: auto;
    overscroll-behavior: contain;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-panel-raised);
    padding: 10px var(--gutter) 18px;
  }

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

  .mobile-nav a:hover,
  .mobile-nav a[aria-current="page"] {
    color: var(--color-text);
  }

  .mobile-language-title {
    display: block;
    margin: 20px 6px 5px;
    color: var(--color-text);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
  }

  .nav-veil {
    position: fixed;
    inset: var(--header-height) 0 0;
    z-index: 90;
    display: block;
    border: 0;
    background: rgb(12 32 24 / 82%);
  }

  .nav-veil[hidden] {
    display: none;
  }

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

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

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

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

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

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

  .section {
    padding-top: 66px;
    padding-bottom: 66px;
  }

  .footer-bottom {
    align-items: flex-start;
    flex-direction: column;
    padding-top: 18px;
    padding-bottom: 18px;
  }
}

@media (max-width: 640px) {
  .tilt,
  [data-tilt-card] {
    transform: none;
  }

  .card {
    padding: 21px;
  }

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

  .footer-brand {
    margin-bottom: 8px;
  }
}

@media (max-width: 430px) {
  .head-in {
    gap: 8px;
  }

  .brand {
    gap: 7px;
  }

  .brand-logo {
    width: 28px;
    height: 28px;
  }

  .head-tools {
    gap: 4px;
  }

  .btn {
    width: 100%;
  }
}

@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;
  }
}