:root {
  --color-bg: #14183F;
  --color-panel: #1B2050;
  --color-panel-raised: #232A63;
  --color-border: #38407F;
  --color-accent: #8AD7FF;
  --color-accent-strong: #4FA8DC;
  --color-text: #EEF1FF;
  --color-text-muted: #A9B0D6;
  --color-success: #5FD9A6;
  --color-warning: #F5C266;
  --color-error: #F0716E;
  --color-flag-red: #D8434B;
  --color-flag-blue: #3A4EA8;
  --color-flag-white: #F4F6FF;
  --color-flag-dark: #202B67;
  --color-flag-gold: #F2D36B;
  --color-edge: rgba(138, 215, 255, 0.15);
  --color-edge-soft: rgba(138, 215, 255, 0.09);
  --color-grid-dot: rgba(138, 215, 255, 0.055);
  --color-glow: rgba(138, 215, 255, 0.16);
  --color-panel-glass: rgba(27, 32, 80, 0.6);
  --color-panel-chrome: rgba(27, 32, 80, 0.45);
  --color-shadow-deep: rgba(6, 9, 32, 0.5);
  --color-shadow-soft: rgba(6, 9, 32, 0.35);
  --color-shadow-accent: rgba(79, 168, 220, 0.28);
  --color-focus-halo: rgba(138, 215, 255, 0.24);
  --color-overlay: rgba(6, 9, 32, 0.72);
  --color-transparent: transparent;
  --font-display: 'Inter', 'Noto Sans SC', -apple-system, 'PingFang SC', 'Hiragino Sans', 'Microsoft YaHei', sans-serif;
  --font-body: 'Inter', 'Noto Sans SC', -apple-system, 'PingFang SC', 'Hiragino Sans', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Courier New', monospace;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-pill: 999px;
  --shadow-panel: 0 26px 64px var(--color-shadow-deep), 0 6px 18px var(--color-shadow-soft);
  --shadow-button: 0 10px 26px var(--color-shadow-accent);
  --shadow-card: 0 18px 42px var(--color-shadow-soft);
  --page-width: 1280px;
  --reading-width: 800px;
  --gutter: clamp(16px, 4vw, 32px);
  --header-height: 68px;
  --section-space: clamp(72px, 9vw, 128px);
  --toc-offset: 92px;
  --transition-fast: 180ms ease;
  --transition-base: 300ms ease;
}

*,
*::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 {
  position: relative;
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: clip;
  color: var(--color-text);
  background: var(--color-bg);
  font-family: var(--font-body);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  position: fixed;
  z-index: 0;
  inset: 0;
  content: "";
  pointer-events: none;
  background-image: radial-gradient(var(--color-grid-dot) 1px, var(--color-transparent) 1px);
  background-size: 28px 28px;
}

body::after {
  position: fixed;
  z-index: 0;
  top: -260px;
  right: -200px;
  width: 820px;
  height: 820px;
  content: "";
  pointer-events: none;
  background: radial-gradient(closest-side, var(--color-glow), var(--color-transparent) 72%);
}

header,
main,
footer {
  position: relative;
  z-index: 1;
}

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

img {
  height: auto;
}

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

button,
summary,
select {
  cursor: pointer;
}

button {
  border: 0;
}

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

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

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

h1,
h2,
h3,
h4 {
  margin-top: 0;
  color: var(--color-text);
  font-family: var(--font-display);
  font-weight: 520;
  line-height: 1.18;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h1 {
  margin-bottom: 24px;
  font-size: clamp(52px, 5vw, 72px);
}

h2 {
  margin-bottom: 20px;
  font-size: clamp(34px, 4vw, 52px);
}

h3 {
  margin-bottom: 14px;
  font-size: clamp(22px, 2.4vw, 30px);
}

h4 {
  margin-bottom: 10px;
  font-size: 19px;
}

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

strong {
  color: var(--color-text);
  font-weight: 650;
}

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

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

code {
  overflow-wrap: anywhere;
}

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

hr {
  height: 1px;
  margin: 40px 0;
  border: 0;
  background: var(--color-edge-soft);
}

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

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

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

.wrap {
  width: 100%;
  max-width: var(--page-width);
  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(48px, 6vw, 80px);
  padding-bottom: clamp(48px, 6vw, 80px);
}

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

.section-head.is-centered {
  margin-inline: auto;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 9px;
  max-width: 100%;
  padding: 5px 15px;
  overflow: hidden;
  border: 1px solid var(--color-edge);
  border-radius: var(--radius-pill);
  background: var(--color-panel-glass);
  color: var(--color-text-muted);
  font-size: 13px;
}

.eyebrow::before {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  box-shadow: 0 0 8px var(--color-accent);
  content: "";
}

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

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

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

.btn,
.btn-primary,
.btn-secondary,
.btn-quiet {
  display: inline-flex;
  min-width: 24px;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border: 1px solid var(--color-transparent);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.25;
  text-align: center;
  transition: transform var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

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

.btn-primary:hover {
  background: var(--color-accent-strong);
  transform: translateY(-2px);
}

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

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

.btn-quiet {
  min-height: 40px;
  padding: 9px 18px;
  border-color: var(--color-border);
  color: var(--color-text);
  background: var(--color-panel-raised);
}

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

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

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

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

.card {
  padding: 26px;
}

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

.site-head__inner {
  display: flex;
  width: 100%;
  max-width: var(--page-width);
  height: var(--header-height);
  align-items: center;
  gap: 28px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

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

.site-brand__word {
  color: var(--color-text);
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

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

.desktop-nav {
  display: flex;
  min-width: 0;
  align-self: stretch;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.desktop-nav a {
  position: relative;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  padding: 0 10px;
  color: var(--color-text-muted);
  font-size: 14px;
  white-space: nowrap;
  transition: color var(--transition-fast);
}

.desktop-nav a::after {
  position: absolute;
  right: 10px;
  bottom: -1px;
  left: 10px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--color-accent);
  content: "";
  transform: scaleX(0);
  transform-origin: center;
  transition: transform var(--transition-fast);
}

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

.desktop-nav a:hover::after {
  transform: scaleX(0.55);
}

.desktop-nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

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

.language-switcher {
  position: relative;
}

.language-toggle {
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 10px;
  color: var(--color-text-muted);
  background: var(--color-transparent);
  font-size: 13px;
}

.language-toggle:hover {
  color: var(--color-text);
}

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

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

.language-menu a {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-size: 13px;
}

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

.header-login {
  min-height: 40px;
  padding: 8px 20px;
}

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

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

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

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

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

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

.mobile-nav__languages {
  display: grid;
  grid-template-columns: 1fr;
  margin-top: 10px;
}

.mobile-nav__label {
  padding: 12px 14px 4px;
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
}

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

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

.site-footer {
  margin-top: var(--section-space);
  border-top: 1px solid var(--color-edge-soft);
  background: var(--color-panel);
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(240px, 1.3fr) repeat(3, minmax(150px, 1fr));
  gap: 40px;
  padding-top: 58px;
  padding-bottom: 46px;
}

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

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

.footer-brand p {
  font-size: 14px;
}

.footer-column h2 {
  margin-bottom: 14px;
  color: var(--color-text);
  font-size: 14px;
  letter-spacing: 0;
}

.footer-links {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

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

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

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

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

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

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

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

.prose {
  min-width: 0;
}

.prose h2,
.prose h3 {
  scroll-margin-top: var(--toc-offset);
}

.prose p,
.prose li {
  font-size: 17px;
}

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

.prose ul,
.prose ol {
  padding-left: 1.4em;
}

.prose > * + * {
  margin-top: 1.25em;
}

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

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

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

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

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

  .site-brand__local,
  .language-switcher {
    display: none;
  }

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

  .header-login {
    min-height: 40px;
    padding-inline: 14px;
  }

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

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

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

  body::after {
    top: -180px;
    right: -360px;
  }
}

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

  body,
  main,
  section,
  article,
  .hero,
  .panel {
    overflow-x: clip;
  }

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

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

  .tilt-card,
  [data-tilt] {
    transform: none;
  }

  .btn,
  .btn-primary,
  .btn-secondary {
    max-width: 100%;
  }

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

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

  .site-brand__word {
    font-size: 15px;
  }
}

@media (max-width: 390px) {
  .site-head__inner {
    gap: 8px;
  }

  .header-login {
    padding-inline: 11px;
    font-size: 13px;
  }
}

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

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

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