:root {
  --color-bg: #24102A;
  --color-panel: #2F1637;
  --color-panel-raised: #3A1C44;
  --color-border: #452B52;
  --color-accent: #FFDA2E;
  --color-accent-strong: #D9AE00;
  --color-text: #F4EDF7;
  --color-text-muted: #B9A6C4;
  --color-success: #57D98A;
  --color-warn: #FFA149;
  --color-error: #FF5D73;
  --color-accent-soft: rgba(255, 218, 46, 0.08);
  --color-accent-medium: rgba(255, 218, 46, 0.16);
  --color-panel-soft: rgba(58, 28, 68, 0.68);
  --color-shadow: rgba(10, 3, 14, 0.5);
  --color-shadow-soft: rgba(10, 3, 14, 0.38);
  --color-focus-shadow: rgba(255, 218, 46, 0.18);
  --color-grid: rgba(244, 237, 247, 0.035);
  --color-noise: rgba(244, 237, 247, 0.025);
  --color-white: #FFFFFF;
  --color-flag-red: #D92D3B;
  --color-flag-red-dark: #BC002D;
  --color-flag-blue: #243B7D;
  --color-flag-blue-dark: #012169;
  --color-flag-hk: #DE2910;
  --color-flag-white: #F4EDF7;
  --color-on-accent: #24102A;
  --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, 'SFMono-Regular', Consolas, 'Courier New', monospace;
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;
  --shadow-panel: 0 28px 64px var(--color-shadow), 0 6px 18px var(--color-shadow-soft);
  --shadow-button: 0 6px 18px rgba(217, 174, 0, 0.24);
  --shadow-card: 0 14px 34px rgba(10, 3, 14, 0.28);
  --header-height: 64px;
  --content-max: 1240px;
  --reading-max: 820px;
  --gutter: clamp(16px, 3vw, 24px);
  --section-space: clamp(56px, 8vw, 96px);
  --transition-fast: 160ms ease;
  --transition-base: 280ms ease;
  --route-row-height: 54px;
  --toc-offset: 82px;
}

*,
*::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;
  color: var(--color-text);
  background:
    linear-gradient(var(--color-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-grid) 1px, transparent 1px),
    radial-gradient(circle at 78% 12%, var(--color-accent-soft), transparent 28%),
    var(--color-bg);
  background-size: 34px 34px, 34px 34px, auto, auto;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    radial-gradient(circle at 20% 30%, var(--color-noise) 0 1px, transparent 1px),
    radial-gradient(circle at 70% 65%, var(--color-noise) 0 1px, transparent 1px);
  background-size: 9px 9px, 11px 11px;
  content: "";
  pointer-events: none;
}

body > * {
  position: relative;
  z-index: 1;
}

body:has(.float-cta)::after {
  display: block;
  height: calc(88px + env(safe-area-inset-bottom, 0px));
  content: "";
}

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

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

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

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

button {
  border: 0;
}

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

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

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

nav ul,
.footer-links,
.chip-list,
.platform-list,
.flag-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

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

h1 {
  margin-bottom: 20px;
  font-size: clamp(52px, 5.2vw, 72px);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.012em;
}

h2 {
  margin-bottom: 16px;
  font-size: clamp(30px, 3.4vw, 46px);
  font-weight: 850;
  line-height: 1.16;
  letter-spacing: -0.01em;
}

h3 {
  margin-bottom: 10px;
  font-size: clamp(20px, 2vw, 27px);
  font-weight: 800;
  line-height: 1.25;
}

h4 {
  margin-bottom: 8px;
  font-size: 17px;
  font-weight: 750;
}

p {
  margin-bottom: 1em;
  color: var(--color-text-muted);
}

strong {
  color: var(--color-text);
}

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

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

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

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

pre code {
  color: var(--color-text);
  white-space: pre;
}

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

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

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

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

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

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

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

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

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

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

.section-compact {
  padding-top: clamp(38px, 5vw, 60px);
  padding-bottom: clamp(38px, 5vw, 60px);
  overflow-x: clip;
}

.section-head {
  max-width: 760px;
  margin-bottom: clamp(28px, 4vw, 46px);
}

.section-index {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

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

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

.card {
  min-width: 0;
  padding: clamp(20px, 3vw, 28px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-panel);
  box-shadow: var(--shadow-card);
}

.card > :last-child {
  margin-bottom: 0;
}

.grid-two,
.grid-three,
.grid-four {
  display: grid;
  gap: 18px;
}

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

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

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

.grid-two > *,
.grid-three > *,
.grid-four > *,
.hero-grid > *,
.footer-grid > * {
  min-width: 0;
}

.btn {
  display: inline-flex;
  min-width: 24px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  transition:
    color var(--transition-fast),
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-fast);
}

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

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

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

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

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

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

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

.btn-small {
  min-height: 36px;
  padding: 7px 14px;
  font-size: 13px;
}

.btn-disabled,
.btn:disabled {
  color: var(--color-text-muted);
  border-color: var(--color-border);
  background: var(--color-panel);
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
}

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

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

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

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

.status-dot.error {
  background: var(--color-error);
}

.chip.is-active,
.status-chip.is-active {
  color: var(--color-on-accent);
  border-color: var(--color-accent);
  background: var(--color-accent);
  font-weight: 800;
}

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

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

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

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

.header-inner {
  display: flex;
  width: 100%;
  max-width: var(--content-max);
  height: var(--header-height);
  margin-inline: auto;
  padding-inline: var(--gutter);
  align-items: center;
  gap: 24px;
}

.site-brand {
  display: inline-flex;
  min-height: 44px;
  flex-shrink: 0;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 850;
  letter-spacing: 0.02em;
}

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

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

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

.desktop-nav > a,
.nav-more-toggle {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  background: transparent;
  font-size: 14px;
  font-weight: 700;
}

.desktop-nav > a:hover,
.nav-more-toggle:hover {
  color: var(--color-text);
  background: var(--color-panel);
}

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

.desktop-nav > a.is-active::after {
  position: absolute;
  right: 12px;
  bottom: 3px;
  left: 12px;
  height: 2px;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  content: "";
}

.desktop-nav > a {
  position: relative;
}

.nav-more {
  position: relative;
}

.nav-more-toggle::after {
  margin-left: 6px;
  color: var(--color-text-muted);
  content: "▾";
  font-size: 10px;
}

.nav-dropdown {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  display: none;
  min-width: 180px;
  padding: 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-panel-raised);
  box-shadow: var(--shadow-panel);
}

.nav-more:hover .nav-dropdown,
.nav-more:focus-within .nav-dropdown {
  display: block;
}

.nav-dropdown a {
  display: flex;
  min-height: 42px;
  align-items: center;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: 650;
}

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

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

.language-menu {
  position: relative;
}

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

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

.language-toggle::after {
  content: "▾";
  font-size: 10px;
}

.language-dropdown {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  display: none;
  min-width: 158px;
  padding: 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-panel-raised);
  box-shadow: var(--shadow-panel);
}

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

.language-dropdown a {
  display: flex;
  min-height: 42px;
  align-items: center;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
}

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

.header-login {
  min-height: 38px;
  padding: 8px 17px;
}

.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);
}

.menu-toggle-lines,
.menu-toggle-lines::before,
.menu-toggle-lines::after {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: var(--radius-pill);
  background: var(--color-text);
  transition: transform var(--transition-fast);
}

.menu-toggle-lines {
  position: relative;
}

.menu-toggle-lines::before,
.menu-toggle-lines::after {
  position: absolute;
  left: 0;
  content: "";
}

.menu-toggle-lines::before {
  top: -6px;
}

.menu-toggle-lines::after {
  top: 6px;
}

.menu-toggle[aria-expanded="true"] .menu-toggle-lines {
  background: transparent;
}

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

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

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

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

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

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

.mobile-nav-label {
  display: block;
  padding: 15px 12px 5px;
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-header.is-menu-open .mobile-nav,
.site-header.is-menu-open + .mobile-veil {
  display: block;
}

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

.footer-main {
  padding-top: 52px;
  padding-bottom: 42px;
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) repeat(3, minmax(150px, 1fr));
  gap: 34px;
}

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

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

.footer-title {
  margin-bottom: 13px;
  color: var(--color-text);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

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

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

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

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

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

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

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

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

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

.prose a.btn.btn-primary {
  color: var(--color-on-accent);
  text-decoration: none;
}

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

.prose img,
.prose iframe {
  max-width: 100%;
}

.prose > .data-table {
  display: block;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

@media (max-width: 980px) {
  .desktop-nav > a:nth-of-type(n + 4) {
    display: none;
  }

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

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

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

  h2 {
    font-size: clamp(27px, 8vw, 36px);
  }

  .desktop-nav,
  .header-tools .language-menu {
    display: none;
  }

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

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

  .header-inner {
    gap: 8px;
  }

  .brand-local {
    display: none;
  }

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

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

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

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

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

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

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

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

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

@media (max-width: 380px) {
  .site-brand span:first-of-type {
    font-size: 16px;
  }

  .header-login {
    min-width: 48px;
    padding-inline: 10px;
  }
}

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

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

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