:root {
  color-scheme: dark;
  --color-bg: #0A2530;
  --color-panel: #0F3242;
  --color-panel-raised: #154153;
  --color-border: #24586E;
  --color-accent: #FFD34D;
  --color-accent-dark: #D9A81C;
  --color-text: #EAF4F8;
  --color-text-muted: #9CBECC;
  --color-success: #45D9A1;
  --color-warning: #FFA94D;
  --color-error: #FF6161;
  --color-ink: #0A2530;

  --color-client-bg: #F4F8FA;
  --color-client-ink: #123240;
  --color-client-muted: #5F7B88;
  --color-client-line: #DBE6EC;
  --color-client-row: #EAF1F5;
  --color-client-pill: #FFF3D0;
  --color-client-pill-line: #EDD79A;

  --color-flag-red: #D8434E;
  --color-flag-blue: #2E4C97;
  --color-flag-white: #F7F9FA;
  --color-flag-green: #2F9E60;
  --color-flag-hk: #D9272E;

  --color-dot-texture: rgba(156, 190, 204, 0.09);
  --color-shadow-deep: rgba(2, 14, 20, 0.55);
  --color-shadow-mid: rgba(2, 14, 20, 0.35);
  --color-shadow-soft: rgba(2, 14, 20, 0.24);
  --color-accent-glow: rgba(255, 211, 77, 0.22);
  --color-halo: rgba(32, 92, 116, 0.58);
  --color-halo-clear: rgba(32, 92, 116, 0);
  --color-focus-backdrop: rgba(10, 37, 48, 0.72);
  --color-flag-ring: rgba(10, 37, 48, 0.22);
  --color-knob-shadow: rgba(10, 37, 48, 0.35);
  --color-overlay: rgba(2, 14, 20, 0.72);
  --color-table-stripe: rgba(21, 65, 83, 0.42);

  --gradient-halo: radial-gradient(closest-side, var(--color-halo), var(--color-halo-clear) 72%);
  --gradient-panel: linear-gradient(145deg, var(--color-panel-raised), var(--color-panel));
  --gradient-accent: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));

  --font-display: 'Inter', 'Noto Sans SC', 'Noto Sans JP', 'Noto Sans KR', -apple-system, 'PingFang SC', 'Hiragino Sans', 'Microsoft YaHei', sans-serif;
  --font-body: 'Inter', 'Noto Sans SC', 'Noto Sans JP', 'Noto Sans KR', -apple-system, 'PingFang SC', 'Hiragino Sans', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, 'Courier New', monospace;

  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --radius-pill: 999px;

  --shadow-client: 0 32px 72px var(--color-shadow-deep), 0 10px 24px var(--color-shadow-mid);
  --shadow-raised: 0 18px 40px var(--color-shadow-soft);
  --shadow-menu: 0 18px 40px var(--color-shadow-deep);
  --shadow-cta: 0 10px 28px var(--color-accent-glow);
  --shadow-knob: 0 1px 3px var(--color-knob-shadow);

  --header-height: 76px;
  --content-max: 1280px;
  --reading-max: 820px;
  --gutter: clamp(16px, 4vw, 44px);
  --section-space: clamp(72px, 9vw, 124px);
  --toc-top: 88px;
  --toc-offset: 158px;

  --transition-fast: 150ms ease;
  --transition-reveal: 620ms cubic-bezier(0.2, 0.72, 0.2, 1);
}

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

html {
  min-width: 320px;
  overflow-x: clip;
  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-color: var(--color-bg);
  background-image: radial-gradient(var(--color-dot-texture) 1px, transparent 1.4px);
  background-size: 26px 26px;
  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,
ul,
ol,
li {
  min-width: 0;
}

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

img {
  height: auto;
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

p,
h1,
h2,
h3,
h4,
ul,
ol,
dl,
dd,
figure,
blockquote {
  margin-top: 0;
}

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

ul[role='list'],
ol[role='list'],
.site-nav-list,
.footer-links,
.trust-list,
.platform-row,
.flag-row {
  margin: 0;
  padding: 0;
  list-style: none;
}

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

h1,
.hero-title {
  max-width: 14ch;
  margin-bottom: 24px;
  font-size: clamp(52px, 5vw, 72px);
  letter-spacing: -0.015em;
  line-height: 1.12;
}

h2 {
  margin-bottom: 20px;
  font-size: clamp(32px, 4vw, 48px);
  letter-spacing: -0.012em;
}

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

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

p {
  margin-bottom: 1.25em;
}

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

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

code,
kbd,
samp,
pre,
.mono {
  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-md);
  background: var(--color-panel);
  color: var(--color-text);
  -webkit-overflow-scrolling: touch;
}

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

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

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

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}

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

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

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

.section-compact {
  position: relative;
  overflow-x: clip;
  padding-top: clamp(48px, 6vw, 76px);
  padding-bottom: clamp(48px, 6vw, 76px);
}

.section-panel {
  border-block: 1px solid var(--color-border);
  background: var(--color-panel);
}

.eyebrow {
  margin-bottom: 12px;
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.section-lede {
  max-width: 64ch;
  color: var(--color-text-muted);
  font-size: clamp(17px, 2vw, 20px);
}

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

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

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

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

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

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

.panel-body,
.card-body {
  padding: clamp(22px, 3vw, 34px);
}

.button,
.btn-main,
.btn-sub,
.btn-ghost {
  display: inline-flex;
  min-width: 24px;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 26px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 750;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition:
    color var(--transition-fast),
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-fast);
}

.btn-main,
.button-primary,
.prose a.button-primary {
  border-color: var(--color-accent);
  background: var(--color-accent);
  box-shadow: var(--shadow-cta);
  color: var(--color-ink);
}

.btn-main:hover,
.button-primary:hover,
.prose a.button-primary:hover {
  border-color: var(--color-accent-dark);
  background: var(--color-accent-dark);
  color: var(--color-ink);
  transform: translateY(-1px);
}

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

.btn-sub:hover,
.button-secondary:hover {
  border-color: var(--color-accent-dark);
  background: var(--color-panel-raised);
}

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

.btn-ghost:hover,
.button-ghost:hover {
  color: var(--color-text);
  background: var(--color-panel);
}

.button[aria-disabled='true'],
.button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
}

.button-small {
  min-height: 40px;
  padding: 9px 16px;
  font-size: 14px;
}

.button-row,
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

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

.badge-accent {
  border-color: var(--color-accent-dark);
  background: var(--color-client-pill);
  color: var(--color-client-ink);
}

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

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

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

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

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

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

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

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

.site-header-inner {
  display: flex;
  height: var(--header-height);
  align-items: center;
  gap: 30px;
}

.brand-link {
  display: inline-flex;
  min-height: 44px;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  color: var(--color-text);
  text-decoration: none;
}

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

.brand-word {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

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

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

.site-nav-list {
  display: flex;
  align-items: center;
  gap: 5px;
}

.site-nav-link,
.more-toggle,
.language-toggle {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 13px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  font-size: 15px;
  line-height: 1;
  text-decoration: none;
  transition:
    color var(--transition-fast),
    background-color var(--transition-fast);
}

.site-nav-link:hover,
.more-toggle:hover,
.language-toggle:hover {
  background: var(--color-panel);
  color: var(--color-text);
}

.site-nav-link.is-active {
  position: relative;
  color: var(--color-text);
}

.site-nav-link.is-active::after {
  position: absolute;
  right: 13px;
  bottom: 3px;
  left: 13px;
  height: 2px;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  content: '';
}

.nav-more,
.language-menu {
  position: relative;
}

.nav-caret {
  color: var(--color-text-muted);
  font-size: 11px;
}

.nav-dropdown,
.language-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  z-index: 95;
  min-width: 178px;
  padding: 8px;
  visibility: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-panel);
  box-shadow: var(--shadow-menu);
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity var(--transition-fast),
    transform var(--transition-fast),
    visibility var(--transition-fast);
}

.nav-dropdown {
  left: -5px;
}

.language-dropdown {
  right: 0;
}

.nav-more:hover .nav-dropdown,
.nav-more:focus-within .nav-dropdown,
.language-menu.is-open .language-dropdown {
  visibility: visible;
  opacity: 1;
  transform: none;
}

.nav-dropdown a,
.language-dropdown a {
  display: flex;
  min-height: 42px;
  align-items: center;
  padding: 9px 12px;
  border-radius: 9px;
  color: var(--color-text-muted);
  font-size: 14px;
  text-decoration: none;
}

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

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

.header-login {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 9px 21px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-panel);
  color: var(--color-text);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.header-login:hover {
  border-color: var(--color-accent-dark);
  background: var(--color-panel-raised);
}

.menu-toggle {
  display: none;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 8px;
  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 {
  width: 20px;
  height: 2px;
  border-radius: var(--radius-pill);
  background: var(--color-text);
}

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

.mobile-menu {
  display: none;
}

.menu-veil {
  display: none;
}

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

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

.footer-brand {
  max-width: 36ch;
}

.footer-brand-row {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 16px;
  text-decoration: none;
}

.footer-logo {
  width: 38px;
  height: 38px;
}

.footer-brand-name {
  font-size: 22px;
  font-weight: 800;
}

.footer-description {
  color: var(--color-text-muted);
  font-size: 14px;
  line-height: 1.75;
}

.footer-heading {
  margin-bottom: 14px;
  color: var(--color-text);
  font-size: 14px;
  letter-spacing: 0.05em;
}

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

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

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

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

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

.footer-legal a {
  min-height: 28px;
  color: var(--color-text-muted);
  text-decoration: none;
}

/* Long-form content */
.prose {
  color: var(--color-text-muted);
}

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

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

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

.prose a {
  color: var(--color-accent);
}

.prose li + li {
  margin-top: 0.55em;
}

.prose img {
  margin-block: 28px;
  border-radius: var(--radius-lg);
}

.prose blockquote {
  margin-inline: 0;
}

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

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

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

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

  .language-menu {
    display: none;
  }

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

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

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

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

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

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

  .mobile-menu-inner {
    width: 100%;
    padding: 12px var(--gutter) 22px;
  }

  .mobile-menu ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }

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

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

  .mobile-language-heading {
    margin: 18px 13px 8px;
    color: var(--color-text-muted);
    font-size: 12px;
    letter-spacing: 0.15em;
  }
}

@media (max-width: 720px) {
  :root {
    --header-height: 68px;
    --toc-top: 78px;
    --toc-offset: 148px;
  }

  h1,
  .hero-title {
    max-width: none;
    font-size: clamp(28px, 9.6vw, 40px);
    line-height: 1.14;
  }

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

  .site-header-inner {
    gap: 10px;
  }

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

  .brand-word {
    font-size: 18px;
  }

  .brand-local {
    display: none;
  }

  .header-tools {
    gap: 8px;
  }

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

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

  .button-row .button,
  .hero-actions .button,
  .hero-actions .btn-main,
  .hero-actions .btn-sub {
    flex: 1 1 140px;
  }

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

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

  .footer-bottom {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding-block: 20px;
  }
}

@media (max-width: 480px) {
  .footer-main {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 640px) {
  .tilt,
  [class*='tilt-'] {
    transform: none;
  }

  .absolute-decoration,
  [data-absolute-decoration] {
    display: none;
  }

  table {
    max-width: 100%;
  }
}

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

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

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