.header-tools {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: clamp(8px, .9vw, 12px);
}

.language-switch { position: relative; z-index: 6; }
.language-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 6px 12px;
  border: 1px solid rgba(184, 198, 216, 0.65);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #0d1b2e;
  font-size: 13px;
  font-weight: 620;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
  -webkit-tap-highlight-color: transparent;
}

.language-trigger:hover, .language-trigger[aria-expanded="true"] {
  background: #ffffff;
  border-color: #164cc5;
  color: #164cc5;
}
.language-trigger svg { flex: none; }
.language-chevron { transition: transform 160ms cubic-bezier(0.16, 1, 0.3, 1); }
.language-trigger[aria-expanded="true"] .language-chevron { transform: rotate(180deg); }

.language-list {
  position: absolute;
  inset: calc(100% + 8px) 0 auto auto;
  width: 156px;
  padding: 6px;
  border: 1px solid #d6dfe9;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 12px 32px rgba(8, 21, 38, 0.12);
  color: #0d1b2e;
  font-size: 14px;
  opacity: 0;
  transform: translateY(-4px) scale(0.985);
  transform-origin: top right;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 160ms cubic-bezier(0.16, 1, 0.3, 1), transform 160ms cubic-bezier(0.16, 1, 0.3, 1), visibility 0s 160ms;
}

.language-trigger[aria-expanded="true"] + .language-list {
  opacity: 1;
  transform: translateY(0) scale(1);
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.language-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  transition: background-color 120ms ease;
}
.language-list a:hover, .language-list a:focus-visible { background: #f1f5fb; }
.language-list a[aria-current="true"] {
  color: #164cc5;
  background: #e8effc;
  font-weight: 650;
}
.language-list a svg { flex: none; }

/* 五国语言排印韧性（I18n Layout Resilience） */
html[lang="ko"] { word-break: keep-all; }
html[lang="ja"] { line-break: strict; }
html[lang="en"] .subnav a { white-space: normal; text-align: center; line-height: 1.25; }
html:not([lang="zh-CN"]) .metric-card dd { white-space: normal; overflow-wrap: anywhere; }

@media (prefers-reduced-motion: reduce) {
  .language-trigger, .language-chevron, .language-list, .language-list * { transition: none; }
}

@media (min-width: 769px) and (max-width: 1020px) and (max-height: 740px) {
  html[lang="en"] .technology.assembly-ready:has(.assembly-intro)::after { display: none; }
  html[lang="en"] .assembly-ready .assembly-stage:has(.assembly-intro) { position: static; min-height: 0; }
  html[lang="en"] .assembly-ready .assembly-scroll-hint { display: none; }
  html[lang="en"] .assembly-ready .assembly-manual-hint { display: block; }
}

@media (max-width: 680px) {
  html[lang="en"] .home-hero h1 { font-size: clamp(2rem, 8.2vw, 3.3rem); }
  html:not([lang^="zh"]) .button,
  html:not([lang^="zh"]) .hero-link { max-width: 100%; white-space: normal; }
  html:not([lang^="zh"]) .site-footer-nav h2 { overflow-wrap: anywhere; }
  html:not([lang^="zh"]) .site-footer-nav a { min-height: 40px; padding-block: 4px; }
}

@media (max-width: 380px) {
  .header .header-inner { padding-inline: 12px; }
  .language-trigger { padding-inline: 9px; }
}
