:root {
  --color-page: #FFFFFF;
  --color-panel: #F6F8FA;
  --color-ink-panel: #0B1B2E;
  --color-border: #E3E8EF;
  --color-accent: #00A4F4;
  --color-accent-deep: #0272B6;
  --color-text: #101826;
  --color-muted: #5A6675;
  --color-success: #14A96C;
  --color-warning: #FF6B45;
  --color-error: #E23D2E;
  --color-sky: #3EC4FF;
  --color-white: #FFFFFF;
  --color-dark-text: #EAF1F7;
  --color-dark-subtle: #AFC2D2;
  --color-dark-muted: #8299AC;
  --color-dark-line: rgba(255, 255, 255, .09);
  --color-dark-line-strong: rgba(255, 255, 255, .2);
  --color-dark-card: rgba(255, 255, 255, .035);
  --color-accent-soft: rgba(0, 164, 244, .16);
  --color-accent-glow: rgba(0, 164, 244, .45);
  --color-rib: rgba(255, 255, 255, .55);
  --color-rain: rgba(150, 168, 185, .5);
  --color-overlay: rgba(11, 27, 46, .54);
  --color-shadow: rgba(11, 27, 46, .13);
  --color-flag-red: #CE3B31;
  --color-flag-blue: #254A9A;
  --color-flag-gold: #F3C348;
  --color-hk-red: #DA1F36;
  --color-us-blue: #244B8F;
  --color-uk-blue: #173A78;
  --color-nl-blue: #244C91;
  --font-display: 'Inter', 'Noto Sans SC', 'Noto Sans JP', 'Noto Sans KR', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-body: 'Inter', 'Noto Sans SC', 'Noto Sans JP', 'Noto Sans KR', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, 'Courier New', monospace;
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-hero: 28px;
  --radius-pill: 999px;
  --line: 1px;
  --header-height: 62px;
  --content-width: 1400px;
  --reading-width: 820px;
  --gutter: clamp(16px, 3vw, 36px);
  --section-space: clamp(54px, 7vw, 96px);
  --toc-top: 12px;
  --toc-offset: 78px;
  --motion-fast: 160ms;
  --motion-base: 280ms;
  --motion-slow: 620ms;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
}

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

html {
  min-width: 320px;
  scroll-behavior: smooth;
  background: var(--color-page);
}

html.nav-open {
  overflow: hidden;
}

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

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,
summary {
  cursor: pointer;
}

a {
  color: var(--color-accent-deep);
  text-decoration: none;
}

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

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

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

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

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

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

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

h1 {
  margin: 0 0 20px;
  font-size: clamp(52px, 5vw, 72px);
  font-weight: 900;
  letter-spacing: -.02em;
  line-height: 1.1;
}

h2 {
  margin: 0 0 18px;
  font-size: clamp(30px, 3.4vw, 46px);
  font-weight: 850;
  letter-spacing: -.015em;
  line-height: 1.16;
}

h3 {
  margin: 0 0 12px;
  font-size: clamp(20px, 2vw, 26px);
  font-weight: 800;
  line-height: 1.25;
}

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

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

.wrap {
  width: 100%;
  max-width: var(--content-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);
  overflow-x: clip;
}

.section-tight {
  padding-top: clamp(36px, 5vw, 64px);
  padding-bottom: clamp(36px, 5vw, 64px);
  overflow-x: clip;
}

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

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

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

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.panel,
.card {
  border: var(--line) solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-page);
}

.panel {
  padding: clamp(20px, 3vw, 34px);
}

.card {
  padding: 22px;
  transition: border-color var(--motion-fast), transform var(--motion-fast);
}

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

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

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

.badge-accent {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: var(--color-white);
}

.badge-warn {
  border-color: var(--color-warning);
  background: var(--color-warning);
  color: var(--color-white);
}

.btn {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 24px;
  border: var(--line) solid transparent;
  border-radius: 10px;
  font-weight: 750;
  line-height: 1.2;
  text-align: center;
  transition: background var(--motion-fast), border-color var(--motion-fast), color var(--motion-fast), transform var(--motion-fast);
}

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

.btn:focus-visible,
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--color-accent-soft);
  outline-offset: 3px;
}

.btn-primary {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: var(--color-white);
  box-shadow: 0 7px 24px -12px var(--color-accent-glow);
}

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

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

.btn-secondary:hover {
  border-color: var(--color-accent);
  color: var(--color-accent-deep);
}

.btn-dark {
  border-color: var(--color-text);
  background: var(--color-text);
  color: var(--color-white);
}

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

.btn[aria-disabled="true"],
.btn:disabled {
  cursor: not-allowed;
  opacity: .48;
  transform: none;
}

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

.head-in {
  display: flex;
  height: var(--header-height);
  align-items: center;
  gap: 18px;
}

.brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  color: var(--color-text);
}

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

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

.brand-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 850;
  letter-spacing: -.01em;
}

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

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

.desktop-nav a {
  padding: 7px 12px;
  border: var(--line) solid transparent;
  border-radius: var(--radius-pill);
  color: var(--color-muted);
  font-size: 13.5px;
  font-weight: 550;
  white-space: nowrap;
}

.desktop-nav a:hover {
  color: var(--color-text);
}

.desktop-nav a.is-active {
  border-color: var(--color-border);
  background: var(--color-panel);
  color: var(--color-text);
  font-weight: 750;
}

.header-tools {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
}

.lang-menu {
  position: relative;
}

.lang-trigger {
  min-height: 38px;
  padding: 6px 10px;
  border: 0;
  background: transparent;
  color: var(--color-muted);
  font-size: 13px;
}

.lang-list {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 12;
  display: none;
  width: 154px;
  padding: 6px;
  border: var(--line) solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-page);
  box-shadow: 0 14px 34px -20px var(--color-shadow);
}

.lang-menu.is-open .lang-list {
  display: grid;
}

.lang-list a {
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  color: var(--color-text);
  font-size: 13px;
}

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

.login-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 7px 18px;
  border-radius: var(--radius-sm);
  background: var(--color-text);
  color: var(--color-white);
  font-size: 13.5px;
  font-weight: 750;
}

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

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

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

.mobile-nav {
  position: absolute;
  top: var(--header-height);
  right: 0;
  left: 0;
  z-index: 101;
  display: none;
  max-height: calc(100dvh - var(--header-height));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px var(--gutter) 18px;
  border-bottom: var(--line) solid var(--color-border);
  background: var(--color-page);
  box-shadow: 0 18px 32px -24px var(--color-shadow);
  -webkit-overflow-scrolling: touch;
}

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

.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);
  font-weight: 650;
}

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

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

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

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

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

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

.footer-brand p {
  max-width: 400px;
  margin: 16px 0 0;
  color: var(--color-muted);
  font-size: 13.5px;
}

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

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

.footer-links a {
  color: var(--color-muted);
  font-size: 13px;
}

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

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

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

.footer-legal a {
  color: var(--color-muted);
}

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

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

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

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

.prose p,
.prose li {
  overflow-wrap: break-word;
}

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

.prose h2 {
  margin-top: 54px;
}

.prose h3 {
  margin-top: 32px;
}

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

.prose ol {
  counter-reset: prose-step;
  list-style: none;
  padding-left: 0;
}

.prose ol > li {
  position: relative;
  min-height: 32px;
  padding-left: 42px;
  counter-increment: prose-step;
}

.prose ol > li::before {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: var(--color-white);
  content: counter(prose-step);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
}

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

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

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

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

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

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

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

  h2 {
    font-size: clamp(25px, 7vw, 34px);
  }

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

  .lang-menu {
    display: none;
  }

  .login-button {
    min-width: 64px;
    padding-inline: 13px;
  }

  .footer-main {
    grid-template-columns: 1fr 1fr;
    gap: 28px 20px;
  }

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

@media (max-width: 640px) {
  :root {
    --gutter: 16px;
    --toc-top: 8px;
    --toc-offset: 72px;
  }

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

  .btn {
    padding-inline: 18px;
  }

  .head-in {
    gap: 9px;
  }

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

  .brand-local {
    display: none;
  }

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

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

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

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

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