.language-switch {
  --language-accent: #72e8a7;
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(2.1rem, auto));
  align-items: center;
  min-height: 2.75rem;
  padding: 0.22rem;
  border: 1px solid rgba(177, 221, 196, 0.34);
  border-radius: 999px;
  background: rgba(7, 27, 19, 0.66);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.05);
  -webkit-backdrop-filter: blur(18px) saturate(135%);
  backdrop-filter: blur(18px) saturate(135%);
  color: rgba(223, 240, 230, 0.7);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  touch-action: manipulation;
  white-space: nowrap;
}

.language-switch:hover {
  border-color: rgba(114, 232, 167, 0.58);
}

.language-switch:focus-visible {
  outline: 3px solid rgba(114, 232, 167, 0.34);
  outline-offset: 3px;
}

.language-switch span {
  display: grid;
  place-items: center;
  min-height: 2.22rem;
  padding: 0 0.62rem;
  border-radius: 999px;
  transition: color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.language-switch[data-locale="zh-CN"] [data-language-option="zh-CN"],
.language-switch[data-locale="en"] [data-language-option="en"] {
  color: #082116;
  background: var(--language-accent);
  box-shadow: 0 5px 16px rgba(28, 170, 96, 0.22);
}

.language-switch-slot {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.legal-language-slot {
  position: fixed;
  z-index: 5;
  top: max(1rem, env(safe-area-inset-top));
  right: max(1rem, env(safe-area-inset-right));
}

html[lang="en"] .brand-wordmark {
  letter-spacing: -0.025em;
}

@media (max-width: 720px) {
  .top-nav {
    gap: .35rem;
  }

  .language-switch {
    min-height: 2.45rem;
    grid-template-columns: repeat(2, minmax(1.72rem, auto));
    padding: 0.18rem;
    font-size: 0.7rem;
  }

  .language-switch span {
    min-height: 2.02rem;
    padding: 0 0.46rem;
  }

  .legal-language-slot {
    position: static;
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
  }

  .top-nav .brand {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
  }

  .top-nav .brand-wordmark {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    font-size: 0.68rem;
    letter-spacing: -0.035em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .top-nav .account-trigger,
  .top-nav .nav-cta {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .top-nav .account-trigger {
    box-sizing: border-box;
    width: auto;
    max-width: 4.5rem;
    min-height: 2.5rem;
    gap: .2rem;
    padding: 0 .3rem;
    font-size: .62rem;
  }

  .top-nav .account-trigger svg {
    width: .85rem;
    height: .85rem;
    flex: 0 0 auto;
  }

  .top-nav .account-trigger span {
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (prefers-reduced-motion: reduce) {
  .language-switch span {
    transition: none;
  }
}

/* Brand lockup: make the product name the visual anchor while keeping the
   dashboard descriptor legible but secondary on narrow screens. */
.top-nav .brand-wordmark {
  display: inline-flex;
  align-items: baseline;
  min-width: 0;
  gap: .34em;
  overflow: hidden;
  white-space: nowrap;
}

.top-nav .brand-primary {
  flex: 0 0 auto;
  color: #f4fbf6;
  font-size: 1.24em;
  font-weight: 900;
  letter-spacing: -.055em;
}

.top-nav .brand-secondary {
  min-width: 0;
  overflow: hidden;
  color: rgba(224, 239, 229, .82);
  font-size: .7em;
  font-weight: 700;
  letter-spacing: -.028em;
  text-overflow: ellipsis;
}

@media (max-width: 720px) {
  .top-nav .brand-wordmark {
    gap: .3em;
    font-size: .86rem;
  }

  .top-nav .brand-primary {
    font-size: 1.16em;
  }

  .top-nav .brand-secondary {
    font-size: .68em;
  }
}
